request point create: feed or control, lid and pid point lid
17504
def request_point_create(self, foc, lid, pid, control_cb=None, save_recent=0):
        
        Validation.foc_check(foc)
        lid = Validation.lid_check_convert(lid)
        pid = Validation.pid_check_convert(pid)
        save_recent = validate_int(save_recent, 'save_recent')
        logger.debug("request_point_create foc=%i lid='%s' pid='%s' save_recent=%d", foc, lid, pid, save_recent)

        if foc == R_CONTROL:
            Validation.callable_check(control_cb)
            if save_recent:
                logger.warning('ignoring non-zero save_recent value for control')
            evt = self._request(foc, C_CREATE, (lid,), {'lid': pid}, is_crud=True)
            with self.__pending_controls:
                self.__pending_controls[evt.id_] = control_cb
            return evt
        elif control_cb:
            raise ValueError('callback specified for Feed')
        else:
            return self._request(foc, C_CREATE, (lid,), {'lid': pid, 'saveRecent': save_recent}, is_crud=True)
606283
function xivelyPost(feedId, streamId, apiKey, currentValue) {
    var dataPoint =
    {
        "version":"1.0.0",
        "datastreams" :
        [
            {
                "id" : streamId,
                "current_value" : currentValue
            },
        ]
    };

    var requestUrl = "https://api.xively.com/v2/feeds/" + feedId;

    var options = {
        url: requestUrl,
        headers: {
            "X-ApiKey" : apiKey,
            "Content-Type": "application/json",
            "Accept": "*/*",
            "User-Agent": "nodejs"
        },
        body: JSON.stringify(dataPoint)
    };

    return requestPut(options);
}
603590
def set_meta_rdf(self, rdf, fmt='n3'):
        
        evt = self._client._request_point_meta_set(self._type, self.__lid, self.__pid, rdf, fmt=fmt)
        self._client._wait_and_except_if_failed(evt)
1230442
function mouseEventPoint(mouseEvent, container) {
  const rect = container.getBoundingClientRect();
  return new Point(
    mouseEvent.clientX - rect.left - (container.clientLeft || 0),
    mouseEvent.clientY - rect.top - (container.clientTop || 0)
  );
}
1204833
def _create_request_record(self, identifier, rtype, name, content, ttl, priority):  # pylint: disable=too-many-arguments
        """"""
        record = collections.OrderedDict()

        # Mandatory content

        # Just for update - not for creation
        if identifier is not None:
            record['id'] = identifier

        record['type'] = rtype

        # Just for creation - not for update
        if name is not None:
            record['name'] = self._relative_name(name)

        # Optional content
        if content is not None:
            record['content'] = content
        if ttl is not None:
            record['ttl'] = ttl
        if priority is not None:
            record['prio'] = priority
        return record
1205356
def do_create(self, line):
        ""
        args = self.getargs(line)
        rc = wc = 5

        name = args.pop(0)  #  tablename

        if args[0] == "-c": # capacity
            args.pop(0)  # skyp -c

            capacity = args.pop(0).strip()
            rc, _, wc = capacity.partition(",")
            rc = int(rc)
            wc = int(wc) if wc != "" else rc

        schema = []

        hkey, _, hkey_type = args.pop(0).partition(':')
        hkey_type = self.get_type(hkey_type or 'S')
        schema.append(boto.dynamodb2.fields.HashKey(hkey, hkey_type))

        if args:
            rkey, _, rkey_type = args.pop(0).partition(':')
            rkey_type = self.get_type(rkey_type or 'S')
            schema.append(boto.dynamodb2.fields.RangeKey(rkey, rkey_type))

        t = boto.dynamodb2.table.Table.create(name,
                                              schema=schema,
                                              throughput={'read': rc, 'write': wc})
        self.pprint(t.describe())
446869
def process_request(control, sym, args)
      instance = factory.call(control)

      instance.send(sym, *args)
    end
363726
def __sub_make_request(self, foc, gpid, callback):
        """"""
        # global
        if isinstance(gpid, string_types):
            gpid = uuid_to_hex(gpid)
            ref = (foc, gpid)
            with self.__sub_add_reference(ref):
                req = self._client._request_sub_create(self.__lid, foc, gpid, callback=callback)
        # local
        elif isinstance(gpid, Sequence) and len(gpid) == 2:
            ref = (foc, tuple(gpid))
            with self.__sub_add_reference(ref):
                req = self._client._request_sub_create_local(self.__lid, foc, *gpid, callback=callback)
        else:
            raise ValueError('gpid must be string or two-element tuple')

        req._run_on_completion(self.__sub_del_reference, ref)
        return req
252023
private void getControllingProcessDirectory(long timestamp, String pid) {
		int count = 0;
		while (ivSubDirectory == null) {
			ivSubDirectory = makeLogDirectory(timestamp, pid);
			if (ivSubDirectory == null) {
				if (++count > FAILED_MAX_COUNT) {
					ivSubDirectory = makeLogDirectory(timestamp, pid,true);
					if(ivSubDirectory==null){
						if (debugLogger.isLoggable(Level.FINE) && isDebugEnabled())
						{
							debugLogger.logp(Level.FINE, thisClass, "UnableToMakeDirectory", "Unable to create instance directory forcefully , throwing Runtime Exception");
						}
					  throw new RuntimeException("Failed to create instance log repository. See SystemOut.log for details.");
				    }
				}
				try {
					Thread.sleep(FAILED_WAIT_TIME);
				} catch (InterruptedException ex) {
					// Ignore it, assume that we had enough sleep.
				}
			}
		}
	}
608479
public void createCheckpoint(Transaction checkpointTx) {
		// stop access new tx request and find out active txs by using a write
		// lock on threadTxNums
		List<Long> txNums;
		// for (Transaction tx : activeTxs)
		// if (tx.getTransactionNumber() != checkpointTx
		// .getTransactionNumber())
		// txNums.add(tx.getTransactionNumber());

		// activeTxsLock.writeLock().lock();
		// try {
		// for (Long l : threadTxNums) {
		// if (l >= 0) {
		// txNums.add(l);
		// }
		// }
		//
		// // flush all buffers
		// // CT : Pick a tx and call its bufferMgr flushAll, or get
		// // bufferPoolMgr (init it at VanillaDb)
		// checkpointTx.bufferMgr().flushAll();
		// // wrtie a checkpoint record and flush to disk
		// LogSeqNum lsn = checkpointTx.recoveryMgr().checkpoint(txNums);
		// VanillaDb.logMgr().flush(lsn);
		// System.out.println("Chkpnt :" + txNums);
		// } finally {
		// activeTxsLock.writeLock().unlock();
		// }

		// Old method
		synchronized (this) {
			txNums = new LinkedList<Long>(activeTxs);
			checkpointTx.bufferMgr().flushAll();
			LogSeqNum lsn = checkpointTx.recoveryMgr().checkpoint(txNums);
			VanillaDb.logMgr().flush(lsn);
		}
	}
170363
function PIDController(options)
{
    // Options configuration
    this.opts       = {
        Kp         : 1.0,
        Ki         : 0.0,
        Kd         : 0.0,
        round      : true,
        Ts         : 1000,  // In MS. (Old sampleTime)
        uMin       : 0,
        uMax       : 255
    };

    options         = options || {};
    this.opts       = extend({}, this.opts, options);

    // Internal Use variables
    this.input           = function ()
    {
        // Function (Reading from sensor)
        this.setIVal(0);
    };

    this.direction       = 0;     // 0 = forward, 1 = drop down to and go forward, 3 = reverse
    this.duration        = 1;     // In seconds (How long to run - 0 = infinite)

    this.output          = function (val)
    {
        // Function (Writing to device)
        return val;
    };

    this.e          = [0.00, 0.00];
    this.PV         = [0.00, 0.00, 0.00];
    this.CO         = [0.00, 0.00];
    this.interval   = 0;
    this.iVal       = 0;
    this.running    = false;
    this.startTime  = 0;
    this.duration   = 0;
    this.SP         = 0;
    this.t1         = 0;
    this.timeLeft   = 0;
    this.tReached   = false;

    EventEmitter.call(this);
}
637086
def pid(self, value):
        """"""
        self.bytearray[self._get_slicers(0)] = bytearray(c_int32(value or 0))
1283617
def feed_index(service, opts):
    """"""

    indexname = opts.args[0]
    itype = opts.kwargs['ingest']


    # get index handle
    try:
        index = service.indexes[indexname]
    except KeyError:
        print("Index %s not found" % indexname)
        return

    if itype in ["stream", "submit"]:
        stream = index.attach()
    else:
        # create a tcp input if one doesn't exist
        input_host = opts.kwargs.get("inputhost", SPLUNK_HOST)
        input_port = int(opts.kwargs.get("inputport", SPLUNK_PORT))
        input_name = "tcp:%s" % (input_port)
        if input_name not in service.inputs.list():
            service.inputs.create("tcp", input_port, index=indexname)
        # connect to socket
        ingest = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        ingest.connect((input_host, input_port))

    count = 0
    lastevent = ""
    try:
        for i in range(0, 10):
            for j in range(0, 5000):
                lastevent = "%s: event bunch %d, number %d\n" % \
                             (datetime.datetime.now().isoformat(), i, j)

                if itype == "stream":
                    stream.write(lastevent + "\n")
                elif itype == "submit":
                    index.submit(lastevent + "\n")
                else:
                    ingest.send(lastevent + "\n")

                count = count + 1
            
            print("submitted %d events, sleeping 1 second" % count)
            time.sleep(1)
    except KeyboardInterrupt:
        print("^C detected, last event written:")
        print(lastevent)
319397
def _init_controls(self):
        
        self._config['heater'] = 0
        self._config['fan'] = 0
        self._config['main_fan'] = 0
        self._config['drum_motor'] = 1
        self._config['solenoid'] = 0
        self._config['cooling_motor'] = 0
        self._config['interval'] = self.INTERVAL
        self._config['environment_temp'] = 0
        self._config['bean_temp'] = 0
        self._config['chaff_tray'] = 1

        self._roast['name'] = None
        self._roast['input_weight'] = -1
        self._roast['output_weight'] = -1
        self._roast['operator'] = None
        self._roast['start_time'] = None
        self._roast['end_time'] = None
        self._roast['duration'] = -1
        self._roast['notes'] = None
        self._roast['events'] = list()
        self._roast['last'] = None
        self._roast['record'] = False
        self._roast['charge'] = None
        self._roast['turning_point'] = None
71222
function(options, callback) {
        var self = this;

        ['flavor', 'size'].forEach(function(required) {
            if (!options[required]) throw new Error('options.' +
                required + ' is a required argument.');
        });

        var requestOptions = {
            uri: '/instances',
            method: 'POST',
            data: {
                instance: {
                    flavorRef: options.flavor,
                    volume: {size: options.size},
                }
            },
            endpoint: rackspace.Endpoints.CloudDatabases
        };

        ['name', 'databases', 'users'].forEach(function(optional) {
            requestOptions.data.instance[optional] = options[optional];
        });

        self.authorizedRequest(requestOptions, function(err, res, body) {
            if (err || !body.instance) {
                callback(err ? err : body);
                return;
            }

            callback(err, new rackspace.DatabaseInstance(self, _.extend({}, body.instance, options)));
        });
    }
719425
public void initEndpoints() {
		switch (this.getVersion()) {
			case 1:
				// get number of instances for all command classes on this node.
				for (ZWaveCommandClass commandClass : this.getNode().getCommandClasses()) {
					if (commandClass.getCommandClass() == CommandClass.NO_OPERATION)
						continue;
					this.getController().sendData(this.getMultiInstanceGetMessage(commandClass.getCommandClass()));
				}
				break;
			case 2:
				this.getController().sendData(this.getMultiChannelEndpointGetMessage());
				break;
			default:
				logger.warn(String.format("Unknown version %d for command class %s (0x%02x)", 
						this.getVersion(), this.getCommandClass().getLabel(), this.getCommandClass().getKey()));
		}
	}
131915
function createJob(feed) {

  // Job skeleton
  var job = {
    id: 'Job[' + uuid.v4() + ']',
    original: feed,
    time: {
      start: 0,
      end: 0
    },
    state: {
      retrying: false,
      failing: false
    },
    req: {
      retries: 0,
      data: {}
    },
    res: {
      data: null
    }
  };

  // Handling polymorphism
  if (types.check(feed, 'string')) {
    job.req.url = feed;
    feed = {};
  }
  else {

    // Parsing url if needed
    if (feed.url)
      if (types.check(feed.url, 'object'))
        job.req.url = nodeUrl.format(extend(feed.url, {protocol: 'http'}));
      else
        job.req.url = feed.url;
    else if (feed.host || feed.hostname)
      job.req.url = nodeUrl.format(extend(feed, {protocol: 'http'}));
  }

  // Request properties
  job.req.data = feed.data || {};

  [
    'auth',
    'artoo',
    'body',
    'bodyType',
    'cheerio',
    'cookies',
    'encoding',
    'headers',
    'method',
    'phantomPage',
    'proxy',
    'timeout'
  ].forEach(function(p) {
    if (feed[p]) {

      // Solving object proxy
      if (p === 'proxy' && types.check(feed[p], 'object'))
        job.req[p] = nodeUrl.format(extend(feed[p], {protocol: 'http'}));

      job.req[p] = feed[p];
    }
  });

  return job;
}