Callback to register data types when reconnect
505604
def register_type(self, oids, name, casting):
        
        assert type(oids) is tuple
        assert isinstance(name, basestring)
        assert hasattr(casting, '__call__')
        self._register_types.append((oids, name, casting))
        psycopg2.extensions.register_type(psycopg2.extensions.new_type(oids, name, casting))
23728
@Override
    public void registerAdapterDataObserver(RecyclerView.AdapterDataObserver observer) {
        super.registerAdapterDataObserver(observer);
        if (mFastAdapter != null) {
            mFastAdapter.registerAdapterDataObserver(observer);
        }
    }
60143
def _handle_callback(self, data):
        """"""

        cb_id = data.get("id")
        args = data.get("args")
        event = self.__callbacks.pop(cb_id, None)
        if not event:
            return
        if not args:
            event.put(args)
            return
        err, info = args
        if err is None:
            event.put(info)
        else:
            LOGGER.warning("Callback returned error of %s", str(err))
            event.put(err)
480066
def register_on_session_state_changed(self, callback):
        
        event_type = library.VBoxEventType.on_session_state_changed
        return self.event_source.register_callback(callback, event_type)
347095
function (callback) {
            loadArrayBuffer(path.join(dic_path, "cc.dat.gz"), function (err, buffer) {
                if(err) {
                    return callback(err);
                }
                var cc_buffer = new Int16Array(buffer);
                dic.loadConnectionCosts(cc_buffer);
                callback(null);
            });
        }
214503
function(key, callback) {
		if (typeof data[key] == 'undefined') {
			callback && callback(null, null)
		} else if (typeof data[key] == 'string' || typeof data[key] == 'number' || typeof data[key] == 'boolean') {
			callback && callback(null, data[key])
		} else {
			callback && callback(typeError('getBytes', 'string or number', key))
		}
	}
702698
def register_callback(self, sensorid, callback, user_data=None):
        """"""
        if sensorid not in self._registry:
            self._registry[sensorid] = list()
        self._registry[sensorid].append((callback, user_data))
36475
function (dataChannel, info, event) {
        if (event.data instanceof ArrayBuffer) {
          self.dispatchEvent('onReceived', {
            'channelLabel': info.label,
            'buffer': event.data
          });
        } else if (event.data instanceof Blob) {
          self.dispatchEvent('onReceived', {
            'channelLabel': info.label,
            'binary': event.data
          });
        } else if (typeof (event.data) === 'string') {
          self.dispatchEvent('onReceived', {
            'channelLabel': info.label,
            'text': event.data
          });
        }
      }
886175
function(callback){
        callback = callback || function(){};
        var res = [], _this = this, obj = null, callbackReturn;
        this._dataCache.forEach(function(item){
            if(item.type == 'group'){
                res.push({
                    type : item.type,
                    value : _this._map(item.value, callback),
                    parent : item.parent,
                    name : item.name
                });
            }else{
                obj = clone(item);
                callbackReturn = callback.call(obj, obj, item);
                if(callbackReturn != false){
                    res.push(obj);
                }
                obj = null;
            }
        });
        res = new HostAdmin()._loadJSON(res);
        return res;
    }
37022
function(params) {
        var data = {
          type: params.type
        };

        if (params.trackerId) {
          data.trackerId = params.trackerId;
        }

        sendPingTimeout && clearTimeout(sendPingTimeout);
        sendPingTimeout = setTimeout(function() {
          ping();
        }, connectionCheckTimeout);

        try {
          if (params.content) {
            data.content = JSON.stringify(params.content);
          }

          if (socket.readyState === 1) {
            socket.send(JSON.stringify(data));
          }
        } catch (error) {
          eventCallback["customError"]({
            errorCode: 4004,
            errorMessage: "Error in Socket sendData!",
            errorEvent: error
          });
        }
      }
332753
def a_return_and_reconnect(ctx):
    """"""
    ctx.ctrl.send("\r")
    ctx.device.connect(ctx.ctrl)
    return True
827060
function reconnectToNewUri(maxRetries, numRetries, reconnectWsUri) {
        Logger.debug("Reconnection attempt #" + numRetries);

        ws.close();

        wsUri = reconnectWsUri || wsUri;

        var newWs;
        if (useSockJS) {
            newWs = new SockJS(wsUri);
        } else {
            newWs = new WebSocket(wsUri);
        }

        newWs.onopen = function() {
            Logger.debug("Reconnected after " + numRetries + " attempts...");
            logConnected(newWs, wsUri);
            reconnecting = false;
            registerMessageHandler();
            if (config.onreconnected()) {
                config.onreconnected();
            }

            newWs.onclose = reconnectionOnClose;
        };

        var onErrorOrClose = function(error) {
            Logger.warn("Reconnection error: ", error);

            if (numRetries === maxRetries) {
                if (config.ondisconnect) {
                    config.ondisconnect();
                }
            } else {
                setTimeout(function() {
                    reconnectToSameUri(maxRetries, numRetries + 1);
                }, RETRY_TIME_MS);
            }
        };

        newWs.onerror = onErrorOrClose;

        ws = newWs;
    }
1071949
def registerToDataTypes( cls ):
        
        from projexui.xdatatype import registerDataType
        registerDataType(cls.__name__,
            lambda pyvalue:  pyvalue.toString(),
            lambda qvariant: cls.fromString(unwrapVariant(qvariant)))
837680
def data_callback(data_type, buffer, the_end, options = {})
      return unless @marks.has_key? data_type
      callback(data_type, buffer, @marks[data_type], the_end)
      unless options[:clear]
        @marks[data_type] = 0
      else
        @marks.delete data_type
      end
    end
850619
function(type, data){
            var listeners = _cache[type],len = 0;
            if(!$.isUndefined(listeners)){
                var args = [].slice.call(arguments, 0);
                args = args.length > 2 ? args.splice(2, args.length-1) : [];
                args = [data].concat(args);

                len = listeners.length;
                for(var i = 0; i<len;i++){
                    var listener = listeners[i];
                    if(listener && listener.callback) {
                        args = args.concat(listener.args);
                        listener.callback.apply(listener.scope, args);
                    }
                }
            }
            return this;
        }
1005202
protected void nowReconnectedAsync() {

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Reconnected async for " + this);
        }
        // reset the data buffers first
        if (!resetWriteBuffers()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Resetting buffers (async) failed");
            }
            // otherwise pass the error along to the channel above us, or close
            // the connection if nobody is above
            IOException ioe = new IOException("Failed reconnect");
            if (null != getAppWriteCallback()) {
                getAppWriteCallback().error(getVC(), ioe);
            } else {
                // nobody above us, just close the connection
                getLink().getDeviceLink().close(getVC(), ioe);
            }
            return;
        }

        // now that we've reconnected, we should reset the "broken" flag. First
        // we set it to the default and then recheck the request msg
        setPersistent(true);
        updatePersistence(getRequestImpl());

        // in case we previously read any partial data, clean out the response
        resetRead();

        // attempt to write the data
        VirtualConnection rc = getTSC().getWriteInterface().write(TCPWriteRequestContext.WRITE_ALL_DATA, HttpOSCWriteCallback.getRef(), isForceAsync(), getWriteTimeout());
        if (null != rc) {
            // if we've finished writing part of a request, let the channel
            // above know that it can write more, otherwise start the read
            // for the response
            if (!isMessageSent()) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Calling callback.complete of app channel.");
                }
                getAppWriteCallback().complete(getLink().getVirtualConnection());
            } else {
                if (isReadAheadEnabled()) {
                    // after a reconnect, there is no more read-ahead active
                    this.bReadAheadEnabled = false;
                }
                // force an async read for the response now. Avoid trying to
                // re-use any existing read buffer to skip complexity with
                // adjusting for partial reads before the reconnect.
                setupJITRead(getHttpConfig().getIncomingHdrBufferSize());
                getTSC().getReadInterface().read(1, HttpOSCReadCallback.getRef(), true, getReadTimeout());
            }
        }
    }
1072145
def register(self, itemtype, item_id, handler):
        '''
        
        '''
        # Create a node with data
        #TODO: add system properties in data (ip, os)
        #TODO: add uniq client id
        if itemtype not in [ZooConst.CLIENT, ZooConst.WORKER, ZooConst.BROKER]:
            raise Exception('Zooborg.register: invalid type')
        self.initconn()
        self.zk.ensure_path("/distark/" + itemtype + "/list")
        path=''.join(['/distark/' + itemtype + '/list/', item_id])
        self.registred.append(path)
        data=b'ip̂,os'
        if not(self.zk.exists(path)):
            self.zk.create(path, data, None, True)
        else:
            self.zk.delete(path, recursive=True)
            self.zk.create(path, data, None, True)
        #reload conf if change in zoo
        self.zk.DataWatch('/distark/' + itemtype + '/conf/conf_reload_trigger',
                          handler)