/*
@param X client
@param wid
@param prop (name or atom)
@param type (name or atom)
@param data
@param null_terminated (optional)
@param cb, function(err)
965599
function set_property(X, wid, prop, type, format, data, null_terminated, cb) {

    if (typeof null_terminated === 'function') {
        cb = null_terminated;
        null_terminated = undefined;
    }

    async.parallel(
        [
            function get_prop_atom(cb) {
                if (typeof prop === 'string') {
                    X.InternAtom(false, prop, cb);
                } else {
                    cb(undefined, prop);
                }
            },
            function get_type_atom(cb) {
                if (typeof type === 'string') {
                    X.InternAtom(false, type, cb);
                } else {
                    cb(undefined, type);
                }
            }
        ],
        function(err, results) {
            if (err) {
                if (cb) {
                    cb(err);
                }

                return;
            }


            _set_property(X, wid, results[0], results[1], format, data, null_terminated, cb);
        }
    );
}
1298706
public void getData(String path, boolean watch, DataCallback cb, Object ctx) {
        getData(path, watch ? watchManager.defaultWatcher : null, cb, ctx);
    }
1192584
static CRBase create(final boolean request, final int type, final byte[] data)
	{
		final byte[] opt = data != null ? data : new byte[0];
		if (type == KNXnetIPTunnel.TUNNEL_CONNECTION)
			return request ? (CRBase) new TunnelCRI(opt) : new TunnelCRD(opt);
		if (type != KNXnetIPDevMgmt.DEVICE_MGMT_CONNECTION)
			logger.warn("unknown connection type 0x" + Integer.toHexString(type)
					+ ", create default CRI/CRD");
		return request ? (CRBase) new CRI(type, opt.clone()) : new CRD(type,
				opt.clone());
	}
229299
function CIF_var (rtype, types, numFixedArgs, abi) {
  debug('creating `ffi_cif *` instance with `ffi_prep_cif_var()`');

  // the return and arg types are expected to be coerced at this point...
  assert(!!rtype, 'expected a return "type" object as the first argument');
  assert(Array.isArray(types), 'expected an Array of arg "type" objects as the second argument');
  assert(numFixedArgs >= 1, 'expected the number of fixed arguments to be at least 1');

  // the buffer that will contain the return `ffi_cif *` instance
  const cif = Buffer.alloc(FFI_CIF_SIZE);

  const numTotalArgs = types.length;
  const _argtypesptr = Buffer.alloc(numTotalArgs * POINTER_SIZE);
  const _rtypeptr = Type(rtype);

  for (let i = 0; i < numTotalArgs; i++) {
    const ffiType = Type(types[i]);
    _argtypesptr.writePointer(ffiType, i * POINTER_SIZE);
  }

  // prevent GC of the arg type and rtn type buffers (not sure if this is required)
  cif.rtnTypePtr = _rtypeptr;
  cif.argTypesPtr = _argtypesptr;

  if (typeof abi === 'undefined') {
    debug('no ABI specified (this is OK), using FFI_DEFAULT_ABI');
    abi = FFI_DEFAULT_ABI;
  }

  const status = ffi_prep_cif_var(cif, numFixedArgs, numTotalArgs, _rtypeptr, _argtypesptr, abi);

  if (status !== FFI_OK) {
    switch (status) {
      case FFI_BAD_TYPEDEF:
      {
        const err = new Error('ffi_prep_cif_var() returned an FFI_BAD_TYPEDEF error');
        err.code = 'FFI_BAD_TYPEDEF';
        err.errno = status;
        throw err;
      }
      case FFI_BAD_ABI:
      {
        const err = new Error('ffi_prep_cif_var() returned an FFI_BAD_ABI error');
        err.code = 'FFI_BAD_ABI';
        err.errno = status;
        throw err;
      }
      default:
      {
        const err = new Error('ffi_prep_cif_var() returned an error: ' + status);
        err.errno = status;
        throw err;
      }
    }
  }

  return cif;
}
364464
private void writeTypedBytes(final int type, final byte[] data, final int offset, final int length)
    {
        int totalLength = 1 + length;
        if (length < 14)
        {
            buffer.writeUInt8(type | length);
        }
        else
        {
            // need to specify length explicitly
            buffer.writeUInt8(type | 0xE);
            final int sizeLength = buffer.writeVarUInt(length);
            totalLength += sizeLength;
        }
        updateLength(totalLength);
        buffer.writeBytes(data, offset, length);
    }
1357503
function getExistingWidget(id, type) {
    var existingEl = document.getElementById(id);
    var existingWidget;

    if (existingEl && (existingWidget = existingEl.__widget) && existingWidget.__type === type) {
        return existingWidget;
    }

    return null;
}
1175880
public function sendFrame($data, $type = null, $cb = null)
    {
        if (!$this->handshaked) {
            return false;
        }

        if ($this->finished && $type !== 'CONNCLOSE') {
            return false;
        }

        if ($type === 'CONNCLOSE') {
            if ($cb !== null) {
                $cb($this);
                return true;
            }
        }

        // Binary
        $type = $this->getFrameType($type);
        if (($type & self::BINARY) === self::BINARY) {
            $n = mb_orig_strlen($data);
            $len = '';
            $pos = 0;

            char:

            ++$pos;
            $c = $n >> 0 & 0x7F;
            $n >>= 7;

            if ($pos !== 1) {
                $c += 0x80;
            }

            if ($c !== 0x80) {
                $len = chr($c) . $len;
                goto char;
            };

            $this->write(chr(self::BINARY) . $len . $data);
        } // String
        else {
            $this->write(chr(self::STRING) . $data . "\xFF");
        }
        if ($cb !== null) {
            $this->onWriteOnce($cb);
        }
        return true;
    }
733965
function createClient(wsdlUrl, options, cb) {
  if (!cb) {
    cb = options;
    options = {};
  }

  if (this.errOnCreateClient) {
    return setTimeout(cb.bind(null, new Error('forced error on createClient')));
  }

  var client = getStub(wsdlUrl);

  if (client) {
    resetStubbedMethods(client);
    setTimeout(cb.bind(null, null, client));
  } else {
    setTimeout(cb.bind(null, new Error('no client stubbed for ' + wsdlUrl)));
  }
}
608455
function xfer (res, files, cb) {
    var file = files.shift();

    if (!file) {
        return cb(null);
    }

    fs.createReadStream(file
    ).on("data", function (chunk) {
        res.write(chunk);
    }).on("error", cb
    ).on("close", function xferClose () {
        xfer(res, files, cb);
    });
}
492726
function(type) {
			var result = gui.Array.from(this.spirit.element.children);
			if (type) {
				result = result.filter(function(elm) {
					return elm.spirit && elm.spirit instanceof type;
				}).map(function(elm) {
					return elm.spirit;
				});
			}
			return result;
		}
89795
function TXDBState(wid, id) {
  this.wid = wid;
  this.id = id;
  this.tx = 0;
  this.coin = 0;
  this.unconfirmed = 0;
  this.confirmed = 0;
  this.committed = false;
}
1123013
@Override
    public void visitTypeParameter(JCTypeParameter tree) {
        TypeVar a = (tree.type != null)
            ? (TypeVar)tree.type
            : new TypeVar(tree.name, env.info.scope.owner, syms.botType);
        tree.type = a;
        if (chk.checkUnique(tree.pos(), a.tsym, env.info.scope)) {
            env.info.scope.enter(a.tsym);
        }
        result = a;
    }
846141
function isValidWIF (key, network) {
	try {
	let dec = wif.decode(key);

	if (network) {
		return dec.version === network.wif
	} else {
		return true
	}
} catch (e) {
	console.error(e);
	return false
}
}
773278
public String sendDataWithObjectMapper(Object sourceObject, String index,
            String type) {
        return sendDataWithObjectMapper(sourceObject, index, type, null)
                .getId();
    }
409181
async function createData(dgraphClient) {
    // Create a new transaction.
    const txn = dgraphClient.newTxn();
    try {
        // Create data.
        const p = {
            name: "Alice",
            age: 26,
            married: true,
            loc: {
                type: "Point",
                coordinates: [1.1, 2],
            },
            dob: new Date(1980, 1, 1, 23, 0, 0, 0),
            friend: [
                {
                    name: "Bob",
                    age: 24,
                },
                {
                    name: "Charlie",
                    age: 29,
                }
            ],
            school: [
                {
                    name: "Crown Public School",
                }
            ]
        };

        // Run mutation.
        const mu = new dgraph.Mutation();
        mu.setSetJson(p);
        const assigned = await txn.mutate(mu);

        // Commit transaction.
        await txn.commit();

        // Get uid of the outermost object (person named "Alice").
        // Assigned#getUidsMap() returns a map from blank node names to uids.
        // For a json mutation, blank node names "blank-0", "blank-1", ... are used
        // for all the created nodes.
        console.log(`Created person named "Alice" with uid = ${assigned.getUidsMap().get("blank-0")}\n`);

        console.log("All created nodes (map from blank node names to uids):");
        assigned.getUidsMap().forEach((uid, key) => console.log(`${key} => ${uid}`));
        console.log();
    } finally {
        // Clean up. Calling this after txn.commit() is a no-op
        // and hence safe.
        await txn.discard();
    }
}
221986
function (self, cmd, channel, data, cb) {
		if (typeof(cb) != "function") {
			cb = false;
		}

		if (typeof(channel) == "number") {
			channel = channel.toString();
		}

		if (typeof(channel) != "string" || !/[0-9]+-[0-9]+/.test(channel)) {
			self.log("Invalid channel");
			return cb && cb(new Error("Invalid channel"));
		}

		if (typeof(data) != "string") {
			data = self.datObJectToXml(data);
		}

		if (typeof(data) != "string") {
			self.log("Invalid data");
			return cb && cb(new Error("Invalid data"));
		}

		self.sendCommand("CG " + channel + " " + cmd + " 1 \"" + data + "\"", cb);
	}
1187490
public static <T> T prop(JavaScriptObject o, Object id, Class<? extends T> type) {
    return o == null ? null : o.<JsCache> cast().get(id, type);
  }