queue

Email queueing in php

妖精的绣舞 提交于 2019-12-04 08:20:35
What is the most proper way to sending email of minimal 1000 or more in PHP? Any reliable email queuing technique that is capable to handle that? ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ You could just insert your emails into a Mail Queue database table, and have a separate process check the queue and batch send a certain number at once. There's a tested solution for that: PEAR Mail_Queue Works fine for me. as mercutio suggested, i would insert a new record into a mail queue table for each email waiting to be sent and then use a separate process (like a CRON) to check the table periodically for any

C++ std::queue::pop() calls destructor. What of pointer types?

依然范特西╮ 提交于 2019-12-04 08:14:32
问题 I have a std::queue that is wrapped as a templated class to make a thread-safe queue. I have two versions of this class: one that stores value types, one that stores pointer types. For the pointer type, I'm having trouble deleting the elements of the queue on destruction. The reason is that I don't know a way to remove the items from the queue safely. This reference states (vacuously, so I guess it doesn't actually STATE it) that the only way to remove elements from the queue is to call pop()

A good persistent synchronous queue in python

最后都变了- 提交于 2019-12-04 08:03:33
I don't immediately care about fifo or filo options, but it might be nice in the future.. What I'm looking for a is a nice fast simple way to store (at most a gig of data or tens of millions of entries) on disk that can be get and put by multiple processes. The entries are just simple 40 byte strings, not python objects. Don't really need all the functionality of shelve . I've seen this http://code.activestate.com/lists/python-list/310105/ It looks simple. It needs to be upgraded to the new Queue version. Wondering if there's something better? I'm concerned that in the event of a power

Removing top of PriorityQueue?

南楼画角 提交于 2019-12-04 07:52:29
Assume that I am using the PriorityQueue class from Java.util. I want to remove the largest number from the PriorityQueue pq, which we assume is at the head of the queue. Will the following work? // 1 int head = pq.peek(); pq.dequeue(head); // 2 int head = pq.dequeue(pq.peek()); Would this work the same for non-primitives as well? Queue#peek and Queue#element return the head value of the queue, Queue#poll and Queue#remove return and remove it. It looks like int head = pq.poll(); is what you want. And: it will only work for non-primitive values because a queue will store objects only. The trick

Implementation of a work stealing queue in C/C++? [closed]

蓝咒 提交于 2019-12-04 07:35:03
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 9 days ago . I'm looking for a proper implementation of a work stealing queue in C/CPP. I've looked around Google but haven't found anything useful. Perhaps someone is familiar with a good open-source implementation? (I prefer not to implement the pseudo-code taken from the original academic papers). 回答1: No free lunch.

Implementing queue in java

限于喜欢 提交于 2019-12-04 07:08:24
问题 Implementing a queue in Java is pretty common interview question. I surfed online and saw many implementations where they do fancy stuff like implementing queue interface and writing own addLast() and removeFirst() methods. My question is can't I just use LinkedList() class and use its predefined methods addLast and removeFirst methods to do the same?? e.g. LinkedList<Student> qu=new LinkedList<Student>(); qu.add(new Student("anadkat1")); qu.add(new Student("anadkat2")); qu.add(new Student(

How to read serial data with multiprocessing in python?

二次信任 提交于 2019-12-04 06:48:49
问题 I have a device that outputs data at irregular intervals. I want to write data onto a csv in 2 second intervals. So I figured multiprocessing with a queue might work. Here I'm trying to just pass data from one process to another but I get Serial Exception. Also, I'm unable to run it on IDLE. So I'm stuck with using the terminal. As a result, the error message closes as soon as it opens. Here's the code: import multiprocessing import time import datetime import serial try: fio2_ser = serial

Python threading with queue: how to avoid to use join?

邮差的信 提交于 2019-12-04 06:37:41
问题 I have a scenario with 2 threads: a thread waiting for messages from a socket (embedded in a C library - blocking call is "Barra.ricevi") then putting an element on a queue a thread waiting to get element from the queue and do something Sample code import Barra import Queue import threading posQu = Queue.Queue(maxsize=0) def threadCAN(): while True: canMsg = Barra.ricevi("can0") if canMsg[0] == 'ERR': print (canMsg) else: print ("Enqueued message"), canMsg posQu.put(canMsg) thCan = threading

Python threading.Thread can be stopped only with private method self.__Thread_stop()

人走茶凉 提交于 2019-12-04 05:15:16
I have a function that accepts a large array of x,y pairs as an input which does some elaborate curve fitting using numpy and scipy and then returns a single value. To try and speed things up I am trying to have two threads that I feed the data to using Queue.Queue . Once the data is done. I am trying to have the threads terminate and then end the calling process and return control to the shell. I am trying to understand why I have to resort to a private method in threading.Thread to stop my threads and return control to the commandline. The self.join() does not end the program. The only way

How to realize a persistent queue on Android

我与影子孤独终老i 提交于 2019-12-04 05:07:25
My application needs a data structure similar to a queue: put data in it, receive data from it, FIFO-like. With data I mean simple strings for now, later on perhaps more complex objects. The thing is that the queue and its content should be persistent, regardless of what Android is doing. If the application gets closed and reopened (or even Android reboots), the queue should have the same state and data it had before the application was closed. I think the queue has to use some kind of storage under the hood, preferably the internal storage of the device. Maybe you could do some brainstorming