Write BIFF record DEFROWHEIGHT.
513463
def store_defrow   #:nodoc:
    record   = 0x0225      # Record identifier
    length   = 0x0004      # Number of bytes to follow

    grbit    = 0x0000      # Options.
    height   = 0x00FF      # Default row height

    header = [record, length].pack("vv")
    data   = [grbit,  height].pack("vv")

    prepend(header, data)
  end
1273787
function (r) {
            // If DONE (cancelled), then don't do anything
            if (me.readyState === FileWriter.DONE) {
                return;
            }

            // position always increases by bytes written because file would be extended
            me.position += r;
            // The length of the file is now where we are done writing.

            me.length = me.position;

            // DONE state
            me.readyState = FileWriter.DONE;

            // If onwrite callback
            if (typeof me.onwrite === 'function') {
                me.onwrite(new ProgressEvent('write', { 'target':me }));
            }

            // If onwriteend callback
            if (typeof me.onwriteend === 'function') {
                me.onwriteend(new ProgressEvent('writeend', { 'target':me }));
            }
        }
717108
def flush(self):
        """"""
        if self._num_outstanding_events == 0 or self._recordio_writer is None:
            return
        self._recordio_writer.flush()
        if self._logger is not None:
            self._logger.info('wrote %d %s to disk', self._num_outstanding_events,
                              'event' if self._num_outstanding_events == 1 else 'events')
        self._num_outstanding_events = 0
638491
def _record_buffer(records, buffer_size=DEFAULT_BUFFER_SIZE):
    
    with tempfile.SpooledTemporaryFile(buffer_size, mode='wb+') as tf:
        pickler = pickle.Pickler(tf)
        for record in records:
            pickler.dump(record)

        def record_iter():
            tf.seek(0)
            unpickler = pickle.Unpickler(tf)
            while True:
                try:
                    yield unpickler.load()
                except EOFError:
                    break

        yield record_iter
892357
def write(self, arc_record):
        ""
        if not self.version:
            self.version = 2
        if not self.header_written:
            self.header_written = True
            self._write_header()
        arc_record.write_to(self.fileobj, self.version)
        self.fileobj.write("\n")
1155569
def _write_pidfile(self):
        """"""
        LOGGER.debug('Writing pidfile: %s', self.pidfile_path)
        with open(self.pidfile_path, "w") as handle:
            handle.write(str(os.getpid()))
1047570
private function _writeMarginRight()
	{
		$record  = 0x0027;				   // Record identifier
		$length  = 0x0008;				   // Bytes to follow

		$margin  = $this->_phpSheet->getPageMargins()->getRight();	 // Margin in inches

		$header	= pack("vv",  $record, $length);
		$data	  = pack("d",   $margin);
		if (self::getByteOrder()) { // if it's Big Endian
			$data = strrev($data);
		}

		$this->_append($header . $data);
	}
1227917
def store_defcol   #:nodoc:
    record   = 0x0055      # Record identifier
    length   = 0x0002      # Number of bytes to follow
    colwidth = 0x0008      # Default column width

    header   = [record, length].pack("vv")
    data     = [colwidth].pack("v")

    prepend(header, data)
  end
1034070
def deflate_write_block(fo, block_bytes):
    """"""
    # The first two characters and last character are zlib
    # wrappers around deflate data.
    data = compress(block_bytes)[2:-1]

    write_long(fo, len(data))
    fo.write(data)
1190132
public void toPdf(int midSize, OutputStream os) throws IOException {
                os.write((byte)type);
                while (--midSize >= 0)
                    os.write((byte)((offset >>> (8 * midSize)) & 0xff));
                os.write((byte)((generation >>> 8) & 0xff));
                os.write((byte)(generation & 0xff));
            }
1034238
private void writeFullBuffer(ByteBuffer buffer) throws IOException {
        int iterationsCount = MAX_WRITE_ITERATIONS;
        int writeCount;
        
        while(buffer.remaining() > 0 && iterationsCount > 0) {
            writeCount = _channel.write(buffer);
            if(writeCount == 0) {
                // we decrement iterations count only when we could not write anything
                --iterationsCount;
            } else {
                // as long as we can write, we reset iterationsCount
                iterationsCount = MAX_WRITE_ITERATIONS;
            }
        }
        
        if(buffer.remaining() > 0)
            throw new IOException("couldn't write the buffer after " + MAX_WRITE_ITERATIONS + " tries");
    }
971396
def __dbfRecords(self):
        """"""
        f = self.__getFileObj(self.dbf)
        for record in self.records:
            if not self.fields[0][0].startswith("Deletion"):
                f.write(b(' ')) # deletion flag
            for (fieldName, fieldType, size, dec), value in zip(self.fields, record):
                fieldType = fieldType.upper()
                size = int(size)
                if fieldType.upper() == "N":
                    value = str(value).rjust(size)
                elif fieldType == 'L':
                    value = str(value)[0].upper()
                else:
                    value = str(value)[:size].ljust(size)
                assert len(value) == size
                value = b(value)
                f.write(value)
137332
def _write_pidfile(self):
        """"""
        flags = os.O_CREAT | os.O_RDWR
        try:
            # Some systems don't have os.O_EXLOCK
            flags = flags | os.O_EXLOCK
        except AttributeError:
            pass
        self._pid_fd = os.open(self.pidfile, flags, 0o666 & ~self.umask)
        os.write(self._pid_fd, str(os.getpid()).encode('utf-8'))
847762
function recordhopper(data, cb, opts) {
	if(!data) return;
	var tmpbyte, cntbyte, length;
	prep_blob(data, data.l || 0);
	var L = data.length, RT = 0, tgt = 0;
	while(data.l < L) {
		RT = data.read_shift(1);
		if(RT & 0x80) RT = (RT & 0x7F) + ((data.read_shift(1) & 0x7F)<<7);
		var R = XLSBRecordEnum[RT] || XLSBRecordEnum[0xFFFF];
		tmpbyte = data.read_shift(1);
		length = tmpbyte & 0x7F;
		for(cntbyte = 1; cntbyte <4 && (tmpbyte & 0x80); ++cntbyte) length += ((tmpbyte = data.read_shift(1)) & 0x7F)<<(7*cntbyte);
		tgt = data.l + length;
		var d = R.f(data, length, opts);
		data.l = tgt;
		if(cb(d, R.n, RT)) return;
	}
}
625731
def discands(record):
    """"""
    import pyraf, pyfits

    pyraf.iraf.tv()
    display = pyraf.iraf.tv.display
    
    width=128
    
    cands = record['cands']
    exps=   record['fileId']

    ### load some header info from the mophead file
    headers={}
    for exp in exps:
        f = pyfits.open(exp+".fits")
        headers[exp]={}
        for key in ['MJDATE', 'NAXIS1', 'NAXIS2', 'EXPTIME', 'FILTER']:
            headers[exp][key]=f[0].header[key]
        headers[exp]['MJD-OBSC']=headers[exp]['MJDATE']+headers[exp]['EXPTIME']/2.0/3600.0/24.0
        f.close()

    import math,os
    for cand in cands:
        for i in range(len(exps)):
            x2=[]
            y2=[]
            y1=[]
            x1=[]
            fileId=exps[i]
            x2.append(int(min(math.floor(cand[i]['x'])+width,headers[fileId]['NAXIS1'])))
            y2.append(int(min(math.floor(cand[i]['y'])+width,headers[fileId]['NAXIS2'])))
            x1.append(int(max(math.floor(cand[i]['x'])-width,1)))
            y1.append(int(max(math.floor(cand[i]['y'])-width,1)))
        x_1 = min(x1)
        y_1 = min(y1)
        x_2 = max(x2)
        y_2 = max(y2)
        for i in range(len(exps)):
            tvmark=open('tv.coo','w')
            xshift=cand[i]['x']-cand[i]['x_0']
            yshift=cand[i]['y']-cand[i]['y_0']
            tvmark.write('%f %f\n' % ( cand[i]['x'], cand[i]['y']))
            x1=x_1 + xshift
            y1=y_1 + yshift
            x2=x_2 + xshift
            y2=y_2 + yshift
            cutout = "[%d:%d,%d:%d]" % (x1,x2,y1,y2)
            fileId=exps[i]
            display(fileId+cutout,i+1)
            tvmark.close()
            pyraf.iraf.tv.tvmark(i+1,'tv.coo',mark='circle',radii=15)
            os.unlink('tv.coo')
140683
def write(self, b):
        """"""

        if not isinstance(b, _BINARY_TYPES):
            raise TypeError(
                "input must be one of %r, got: %r" % (_BINARY_TYPES, type(b)))

        self._buf.write(b)
        self._total_bytes += len(b)

        if self._buf.tell() >= self._min_part_size:
            self._upload_next_part()

        return len(b)
1063457
def write_record(self, record, now):
        """"""
        self.write_name(record.name)
        self.write_short(record.type)
        if record.unique and self.multicast:
            self.write_short(record.clazz | _CLASS_UNIQUE)
        else:
            self.write_short(record.clazz)
        if now == 0:
            self.write_int(record.ttl)
        else:
            self.write_int(record.get_remaining_ttl(now))
        index = len(self.data)
        # Adjust size for the short we will write before this record
        #
        self.size += 2
        record.write(self)
        self.size -= 2

        length = len(b''.join(self.data[index:]))
        self.insert_short(index, length)