Search Results

Search found 22893 results on 916 pages for 'message queue'.

Page 14/916 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Mistake in dispaly and insert method (double - ended queue)

    - by MANAL
    1) My problem when i make remove from right or left program will be remove true but when i call diplay method the content wrong like this I insert 12 43 65 23 and when make remove from left program will remove 12 but when call display method show like this 12 43 65 and when make remove from right program will remove 23 but when call display method show like this 12 43 Why ?????? ); and when i try to make insert after remove write this Can not insert right because the queue is full . first remove right and then u can insert right where is the problem ?? Please Help me please 2) My code FIRST CLASS class dqueue { private int fullsize; //number of all cells private int item_num; // number of busy cells only private int front,rear; public int j; private double [] dqarr; //========================================== public dqueue(int s) //constructor { fullsize = s; front = 0; rear = -1; item_num = 0; dqarr = new double[fullsize]; } //========================================== public void insert(double data) { if (rear == fullsize-1) rear = -1; rear++; dqarr[rear] = data; item_num++; } public double removeLeft() // take item from front of queue { double temp = dqarr[front++]; // get value and incr front if(front == fullsize) front = 0; item_num --; // one less item return temp; } public double removeRight() // take item from rear of queue { double temp = dqarr[rear--]; // get value and decr rear if(rear == -1) // rear = item_num -1; item_num --; // one less item return temp; } //========================================= public void display () //display items { for (int j=0;j //========================================= public int size() //number of items in queue { return item_num; } //========================================== public boolean isEmpty() // true if queue is empty { return (item_num ==0); } } SECOND CLASS import java.util.Scanner; class dqueuetest { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println(" Welcome here** "); System.out.println(" * Mind Of Programming Group*** "); System.out.println(" _________________________ "); System.out.println("enter size of your dqueue"); int size = input.nextInt(); dqueue mydq = new dqueue(size); System.out.println(""); System.out.println("enter your itemes"); //===================================== for(int i = 0;i<=size-1;i++) { System.out.printf("item %d:",i+1); double item = input.nextDouble(); mydq.insert(item); System.out.println(""); } //===================================== int queue =size ; int c = 0 ; while (c != 6) { System.out.println(""); System.out.println("**************************"); System.out.println(" MAIN MENUE"); System.out.println("1- INSERT RIGHT "); System.out.println("2- REMOVE LEFT"); System.out.println("3- REMOVE RIGHT"); System.out.println("4- DISPLAY"); System.out.println("5- SIZE"); System.out.println("6- EXIT"); System.out.println("**************************"); System.out.println("choose your operation by number(1-6)"); c = input.nextInt(); switch (c) { case 1: if (queue == size) System.out.print("Can not insert right because the queue is full . first remove right and then u can insert right "); else { System.out.print("enter your item: "); double item = input.nextDouble(); mydq.insert(item);} break; case 2: System.out.println("REMOVE FROM REAR :"); if( !mydq.isEmpty() ) { double item = mydq.removeLeft(); System.out.print(item + "\t"); } // end while System.out.println(""); mydq.display(); break; case 3: System.out.println("REMOVE FROM FRONT :"); if( !mydq.isEmpty() ) { double item = mydq.removeRight(); System.out.print(item + "\t"); } // end while System.out.println(""); mydq.display(); break; case 4: System.out.println("The items in Queue are :"); mydq.display(); break; case 5: System.out.println("The Size of the Queue is :"+mydq.size()); break; case 6: System.out.println("Good Bye"); break; default: System.out.println("wrong chiose enter again"); } //end switch } //end while } // end main }//end class

    Read the article

  • How do I include a newline in a text message sent as email from an ASP.Net application?

    - by Tim Goodman
    I have an ASP.Net Application that sends text messages to mobile phones. It does this by sending an email. For instance, if your phone number is 555-555-5555 and your wireless carrier is Verizon, you can send an email to [email protected] and it will show up as a text message. I want to be able to include a newline in the body of the message. How do I do this? Also please note that my ASP.Net program gets the message from a database (MS SQL Server) so what I really need to know is what characters to include in the message body when I store it in my database. I already tried \n but it just showed up in the text message as \n

    Read the article

  • MVC Communication Pattern

    - by Kedu
    This is kind of a follow up question to this http://stackoverflow.com/questions/23743285/model-view-controller-and-callbacks, but I wanted to post it separately, because its kind of a different topic. I'm working on a multiplayer cardgame for the Android platform. I split the project into MVC which fits the needs pretty good, but I'm currently stuck because I can't figure out a good way to communicate between the different parts. I have everything setup and working with the controller being a big state machine, which is called over and over from the gameloop, and calls getter methods from the GUI and the android/network part to get the input. The input itself in the GUI and network is set by inputlisteners that set a local variable which I read in the getter method. So far so good, this is working. But my problem is, the controller has to check every input separately,so if I want to add an input I have to check in which states its valid and call the getter method from all these states. This is not good, and lets the code look pretty ugly, makes additions uncomfortable and adds redundance. So what I've got from the question I mentioned above is that some kind of command or event pattern will fit my needs. What I want to do is to create a shared and threadsafe queue in the controller and instead of calling all these getter methods, I just check the queue for new input and proceed it. On the other side, the GUI and network don't have all these getters, but instead create an event or command and send it to the controller through, for example, observer/observable. Now my problem: I can't figure out a way, for these commands/events to fit a common interface (which the queue can store) and still transport different kind of data (button clicks, cards that are played, the player id the command comes from, synchronization data etc.). If I design the communication as command pattern, I have to stick all the information that is needed to execute the command into it when its created, that's impossible because the GUI or network has no knowledge of all the things the controller needs to execute stuff that needs to be done when for example a card is played. I thought about getting this stuff into the command when executing it. But over all the different commands I have, I would need all the information the controller has, and thus give the command a reference to the controller which would make everything in it public, which is real bad design I guess. So, I could try some kind of event pattern. I have to transport data in the event. So, like the command, I would have an interface, which all events have in common, and can be stored in the shared queue. I could create a big enum with all the different events that a are possible, save one of these enums in the actual event, and build a big switch case for the events, to proceed different stuff for different events. The problem here: I have different data for all the events. But I need a common interface, to store the events in a queue. How do I get the specific data, if I can only access the event through the interface? Even if that wouldn't be a problem, I'm creating another big switch case, which looks ugly, and when i want to add a new event, I have to create the event itself, the case, the enum, and the method that's called with the data. I could of course check the event with the enum and cast it to its type, so I can call event type specific methods that give me the data I need, but that looks like bad design too.

    Read the article

  • How to specify a remote private queue in NServiceBus?

    - by Benny
    I tried to modify the sample PubSub from NServiceBus, which says in order to configure remote endpoints use the format: "queue@machine" and I didn't see the message arrive on the publishing machine, the following is the config of subscriber <UnicastBusConfig> <MessageEndpointMappings> <add Messages="MyMessages" Endpoint="MyPublisherInputQueue@Dell755" /> </MessageEndpointMappings> </UnicastBusConfig>

    Read the article

  • Should I move this task to a message queue?

    - by Fedyashev Nikita
    I'm a big fan of using message queue systems(like Apache ActiveMQ) for the tasks which are rather slow and do not require instant feedback in User Interface. The question is: Should I use it for other tasks(which are pretty fast) and do not require instant feedback in User Interface? Or does it in involve another level of complexity without not so much benefits?

    Read the article

  • Push-Based Events in a Services Oriented Architecture

    - by Colin Morelli
    I have come to a point, in building a services oriented architecture (on top of Thrift), that I need to expose events and allow listeners. My initial thought was, "create an EventService" to handle publishing and subscribing to events. That EventService can use whatever implementation it desires to actually distribute the events. My client automatically round-robins service requests to available service hosts which are determined using Zookeeper-based service discovery. So, I'd probably use JMS inside of EventService mainly for the purpose of persisting messages (in the event that a service host for EventService goes down before it can distribute the message to all of the available listeners). When I started considering this, I began looking into the differences between Queues and Topics. Topics unfortunately won't work for me, because (at least for now), all listeners must receive the message (even if they were down at the time the event was pushed, or hadn't made a subscription yet because they haven't completed startup (during deployment, for example) - messages should be queued until the service is available). However, I don't want EventService to be responsible for handling all of the events. I don't think it should have the code to react to events inside of it. Each of the services should do what it needs with a given event. This would indicate that each service would need a JMS connection, which questions the value of having EventService at all (as the services could individually publish and subscribe to JMS directly). However, it also couples all of the services to JMS (when I'd rather that there be a single service that's responsible for determining how to distribute events). What I had thought was to publish an event to EventService, which pulls a configuration of listeners from some configuration source (database, flat file, irrelevant for now). It replicates the message and pushes each one back into a queue with information specific to that listener (so, if there are 3 listeners, 1 event would become 3 events in JMS). Then, another thread in EventService (which is replicated, running on multiple hots) would be pulling from the queue, attempting to make the service call to the "listener", and returning the message to the queue (if the service is down), or discarding the message (if the listener completed successfully). tl;dr If I have an EventService that is responsible for receiving events and delegating service calls to "event listeners," (which are really just endpoints on other services), how should it know how to craft the service call? Should I create a generic "Event" object that is shared among all services? Then, the EventService can just construct this object and pass it to the service call. Or is there a better answer to this problem entirely?

    Read the article

  • BlockingCollection having issues with byte arrays

    - by MJLaukala
    I am having an issue where an object with a byte[20] is being passed into a BlockingCollection on one thread and another thread returning the object with a byte[0] using BlockingCollection.Take(). I think this is a threading issue but I do not know where or why this is happening considering that BlockingCollection is a concurrent collection. Sometimes on thread2, myclass2.mybytes equals byte[0]. Any information on how to fix this is greatly appreciated. MessageBuffer.cs public class MessageBuffer : BlockingCollection<Message> { } In the class that has Listener() and ReceivedMessageHandler(object messageProcessor) private MessageBuffer RecievedMessageBuffer; On Thread1 private void Listener() { while (this.IsListening) { try { Message message = Message.ReadMessage(this.Stream, this); if (message != null) { this.RecievedMessageBuffer.Add(message); } } catch (IOException ex) { if (!this.Client.Connected) { this.OnDisconnected(); } else { Logger.LogException(ex.ToString()); this.OnDisconnected(); } } catch (Exception ex) { Logger.LogException(ex.ToString()); this.OnDisconnected(); } } } Message.ReadMessage(NetworkStream stream, iTcpConnectClient client) public static Message ReadMessage(NetworkStream stream, iTcpConnectClient client) { int ClassType = -1; Message message = null; try { ClassType = stream.ReadByte(); if (ClassType == -1) { return null; } if (!Message.IDTOCLASS.ContainsKey((byte)ClassType)) { throw new IOException("Class type not found"); } message = Message.GetNewMessage((byte)ClassType); message.Client = client; message.ReadData(stream); if (message.Buffer.Length < message.MessageSize + Message.HeaderSize) { return null; } } catch (IOException ex) { Logger.LogException(ex.ToString()); throw ex; } catch (Exception ex) { Logger.LogException(ex.ToString()); //throw ex; } return message; } On Thread2 private void ReceivedMessageHandler(object messageProcessor) { if (messageProcessor != null) { while (this.IsListening) { Message message = this.RecievedMessageBuffer.Take(); message.Reconstruct(); message.HandleMessage(messageProcessor); } } else { while (this.IsListening) { Message message = this.RecievedMessageBuffer.Take(); message.Reconstruct(); message.HandleMessage(); } } } PlayerStateMessage.cs public class PlayerStateMessage : Message { public GameObject PlayerState; public override int MessageSize { get { return 12; } } public PlayerStateMessage() : base() { this.PlayerState = new GameObject(); } public PlayerStateMessage(GameObject playerState) { this.PlayerState = playerState; } public override void Reconstruct() { this.PlayerState.Poisiton = this.GetVector2FromBuffer(0); this.PlayerState.Rotation = this.GetFloatFromBuffer(8); base.Reconstruct(); } public override void Deconstruct() { this.CreateBuffer(); this.AddToBuffer(this.PlayerState.Poisiton, 0); this.AddToBuffer(this.PlayerState.Rotation, 8); base.Deconstruct(); } public override void HandleMessage(object messageProcessor) { ((MessageProcessor)messageProcessor).ProcessPlayerStateMessage(this); } } Message.GetVector2FromBuffer(int bufferlocation) This is where the exception is thrown because this.Buffer is byte[0] when it should be byte[20]. public Vector2 GetVector2FromBuffer(int bufferlocation) { return new Vector2( BitConverter.ToSingle(this.Buffer, Message.HeaderSize + bufferlocation), BitConverter.ToSingle(this.Buffer, Message.HeaderSize + bufferlocation + 4)); }

    Read the article

  • Sorted queue with dropping out elements

    - by ffriend
    I have a list of jobs and queue of workers waiting for these jobs. All the jobs are the same, but workers are different and sorted by their ability to perform the job. That is, first person can do this job best of all, second does it just a little bit worse and so on. Job is always assigned to the person with the highest skills from those who are free at that moment. When person is assigned a job, he drops out of the queue for some time. But when he is done, he gets back to his position. So, for example, at some moment in time worker queue looks like: [x, x, .83, x, .7, .63, .55, .54, .48, ...] where x's stand for missing workers and numbers show skill level of left workers. When there's a new job, it is assigned to 3rd worker as the one with highest skill of available workers. So next moment queue looks like: [x, x, x, x, .7, .63, .55, .54, .48, ...] Let's say, that at this moment worker #2 finishes his job and gets back to the list: [x, .91, x, x, .7, .63, .55, .54, .48, ...] I hope the process is completely clear now. My question is what algorithm and data structure to use to implement quick search and deletion of worker and insertion back to his position. For the moment the best approach I can see is to use Fibonacci heap that have amortized O(log n) for deleting minimal element (assigning job and deleting worker from queue) and O(1) for inserting him back, which is pretty good. But is there even better algorithm / data structure that possibly take into account the fact that elements are already sorted and only drop of the queue from time to time?

    Read the article

  • Is there anyway to get the cyberphunks pidgin OTR plugin to be less verbose?

    - by Matt
    Is there anyway to get the cyberphunk piding OTR plugin to be less verbose? Sometimes I get hundreds of lines notifying me of the same thing... (6:40:56 PM) OTR Error: You sent encrypted data to anoynmous, who wasn't expecting it. (6:40:57 PM) Successfully refreshed the unverified conversation with [email protected]/Gaim939DD745. (6:40:57 PM) The last message to [email protected] was resent. (6:40:57 PM) Error setting up private conversation: Malformed message received (6:40:58 PM) OTR Error: You sent encrypted data to anoynmous, who wasn't expecting it. (6:40:58 PM) Successfully refreshed the unverified conversation with [email protected]/Gaim939DD745. (6:40:58 PM) The last message to [email protected] was resent. (6:40:59 PM) Error setting up private conversation: Malformed message received (6:40:59 PM) OTR Error: You sent encrypted data to anoynmous, who wasn't expecting it. (6:41:00 PM) Successfully refreshed the unverified conversation with [email protected]/Gaim939DD745. (6:41:00 PM) The last message to [email protected] was resent. (6:41:00 PM) Error setting up private conversation: Malformed message received (6:41:01 PM) OTR Error: You sent encrypted data to anoynmous, who wasn't expecting it. (6:41:01 PM) Attempting to refresh the private conversation with [email protected]/Gaim939DD745... (6:41:01 PM) Successfully refreshed the unverified conversation with [email protected]/Gaim939DD745. (6:41:01 PM) The last message to [email protected] was resent. (6:41:02 PM) OTR Error: You transmitted an unreadable encrypted message. (6:41:02 PM) Error setting up private conversation: Malformed message received (6:41:02 PM) OTR Error: You sent encrypted data to anoynmous, who wasn't expecting it. (6:41:02 PM) Successfully refreshed the unverified conversation with [email protected]/Gaim939DD745. (6:41:02 PM) The last message to [email protected] was resent. (6:41:03 PM) Error setting up private conversation: Malformed message received (6:41:03 PM) OTR Error: You transmitted an unreadable encrypted message. (6:41:03 PM) Successfully refreshed the unverified conversation with [email protected]/Gaim939DD745. (6:41:03 PM) The last message to [email protected] was resent. (6:41:03 PM) OTR Error: You sent encrypted data to anoynmous, who wasn't expecting it. (6:41:04 PM) Error setting up private conversation: Malformed message received (6:41:09 PM) Attempting to refresh the private conversation with [email protected]/Adium39B22966... (6:41:11 PM) Unverified conversation with [email protected]/Adium39B22966 started. (6:41:11 PM) The last message to [email protected] was resent. (6:41:11 PM) OTR Error: You transmitted an unreadable encrypted message. **(6:41:16 PM) Anonymous: yea** (6:41:20 PM) [email protected]/91A31EC5: yarrr (**6:41:25 PM) Anonymous: sup? (6:41:29 PM) [email protected]/91A31EC5: nothing (6:41:33 PM) [email protected]/91A31EC5: just speaking like a pirate (6:41:51 PM) Anonymous: word (7:13:47 PM) Anonymous: how late you workin? (9:18:12 PM) [email protected]/91A31EC5: not too late** (9:18:13 PM) OTR Error: You transmitted an unreadable encrypted message. (9:18:13 PM) Unverified conversation with [email protected]/Gaim939DD745 started. (9:18:13 PM) The last message to [email protected] was resent. (9:18:14 PM) Error setting up private conversation: Malformed message received (9:18:14 PM) OTR Error: You transmitted an unreadable encrypted message. (9:18:14 PM) Unverified conversation with [email protected]/Adium39B22966 started. (9:18:14 PM) The last message to [email protected] was resent. (9:18:15 PM) OTR Error: You transmitted an unreadable encrypted message. (9:18:15 PM) Unverified conversation with [email protected]/Gaim939DD745 started. (9:18:15 PM) The last message to [email protected] was resent. (9:18:15 PM) OTR Error: You transmitted an unreadable encrypted message. (9:18:16 PM) Successfully refreshed the unverified conversation with [email protected]/Gaim939DD745. (9:18:16 PM) The last message to [email protected] was resent. (9:18:16 PM) OTR Error: You transmitted an unreadable encrypted message. (9:18:17 PM) Successfully refreshed the unverified conversation with [email protected]/Gaim939DD745. (9:18:17 PM) The last message to [email protected] was resent. (9:18:17 PM) OTR Error: You transmitted an unreadable encrypted message. (9:18:18 PM) Successfully refreshed the unverified conversation with [email protected]/Gaim939DD745. (9:18:18 PM) The last message to [email protected] was resent. (9:18:18 PM) OTR Error: You transmitted an unreadable encrypted message. (9:18:19 PM) Unverified conversation with [email protected]/Adium39B22966 started. (9:18:19 PM) The last message to [email protected] was resent. (9:18:19 PM) OTR Error: You transmitted an unreadable encrypted message. (9:18:20 PM) Successfully refreshed the unverified conversation with [email protected]/Adium39B22966. (9:18:20 PM) The last message to [email protected] was resent. (9:18:20 PM) OTR Error: You transmitted an unreadable encrypted message. (9:18:20 PM) Attempting to refresh the private conversation with [email protected]/Gaim939DD745... (9:18:21 PM) Unverified conversation with [email protected]/Gaim939DD745 started. (9:18:21 PM) The last message to [email protected] was resent. (9:18:21 PM) OTR Error: You transmitted an unreadable encrypted message. (9:18:21 PM) OTR Error: You transmitted an unreadable encrypted message. (9:18:21 PM) Successfully refreshed the unverified conversation with [email protected]/Gaim939DD745. (9:18:21 PM) The last message to [email protected] was resent. (9:18:21 PM) OTR Error: You transmitted an unreadable encrypted message. (9:18:22 PM) We received an unreadable encrypted message from [email protected]. (9:18:23 PM) The last message to [email protected] was resent. (9:18:24 PM) OTR Error: You transmitted an unreadable encrypted message. (9:18:25 PM) We received an unreadable encrypted message from [email protected]. (9:18:26 PM) Unverified conversation with [email protected]/Adium39B22966 started. (9:18:26 PM) The last message to [email protected] was resent.

    Read the article

  • Multilevel Queue Scheduling (MQS) with Round Robin

    - by stackuser
    I'm trying to use MQS to create a Gantt chart of 5 processes (P1-P5) as well as their waiting, response, and turnaround times (and averages of those metrics) within a CPU task schedule. Here's the basic table of arrival times and bursts: Here's my actual work version after ticking off the finished processes. The time quantum for each time slice is (2 queues) TQ1=4 and TQ2=3. Note that I'm doing MQS and NOT MLFQ: It just doesn't feel like I'm doing MQS right here, I know this gets a little complex but maybe someone can point out where I'm going totally wrong.

    Read the article

  • Algorithms for pairing a rating system to an assignment queue

    - by blunders
    Attempting to research how to allow a group of people to effectively rank a set of objects (each group member will have contributed one object to the group), and then assign each member an object that's not their own based on: Their ratings of the objects, Their objects rating, and The object remaining to be assigned. Idea is to attempt to assign objects to people based on the groups rating of their contribution to the group relative to other member's contribution, the the personal preferences expressed via the ratings. Any suggestions for: Further research, Refining the statement of the problem/solution, or A solution.

    Read the article

  • Using tumblr auto-queue

    - by AK
    Can't get this thing to work. Has anyone else had any success with Tumblr's auto-publish queue feature? I have a bunch of items in my queue It's set to auto-publish once a day It's set to only publish between 1am and 3am The next morning nothing will be published. The interface isn't perfectly clear - is it attempting to auto-post at a time that's not between 1 - 3 and then giving up?

    Read the article

  • Getting the error "SMTP server cannot create a file in the queue directory C:\Inetpub\mailroot\Queue\"

    - by Glenn Slaven
    We're using the default SMTP server for our websites to send mail with, but in the last day sending messages started getting this error: Insufficient system storage. The server response was: 4.3.1 Out of memory Further digging found this message in the System event log: SMTP server cannot create a file in the queue directory C:\Inetpub\mailroot\Queue\ I've since given the Everyone account full control of the mailroot folder but it's still happening. There's enough space on the server and to the best of my knowledge nothing on the server has been changed

    Read the article

  • Consolidated queue for video on demand?

    - by Herb Caudill
    It's great having lots of video on demand options, but actually choosing something to watch is turning into a mess - I have to jump from one website or application to another. I'd like to have a single queue where I can add and prioritize movies and TV I want to watch from any source: iTunes purchases, iTunes rentals, Netflix on demand, Amazon video on demand, Hulu, etc. I'd like the consolidated queue to be accessible from Front Row on my Mac Mini. Does such a thing exist?

    Read the article

  • Oracle Service Bus duplicate message check using Coherence by Jan van Zoggel

    - by JuergenKress
    In a situation where you need some sort of duplicate message check for an Oracle Service Bus project you would need some custom code. Since the Oracle Service Bus is stateless, when it handles a proxy service call it will not know if this specific message was handled before. So there needs to be some sort of logic in your service for validating it’s a new unique message id. Read the full article here. SOA & BPM Partner Community For regular information on Oracle SOA Suite become a member in the SOA & BPM Partner Community for registration please visit  www.oracle.com/goto/emea/soa (OPN account required) If you need support with your account please contact the Oracle Partner Business Center. Blog Twitter LinkedIn Mix Forum Technorati Tags: OSB,SOA Community,Oracle SOA,Oracle BPM,BPM,Community,OPN,Jürgen Kress,Jan van Zoggel

    Read the article

  • OCS 2007 R2 User Properties Error Message

    - by BWCA
    When I attempted to configure one of our user’s Meeting settings using the Microsoft Office Communications Server 2007 R2 Administration Tool   I received an Validation failed – Validation failed with HRESULT = 0XC3EC7E02 dialog box error message. I received the same error message when I tried to configure the user’s Telephony and Other settings. Using ADSI Edit, I compared the settings of an user that I had no problems configuring and the user that I had problems configuring.  For the user I had problems configuring, I noticed a trailing space after the last phone number digit for the user’s msRTCSIP-Line attribute. After I removed the trailing space for the attribute and waited for Active Directory replication to complete, I was able to configure the user’s Meeting settings (and Telephony/Other settings) without any problems. If you get the error message, check your user’s msRTCSIP-xxxxx attributes in Active Directory using ADSI Edit for any trailing spaces, typos, or any other mistakes.

    Read the article

  • what is message passing in OO?

    - by Tom
    I've been studying OO programming, primarily in C++, C# and Java. I thought I had a good grasp on it with my understanding of encapsulation, inheritance and polymorphism (as well as reading a lot of questions on this site). One thing that seems to popup up here and there is the concept of "message passing". Apparently, this is something that is not used whilst OO programming in today's mainstream languages, but is supported by Smalltalk. My questions are: What is message passing? (Can someone give a practical example?) Is there any support for this "message passing" in C++, C# or Java?

    Read the article

  • Purpose of front() and back() in assigning values in a Queue? (C++)

    - by kevin
    I have declared: queue<int, list<int> > Q After a series of calls: Q.push(37); Q.pop(); Q.push(19); Q.push(3); Q.push(13); Q.front(); Q.push(22); Q.push(8); Q.back(); I get: 19-3-13-22-8-NULL What I don't get is what the calls to Q.front() and Q.back() do. From what I understand, they return a reference to the first or last elements respectively, but I dont see how my list would be any different had those calls not been made. Do they have any effect? Sorry if this seems trivial, but I'm trying to figure out of those calls have a purpose, or of my professor is just trying to screw with me.

    Read the article

  • Syncronization Exception

    - by Kurru
    Hi I have two threads, one thread processes a queue and the other thread adds stuff into the queue. I want to put the queue processing thread to sleep when its finished processing the queue I want to have the 2nd thread tell it to wake up when it has added an item to the queue However these functions call System.Threading.SynchronizationLockException: Object synchronization method was called from an unsynchronized block of code on the Monitor.PulseAll(waiting); call, because I havent syncronized the function with the waiting object. [which I dont want to do, i want to be able to process while adding items to the queue]. How can I achieve this? Queue<object> items = new Queue<object>(); object waiting = new object(); 1st Thread public void ProcessQueue() { while (true) { if (items.Count == 0) Monitor.Wait(waiting); object real = null; lock(items) { object item = items.Dequeue(); real = item; } if(real == null) continue; .. bla bla bla } } 2nd Thread involves public void AddItem(object o) { ... bla bla bla lock(items) { items.Enqueue(o); } Monitor.PulseAll(waiting); }

    Read the article

  • Linux/Unix MTA with the smartest queue?

    - by threecheeseopera
    I am looking for an MTA that will allow me (a script, really) to proactively manage it's send queue in response to status codes returned by the remote servers I am delivering to. Basically, for each mail sent I would like to be able to react to the SMTP reply code returned by the remote server, ex. '250 OK', or to any error conditions like connection timeouts. Additionally, I would like to be able to manage the send queue moving forward based on this information, e.g. 'example.com has timed out the last 5 connection attempts, so no longer queue mail for recipients @example.com'. I am currently using postfix and perl to parse it's logs for this information, but I am playing a game of catchup that is prone to errors (out-of-order log entries etc.) and it's starting to get messy (some real ugly regexes ;). I really don't want to reinvent the wheel and use some language's smtp library; i would prefer to use a proven/fast/reliable MTA. I am however open to suggestions if what I need just isn't possible. Thanks for your help!

    Read the article

  • Better viewing of postfix mail queue files than postcat?

    - by Geekman
    So I got a call early this morning about a client needing to see what email they have waiting to be delivered sitting in our secondary mail server. Their link for the main server had (still is) been down for two days and they needed to see their email. So I wrote up a quick perl script to use mailq in combination with postcat to dump each email for their address into separate files, tar'd it up and sent it off. Horrible code, I know, but it was urgent. My solution works OK in that it at least gives a raw view, but I thought tonight it would be nice if I had a solution where I could provide their email attachments and maybe remove some "garbage" header text as well. Most of the important emails seem to have a PDF or similar attached. I've been looking around but the only method of viewing queue files I can see is the postcat command, and I really don't want to write my own parser - so I was wondering if any of you have already done so, or know of a better command to use? Here's the code for my current solution: #!/usr/bin/perl $qCmd="mailq | grep -B 2 \"someemailaddress@isp\" | cut -d \" \" -f 1"; @data = split(/\n/, `$qCmd`); $i = 0; foreach $line (@data) { $i++; $remainder = $i % 2; if ($remainder == 0) { next; } if ($line =~ /\(/ || $line =~ /\n/ || $line eq "") { next; } print "Processing: " . $line . "\n"; `postcat -q $line > $line.email.txt`; $subject=`cat $line.email.txt | grep "Subject:"`; #print "SUB" . $subject; #`cat $line.email.txt > \"$subject.$line.email.txt\"`; } Any advice appreciated.

    Read the article

  • Is there a better tool than postcat for viewing postfix mail queue files?

    - by Geekman
    So I got a call early this morning about a client needing to see what email they have waiting to be delivered sitting in our secondary mail server. Their link for the main server had (still is) been down for two days and they needed to see their email. So I wrote up a quick Perl script to use mailq in combination with postcat to dump each email for their address into separate files, tar'd it up and sent it off. Horrible code, I know, but it was urgent. My solution works OK in that it at least gives a raw view, but I thought tonight it would be nice if I had a solution where I could provide their email attachments and maybe remove some "garbage" header text as well. Most of the important emails seem to have a PDF or similar attached. I've been looking around but the only method of viewing queue files I can see is the postcat command, and I really don't want to write my own parser - so I was wondering if any of you have already done so, or know of a better command to use? Here's the code for my current solution: #!/usr/bin/perl $qCmd="mailq | grep -B 2 \"someemailaddress@isp\" | cut -d \" \" -f 1"; @data = split(/\n/, `$qCmd`); $i = 0; foreach $line (@data) { $i++; $remainder = $i % 2; if ($remainder == 0) { next; } if ($line =~ /\(/ || $line =~ /\n/ || $line eq "") { next; } print "Processing: " . $line . "\n"; `postcat -q $line > $line.email.txt`; $subject=`cat $line.email.txt | grep "Subject:"`; #print "SUB" . $subject; #`cat $line.email.txt > \"$subject.$line.email.txt\"`; } Any advice appreciated.

    Read the article

  • How to queue and call actual methods (rather than immediately eval) in java?

    - by alleywayjack
    There are a list of tasks that are time sensitive (but "time" in this case is arbitrary to what another program tells me - it's more like "ticks" rather than time). However, I do NOT want said methods to evaluate immediately. I want one to execute after the other finished. I'm using a linked list for my queue, but I'm not really sure how/if I can access the actual methods in a class without evaluating them immediate. The code would look something like... LinkedList<Method> l = new LinkedList<Method>(); l.add( this.move(4) ); l.add( this.read() ); l.removeFirst().call(); //wait 80 ticks l.removeFirst().call(); move(4) would execute immediately, then 80 ticks later, I would remove it from the list and call this.read() which would then be executed. I'm assuming this has to do with the reflection classes, and I've poked around a bit, but I can't seem to get anything to work, or do what I want. If only I could use pointers...

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >