message-passing

Get the sender of the message for an NSInvocation

旧巷老猫 提交于 2019-12-13 00:36:17
问题 How do I get the sender of the message wrapped in an `NSInvocation? I'm in an object, and I've just received an invocation in my forwardInvocation: . Is there any way to know who sent me the message in the first place? 回答1: No. Information about the sender is not available (unless you explicitly add an sender:self argument). See also this thread http://www.cocoabuilder.com/archive/cocoa/194746-is-the-sender-of-an-obj-method-implied-in-the-destination-method.html: It isn't explicitly available

Sending message Pid Erlang

天涯浪子 提交于 2019-12-12 16:55:58
问题 I would like to know, how can i send a message to process with erlang. I did start a process and the output shows me that the pid is <0.39.0>. My problem is how can i send a message to this process (<0.39.0>) manually. Anyhelp would be appreciated 回答1: While list_to_pid/1 can indeed be used to construct a PID and use it to send messages its usage is discouraged: This BIF is intended for debugging and for use in the Erlang operating system. It should not be used in application programs. A

how to pass localstorage from popup.js to content.js

我的未来我决定 提交于 2019-12-12 04:36:39
问题 i want to pass data from localstorage of popup.hmtl to content script content.js i use popup.html to receive username and password and store it in local storage.Now i want to transfer the data to content script before it execute. **popup.html** <!DOCTYPE html> <html> <head> <script type="text/javascript" async src="popup.js"></script> </head> <body> <table> <tr> <td> Username: <td><input id="u1" type="text" name="uname"> </tr> <tr> <td> Password: <td><input id="u2" type="password" name="pass"

implicitly logging messages received by an actor in scala

拜拜、爱过 提交于 2019-12-12 04:36:09
问题 I am new to this fancy language scala and I am trying to create a library for logging scala actors. My library has a class Logger which extends the Actor class. So any Scala application which uses actor model can extend from this class instead or the Actor class for added logging functionality. Eg. class MyClass extends Logger. In my Logger class I have implemented the logic that whenever someone sends a message to some actor it is logged by the log file of the sending actor. For this,

Passing exceptions across classes while unit-testing in Python

試著忘記壹切 提交于 2019-12-12 03:32:57
问题 Assume two Python classes, the first of which ( Class 1 ) contains a function ( function_c1 ) that encompasses some statement ( some_statement ), which - if true - returns a customized exception ( MyException ). Further assume that the second class ( Class 2 ) executes the first class and wishes to pass on the customized exception (i.e., return the same exception itself). The following code exemplifies this situation: class Class1: ''' My nifty class 1. ''' def __init__(self): pass def

Why can't I deliver this message to all of the frames running in a tab?

可紊 提交于 2019-12-12 03:17:26
问题 Subject I am creating a chrome extension that requires me to send a message from my event page to a content script that is running on a specific frame The message passing operation is invoked when a context menu option is clicked. Said option is only available when the element in focus is categorized as editable by the chrome.contextMenus API. I need to send it to the innermost frame in which the element is contained. (so I can modify its contents by accessing the document.activeElement

Chrome extension message passing from background script to content script is not working

心已入冬 提交于 2019-12-12 01:54:37
问题 I am trying chrome plugin creation Message Passing. My code is as follows: manifest.json: { "name": "Sending Messages Test", "version": "1.0", "manifest_version": 2, "description": "Send a Message to background.js from contentscript.js and send reply", "background": { "scripts": ["background.js"], "persistent": false }, "browser_action": { "default_title": "That's the tool tip", "default_popup": "popup.html" }, // "permissions": ["tabs"], "content_scripts": [{ "matches": ["http://*/*", "https

How can I fix my “write end dead” and “read end dead” errors for ObjectInputStream and ObjectOutputStream?

和自甴很熟 提交于 2019-12-11 05:56:27
问题 This is a kind of an extension of my question here. I have 3 classes. My main: import java.io.*; public class ConnectionManager { public static void main(String argv[]) { try { PipedOutputStream pout = new PipedOutputStream(); PipedInputStream pin = new PipedInputStream(pout); Sender s = new Sender(pout,true); Receiver r = new Receiver(pin,true); System.out.println("Starting threads"); s.start(); r.start(); } catch (Exception e) {System.out.println(e);} } } My Sender/Producer class: import

Message passing between two programs

此生再无相见时 提交于 2019-12-11 03:35:56
问题 Currently I have two standalone C++ programs, a master and a slave. The master writes some data to shared memory, using boost::interprocess , and then launches the slave, which is able to read from the memory. What I would like to do is to have the slave constantly running, and for the master to send a message to the slave when the memory has been written to and is ready to be read from. The only way I can think to achieve the same thing is for the slave to constantly check the shared memory

In Akka, how do I know when an actor is ready to use after having been registered with actorOf()?

放肆的年华 提交于 2019-12-10 15:03:14
问题 If I create an actor using context().actorOf() in Akka, I get back a valid ActorRef. However, if I do the same but create an ActorRef using actorFor and the path I know that the actor will appear at, I do not reliably get a valid ActorRef back. How can I tell that an actor has been registered successfully? In the description above, I could simply use the ActorRef returned from actorOf(). However, in my actual case I create an actor that itself registers a child actor and I need to resolve