17
голосов
5ответов
11290 просмотров

Is there a better way to implement a Remove method for a Queue?

First of all, just grant that I do in fact want the functionality of a Queue<T> -- FIFO, generally only need Enqueue/Dequeue, etc. -- and so I'd prefer an answer other than "What you really want is a List<T>" (I know about RemoveAt). For example, say I have a Queue<DataPoint> d...

33
голосов
1ответов
24105 просмотров

Python Queue get()/task_done() issue

My consumer side of the queue: m = queue.get() queue.task_done() <rest of the program> Questions: Does task_done() effectively pops m off the queue and release whatever locks the consumer has on the queue? I need to use m during the rest of the program. Is it safe, or do I need to cop...

2
голосов
7ответов
2237 просмотров

Simple queue algorithm

This is not a request for a queueing algorithm, I know there are plenty. I'm reading a C# book and it explains the Circular Queue algorithm with a code example. On lines 13, 14 and 15, he explains how to check if the queue is full. However I can't understand why the first optional condition is n...

759
голосов
24ответов
407190 просмотров

How do you implement a Stack and a Queue in JavaScript?

What is the best way to implement a Stack and a Queue in JavaScript? I'm looking to do the shunting-yard algorithm and I'm going to need these data-structures.

3
голосов
1ответов
8264 просмотров

MSMQ slow queue reading

I am using an open source .Net library which uses MSMQ underneath. After about a week or 2, the service slows down (not timed exactly but general guess). It appears that what is happening is messages from MSMQ are only being read exactly once every 10 seconds. Normally, they are read instantly...

3
голосов
2ответов
7454 просмотров

How to create a temporary jms queue and connect to it by name?

I need to create a temporary queue for responses, but I need to know if it is possible to connect to temporary queue without sending response queue object via setJMSReplyTo method of message, because replying thread doesn't get that object at all.

16
голосов
12ответов
10220 просмотров

How check if a task is already in python Queue?

I'm writing a simple crawler in Python using the threading and Queue modules. I fetch a page, check links and put them into a queue, when a certain thread has finished processing page, it grabs the next one from the queue. I'm using an array for the pages I've already visited to filter the links ...

2
голосов
1ответов
1358 просмотров

How to create a temporary jms queue with jboss?

I need to create temporary queues on fly. How is that possible?

1
голосов
3ответов
1699 просмотров

How can you open a popup window after you close another one?

I need to open a popup window, which when closed, opens a new pop up window. Then when you close that one another opens. I'm aware that this functionality can have uses for spam and nag-ware, but I need it for a user experience survey. Don't ask me, it wasn't my idea. How do you do this?

7
голосов
4ответов
3084 просмотров

concurrent queue - general question (description and usage)

I am having some trouble grasping the idea of a concurrent queue. I understand a queue is a FIFO, or first come first serve, data structure. Now when we add the concurrency part, which I interpret as thread safety (please let me know if that is incorrect) things get a bit fuzzy. By concurrency w...

16
голосов
3ответов
7631 просмотров

Add timeout argument to python's Queue.join()

I want to be able to join() the Queue class but timeouting after some time if the call hasn't returned yet. What is the best way to do it? Is it possible to do it by subclassing queue\using metaclass?

1
голосов
4ответов
2429 просмотров

Is Queue.Peek thread safe?

A read operation on a 32 bit field is atomic. So if the queue holds object references the Queue.Peek method should be thread safe, right?

0
голосов
1ответов
2233 просмотров

Accessing a Queue from standalone code

I have a Queue configured in the Rational Application Developer for WebSphere, using a "V5 default messaging provider" and a Websphere6.1 I now try to access it using a standalone app (JUnit Test), in order to put some messages in it. I currently use the following code: Hashtable env = ...

23
голосов
2ответов
18728 просмотров

Dumping a multiprocessing.Queue into a list

I wish to dump a multiprocessing.Queue into a list. For that task I've written the following function: import Queue def dump_queue(queue): """ Empties all pending items in a queue and returns them in a list. """ result = [] # START DEBUG CODE initial_size = queue.qsize(...

1
голосов
1ответов
610 просмотров

Is there a pattern for this queueing system, and example Java code?

I have a component that I wish to write and it's the kind of thing that feels like a common pattern. I was hoping to find the common name for the pattern if there is one, and examples of how to go about implementing it. I have a service that queues requests and processes them one at a time. I ha...

7
голосов
7ответов
8337 просмотров

Does C++ have standard queue?

I know that there's a standard library vector in C++. Is there a queue? An online search suggests there might be, but there's not much about it if there is one. Edit: All right. Thanks a ton guys.

7
голосов
5ответов
8342 просмотров

Removing from STL std::queue without destructing the removed object?

All the documentation I can find on the STL containers (both queue and list) say that for any of the remove functions the removed object's destructor is called. This means that I can't use std::queue any time I want a queue that's simply a list of objects needing some operation performed on them...

1
голосов
1ответов
489 просмотров

Queue for producers and consumers in a tree

I am reading up on how to utilize Python Queues to send and receive short messages between nodes. I am simulating a set of nodes that are in a nice tree structure. I want some of these nodes to send a fixed-size data to its parent. Once this parent receives data from some of its child-nodes, it w...

0
голосов
1ответов
896 просмотров

Dynamics CRM v4 monitor mailbox for a queue

Hi I want to set up Microsoft Dynamics CRM to monitor a single mailbox using pop3 and then have any mails in that mailbox added as email activities to a queue in CRM. I have set up the pop3 mail box and I know that it works. I have set up the email router with an incoming profile for the mailbo...

0
голосов
3ответов
363 просмотров

not exactly fifo

I'm busting my head but cannot find a solution for this. Please consider this scenario: I have writers that want to write to non-blocking "queue" to another machine on the local network and have a reader that will read data (blocking mode if there are no writers) and do some job A and then retu...

1
голосов
3ответов
91 просмотров

Best method for saving values of a queue in case of program failure

Say I have a multithreaded application made up of two separate threads and a Queue. Thread 1 finishes it's computation and puts the result in the Queue. Meanwhile thread 2 is constantly looping and checking if there is any data in the Queue for it to process. How can I save the values in the qu...

0
голосов
1ответов
103 просмотров

queuing solution to process a record through multiple processes

The application is on .Net 3.5 and Oracle Standard Edition 11G database where a table have over 2 million records. The record size is not huge. The records have a Status column of type Char(1). Depending upon the status a process picks records to process and updates the status after completion. A...

0
голосов
2ответов
70 просмотров

display of duplicate records in firefox

I am working on an online music store. There are buttons like myplaylists, mydownloads etc... On clicking on these buttons, a list of songs appears accordingly in a grid view. The problem is that when i click on the buttons twice quickly the list appears two times like 1..4..8 1..4..8 and if i c...

3
голосов
2ответов
1433 просмотров

AudioQueueStart reporting unsupported format

I'm trying to get audio queue working on an iphone app, and whenever AudioQueueStart is called it gives the "fmt?" result code (kAudioFormatUnsupportedDataFormatError). In the code below i'm setting the format to kAudioFormatLinearPCM, which surely is supported. What am i doing wrong? data.mData...

3
голосов
3ответов
797 просмотров

C# Queue problem

Suppose I have a class XYNode { protected int mX; protected int mY; } and a queue Queue<XyNode> testQueue = new Queue<XYNode>(); I want to check if a node with that specific x and y coordinate is already in the queue. The following obviously doesn't work : testQueue.Con...

9
голосов
1ответов
9667 просмотров

Threadpool in IIS context

I have a general question about System.Threading.Threadpool when run in a webapplication on IIS. Say we have 2 requests execute at once, and we fire up a couple of threads through the ThreadPool.QueueUserWorkItem method. Will the two requests share the ThreadPool, or will the calls to the Thread...

2
голосов
3ответов
285 просмотров

Which queue is most appropriate?

I'm building a mobile photo sharing site in Python similar to TwitPic and have been exploring various queues to handle the image processing. I've looked into RabbitMQ and ActiveMQ but I'm thinking that there is a better solution for my use case. I'm looking for something a little more lightweigh...

11
голосов
2ответов
3778 просмотров

Python 2.6 send connection object over Queue / Pipe / etc

Given this bug (Python Issue 4892) that gives rise to the following error: >>> import multiprocessing >>> multiprocessing.allow_connection_pickling() >>> q = multiprocessing.Queue() >>> p = multiprocessing.Pipe() >>> q.put(p) >>> q.get() Trac...

0
голосов
1ответов
766 просмотров

Blackhen Threading Library

I am looking for documentation for the Blackhen threading library and am unable to find any. I have just found one article here. Can someone please point me to some documention for this library?

112
голосов
5ответов
58658 просмотров

LinkedBlockingQueue vs ConcurrentLinkedQueue

My question relates to this question asked earlier. In situations where I am using a queue for communication between producer and consumer threads would people generally recommend using LinkedBlockingQueue or ConcurrentLinkedQueue? What are the advantages / disadvantages of using one over the o...