FAQ Database Discussion Community


Sharing many queues among processes in Python

python,queue,multiprocessing,python-multiprocessing
I am aware of multiprocessing.Manager() and how it can be used to create shared objects, in particular queues which can be shared between workers. There is this question, this question, this question and even one of my own questions. However, I need to define a great many queues, each of...

Laravel queue retries delay

laravel,laravel-4,queue,beanstalk
I am building a large application using Laravel and find the use of queue in this application. I am now using beanstalkd service for this. However, I am stuck in finding an answer for this set up. Is there a way to put the queue retries be processed in not...

Preserve beanstalkd queue on restart or crash

queue,beanstalkd
I'm using beanstalkd to managed queues. I just realised that if there are jobs in a queue and the beanstalkd process is restarted or crashes then the job is lost forever (or so I think). Is there a way to preserve the jobs in the queue on beanstalkd failure or...

Python priorityQueue.get() returns int instead of object

python,search,queue
I am currently developing an AI system in python to solve the bloxorz game using the A* search algorithm. Naturally, the algorithm stores the nodes in a priority queue,but when i try to get() an element from the queue, it returns an int instead of the object. As I am...

How are distributed queues architectured?

queue,distributed,distributed-computing,distributed-system
What are architectural patterns/solutions that make distributed queues tick? Please share for both ordered and non-ordered types....

Overfilling of Stack and Queue Capacity (c++)

c++,stack,queue
After many hours of research, reading, going over sample codes... I am stuck (or fried). I have a memory leak which dumps nothing into my Stack and Queue 'lists'. The premise is that I am trying to create find if a word or phrase is a palindrome by using Stacks...

Does MySQL have query queues and what's behind query_time in the slow log?

mysql,queue,execution-time,mysql-slow-query-log
what timestamps are used for calculating the query_time parameter in the mysql slow query log? Can't find any definition of that parameter. Only thing i found is The time to acquire the initial locks is not counted as execution time. from: http://dev.mysql.com/doc/refman/5.0/en/slow-query-log.html I'm asking this question because i want to...

Queue Iterator with Java

java,iterator,queue
I'm trying to use a queue to store a set amount of data and I want to be able to iterate through it. I made a new queue with a specific type and I am having a problem with the iterator. Whenever I call iterator.next() I have a type mismatch....

pushing structure variable in queue

c++,struct,queue
#include <iostream> #include <queue> using namespace std; int main () { struct process { int burst; int ar; }; int x=4; process a[x]; queue <string> names; /* Declare a queue */ names.push(a[1]); return 0; } I'm trying to pushing struct variable in queue but its not taking it and gives...

Circular array-backed queue: enqueues at wrong offset after resizing

java,queue
I think something is wrong when I'm resizing the array, but the queue isn't enqueuing correctly after I resize. This was for a class I'm already done with. /** * ArrayQueue * Implementation of a queue using * an array as the backing structure * * @author Your Name Here...

rabbitMQ persistency when consummers die

queue,rabbitmq,persistence
I would like consummers to subscribe to events, in case one of them die, I'd like the messages to be persisted for this consummer, so it gets them once it is online. If the producer creates N queues, 1 per consummer, then it works. But the producer shall not not...

Sending from multiple Mailgun domains using Laravel Mail facade

email,laravel,dns,queue,mailgun
I'm using the Laravel 4's Mail::queue() to send emails, using the built in Mailgun driver. The problem is that there are multiple Mailgun domains I would like to be able to send emails from, but the domain must be set in app/config/services.php. Since I'm using Mail::queue(), I can't see how...

Can I use lpop/rpop to create a simple queue system with Redis?

redis,queue,message-queue
I tried several message/job queue systems but they all seem to add unnecessary complexity and I always end up with the queue process dying for no reason and cryptic log messages. So now I want to make my own queue system using Redis. How would you go about doing this?...

How to implement a queue where the first-in item is automatically popped out when full? [duplicate]

java,collections,queue
This question already has an answer here: Size-limited queue that holds last N elements in Java 8 answers I am tracking a list of colors. I only need to worry about the last two colors added to this list. So this queue should be a fixed size (of 2)....

multithreading - overwrite old value in queue?

python,multithreading,queue
I have two threads: a producer and a consumer. The producer periodically acquires information and provides it to the consumer. The consumer wants only the most current copy of the information and will check it aperiodically and maybe a long intervals. It seems like the simplest mechanism to facilitate this...

NodeJS run code in X minutes architecture

node.js,mongodb,architecture,cron,queue
I want to schedule some code to be run at a variable time. For example, after 60 minutes I want to send an HTTP request to an endpoint and update a database document, but I also want to be able to cancel that code from being ran if an action...

Laravel 5 Command Scheduler, How to Pass in Options

laravel,command,queue,scheduled-tasks,laravel-5
I have a command that takes in a number of days as an option. I did not see anywhere in the scheduler docs how to pass in options. Is it possible to pass options in to the command scheduler? Here is my command with a days option: php artisan users:daysInactiveInvitation...

Java accessing to Map in Queue

java,object,dictionary,queue
I'm trying to figure out how can I add some data into this : Map<String, Queue<Map<Integer, MyObject>>> map1 = new HashMap<String, Queue<Map<Integer, MyObject>>>(); I have been trying things like that : map1.put(login, new ArrayBlockingQueue<Map<MyObject>>(500, true); But I guess i'm totally wrong, and I would love some tips and further explanations....

Multi-threading and queuing

java,multithreading,queue,threadpool
I kinda got the hang of threads but now I'm confused. I don't quite understand queues at all. I created a thread pool executor which initializes a set amount of threads and each of those threads input a username(string) on a website to check if its available or not. So...

toString method in circular array queue

java,arrays,queue
I need to create a circular array queue that allows the user to "wrap around" the array. The enqueue and dequeue methods were checked off by my teacher, but I'm having trouble getting the queue to print off correctly. public class MyArrayQueue<E> implements QueueInterface<E> { public static final int CAPACITY...

c - kernel - spinlocks vs queues

linux,linux-kernel,kernel,queue,spinlock
I think, no matter the whole lot of documentation available, I don't understand why one have to wait for a spin lock in a kernel context. Why isn't there a specific queue with process requiring a lock with an atomic counter/index and , with preempt disabled, treat them as they...

Why does dispatch_queue_create give an EXC_BAD_ACCESS error in Swift?

c++,swift,queue,port,grand-central-dispatch
I am porting some code from C++ to Swift that used Grand Central Dispatch, and I am finding a curious error with dispatch_queue_create seemingly not working at all. For instance, in my C++ base class header, I would declare dispatch_queue_t m_WorkQ; and in the initializer, put m_ResultQ = dispatch_queue_create("com.myapp.mHitsUpdateQueue", 0);...

Data structure queue confusion

data-structures,queue
I'm practising with data structures at the moment, I came across this question at one of the online tests I was taking and it confused me. Can anyone clarify this for me because I couldn't answer it and I started hesitating my knowledge. Question: Assume that the underpinning data structure...

How can i download a file faster?

c#,file,download,queue
I have made a download program in C#. It is a queue downloader. You can see how it works here: Click Express Downloader Is there any faster method to download? Here is the method i use, it must support resume support. private void Download(object startPoint) { try { try {...

Does PHP have a peek array operation?

php,arrays,stack,queue
I would like to peek at the first element of an array. This operation would be equivalent to this code: function peek($list) { $item = array_shift($list); array_unshift($list, $item); return $item; } This code just seems really heavy to me and peek is often provided by queue and stack libraries. Does...

What is meant by re-buffering issue in a dequeue operation

algorithm,data-structures,queue,circular-buffer
I was going through a circular queue post, and it mentioned about re-buffering problem in other queue datastructures. In a standard queue data structure re-buffering problem occurs for each dequeue operation. This problem can be solved by joining the front and rear ends of a queue to make the queue...

Implementing a queue in LinkedList

python,linked-list,queue
For a homework question, my teacher wants me to implement a stack and a queue in a LinkedList. I made the stack class no problem, however the queue part is what I am having trouble with. Here is my ListNode Class: class ListNode(object): def __init__(self, item = None, link =...

How would i sort a queue using only one additional queue

algorithm,queue,constants,analysis
So basically, Im asked to sort a queue, and i can only use one helper queue , and am only allowed constant amount of additional memory. How would i sort a queue using only one additional queue ?...

Laravel 5 Commands - Execute one after other

laravel,command,queue,laravel-5
I have a CustomCommand_1 and a CustomCommand_2. Any way to create a pipeline of commands and executing CustomCommand_2 right after CustomCommand_1 execution? (without call a command inside the other one)....

Use of serialized target queues for Concurrent queues in iOS

ios,concurrency,queue
I was going through this excellent blog post (http://www.humancode.us/2014/08/14/target-queues.html) of target threads in iOS and I could not help but wonder why do we need such a mechanism. In the example, we are specifying a serialised target queue for a custom concurrent queue. Can we not achieve the same by...

Implement queues in java [duplicate]

java,data-structures,queue
This question already has an answer here: What is a Null Pointer Exception, and how do I fix it? 12 answers I have a homework about implementing queues in java. I have written a code, but there is an error and I don't know how to fix it. Can...

Improving performance on Sieve method

java,queue,sieve
I am writing a method to find primes up to n(Sieve of Eratosthenes), yes this is for homework. I am looking to improve performance in the method I have written. I have been tweaking this for the last few days but am unable to to follow the pseudocode given and...

Alamofire Priority Queue

ios,swift,queue,alamofire
I am using Alamofire as my networking library for my Swift app. Is there a way to keep a "priority queue" of network requests with Alamofire? I believe I saw this feature in a library in the past but I can no longer find it or find other posts about...

Dequeue algorithm

algorithm,data-structures,queue,deque
Write four O(1)-time procedures to insert elements into and delete elements from both ends of a deque constructed from an array. In my implementation I have maintained 4 pointers front1,rear1,front2,rear2. Do you have any other algorithm with less pointers and O(1) complexity ? Please explain....

Understanding queue arithmetic in data structures

data-structures,queue
When an element is inserted in a queue, REAR = REAR + 1. When an element is deleted from the queue, FRONT = FRONT + 1 when queues are implemented using arrays. Now, initially, both FRONT = REAR = -1 indicating the queue is empty. When the first element is...

Laravel 5 - How to create queue table with Command Prompt in Windows 8.1

php,email,laravel,queue
I am using Laravel 5 on my local with Windows 8.1. I successfully installed laravel with windows, it was hard because laravel's official documentation never talk about windows. However, I want to add a new table in my Database using Artisan Command. As you can already guess, it's not working...

Flavius Josephus/ Hot Pocket simulation

python,algorithm,queue,josephus
So I was reading Problem Solving Using Data Structures Python where the author implements a queue to simulate the famous Hot Pocket/Josephus execution problem. However, I believe that this implementation is not correct since no matter how many times I tried, the last survivor, as computed by the program doesn't...

Executing a cassandra insert query through Python multiprocessing queue

python,cassandra,queue,multiprocessing
I have a cassandra keyspace sujata.I am connecting to cassandra using python driver cassandra.cluster.The column family of sujata is hello. Following is my code:- from multiprocessing import Process,Queue from cassandra.cluster import Cluster import os queue=Queue() cluster = Cluster(['127.0.0.1']) metadata = cluster.metadata session = cluster.connect("sujata") def hi(): global session global queue...

How can I pop from a queue, process it, push to another queue, and it's thread-safe?

c++,multithreading,thread-safety,queue
It's a C++ program. There are 2 child thread and 2 queue.What I want to do is, Push something to the queue 1 in the main thread. The child thread 1 pop from the queue 1 and process it, then push it to the queue 2. The child thread 2...

Getting new token on retry before retrying old request with Volley

authentication,queue,token,android-volley,priority
I have a simple authentication system implemented using Volley. It goes like this: Get a token from server on login -> an hour later, this token expires -> when it expires, we will find that out on a failed API call, so we should (on retry) -> fetch a new...

malloc can't create space for struct in queue

c,struct,queue,malloc
I tried to create a queue which contains 2 int values. The problem happens in insert function. When i try to allocate memory for head->front->next program halts. The error happens only in else part in insert function. struct Patient{ int national_id; int condition; }; struct Node{ struct Patient *info; struct...

Queue:push() being processed synchronously in Laravel 5

php,laravel,queue
I'm running Laravel 5 and I'm trying to get queue a command. I'm kicking it off by running: Queue::push( new MyCommand() ); To create I command, I did: php artisan make:command --queued MyCommand MyCommand contains a sleep(20) and file_put_contents('test.txt','I work!') Command-line I'm running: beanstalkd -l 127.0.0.1 -p 11301 & php...

Single process blocking queue

java,queue,message-queue,priority-queue
I am writing an application that communicates with hardware. While the application can receive and process multiple requests simultaneously in parallel, the hardware cannot! The hardware requires these parallel requests to basically be organised into a linear request chain each one executed one after the other. I also have a...

How to correctly implement queue with using Linked list

c,pointers,linked-list,queue
I am currently working on my homework. In my program I had to use queue, so I wrote a queue with Linked list. But it doesn't seem to like my syntax. So I have struct typedef struct Node{ pthread_t thread; int threadID; int securityMode; // nTS = 1, S =...

How efficient is IEnumerable.First and IEnumerable.Last?

.net,linq,queue,ienumerable,peek
I want to use a System.Collections.Generic.Queue, but with one difference: I want Queue.Peek to return the last item put in rather than the first. I still want items to enter and exit in the same manner. I was thinking of using Queue.Last() as an alternative to Queue.Peek() (which I assume...

Remove() function in Queue using a doubly linked list

c++,list,function,queue,nodes
I have written the program below and overall it seems to work fine... Except that the remove() function keeps deleting all of the values in the queue without even being called... #include <iostream> #include <string> using namespace std; //Create a node struct struct Node { int data; Node *next; Node...

Does PriorityQueue maintain natural order? [duplicate]

java,collections,queue,priority-queue,comparable
This question already has an answer here: Print content of priority queue[java] 1 answer The elements of the priority queue are ordered according to their natural ordering, or by a Comparator provided at queue construction time, depending on which constructor is used. However, in the following example, when I...

Coalescing items in channel

multithreading,go,queue
I have a function which receives tasks and puts them into a channel. Every task has ID, some properties and a channel where result will be placed. It looks like this task.Result = make(chan *TaskResult) queue <- task result := <-task.Result sendReponse(result) Another goroutine takes a task from the channel,...

Trouble implementing a queue in C

c,queue
I'm trying to implement a queue in c. I have gotten as far as implementing an enqueue function in my code. However, when I am testing it I don't get the desired output. Can someone please tell me what I am doing wrong? struct queue{ int array[30]; int *front; //pointer...

brokeredmessage microsoft service bus queue ReceiveBatch not obtaining all dead letter messages

c#,azure,queue,azure-servicebus-queues,brokeredmessage
I am testing a project with a dead letter queue with Microsoft Service Bus. I send 26 messages (representing the alphabet) and I use a program that when receiving the messages, randomly puts some of them in a dead letter queue. The messages are always read in peek mode from...

toString() method for Queue class

java,queue
Just a simple question, if I created a Queue class and initialized this Queue queue = new Queue(5) In the main method, and then enqueued and dequeued accordingly, with the following instance variables, and toString() method: private int maxSize; private Planes[] queArray; private int front; private int rear; private int...

std::queue does not keep data

c++,queue
These are my two classes: class App { public: void run(){ std::vector < std::thread > th_list; for(std::vector < Host * > ::iterator it = host_list.begin(); it != host_list.end(); it++){ th_list.push_back(std::thread(&App::th_getInfo, *this, *it, readFile(holder["cmdFile"]))); } for(std::vector<std::thread>::iterator it = th_list.begin(); it != th_list.end(); it++){ it->join(); } } private: void th_getInfo(Host * pc,...

Generate random number of queues

c++,random,queue
Just out of curiosity, how does someone create a random number of queues? I have a constructor like so from my current project: public: Passenger<NODETYPE> *super_express; Passenger<NODETYPE> *express_line1; Passenger<NODETYPE> *express_line2; Passenger<NODETYPE> *regular_line; Checkout_Simulation() : super_express("Super Express Counter 01"), express_line1("Express Line Counter 01"), express_line2("Express Line Counter 02"), regular_line("Regular Line Counter 01"),...

How to create a Bitset Array Queue?

c++,queue,bitset
I am reading in 14 byte messages from a device and I store them in an array of bitsets... bitset<8> currentMessage[14]; I want to create a queue of these messages. (Ideally I want the last 10 messages but I think that might be a whole other question? limit size of...

Celery limit number of specific task in queue

python,queue,task,celery,worker
I'm using Celery 3.1.x with 2 tasks. The first task (TaskOne) is enqueued when Celery starts up through the celeryd_after_setup signal: @celeryd_after_setup.connect def celeryd_after_setup(*args, **kwargs): TaskOne().apply_async(countdown=5) When TaskOne is run, it does some calculations and then enqueues TaskTwo. Imagine the following workflow: I start celery, thus the signal is fired...

circular array Queue (conceptual)

java,queue
for circular arrays Queues, is a scenario possible where back < front and size < capacity? or is that when back< front, size always equals capacity? Thank You...

Queue Pointers and values not declared

c++,compiler-errors,queue,undeclared-identifier
I have been debugging my project for awhile now. All of my files are practically debugged however my Queue.h has issues connecting with them all. I have a Queue.h file that seems to not process a large sum of my values. I get issues with my current_queue pointer and other...

Regarding ConcurrentLinkedQueue

java,multithreading,concurrency,queue
I have a multi-threaded scenario in which a Sender class which uses a ConcurrentLinkedQueue of type Packet is used. Packet is a POJO defined as: class Packet { int seq; byte[] data; } Sender class is defined as: class Sender implements Runnable { private static ConcurrentLinkedQueue<Packet> queue; public Sender() {...

Queue using several processes to launch bash jobs

bash,shell,parallel-processing,queue
I need to run many (hundreds) commands in shell, but I only want to have a maximum of 4 processes running (from the queue) at once. Each process will last several hours. When a process finishes I want the next command to be "popped" from the queue and executed. I...

Redis - list of visited sites from crawler

python,url,redis,queue,web-crawler
I'm currently working on a crawler coded in Python with combination of Gevent/requests/lxml to crawl a defined set of pages. I use redis as a db to hold lists such as pending queue, fetching, and sites that has been crawled. For each url, I have a key url_ and I'm...

Setting up queue in Laravel 5

php,laravel,queue,laravel-5
I am trying to run code after returning a HTTP response. I know that Laravel 5 has support for queues, but I still find them confusing. I am trying to run code after the user has registered which requires the user's password and username. This answer seems interesting, but is...

Use non-default Laravel 4.2 Queue Connection

laravel,laravel-4,queue
I need to swap out the Laravel Queue connection when I queue certain items. E.g. default is redis but I need to swap it out to use sqs when I queue certain items. Is there anyway to do this without having to change the default queue connection using Config::set('queue.default', 'sqs');?...

Limit amount of threads in python

python,multithreading,csv,queue
I have a script in python that triggers several parallel telnet connections to different routers to do something. It's working nicely. The list of routers is passed over to the python within a CSV file. On the other hand, in order to trigger the parallel telnet connections, I use threads....

Dart: DoubleLinkedQueue length after entry prepend

dart,queue
I'm manipulating entries inside a DoubleLinkedQueue via the DoubleLinkedQueueElement.append/prepend methods. This results in the new elements being inserted into the queue, but fails to update the length, and the toList() method results in an error being thrown. I understand queues are only supposed to have elements added at the start/end,...

Azure Service Bus or Queue

azure,queue,message-queue
I have a process where I would like to use an Azure Queue or Service Bus to decouple the processing from the UI. A user will press a button, and I would like to place 2 messages in the queue, each with it's own topic. 1 set of competing consumers...

Thread safe Queue in C#

c#,.net,multithreading,queue
I need to create a generic queue that can be queued my multiple producers, and de-queued by multiple consumers. I want the system to at least try twice in case it attempts an operation during changes to the system, so if a process thread fails, The now flagged qBit is...

Amazon batch job process queue

amazon-web-services,amazon-ec2,queue,message-queue
I am using AWS EC2 instances for bioinformatics work. I have a number (~1000) of large files that should be processed with a script on EC2 instances and results should be uploaded back to an S3 bucket. I want to distribute jobs (files) to a number of EC2 instances, preferentially...

I need an advice for optimal implementation of a program with priority queue and search

c,pointers,queue,adt
I have to make a program to read the list of patient of an hospital from a file, every patient have a priority. So i decide to make the priority queue in a binary heap because insert and deletion are O log(n), and obtain the patient to be treated is...

How to set multiple pidfile in sidekiq.yml file?

ruby-on-rails,queue,task,jobs,sidekiq
From the official wiki page of sidekiq I found: https://github.com/mperham/sidekiq/wiki/Advanced-Options --- :concurrency: 5 :pidfile: tmp/pids/sidekiq.pid staging: :concurrency: 10 production: :concurrency: 20 :queues: - default - [myqueue, 2] Now I want to create multiple tasks using the same sidekiq.yml file. But use different pid name, such as: /tmp/pids/task1.pid /tmp/pids/task2.pid How to...

Linked queue in python can't tell if it's empty

python,class,linked-list,queue
So I built a linked queue class in python that looks like this. class queue: class _Node: def __init__(self, elem, next): self._elem = elem self._next = next def __init__(self): self._rear = None self._front = None self._size = 0 def enqueue(self, value): if self.isEmpty: self._front = self._Node(value, None) self._rear = self._front...

Performance difference between arrays, stacks and queues

java,arrays,stack,queue
What is the search performance of arrays, stacks and queues? I think that arrays are the quickest and most straightforward, because I can access any element immediately by calling it using its index. Is this correct? What about the performance of stacks and queues? How do they compare?...

I can't print each element in a queue

python,queue
I'm a complete beginner for programming. I created the class "queue" and tried to print each element of the queue as following but i couldn't. Please help me! edited for formatting class queue: def __init__(self): self.items = [] def isempty(self): return self.items == [] def enqueue(self,item): self.items.insert(0,item) def dequeue(self): return...

Copy Elements From Stack to Queue

java,stack,queue
I'm supposed to copy elements from a stack to a queue. I haven't been able to think of a way to keep the stack the way it is and still copy its elements to a queue. I ended up with this method which removes the elements completely from the stack...

Ajax calls inside loop need sequential responses

javascript,jquery,ajax,queue,promise
I need to make 3 or less ajax calls, and the responses need to be appended to the dom in the same order they were requested. I have the following function, but the problem is that the responses that I get are not necessarily in the correct order when they...

Priority Queue using just array and binary search

data-structures,queue,priority-queue,binary-search
So I have come across priority queue data structure, the implementation is usually with heaps or binary tree. Why can't a priority queue just use a simple array and use binary search for insertion, it would still be O(logn) with retrieval time of O(1). while true { // We will...

Data type for a “closable” queue to handle a stream of items for multiple producers and consumers

python,multithreading,queue,producer-consumer
Is there a specific type of Queue that is "closable", and is suitable for when there are multiple producers, consumers, and the data comes from a stream (so its not known when it will end)? I've been unable to find a queue that implements this sort of behavior, or a...

RSQM - polling manually?

javascript,node.js,redis,queue
We are currently restructuring one of our largest projects. The whole project is set up in an Node.js / PHP mixed envorinment and is quite distributed. This is why we are planning to use queueing for various services. We are extensively using Redis in this system, so I came across...

While loop not equaling std::queue size

c++,while-loop,queue
I have this code: std::queue<unsigned int> offsets; // (fill offsets here) DEBUG(std::to_string(offsets.size())) // print offsets.size() to console int iterations = 0; while (!offsets.empty()) { iterations++; unsigned int currOffset = offsets.front(); offsets.pop(); if (currOffset == 0) { DEBUG("breaking from while loop") break; } // do something with currOffset } DEBUG(std::to_string(iterations)) For...

How to move elements?

c#,.net,queue
Say you have an instance of a Queue in .NET (Systems.Generic.Collections.Queue). The queue has 10 elements where element 9 (counting from 0) is the most recently added element in the queue. So the queue could look like this: {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0} where 0.1...

Breaking down 1M row jsonlines file into individual json files - python

python,memory,queue,multiprocessing
I'm trying to process hundreds of different files that are of .jl.gz format stored in s3. I need to take different parts of each of the 1M json objects in these files and move them over to a sql database, a mongodb, and elasticsearch. This is taking too long. So,...

JMS selector strange behaviour

java,queue,jms,selector
In JMS consider the following pseudo-code: Sender: QueueSender qs = session.createSender(queue); int i = 0; while(i < 10) { TextMessage msg = session.createTextMessage(); msg.setText(""+i); msg.setIntProperty("value", i); qs.send(msg); i++; } Receiver: String sel = "value >2"; QueueReceiver qr = session.createReceiver(q,sel); while(true) { TextMessage tm = (TextMessage) qr.receive(); System.out.println(tm.getText); } I would...

Error Queue implementation using Linked List

c++,data-structures,linked-list,queue
I am trying to impliment Queue using linked list but it goes stops unexpectidly. could not find why? #include <iostream> #include <string> using namespace std; Class Node for creating a node. class Node { public: int data; Node *next; }; Queue Class containing operations for Queue. class Queue{ private: Node*...

Modifying Structure's variable Data

c++,struct,queue
Front function of user defined Queue template<class Type> Type queueType<Type>::front() { if(!isEmptyQueue()); return list[queueFront]; } int main() { struct process { int burst; }pro; int tq=2; pro.burst=10; Queue<process> RR; RR.enQueue(pro); RR.front().burst=RR.front().burst - tq; } when i try to run this line: RR.front().burst=RR.front().burst - tq; it gives the following error: using...

flush() and isEmpty() methods for a ring buffer without using .size() in Java

java,pointers,queue,circular-buffer
I am trying to implement a Ring (circular queue) of Chars in Java and I'm having a difficult time thinking through how to detect if the buffer isEmpty without using the .size() method on the array. Because if the Ring Buffer is full read pointer == write pointer but also...

Laravel Artisan CLI safely stop daemon queue workers

php,laravel,queue,daemon,artisan
In order to process large numbers of jobs, I run a variable number of queue workers depending on howmuch work there is to complete. I don't want to run more workers than are necessary to complete the work that needs to be done in a time period that we deem...

Deleted node detection in lockless fifo buffer

c++,c++11,queue,fifo,lockless
I've been working on a lockless c++11 fifo buffer. And I've almost got it. However one small detail has gotten the better of me. The buffer has a head pointed to by: std::shared_ptr<node<T>> m_head; Of the type: struct node { node(const T data) : data(new T(data)), next(nullptr) {} std::shared_ptr<T> data;...

Laravel queue - running as a daemon

php,laravel-4,queue,beanstalkd
I am trying to setup Laravel beanstalkd queue as mentioned here. I need to run the queue handler as a daemon. Trying to run the command: php artisan queue:work --daemon. But looks like 'deamon' command is not defined for queue:work >php artisan queue:work --help Usage: queue:work [--queue[="..."]] [--delay[="..."]] [--force] [--...

Queue.join() doesn't unblock

python,multithreading,queue
I'm trying to write a Python script for parallel crawling of a website. I made a prototype that would allow me to crawl to depth one. However, join() doesn't seem to be working and I can't figure out why. Here's my code: from threading import Thread import Queue import urllib2...

How to setup multiple async methods into a queue?

c#,.net,queue,async-await,.net-4.5
I just picked up async/await, and I wrote a series of async methods that each perform a database SQL task and tied each one to a different button. The GUI doesn't get locked when you click a button, so I figure that's awesome. However, if you click each one the...

Iterate through a fileSystem without using Binary tree or recursion

java,queue
I have seen to similar questions here on this topic but none really helped me grasp the steps to solve this. Given a queue, and a rootNode , how can I iterate through it? I understand first I have to enqueue the node I start with, but I am confused...

Adding Items to a Queue

c++,class,queue
I am supposed to simulate a one runway airport's operations over a given period of time. What I have done is create queues to hold planes that are ready to take off and land respectively. I created a class to represent a plane due to the fact that I am...

Laravel FB SDK v4 requesting w. recursion

php,laravel,queue,facebook-sdk-4.0
I am currently working with laravel and the php fb sdk v4 to gather posts from a page after having a user signup. Here is the flow of what I am attempting. push a job onto the queue. In that job request from fb the first 25 posts via a...

Difference between BrokeredMessage Body Vs message.Properties ?

azure,queue,servicebus,azureservicebus
I'm little confused between BrokeredMessage Body Vs message.Properties ? I want to insert message into queue and based on message want to trigger Webjob What is the Difference between BrokeredMessage Body Vs message.Properties ? example // Create message, passing a string message for the body BrokeredMessage message = new BrokeredMessage("Test...

Most efficient way to implement stack and queue together?

algorithm,data-structures,stack,queue
What would be the most appropriate way to implement a stack and a queue together efficiently, in a single data structure. The number of elements is infinite. The retrieval and insertion should both happen in constant time.

Is there a command to see how many jobs a certain user has in a queue?

linux,queue
I know commands, like qsub, qstat -a, qstat -an, etc. But how can I find how many jobs a single user has in the queue (not all necessarily running) at any given time?...

Is it possible to create a queue of object arrays in C++?

c++,arrays,object,queue
For example: class Hooks { public: std::string text; std::string hookfont; HookFromEncouter() { text = "Would you befriend an elf? "; hookfont = "COPRGTB.ttf"; } HookFromEncouter(string text1, string hookfont1) { text = text; hookfont = hookfont1; } }; I need to store arrays of this object in a queue: How do...

Mirrorring a queue in python

python,class,stack,queue,reverse
I need to mirror a queue using a function called mirror I have made the code for the queue class, but i dont know how to create a mirror of it. It needs to print out the original queue and then the same queue reversed Any help would be appreciated...

Java Browse a queue of object

java,queue
I have a queue of object, and I want to go through the queue and be able to use these objects. I have this : private String format(Queue<MyObject> queue) { for (int i = 0; i < queue.size(); i++) { //Here i would like to use "MyObject" } } I...

Segmentation Fault (core dumped) when trying to run Queue program - C++

c++,class,queue,core,fault
I keep getting a Segmentation fault (core dumped) error every time I try to run my code with g++ on Linux. It compiles fine, but then that happens ... All the functions (remove, add and print) seem to have the same problem, I can't seem to figure out what's wrong......

how to use Queue.java in another class

java,queue
import java.util.Arrays; public class Queue <T>{ private T[] QueueArr; private int front; private int back; private int size; public Queue(){} @SuppressWarnings("unchecked") public Queue (int size) { if (size <= 0) throw new IllegalArgumentException("Size cannot be less than or equal to 0!"); this.size = size; QueueArr = (T[]) new Object[size]; front...