I have a problem with a CFSocket.
I need to enable and disable the
callbacks from the socket and for this i use
CFSocketEnableCallBacks(cfSocket, kCFSocketReadCallBack);
and
CFSocketDisableCallBacks(cfSocket, kCFSocketReadCallBack);
But, when you wake up the callback I get old messages.
is probably a problem of reset (?)
How do I reset everything before disabling
callback?
Related
I'm building my first CloudKit application, and am using CKFetchRecordZoneChangesOperation on startup to get any new records changed while the current device was offline.
I am also calling CKFetchRecordZoneChangesOperation when I receive a subscription notification of changes.
It is possible the subscription notification could come in before the startup call finishes. I am currently using a lock to prevent the 2nd call from starting until the recordZoneFetchCompletionBlock handler is called, signalling that the first one is done. This works, but it also smells a bit hacky.
I'm want to send out an SMS alert when a client fails a keep alive check. I have no desire to reconfigure any clients keep alive settings, just simply use the defaults and send the alert.
You can configure this VERY easily on just the server. Your keepalives should use your default handler. You can set up your default handler to send the SMS (I just use the email handler but send it to mynumber#verizonwireless.com) if you are using the default handler for other things it is easeir to change your other checks to use a different handler than to reconfigure each client...
Ps as a side note (if you have more than a few servers that are being monitored by sensu) You should look into some configuration management tools. We use chef and it is wonderful. If I needed to change a handler for a check or even all of them I simply modify the recipe and then tell the machines to re converge and it the process is done in just a few minutes.
The keepalive check is just like any other check, and can take handlers.
http://sensuapp.org/docs/latest/keepalives
If you are using puppet, you can set the keepalive settings like this:
class { 'sensu':
...
client_keepalive => {
handlers => [ 'sms' ],
}
}
https://github.com/sensu/sensu-puppet/blob/a37c512b29daed9dee7359cac3f3086c0ab3e809/manifests/init.pp#L148
I am developing an app in C++ that uses UIAutomation to receive notification of significant events related to user interaction. I have tried anevent handler by calling AddAutomationEventHandler to listened for window opened events, but I am having problems stopping the notification and cleaning up before exiting. If the user has launched certain applications, such as Firefox, the call to RemoveAutomationEventHandlerhangs. (Calling RemoveAllEventHandlers also hangs in this case.) Note that all calls to add or remove event handlers are done in the context of the same non-UI thread.
Note: I am seeing this behavior on Windows 7 and on Windows 8.
Any ideas on why this is happening or how to fix it? What makes the structure changed event different from all the others?
Window open/close events are implemented via the kernel WinEvent handlers; the structure change events involve the client app. Does your non-ui thread pump messages? UI Automation needs to pump messages to get cross-process communications working.
I'm making a Perl IRC bot and I want to send a message periodically to a channel. I'm using POE::Component::IRC, but as far as I can see, there is no method or event handling this.
Is there a way to accomplish this?
You can use POE::Kernel's delay routine to act like a one-time timer calling itself over and over.
Basically, you have an event handler named my_event. Within my_event, you send the PRIVMSG to the channel. You then call this same event handler my_event using the delay routine inherited through POE.
See: POE: Cookbook - Recurring Alarms
I find the Post notification and delegate function are very useful in iOS. Once I finish a task I can notify another piece of code to do something. I am sending out notices for others to do the work.
Post Notification is when you sending notice right away, whereas delegate sometime down the line it will send a notice.
In Android I know there's event Listener, but that's only passive listening. What about me actively sending notices? Does Android have that equivalent?
Handler which can be fired right away or with postDelay() you can fire them later
You could either use a Handler to get notified from a running Thread or the AsyncTask which does run some code and after it's finished it notifies the UI Thread.
You are probably looking for a way to thread your application? Where there are other "worker" threads that do long computations (or do buffered IO stuff). The way you would do this is by creating an AsyncTask. Within an AsyncTask, there is a "doInBackground" method that seems to be what "delegate" is in your question. "onPostExecute" will handle whatever's returned in "doInBackground". More in the AsyncTask documentation.
Another option is to simply use a Handler and use postDelay() for later executions: