OutputStream
, Syncable
and StreamCapabilities
This document covers the Output Streams within the context of the Hadoop File System Specification.
It uses the filesystem model defined in A Model of a Hadoop Filesystem with the notation defined in notation.
The target audiences are: 1. Users of the APIs. While java.io.OutputStream
is a standard interfaces, this document clarifies how it is implemented in HDFS and elsewhere. The Hadoop-specific interfaces Syncable
and StreamCapabilities
are new; Syncable
is notable in offering durability and visibility guarantees which exceed that of OutputStream
. 1. Implementors of File Systems and clients.
The core mechanism to write data to files through the Hadoop FileSystem APIs is through OutputStream
subclasses obtained through calls to FileSystem.create()
, FileSystem.append()
, or FSDataOutputStreamBuilder.build()
.
These all return instances of FSDataOutputStream
, through which data can be written through various write()
methods. After a stream’s close()
method is called, all data written to the stream MUST BE persisted to the fileysystem and visible to oll other clients attempting to read data from that path via FileSystem.open()
.
As well as operations to write the data, Hadoop’s OutputStream
implementations provide methods to flush buffered data back to the filesystem, so as to ensure that the data is reliably persisted and/or visible to other callers. This is done via the Syncable
interface. It was originally intended that the presence of this interface could be interpreted as a guarantee that the stream supported its methods. However, this has proven impossible to guarantee as the static nature of the interface is incompatible with filesystems whose syncability semantics may vary on a store/path basis. As an example, erasure coded files in HDFS do not support the Sync operations, even though they are implemented as subclass of an output stream which is Syncable
.
A new interface: StreamCapabilities
. This allows callers to probe the exact capabilities of a stream, even transitively through a chain of streams.
For this specification, an output stream can be viewed as a list of bytes stored in the client; hsync()
and hflush()
are operations the actions which propagate the data to be visible to other readers of the file and/or made durable.
buffer: List[byte]
A flag, open
tracks whether the stream is open: after the stream is closed no more data may be written to it:
open: bool buffer: List[byte]
The destination path of the stream, path
, can be tracked to form a triple path, open, buffer
Stream = (path: Path, open: Boolean, buffer: byte[])
(Immediately) after Syncable
operations which flush data to the filesystem, the data at the stream’s destination path MUST match that of buffer
. That is, the following condition MUST hold:
FS'.Files(path) == buffer
Any client reading the data at the path MUST see the new data. The Syncable
operations differ in their durability guarantees, not visibility of data.
Filesystem.create()
The output stream returned by a FileSystem.create(path)
or FileSystem.createFile(path).build()
within a filesystem FS
, can be modeled as a triple containing an empty array of no data:
Stream' = (path, true, [])
The filesystem FS'
MUST contain a 0-byte file at the path:
FS' = FS where data(FS', path) == []
Thus, the initial state of Stream'.buffer
is implicitly consistent with the data at the filesystem.
Object Stores: see caveats in the “Object Stores” section below.
Filesystem.append()
The output stream returned from a call of FileSystem.append(path, buffersize, progress)
within a filesystem FS
, can be modelled as a stream whose buffer
is intialized to that of the original file:
Stream' = (path, true, data(FS, path))
When the stream writes data back to its store, be it in any supported flush operation, in the close()
operation, or at any other time the stream chooses to do so, the contents of the file are replaced with the current buffer
Stream' = (path, true, buffer) FS' = FS where data(FS', path) == buffer
After a call to close()
, the stream is closed for all operations other than close()
; they MAY fail with IOException
or RuntimeException
.
Stream' = (path, false, [])
The close()
operation MUST be idempotent with the sole attempt to write the data made in the first invocation.
close()
succeeds, subsequent calls are no-ops.close()
fails, again, subsequent calls are no-ops. They MAY rethrow the previous exception, but they MUST NOT retry the write.FSDataOutputStream
public class FSDataOutputStream extends DataOutputStream implements Syncable, CanSetDropBehind, StreamCapabilities { // ... }
The FileSystem.create()
, FileSystem.append()
and FSDataOutputStreamBuilder.build()
calls return an instance of a class FSDataOutputStream
, a subclass of java.io.OutputStream
.
The base class wraps an OutputStream
instance, one which may implement Syncable
, CanSetDropBehind
and StreamCapabilities
.
This document covers the requirements of such implementations.
HDFS’s FileSystem
implementation, DistributedFileSystem
, returns an instance of HdfsDataOutputStream
. This implementation has at least two behaviors which are not explicitly declared by the base Java implmentation
Writes are synchronized: more than one thread can write to the same output stream. This is a use pattern which HBase relies on.
OutputStream.flush()
is a no-op when the file is closed. Apache Druid has made such a call on this in the past HADOOP-14346.
As the HDFS implementation is considered the de-facto specification of the FileSystem APIs, the fact that write()
is thread-safe is significant.
For compatibility, not only SHOULD other FS clients be thread-safe, but new HDFS features, such as encryption and Erasure Coding SHOULD also implement consistent behavior with the core HDFS output stream.
Put differently:
It isn’t enough for Output Streams to implement the core semantics of java.io.OutputStream
: they need to implement the extra semantics of HdfsDataOutputStream
, especially for HBase to work correctly.
The concurrent write()
call is the most significant tightening of the Java specification.
java.io.OutputStream
A Java OutputStream
allows applications to write a sequence of bytes to a destination. In a Hadoop filesystem, that destination is the data under a path in the filesystem.
public abstract class OutputStream implements Closeable, Flushable { public abstract void write(int b) throws IOException; public void write(byte b[]) throws IOException; public void write(byte b[], int off, int len) throws IOException; public void flush() throws IOException; public void close() throws IOException; }
write(Stream, data)
Writes a byte of data to the stream.
Stream.open else raise ClosedChannelException, PathIOException, IOException
The exception java.nio.channels.ClosedChannelExceptionn
is raised in the HDFS output streams when trying to write to a closed file. This exception does not include the destination path; and Exception.getMessage()
is null
. It is therefore of limited value in stack traces. Implementors may wish to raise exceptions with more detail, such as a PathIOException
.
The buffer has the lower 8 bits of the data argument appended to it.
Stream'.buffer = Stream.buffer + [data & 0xff]
There may be an explicit limit on the size of cached data, or an implicit limit based by the available capacity of the destination filesystem. When a limit is reached, write()
SHOULD fail with an IOException
.
write(Stream, byte[] data, int offset, int len)
The preconditions are all defined in OutputStream.write()
Stream.open else raise ClosedChannelException, PathIOException, IOException data != null else raise NullPointerException offset >= 0 else raise IndexOutOfBoundsException len >= 0 else raise IndexOutOfBoundsException offset < data.length else raise IndexOutOfBoundsException offset + len < data.length else raise IndexOutOfBoundsException
After the operation has returned, the buffer may be re-used. The outcome of updates to the buffer while the write()
operation is in progress is undefined.
Stream'.buffer = Stream.buffer + data[offset...(offset + len)]
write(byte[] data)
This is defined as the equivalent of:
write(data, 0, data.length)
flush()
Requests that the data is flushed. The specification of ObjectStream.flush()
declares that this SHOULD write data to the “intended destination”.
It explicitly precludes any guarantees about durability.
For that reason, this document doesn’t provide any normative specifications of behaviour.
None.
None.
If the implementation chooses to implement a stream-flushing operation, the data may be saved to the file system such that it becomes visible to others"
FS' = FS where data(FS', path) == buffer
When a stream is closed, flush()
SHOULD downgrade to being a no-op, if it was not one already. This is to work with applications and libraries which can invoke it in exactly this way.
Issue: Should flush()
forward to hflush()
?
No. Or at least, make it optional.
There’s a lot of application code which assumes that flush()
is low cost and should be invoked after writing every single line of output, after writing small 4KB blocks or similar.
Forwarding this to a full flush across a distributed filesystem, or worse, a distant object store, is very inefficient. Filesystem clients which convert a flush()
to an hflush()
will eventually have to roll back that feature: HADOOP-16548.
close()
The close()
operation saves all data to the filesystem and releases any resources used for writing data.
The close()
call is expected to block until the write has completed (as with Syncable.hflush()
), possibly until it has been written to durable storage.
After close()
completes, the data in a file MUST be visible and consistent with the data most recently written. The metadata of the file MUST be consistent with the data and the write history itself (i.e. any modification time fields updated).
After close()
is invoked, all subsequent write()
calls on the stream MUST fail with an IOException
.
Any locking/leaseholding mechanism MUST release its lock/lease.
Stream'.open = false FS' = FS where data(FS', path) == buffer
The close()
call MAY fail during its operation.
close()
to fail and SHOULD code appropriately. Catching and swallowing exceptions, while common, is not always the ideal solution.close()
MUST place the stream into a closed state. Follow-on calls to close()
are ignored, and calls to other methods rejected. That is: caller’s cannot be expected to call close()
repeatedly until it succeeds.close()
operation is undefined. Operations which rely on acknowledgements from remote systems to meet the persistence guarantees implicitly have to await these acknowledgements. Some Object Store output streams upload the entire data file in the close()
operation. This can take a large amount of time. The fact that many user applications assume that close()
is both fast and does not fail means that this behavior is dangerous.Recommendations for safe use by callers
close()
does not block the thread so long that the heartbeat times out.Implementors:
close()
call MUST block until all the asynchronous uploads have completed; any error raised MUST be reported. If multiple errors were raised, the stream can choose which to propagate. What is important is: when close()
returns without an error, applications expect the data to have been successfully written.OutputStream.close()
HDFS does not immediately sync()
the output of a written file to disk on OutputStream.close()
unless configured with dfs.datanode.synconclose
is true. This has caused problems in some applications.
Applications which absolutely require the guarantee that a file has been persisted MUST call Syncable.hsync()
before the file is closed.
org.apache.hadoop.fs.Syncable
@InterfaceAudience.Public @InterfaceStability.Stable public interface Syncable { /** Flush out the data in client's user buffer. After the return of * this call, new readers will see the data. * @throws IOException if any error occurs */ void hflush() throws IOException; /** Similar to posix fsync, flush out the data in client's user buffer * all the way to the disk device (but the disk may have it in its cache). * @throws IOException if error occurs */ void hsync() throws IOException; }
The purpose of Syncable
interface is to provide guarantees that data is written to a filesystem for both visibility and durability.
SYNC-1: An OutputStream
which implements Syncable
and does not raise UnsupportedOperationException
on invocations is making an explicit declaration that it can meet those guarantees.
SYNC-2: If a stream, declares the interface as implemented, but does not provide durability, the interface’s methods MUST raise UnsupportedOperationException
.
The Syncable
interface has been implemented by other classes than subclasses of OutputStream
, such as org.apache.hadoop.io.SequenceFile.Writer
.
SYNC-3 The fact that a class implements Syncable
does not guarantee that extends OutputStream
holds.
That is, for any class C
: (C instanceof Syncable)
does not imply (C instanceof OutputStream)
This specification only covers the required behavior of OutputStream
subclasses which implement Syncable
.
SYNC-4: The return value of FileSystem.create(Path)
is an instance of FSDataOutputStream
.
SYNC-5: FSDataOutputStream implements Syncable
SYNC-5 and SYNC-1 imply that all output streams which can be created with FileSystem.create(Path)
must support the semantics of Syncable
. This is demonstrably not true: FSDataOutputStream
simply downgrades to a flush()
if its wrapped stream is not Syncable
. Therefore the declarations SYNC-1 and SYNC-2 do not hold: you cannot trust Syncable
.
Put differently: callers MUST NOT rely on the presence of the interface as evidence that the semantics of Syncable
are supported. Instead they MUST be dynamically probed for using the StreamCapabilities
interface, where available.
Syncable.hflush()
Flush out the data in client’s user buffer. After the return of this call, new readers will see the data. The hflush()
operation does not contain any guarantees as to the durability of the data. only its visibility.
Thus implementations may cache the written data in memory —visible to all, but not yet persisted.
hasCapability(Stream, "hflush") Stream.open else raise IOException
FS' = FS where data(path) == cache
After the call returns, the data MUST be visible to all new callers of FileSystem.open(path)
and FileSystem.openFile(path).build()
.
There is no requirement or guarantee that clients with an existing DataInputStream
created by a call to (FS, path)
will see the updated data, nor is there a guarantee that they will not in a current or subsequent read.
Implementation note: as a correct hsync()
implementation MUST also offer all the semantics of an hflush()
call, implementations of hflush()
may just invoke hsync()
:
public void hflush() throws IOException { hsync(); }
hflush()
PerformanceThe hflush()
call MUST block until the store has acknowledge that the data has been received and is now visible to others. This can be slow, as it will include the time to upload any outstanding data from the client, and for the filesystem itself to process it.
Often Filesystems only offer the Syncable.hsync()
guarantees: persistence as well as visibility. This means the time to return can be even greater.
Application code MUST NOT call hflush()
or hsync()
at the end of every line or, unless they are writing a WAL, at the end of every record. Use with care.
Syncable.hsync()
Similar to POSIX fsync()
, this call saves the data in client’s user buffer all the way to the disk device (but the disk may have it in its cache).
That is: it is a requirement for the underlying FS To save all the data to the disk hardware itself, where it is expected to be durable.
hasCapability(Stream, "hsync") Stream.open else raise IOException
FS' = FS where data(path) == buffer
Implementations are required to block until that write has been acknowledged by the store.
This is so the caller can be confident that once the call has returned successfully, the data has been written.
StreamCapabilities
@InterfaceAudience.Public @InterfaceStability.Evolving
The org.apache.hadoop.fs.StreamCapabilities
interface exists to allow callers to dynamically determine the behavior of a stream.
public boolean hasCapability(String capability) { switch (capability.toLowerCase(Locale.ENGLISH)) { case StreamCapabilities.HSYNC: case StreamCapabilities.HFLUSH: return supportFlush; default: return false; } }
Once a stream has been closed, a hasCapability()
call MUST do one of
That is: it MUST NOT raise an exception about the file being closed;
See pathcapabilities for specifics on the PathCapabilities
API; the requirements are similar: a stream MUST NOT return true for a capability for which it lacks support, be it because
Standard stream capabilities are defined in StreamCapabilities
; consult the javadocs for the complete set of options.
| Name | Probes for support of |
|---|---|
dropbehind |
CanSetDropBehind.setDropBehind() |
hsync |
Syncable.hsync() |
hflush |
Syncable.hflush() . Deprecated: probe for HSYNC only. |
in:readahead |
CanSetReadahead.setReadahead() |
in:unbuffer" |
CanUnbuffer.unbuffer() |
in:readbytebuffer |
ByteBufferReadable#read(ByteBuffer) |
in:preadbytebuffer |
ByteBufferPositionedReadable#read(long, ByteBuffer) |
Stream implementations MAY add their own custom options. These MUST be prefixed with fs.SCHEMA.
, where SCHEMA
is the schema of the filesystem.
CanSetDropBehind
@InterfaceAudience.Public @InterfaceStability.Evolving public interface CanSetDropBehind { /** * Configure whether the stream should drop the cache. * * @param dropCache Whether to drop the cache. null means to use the * default value. * @throws IOException If there was an error changing the dropBehind * setting. * UnsupportedOperationException If this stream doesn't support * setting the drop-behind. */ void setDropBehind(Boolean dropCache) throws IOException, UnsupportedOperationException; }
This interface allows callers to change policies used inside HDFS.
Implementations MUST return true
for the call
StreamCapabilities.hasCapability("dropbehind");
These are the aspects of the system behaviour which are not directly covered in this (very simplistic) filesystem model, but which are visible in production.
OutputStream.write()
MAY persist the data, synchronously or asynchronouslyOutputStream.flush()
flushes data to the destination. There are no strict persistence requirements.Syncable.hflush()
synchronously sends all outstaning data to the destination filesystem. After returning to the caller, the data MUST be visible to other readers, it MAY be durable. That is: it does not have to be persisted, merely guaranteed to be consistently visible to all clients attempting to open a new stream reading data at the path.Syncable.hsync()
MUST transmit the data as per hflush
and persist that data to the underlying durable storage.close()
The first call to close()
MUST flush out all remaining data in the buffers, and persist it, as a call to hsync()
.Many applications call flush()
far too often -such as at the end of every line written. If this triggered an update of the data in persistent storage and any accompanying metadata, distributed stores would overload fast. Thus: flush()
is often treated at most as a cue to flush data to the network buffers -but not commit to writing any data.
It is only the Syncable
interface which offers guarantees.
The two Syncable
operations hsync()
and hflush()
differ purely by the extra guarantee of hsync()
: the data must be persisted. If hsync()
is implemented, then hflush()
can be implemented simply by invoking hsync()
public void hflush() throws IOException { hsync(); }
This is perfectly acceptable as an implementation: the semantics of hflush()
are satisifed. What is not acceptable is downgrading hsync()
to hflush()
, as the durability guarantee is no longer met.
The outcome of more than one process writing to the same file is undefined.
An input stream opened to read a file before the file was opened for writing MAY fetch data updated by writes to an OutputStream. Because of buffering and caching, this is not a requirement —and if an input stream does pick up updated data, the point at which the updated data is read is undefined. This surfaces in object stores where a seek()
call which closes and re-opens the connection may pick up updated data, while forward stream reads do not. Similarly, in block-oriented filesystems, the data may be cached a block at a time —and changes only picked up when a different block is read.
A filesystem MAY allow the destination path to be manipulated while a stream is writing to it —for example, rename()
of the path or a parent; delete()
of a path or parent. In such a case, the outcome of future write operations on the output stream is undefined. Some filesystems MAY implement locking to prevent conflict. However, this tends to be rare on distributed filesystems, for reasons well known in the literature.
The Java API specification of java.io.OutputStream
does not require an instance of the class to be thread safe. However, org.apache.hadoop.hdfs.DFSOutputStream
has a stronger thread safety model (possibly unintentionally). This fact is relied upon in Apache HBase, as discovered in HADOOP-11708. Implementations SHOULD be thread safe. Note: even the DFSOutputStream
synchronization model permits the output stream to have close()
invoked while awaiting an acknowledgement from datanode or namenode writes in an hsync()
operation.
There is no requirement for the data to be immediately visible to other applications —not until a specific call to flush buffers or persist it to the underlying storage medium are made.
If an output stream is created with FileSystem.create(path, overwrite==true)
and there is an existing file at the path, that is exists(FS, path)
holds, then, the existing data is immediately unavailable; the data at the end of the path MUST consist of an empty byte sequence []
, with consistent metadata.
exists(FS, path) (Stream', FS') = create(FS, path) exists(FS', path) getFileStatus(FS', path).getLen() = 0
The metadata of a file (length(FS, path)
in particular) SHOULD be consistent with the contents of the file after flush()
and sync()
.
(Stream', FS') = create(FS, path) (Stream'', FS'') = write(Stream', data) (Stream''', FS''') hsync(Stream'') exists(FS''', path) getFileStatus(FS''', path).getLen() = len(data)
HDFS does not do this except when the write crosses a block boundary; to do otherwise would overload the Namenode. Other stores MAY copy this behavior.
As a result, while a file is being written length(Filesystem, Path)
MAY be less than the length of data(Filesystem, Path)
.
The metadata MUST be consistent with the contents of a file after the close()
operation.
After the contents of an output stream have been persisted (hflush()/hsync()
) all new open(FS, Path)
operations MUST return the updated data.
After close()
has been invoked on an output stream, a call to getFileStatus(path)
MUST return the final metadata of the written file, including length and modification time. The metadata of the file returned in any of the FileSystem list
operations MUST be consistent with this metadata.
The value of getFileStatus(path).getModificationTime()
is not defined while a stream is being written to. The timestamp MAY be updated while a file is being written, especially after a Syncable.hsync()
call. The timestamps MUST be updated after the file is closed to that of a clock value observed by the server during the close()
call. It is likely to be in the time and time zone of the filesystem, rather than that of the client.
Formally, if a close()
operation triggers an interaction with a server which starts at server-side time t1
and completes at time t2
with a successfully written file, then the last modification time SHOULD be a time t
where t1 <= t <= t2
There are some known issues with the output stream model as offered by Hadoop, specifically about the guarantees about when data is written and persisted —and when the metadata is synchronized. These are where implementation aspects of HDFS and the “Local” filesystem do not follow the simple model of the filesystem used in this specification.
hsync()
only syncs the latest blockThe reference implementation, DFSOutputStream
will block until an acknowledgement is received from the datanodes: that is, all hosts in the replica write chain have successfully written the file.
That means that the expectation callers may have is that the return of the method call contains visibility and durability guarantees which other implementations must maintain.
Note, however, that the reference DFSOutputStream.hsync()
call only actually persists the current block. If there have been a series of writes since the last sync, such that a block boundary has been crossed. The hsync()
call claims only to write the most recent.
From the javadocs of DFSOutputStream.hsync(EnumSet<SyncFlag> syncFlags)
Note that only the current block is flushed to the disk device. To guarantee durable sync across block boundaries the stream should be created with {@link CreateFlag#SYNC_BLOCK}.
This is an important HDFS implementation detail which must not be ignored by anyone relying on HDFS to provide a Write-Ahead-Log or other database structure where the requirement of the application is that “all preceeding bytes MUST have been persisted before the commit flag in the WAL is flushed”
See [Stonebraker81], Michael Stonebraker, Operating System Support for Database Management, 1981, for a discussion on this topic.
If you do need hsync()
to have synced every block in a very large write, call it regularly.
That HDFS file metadata often lags the content of a file being written to is not something everyone expects, nor convenient for any program trying to pick up updated data in a file being written. Most visible is the length of a file returned in the various list
commands and getFileStatus
—this is often out of date.
As HDFS only supports file growth in its output operations, this means that the size of the file as listed in the metadata may be less than or equal to the number of available bytes —but never larger. This is a guarantee which is also held
One algorithm to determine whether a file in HDFS is updated is:
pos
in the file, using 0
if this is the initial read.getFileStatus(FS, Path)
to query the updated length of the file as recorded in the metadata.Status.length > pos
, the file has grown.seek(pos)
to that locationread() != -1
, there is new data.This algorithm works for filesystems which are consistent with metadata and data, as well as HDFS. What is important to know is that, for an open file getFileStatus(FS, path).getLen() == 0
does not imply that data(FS, path)
is empty.
When an output stream in HDFS is closed; the newly written data is not immediately written to disk unless HDFS is deployed with dfs.datanode.synconclose
set to true. Otherwise it is cached and written to disk later.
file:
LocalFileSystem
, file:
, (or any other FileSystem
implementation based on ChecksumFileSystem
) has a different issue. If an output stream is obtained from create()
and FileSystem.setWriteChecksum(false)
has not been called on the filesystem, then the stream only flushes as much local data as can be written to full checksummed blocks of data.
That is, the hsync/hflush operations are not guaranteed to write all the pending data until the file is finally closed.
For this reason, the local fileystem accessed via file://
URLs does not support Syncable
unless setWriteChecksum(false)
was called on that FileSystem instance so as to disable checksum creation. After which, obviously, checksums are not generated for any file. Is
Because org.apache.hadoop.fs.FSOutputSummer
and org.apache.hadoop.fs.ChecksumFileSystem.ChecksumFSOutputSummer
implement the underlying checksummed output stream used by HDFS and other filesystems, it provides some of the core semantics of the output stream behavior.
close()
call is unsynchronized, re-entrant and may attempt to close the stream more than once.write(int)
on a closed stream (but not write(byte[], int, int)
).flush()
on a closed stream.Behaviors 1 and 2 really have to be considered bugs to fix, albeit with care.
Behavior 3 has to be considered a defacto standard, for other implementations to copy.
Object store streams MAY buffer the entire stream’s output until the final close()
operation triggers a single PUT
of the data and materialization of the final output.
This significantly changes their behaviour compared to that of POSIX filesystems and that specified in this document.
There is no guarantee that any file will be visible at the path of an output stream after the output stream is created .
That is: while create(FS, path, boolean)
returns a new stream
Stream' = (path, true, [])
The other postcondition of the operation, data(FS', path) == []
MAY NOT hold, in which case:
exists(FS, p)
MAY return false.overwrite = True
, the existing data MAY still be visible: data(FS', path) = data(FS, path)
.The check for existing data in a create()
call with overwrite=False
, may take place in the create()
call itself, in the close()
call prior to/during the write, or at some point in between. In the special case that the object store supports an atomic PUT
operation, the check for existence of existing data and the subsequent creation of data at the path contains a race condition: other clients may create data at the path between the existence check and the subsequent write.
Calls to create(FS, Path, overwrite=false)
MAY succeed, returning a new OutputStream
, even while another stream is open and writing to the destination path.
This allows for the following sequence of operations, which would raise an exception in the second open()
call if invoked against HDFS:
Stream1 = open(FS, path, false) sleep(200) Stream2 = open(FS, path, false) Stream.write('a') Stream1.close() Stream2.close()
For anyone wondering why the clients don’t create a 0-byte file in the create()
call, it would cause problems after close()
—the marker file could get returned in open()
calls instead of the final data.
close()
One guarantee which Object Stores SHOULD make is the same as those of POSIX filesystems: After a stream close()
call returns, the data MUST be persisted durably and visible to all callers. Unfortunately, even that guarantee is not always met:
Existing data on a path MAY be visible for an indeterminate period of time.
If the store has any form of create inconsistency or buffering of negative existence probes, then even after the stream’s close()
operation has returned, getFileStatus(FS, path)
and open(FS, path)
may fail with a FileNotFoundException
.
In their favour, the atomicity of the store’s PUT operations do offer their own guarantee: a newly created object is either absent or all of its data is present: the act of instantiating the object, while potentially exhibiting create inconsistency, is atomic. Applications may be able to use that fact to their advantage.
The Abortable interface exposes this ability to abort an output stream before its data is made visible, so can be used for checkpointing and similar operations.
Syncable
-even if just to throw UnsupportedOperationException
Because FSDataOutputStream
silently downgrades Syncable.hflush()
and Syncable.hsync()
to wrappedStream.flush()
, callers of the API MAY be misled into believing that their data has been flushed/synced after syncing to a stream which does not support the APIs.
Implementations SHOULD implement the API but throw UnsupportedOperationException
.
StreamCapabilities
Implementors of filesystem clients SHOULD implement the StreamCapabilities
interface and its hasCapabilities()
method to to declare whether or not an output streams offer the visibility and durability guarantees of Syncable
.
Implementors of StreamCapabilities.hasCapabilities()
MUST NOT declare that they support the hflush
and hsync
capabilities on streams where this is not true.
Sometimes streams pass their data to store, but the far end may not sync it all the way to disk. That is not something the client can determine. Here: if the client code is making the hflush/hsync passes these requests on to the distributed FS, it SHOULD declare that it supports them.
Implementors MAY NOT update a file’s metadata (length, date, …) after every hsync()
call. HDFS doesn’t, except when the written data crosses a block boundary.
close()
synchronize and persist data?By default, HDFS does not immediately data to disk when a stream is closed; it will be asynchronously saved to disk.
This does not mean that users do not expect it.
The behavior as implemented is similar to the write-back aspect’s of NFS’s caching. DFSClient.close()
is performing an hflush()
to the client to upload all data to the datanodes.
close()
SHALL return once the guarantees of hflush()
are met: the data is visible to others.hsync()
MUST be called first.


Commands
View the commands for bot.
Category:
General
Usage:
w?help
Examples:
None
Category:
Administration
Usage:
w?ban
Examples:
w?ban {@member}
Category:
Administration
Usage:
w?kick
Examples:
w?kick {@member}
Category:
Administration
Usage:
w?snipe
Examples:
None
Category:
Administration
Usage:
w?purge
Examples:
w?purge 50
Category:
General
Usage:
w?botinfo
Examples:
None
Category:
General
Usage:
w?report
Examples:
w?ban {bug}
Category:
General
Usage:
w?announce
Examples:
w?announce {text}
Category:
General
Usage:
w?membercount
Examples:
None
Category:
Administration
Usage:
w?slowmode
Examples:
w?slowmode {time}
Category:
General
Usage:
w?timer
Examples:
w?timer {time} {text}
Category:
General
Usage:
w?poll
Examples:
w?poll {text}
Category:
General
Usage:
w?google
Examples:
w?google {text}
Category:
General
Usage:
w?youtube
Examples:
w?youtube {text}
Category:
Administration
Usage:
w?warn
Examples:
w?warn {@member} {reason}
Category:
General
Usage:
w?8ball
Examples:
w?8ball {question}
Category:
General
Usage:
w?whois
Examples:
w?whois {@member}
Category:
General
Usage:
w?serverinfo
Examples:
None
Category:
General
Usage:
w?avatar
Examples:
w?avatar {@member}
Category:
General
Usage:
w?vote
Examples:
None
Category:
General
Usage:
w?servers
Examples:
None
Category:
General
Usage:
w?servers
Examples:
None
Category:
General
Usage:
w?invite
Examples:
None
Category:
General
Usage:
w?slap
Examples:
w?slap {@member}
Category:
General
Usage:
w?hack
Examples:
w?hack {@member}
Category:
General
Usage:
w?servers
Examples:
None
Category:
General
Usage:
w?topic
Examples:
None
Category:
General
Usage:
w?invite
Examples:
None
Category:
General
Usage:
w?kill
Examples:
w?kill {@member}
Category:
General
Usage:
w?dog
Examples:
None
Category:
General
Usage:
w?nameme
Examples:
None
Commands: 32


first example, supports arbitrary start day of week, multiple instances, min/max select date, weekly and monthly select range, prior range presets, and user selected start, end date:
options object support:
callback support:
static start, end date, starting month and year support:
lastSelectedDate selection mode:
singleDate selection mode:
singleDate with min-backward-month:
singleDate with 2 backward and forward months:
selection-mode="disableDayClick":
disabled="true" support:
timezone support:
timezone support with timestamp:
new prior range preset:


Hi, I'm a newbie to openenergymonitor, I'm testing the first emontx , emonlcd and a emonbase on raspberry.
a question: is possible on raspberry to write code to launch an external program on some situation? ex. when ct1 power > ct2, or when temperatures is lower 5°?
my idea is to integrate opencms with my home automation to power on / off heat pump or other.
Re: need to launch external software from emoncms
Hi,
There is the "Events" module addon for Emoncms, this does require installing on a local (or virtual) server, and this will allow it to work with one feed.
For more info have a quick read of Martin's Post on his blog, goes into beter detail than I would be able to.
http://harizanov.com/2013/08/installing-emoncmss-events-module/?utm_source=rss&utm_medium=rss&utm_campaign=installing-emoncmss-events-module
Jimmy
Re: need to launch external software from emoncms
fantastic job! thanks for the link


--- layout: default title: Metadata Specs - Browse by Institution ---
{{ institution.description | markdownify }}


HIRedux Extraction
- The following routines all apply to a single object, i.e. multiple exposures of that object will be reduced together.
- Most of the following routines take the hires structure,
and the setup, chip and obj_id tags.
All Obj
hires_allobj :: Run all extraction routines described below. At present, I tend to run the extraction
steps separately to check the progress of the code.
Currently, it is preferable to run hires_allobj with these options:
IDL> hires_allobj , hires, 1, /procall
Process the Image
- hires_proc :: Bias subtract and flat field the Raw image.
This routine takes the index number of the hires structure as input
or keywords setup and obj.
The index number is the integer in the first
column of the file 'hires.list'.
The resulting image is output in 'Final/' and is a
flattened flux and inverse variance fits file
(one gzipped fits image with two extensions per file).
Output is 'Final/f_name.fits'
Example: IDL> hires_proc, hires, SETUP=setup, OBJ=obj_id
Example: IDL> rslt = hires_proc_sngl('rawfil', [chip])
Time : 1min per image
Check : xatv, 'Final/f_name.fits'
- You know the code is working right when you check the image
and it looks reasonable.
- At this step, I strongly recommend that you check that the order traces
match your object. I have found at least a couple of cases where the
flat is not aligned with the object. Am investigating the physical origin.
Anyhow, checking will be tough unless there is a decent amount of
sky in your data. But try this
- xatv, 'Final/f_name.fits'
- hires_chktrcflat, hires, setup, chip, /nostop, /fit
- If there is a serious offset (i.e. more than one pixel), contact me.
You are likely to have troubles with sky subtraction and
extraction.
- You can determine how large an offset you have by
specifying different values for XOFF=? in your
hires_chktrcflat call.
- Once you know serious an offset it is, you can
supply this to hires_proc, again with the XOFF=? tag.
- If things look fine with one frame, I suspect they are all fine.
- hires_objcr (Optional, recommended with caution) ::
Compares two or more images to identify
cosmic rays. For two images, it uses the
difference of the two images scaled to the exposure times and
is quite conservative. One should NOT use this on
multiple exposures
of the same object if the object has moved along the slit.
A CR mask is written to the FITS file in the inverse variance
array with CR's given a value of -1.
Example: IDL> hires_objcr, hires, setup, obj_id, chip, [exp], /CHK
Time : 3min per pair
- You know the code is working right when you run with the
/CHK keyword and the code is not identifiying excessive CR's along the
object profile. This will happen (in particular) if the object has moved
significantly along the slit in between exposures.
Identify and Trace the Object
- hires_fntobj :: This code automatically identifies the object
in each order (rectify+collapse) and then traces using trace_crude.
A PCA analysis is then performed on the coefficients of each trace to
determine a smoothed (quasi-2D) solution that is useful for interpolation
and extrapolation. The code then creates and Object structure
hiresobstrct that contains the trace and will contain the 1D
extractions. Output: 'Extract/Obj_name.fits'
Example: IDL> hires_fntobj, hires, setup, obj_id, chip,
/CHK
Time : fast
- This code creates an object structure in the Extract/ directory
(e.g. 'Extract/Obj_mb0033.fits.gz') which holds information relating
to the trace and extraction of the spectra.
Here is a
link to the code which lists the tags used.
- BRIGHT OBJECTS or the B DECKERS :: If you are extracting a very
bright object and/or using the B deckers, you may wish to extend
the boxcar beyond the default value (it is 75%). In
this case, set OBJAPER=[value,value], e.g. [0.9,0.9]. If you
designate /STD, it uses [0.85, 0.85]. Note you can even choose
values in excess of 1 but (1) you should skip sky subtraction and
(2) will need to use /EXTENBOX in the Extract step.
- You know the code is working right when you run with the
/CHK keyword and the fit to the position in the slit fraction is nearly
constant and well fit as a function of trace number. Also, the image
with the trace overplotted should look sensible. Alternatively (or
in addition), check the QA output (e.g. 'QA/Obj01/qa_fntobj_0022B.ps.gz').
The X0 and PCA0 coefficients should be well fit and the remaining PCA
coefficients should show small variation. Finally, the reduced_chi2 should
be < 0.1 (blue) or <0.01 (red).
- QA: HERE is an example of the QA. It
is quite similar to the Edgeflat QA.
- The first page plots the position of the object in the slit as
a function of order number (non-physical). The position is
relative, i.e. 0.5 is the center of the slit. The trend is
primarily atmospheric although funny things appear when the
orders begin to overlap.
- The second page shows output from the PCA analysis. The x0 and PCA0
components should be well fit (there may be red, rejected outliers).
- PCA1 should be confined to a small range of values
(the magnitude is not particularly relevant) but may not. It is
a modest but not major concern so long as the values are
well fit.
- PCA2-4 should each be confined to a small range of values
(the magnitude is not particularly relevant).
- The third page shows the row-by-row centroid and the fits.
This is not the final trace, but it should look good by eye.
Sky Subtraction
- hires_skysub :: Performs sky subtraction on an order by order
basis using a bspline fitting algorithm to all sky pixels in a given
order (the object is masked). The sky spectrum is also cross-correlated
with the UVES sky line list to investigate a shift. At the moment,
while it calculates the shift, it does nothing with the value.
The sky subtracted image is only used to derive the object
profile in the next step. That is, don't fret if the image
isn't so great, we are just after the zero level here.
- Output: Sky subtracted 2D image appended to the unsubtracted
flux and the variance 2D images (e.g. 'Final/f_name.fits'). Also
the bspline coefficients are written to 'Sky/sky_name.fits'
Example: IDL> hires_skysub, hires, setup, obj_id, chip, [/CHK, /FCHK]
Time : 10min per exposure
- Examine the final product (and get wavelength info) by:
IDL> xatv, 'Final/f_name.fits', getsky=2,
WVIMG='Arcs/Arc_nameI.fits'
- You know the code is working right when you run with /FCHK
and the final image shows 'random' noise in places where sky lines
used to be. You can also run with /CHK to examine the order by order fits.
Finally, the QA file (e.g. 'QA/Obj01/qa_skysub_0022B.ps.gz') shows
a zoom in on key sky lines in the red or several small patches in the
blue.
- BRIGHT OBJECTS and/or the B DECKERS ::
If you are observing bright objects and/or using the
B deckers, you may wish to ignore sky subtraction. In fact, unless you
had exquisite seeing, I claim you CANNOT do sky subtraction with the B
deckers. Therefore you should skip this step.
Extraction
- hires_extract ::
This procedure is quite involved. It is generally based on
mike_box (written primarily by S. Burles) which fits an
optimal profile and the sky to the data and then extracts.
The main modification is that I take the optimal profile and
sky fit and then extract in a different manner than mike_box.
- Output: The tags .box_fx, .box_var, .box_wv, .fx,
.var, .wave and .fin_trc are usually all filled
Example: IDL> hires_extract, hires, setup, obj_id, chip, [/RESCHK, /SKIPSKYSUB]
Time : 15min per exposure (longer for high SNR data)
- Examine the final product:
IDL> hires_specplt, [/BOX]
- You know the code is working right when the reduced chi^2
values are 1.2 or lower (a bit higher for very bright objects).
- BRIGHT OBJECTS or the B DECKERS ::
If you are observing bright objects and/or using the
B deckers, you may have skipped sky subtraction as noted above.
In this case, you will need to turn /SKIPSKYSUB on. For BRIGHT targets,
I recommend you use the /BBOX switch which turns on /SKIPSKYSUB,
/NOMEDSCATT (scattered light will be fit on all chips),
/EXTENBOX (in case you demand a boxcar larger than the nominal
slit length) and /NOPROF (no optimal profile fitting).
Last modified 2005-10-10


Generated: 2013-04-01
Defined in Module impact.map, inherits from ig.Class
// Create a map var data = [ [1,2,6], [0,3,5], [2,8,1], ]; var map = new ig.Map( 16, data ); // 40, 20 are the pixel coordinates for the tile to set // So this essentially does data[2][1] = 8; map.setTile( 40, 20, 8 ); // Gets the same tile we just set, even though the // pixel coordinates are not the exact same var tile = map.getTile( 46, 18 ); tile; // => 8
ig.Map
is the base class for ig.BackgroundMap and ig.CollisionMap. It only provides basic access to the tiles in the map data.
You usually won't need to create instances of an ig.Map
.
tilesize
Width and height of a single tile in pixelsdata
A 2D Array (Array of Arrays) used as the data for this mapThe 2D data array for this map, as set through the constructor.
The width and height of a single tile in pixels, as set through the constructor.
The width and height of the map in tiles.
Get the tile at the pixel coordinates x
, y
. Returns 0
if the coordinates lie outside of this map.
Set the tile at the pixel coordinates x
, y
to the given tile
. Does nothing if the coordinates lie outside of this map.


The Ruby cape, restored to its rightful place @newrelic. 7/18/2014, 8:11:28 AM Favs: 5 Retweets: 0 link


About
This was a little weekend project for me that I created leading up to Bitcoin Node Day. It was also designed to allow 'slactivism' in the block-size debate -- the idea being that a user could raise an XT node quickly and with minimal effort.
This was a little weekend project for me that I created leading up to Bitcoin Node Day. It was also designed to allow 'slactivism' in the block-size debate -- the idea being that a user could raise an XT node quickly and with minimal effort.
2015/08/30 - Default node changed to Core w/ BIP101
. This is a two fold decision:
2015/08/30 - A DoS attack on many nodes has caused them to be null routed by the VPS provider for 24 hours. They will automatically come back online at this point in time. New nodes will be provisioned as usual, though they may also come under attack if they're XT nodes. You can find more detail on the attack in general here.
2015/08/23 - All nodes have been reconfigured to enable much faster sync times. This involves recompiling and downloading a full blockchain via rsync. The benefit is all nodes will shortly have a full copy of the blockchain and can start helping the network. Nodes will be down for a while while they all download the blockchain, however.
Also, the recompile button works, and you can now checkout a branch of your choosing to compile.
2015/08/21 - Adding news and tweet alerts! Also some interface rejiggery and emails for node-up events and if you press the 'send me node deets' button.


Shape creation - simple drag/drop from widget palette
Steps
Standard setup things: Clear the browser cache. Launch the Maqetta server.
Login if necessary.
In some cases, you'll want to setup a virgin user environment by creating a whole new user login.
Go to preferences and look at "Snap to nearest widget" setting.
It should be on by default.
Click on the "New file" icon on the main toolbar. Set composition type to "Desktop hi-fi sketch". Choose any filename.
Drag/drop each of the Drawing Tools widgets from the Widgets palette onto the canvas
Text should show SmartInput to edit the text context
Line and Arrow should create a horizontal line
Polyline and Polyline Arrow should create a default 2-segment polyline
Rectangle, Rounded Rectangle and Circle should create a default shape sized around 100px
You should see snap lines during dragging
Click on each of the Drawing Tools widgets in the Widgets palette, followed by clicking on the canvas.
See bullets below for follow-on clicking for polyline widgets.
Text, Line, Arrow, Rectangles and Circle: same results as previous step
The polylines should act differently. The first click should drop the first point of polyline.
Click on canvas 3 more times. You should now have a 3-segment polyline.
Click once more on top of the last point of polyline. This should
complete the polyline and exit "polyline creation" mode.
You should see snap lines as the mouse moves around canvas before first click
(i.e., after clicking on a widget in widget palette but before first click on canvas to add widget)
Click on each of the Drawing Tools widgets in the Widgets palette, followed by a drag operation on the canvas.
See bullets below for follow-on clicking for polyline widgets.
Text isn't resizable, so should result in same operation as previous steps.
Line, Arrow, Rectangles and Circle: the new widget should be the size of the drag area
The polylines should act differently. The first drag should define the size of the first segment.
After the drag, click on canvas 2 more times. You should now have a 3-segment polyline.
Press the ESC key. This should
complete the polyline and exit "polyline creation" mode.
You should see snap lines as the mouse moves around canvas before first click
(i.e., after clicking on a widget in widget palette but before first click on canvas to add widget)
Repeat the above test with an extra wrinkle.
Click on each of the Drawing Tools widgets in the Widgets palette, followed by a drag operation on the canvas.
While dragging, hold down the shift key to constrain the drag.
See bullets below for follow-on clicking for polyline widgets.
Text isn't resizable, so should result in same operation as previous steps.
Line, Arrow, Polyline, Polyline Arrow: dragging should force
the line segment to be either horizontal or verticle
Rectangles and Circle: dragging should force
the shape into a square aspect ratio (i.e., w=h).
Shapes as containers
Steps
Click on the "New file" icon on the main toolbar. Set composition type to "Desktop hi-fi sketch". Choose any filename.
Drag/drop one of each of a Rectangle, Rounded Rectangle and Circle onto canvas.
Drag/drop a Button into each of the above three widgets.
For each of the Rectangle, Rounded Rectangle and Circle, select that widget and move it.
The Buttons inside of the shapes should move with the shape.
In the Outline palette, you should see that the Buttons are child
widgets of each of the shapes.


Gecode::MiniModel::Matrix< A >::Slice Class Reference
#include <minimodel.hh>
Detailed Description
template<class A>
class Gecode::MiniModel::Matrix< A >::Slice
A slice of a matrix.
This class represents a slice of the matrix. It is used to get context-dependent behaviour. The slice will be automatically converted to an args_type Args-array or to a Matrix<args_type> depending on the context where it is used.
Definition at line 851 of file minimodel.hh.
Public Member Functions | |
| Slice (Matrix< A > &a, unsigned int fc, unsigned int tc, unsigned int fr, unsigned int tr) | |
| operator args_type (void) | |
| operator Matrix (void) |
Constructor & Destructor Documentation
|
|
Definition at line 29 of file matrix.icc. |
Member Function Documentation
|
|
|
|
|
Definition at line 55 of file matrix.icc. |
The documentation for this class was generated from the following files:
- gecode/minimodel.hh (Revision: 3579)
- gecode/minimodel/matrix.icc (Revision: 3513)


// Mahalanobis distance has to be trained before it can be used
// to compute distances
try:
metric.fit(data, axis=1 - self.axis)
except (ValueError, MemoryError) as e:
self.Error.mahalanobis_error(e)
return
// Mahalanobis distance has to be trained before it can be used
// to compute distances
try:
metric = distance.MahalanobisDistance(data, axis=1 - self.axis)
except (ValueError, MemoryError) as e:
self.Error.mahalanobis_error(e)
return


- FEASIBLE_CODES_MAX - Static variable in class domain.model.player.computer.GeneticComputer
-
Max number of feasible codes.
- feasibleCodes - Variable in class domain.model.player.computer.GeneticComputer
-
Array with all the feasible codes found.
- FileUtils - Class in persistence.utils
-
The type File controller
- FileUtils() - Constructor for class persistence.utils.FileUtils
-
- fillComboBox(JFXComboBox<Integer>, int, int) - Method in class presentation.view.LoadView
-
- finish - Variable in class presentation.utils.TerminalMenuBuilder
-
- finishExecution() - Method in class presentation.utils.TerminalMenuBuilder
-
Finish execution.
- finishGame() - Method in class domain.model.Game
-
- finishGame(int) - Method in class domain.model.player.Player
-
Finish Game and notify score
- finishGame() - Method in class domain.model.player.Player
-
Finish Game
- finishGame() - Method in class domain.model.player.UserPlayer
-
Notifies the score to the Breaker
- finishGame(int) - Method in class domain.model.player.UserPlayer
-
Notifies the score to the Breaker
- finishGame(int) - Method in interface domain.model.Receiver
-
Finish game and notify score.
- finishGame() - Method in interface domain.model.Receiver
-
Finish game.
- finishGame() - Method in class presentation.controller.receiver.TerminalGameReceiver
-
Notifies the game is finished because there are no more turns
- finishGame(int) - Method in class presentation.controller.receiver.TerminalGameReceiver
-
Notifies the Breaker's victory and notifies his score
- finishGame() - Method in class presentation.controller.receiver.VisualGameReceiver
-
Notifies the game is finished because there are no more turns
- finishGame(int) - Method in class presentation.controller.receiver.VisualGameReceiver
-
Notifies the Breaker's victory and notifies his score
- finishGame() - Method in class presentation.controller.view.NebulaViewController
-
Enda a game
- FinishGameException - Exception in domain.model.exceptions
-
Treats Finish Game exception
Happens when the user quits a non-finished game.
- FinishGameException() - Constructor for exception domain.model.exceptions.FinishGameException
-
Instantiates a new Finish game exception.
- fitness - Variable in class domain.model.player.computer.GeneticComputer
-
Array that contains the fitness of each population.
- FiveGuessComputer - Class in domain.model.player.computer
-
The Five guess computer
- FiveGuessComputer(Player.Role) - Constructor for class domain.model.player.computer.FiveGuessComputer
-
Instantiates a new Five guess computer


DXM and Brain wave machine (altered “deep meditation” pre-set to include visuals): I had just smoked cannabis (which changes the DXM trip entirely) and decided to see what effect my new “Brain Wave Generator” program would have. The creators had warned against its use with psychoactive substances so I knew the combination would be effective.
I put on the headphones and started the program. The sounds emanating from the headphones made me laugh because they were so strange. After about five minutes of meditation assistance, the effects of the program were in full swing. Suddenly, under me appeared an ancient city of pulsing light. A wall of energy passed through me, melting my body away. I was a mass of liquid static. I felt like a god. Like I had entered the essence of an ancient deity. My thoughts were screaming in my head, blaring. It was as if they were so intense they could not be contained, they spilled out of their realm to include all others, and in my mind became physical. I felt I could shatter the minds and bodies of the “city’s” inhabitants at will. I took off the headphones because I was enjoying the perverse sensation.
This “combination” for me, was incredible. Must drugs are ego destroying, while this sensation was one of transference (into deity consciousness) and massive ego inflation, to a perverse level. It offered a way to explore consciousness in the “other direction”. I do not consider myself an egocentric person either; in fact I try to objectively analyze myself in order to prevent this regularly. I believe it was the colors of the flashes I chose which created the experience (yellow and white). Using different colors has given me entirely different experiences, but none as unique from the traditional direction of psychedelics as that first time.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Social networking algorithms are a useful part of the analyst’s toolkit. The algorithms illustrated in this section help in understanding the structure of a database.
The clustering coefficient is a measure of the interrelatedness of an object’s neighbors. It indicates the ratio of existing links connecting an object’s neighbors to each other to the maximum possible number of such links. An object must have at least two neighbors to calculate the clustering coefficient. No value is calculated for objects having less than two neighbors.
The connected components algorithm identifies the distinct components of the input data. Two objects are in the same component if there is a path from one object to the other.
The hubs and authorities algorithm, originally developed with web search in mind, attempts to identify objects that are likely to be good sources of information (authorities) and objects that are likely to point to many such authorities (hubs) through the link structure of the data.
Proximity adds the results of running these algorithms to the database, either by creating new object attributes (clustering coefficient or hubs and authorities) or by creating a new container of subgraphs (connected components).
This section describes the script found in
$PROX_HOME/doc/user/tutorial/examples/social-networking-algs.py
.
Define a prefix to use for attribute and container names. For example, when running these algorithms on the whole database, you might use the database name as a prefix (as shown below). You might use a container name when running the algorithms on the objects and links in a specified container.
attrPrefix = "proxwebkb"
Get the current set of object attributes. We use this to determine whether the new attributes already exist in the database.
currentAttrs = prox.objectAttrs
For the purposes of calculating the clustering coefficient, Proximity ignores both link direction and the possibility of multiple links when calculating the number of actual and potential links among an object’s neighbors. Proximity uses only the number of distinct object pairs to determine this number.
print "Computing clustering coefficients"
Proximity stores the value of the clustering coefficient in a new object attribute specified by the user. We start by specifying the name of the new attribute.
clusterAttrName = attrPrefix + "-cluster-coeff"
In this example, we assume that the user wants to overwrite existing values so we automatically delete any existing attribute with the same name. See Exercise 6.5 for an example of asking the user whether to delete an existing attribute.
if currentAttrs.isAttributeDefined(clusterAttrName): print " Attribute " + clusterAttrName + " already exists. Deleting..." currentAttrs.deleteAttribute(clusterAttrName)
Create and calculate values for the new clustering coefficient attribute. Proximity lets you calculate the clustering coefficient for either an entire database or limit execution to the data in a specified container. When limited to a container, Proximity runs the algorithm on the objects and links in the container, ignoring subgraph boundaries. The code in this example calculates clustering coefficients for the entire database.
prox.addClusterCoeffAttribute(clusterAttrName)
To compute the clustering coefficient for objects in a container, use
the overloaded addClusterCoeffAttribute()
method
with the input container as the second argument, e.g.,
prox.addClusterCoeffAttribute(clusterAttrName,
inputContainer)
.
Proximity ignores link direction in determining whether a path exists between two objects, implementing the weak sense of connectivity. Proximity creates a subgraph for each component and places all component subgraphs in a new container.
print "Computing connected components"
Define the name of the new container. Each subgraph in this container is a connected component. The new container will be a child of the root container.
outputContainerName = attrPrefix + "-connected-components"
Delete this container if it already exists
rootContainer = prox.rootContainer if rootContainer.hasChild(outputContainerName): print " Container " + outputContainerName + " already exists. Deleting..." rootContainer.deleteChild(outputContainerName)
Find the connected components. Proximity lets you calculate the connected components for either an entire database or limit execution to the data in a specified container. When limited to a container, Proximity runs the algorithm on the objects and links in the container, ignoring subgraph boundaries. The code in this example identifies connected components for the entire database.
prox.computeConnectedComponents(outputContainerName)
To find connected components within a container, use the overloaded
method computeConnectedComponents()
method
with the input container as the second argument, e.g.,
prox.computeConnectedComponents(outputContainerName,
inputContainer)
.
Due to the circular relationship between hubs and authorities, we use an iterative algorithm for calculating these weights. Proximity’s implementation of the hubs and authorities algorithm is based on work by Kleinberg [Kleinberg, 1998], which suggests that 20 iterations is usually sufficient for most applications.
The addHubsAndAuthoritiesAttributes()
method adds
two attributes to the input objects, an authority weight and hub
weight. Both weights are non-negative and normalized so that the
values for each attribute sums to 1.0. Larger authority or hub
weights indicate that the corresponding object
is a better authority or hub, respectively.
print "Computing hubs and authorities"
Specify the name of the new attributes.
hubsAttrName = attrPrefix + "-hubs" authoritiesAttrName = attrPrefix + "-authorities"
Delete these attributes if they already exist.
if currentAttrs.isAttributeDefined(hubsAttrName): print " Attribute " + hubsAttrName + " already exists. Deleting..." currentAttrs.deleteAttribute(hubsAttrName) if currentAttrs.isAttributeDefined(authoritiesAttrName): print " Attribute " + authoritiesAttrName + " already exists. Deleting..." currentAttrs.deleteAttribute(authoritiesAttrName)
Specify the number of iterations.
numIterations = 20
Create and calculate values for the new hubs and authorities attributes. Proximity lets you calculate the hubs and authorities scores for either an entire database or limit execution to the data in a specified container. When limited to a container, Proximity runs the algorithm on the objects and links in the container, ignoring subgraph boundaries. The code in this example calculates hubs and authorities scores for the entire database.
prox.addHubsAndAuthoritiesAttributes(numIterations, hubsAttrName, authoritiesAttrName)
To compute hubs and authorities scores for objects in a container, use
the overloaded method
addHubsAndAuthoritiesAttributes()
with the
input container as the fourth argument, e.g.,
prox.addHubsAndAuthoritiesAttributes(numIterations,
hubsAttrName, authoritiesAttrName, input Container)
.
Exercise 6.6. Running social networking algorithms:
Before beginning, make sure that you are serving the ProxWebKB database using Mserver. Start the Proximity Database Browser if it is not already running.
From the Script menu, choose Run Script. Proximity displays the Open dialog.
Navigate to the $PROX_HOME/doc/user/tutorial/examples
directory and
choose social-networking-algs.py
.
Click Open.
Proximity opens a window to show you any output from the script along with a trace of the script execution. Note that this script may take several minutes to run. Proximity reports:
Status: starting running script: /proximity/doc/user/tutorial/examples/social-networking-algs.py Computing clustering coefficients Computing connected components Computing hubs and authorities Status: finished running script
You can close this window after the script finishes.
Click Object Attributes to see the new attributes created by the clustering coefficient and hubs and authorities calculations. If you wish, you can explore these attributes further.
The proxwebkb-cluster-coeff attribute records the clustering coefficient for each input object having two or more neighbors in the input data. The clustering coefficient is a ratio, thus all values lie between 0 and 1, inclusive.
The proxwebkb-authorities attribute records the authority weight calculated for each input object.
The proxwebkb-hubs attribute records the hub weight calculated for each input object.
Return to the Proximity Database Browser start page and click Containers to see the new proxwebkb-connected-components container created by the connected components method.
Click proxwebkb-connected-components to see the list of subgraphs in this container. Proximity found 17 distinct components in the ProxWebKB data. If you wish, you can explore these subgraphs further.


Let's start with something easy — implementing printf's string directive, %s. The actual syntax of the printf directives is fairly complex, so let's begin with a simple 'insert a string' mechanism.
Note:
One rule to remember: No two effectors can have the same name
and priority.
There's more to an effector definition that just the code; we need to fill in a bunch of other blanks first. Here's a starting point:
include FormatText FTO.clearEffectorList() e = Effector.new({ :name => 'printf %s', :category => _('String insertion'), :syntax => '%s', :priority => 5000, :description => _('Insert a string.'), :reMatch => '%s', :reExtra => '%s', :dWidth => :NA, :code => lambda { | eContext | e = eContext.effectorObj result = eContext.argList.first.to_s return result } }) FTO.registerEffector(e)
We'll concentrate on the code later, but for now let's look at the other pieces of the definition.
This is just a terse name for the directive. It provides a human-readable shorthand reference, and is used in sorting the list of effectors and when documentation is extracted from the effector list. It should not be subjected to gettext interpretation.
This attribute is solely for use in documentation; it aids in grouping related effectors together. Because of this role, it can contain markup and it is appropriate for it to be bracketed by the _(...) call for gettext processing.
This key is also solely for documentation purposes, and provides a quick reference to the effector's usage syntax (duh!). Markup is very appropriate, but gettext processing is not. (The syntax isn't language-specific, after all.)
The priority value is used by the documentation extractor to organise entries in the documentation table, and is also integral to the internal handling.
This attribute is also used solely for documentation purposes. It can be as long or as brief as you like, and can contain markup. It should be marked for gettext processing by enclosing it in _(...).
This is the regular expression used to match the effector in the format string. It can be either a string or an Regexp object.
Note:
Make sure that your regular expressions are sufficiently unique
as to not match each other!
The :reExtra attribute is used to specify an additional regular expression used by the effector function to extract information from the matched string — a field width, for instance.
Now let's move on to the code that implements the %s directive.
:code => lambda { | eContext | e = eContext.effectorObj result = eContext.argList.first.to_s return result }
This is implemented as an anonymous lambda function, but it needn't be. Any sort of Proc object that takes a single argument and returns a string can serve in this capacity.
The sole argument to the effector function is a FormatText::Context object. The Context class is essentially just a container, with no real methods of its own other than a constructor (which ensures sane default values). Let's take a look at its attributes in brief:
class Context # # FormatText::Effector object. The _Effector_ object # involved. Read-only. # attr_accessor :effectorObj # # FTO object. The _FTO_ object being processed. # Read-only. # attr_accessor :ftoObj # # _String_. The string that matched the effector and triggered # its processing. Read-only. # attr_accessor :sMatched # # _Array_. Arguments remaining to be processed. Usually # read-only, but see the description of the _usedArgs_ attribute # for exceptions. # attr_accessor :usedArgs # # _Array_. List of arguments already processed. Usually # read-only. The effector function is responsible for using the # values in this array to perform its task. # # The only time this should be considered read/write is when the # effector is intended to modify the list of arguments being used # to build the final string. The _argList_ attribute should be # modified in conjunction with _usedArgs_ to maintain continuity. # By default, after the effector function returns, the caller (the # FTO#format() method) will take the element from the front # of the _argList_ array and push it onto the end of the # _usedArgs_ array. # attr_accessor :argList # # _Any_. The FTO#format() sets this to the last argument # that was actually used. # attr_accessor :lastArgUsed # # _Boolean_. The effector function sets this to +true+ to inhibit # the FTO#format() method from modifying the argument list # after the function returns. See the descriptions under the # _argList_ and _usedArgs_ attributes. # attr_accessor :reuseArg end # class Context


Recipe: Colonial Cranberry Catsup
by CBS NewsProvincetown, Mass. chef Steven Frappolli offers "Sunday Morning" a Revolutionary-era dish from the cranberry bogs of Cape Cod.
"You can serve it with venison, lamb, pork, turkey, chicken, any kind of game meat," he said.
Colonial Cranberry Catsup
Recipe by Steven Frappolli
Ingredients:
5 cups cranberries
2 cups granulated sugar
½ cup apple cider vinegar (preferably unfiltered)
¾ tsp clove (ground)
¾ tsp allspice (ground)
1 1/2 tsp cinnamon (ground)
Preparation:
Combine all ingredients in a large saucepot. Give a quick stir, then bring to boil and reduce to simmer. Cook until cranberries begin to dissolve and break down (about 30-45 minutes), when you will wind up with a thick cranberry puree.
Cool slightly, then force through a food mill.
Store in sealed jars.


--- layout: post status: publish published: true title: Injuries and Cardinals author: display_name: Andy login: Andy email<EMAIL_ADDRESS>url: '' author_login: Andy author_email<EMAIL_ADDRESS>wordpress_id: 1108 wordpress_url: http://ivyenvy.com/?p=1108 date: '2009-07-09 21:29:31 +0000' date_gmt: '2009-07-10 03:29:31 +0000' categories: - injuries tags: - Geovany Soto - Kerry Wood - Rich Harden - Ryan Dempster - Chris Carpenter - Ryan Freel - Albert Pujols - Farney - Brad Thompson comments: - id: 313 author: Corey author_email<EMAIL_ADDRESS>author_url: http:// date: '2009-07-10 12:15:41 +0000' date_gmt: '2009-07-10 18:15:41 +0000' content: "This really is a pretty big series.\r\nThe Cubs could end the series anywhere from 1/2 game up on the Cards to 7 1/2 games back.\r\n\r\nThe Cubs haven't played the Cardinals well this season, but let's hope the Cubs enter the All-Star Break on a high note." - id: 315 author: Tim author_email<EMAIL_ADDRESS>author_url: '' date: '2009-07-13 07:10:35 +0000' date_gmt: '2009-07-13 13:10:35 +0000' content: 2-2 ain't bad.. I really wanted 3-1 but I'll take a split with the way the cubs have been playing the past few weeks.. hopefully, with exactly one (1) Cub making an appearance at the all star game, it'll give our boys some R&R and get back to the form we all know they can play at.. ---
There is a lot going on with the Cubs right now. One of the most pressing issues is the burgeoning injury list. We were so relieved and happy to be injury-free at the beginning of the regular season. Do you see what happens, little Larry? It would have been better to get it out our system then. This business about Ryan Dempster's toe is just about as frustrating as Kerry Wood's Nintendo finger from last season. However, Dempster hasn't seemed extraordinarly sharp this season anyway. Thankfully we have some good young pitchers showing up at the right time.  This is happening right when he is swinging the bat well and getting a good rhythm going. Hopefully he can find that right away again after a little time off.
This upcoming series against the Cardinals is pretty important. The Cubs have the chance to put themselves in a great position going into the All-Star Break. They also could really bury themselves with some losses. It will be interesting to see if Harden can bounce back and have a great outing tomorrow. He needs to. The Cubs will be facing Chris Carpenter, and hopefully they can support Harden offensively. Saturday's game looks to be very winnable; the Cubs will be facing Brad Thompson, and he seems to be quite hittable (2-5/ 4.92 ERA). At least there aren't any ridiculous neon signs at Wrigley for Pujols to break.
In sad news, Freel and Farney are no longer with the team. At least Freel can now use the "royal we" and be referring to someone besides himself.


--- title: keylookup layout: protoc-gen-docs generator: protoc-gen-docs number_of_entries: 2 ---
value
string
entry


| Potato skins | $3.99 | |
| Chicken Strips | $5.99 | |
| Spring Rolls | $4.99 | |
| Deep Fried Prawns | $7.99 | |
| Yam Fries | $3.99 |
| Chicken Alfredo Pasta | $8.99 | |
| Sirloin Steak | $10.99 | |
| Two Pieces of Fish and Chips | $8.99 | |
| Grilled Chicken Breast W/ Rice and Vegetables | $8.99 |
Comes with either fries or salad(.99c for subsitution)
| The Works | $9.99 | |
| Grilled Chicken Breast with BBQ sauce | $7.99 | |
| BLT | $5.99 | |
| Beef Dip | $7.99 |
***Cakes are by the slice***
| Banana Split | $4.50 | |
| Chocolate Lava Cake | $3.50 | |
| Strawberry Short-cake | $4.00 | |
| Carnegie Deli Cheesecake | $5.00 |


| FibonacciHeapWrapper |
NOTE: each heap has O(1) decreaseKey, but if multiple bins are used,
the method takes O(log_2(n)) + O(1).
|
| FlowNetwork |
class representing a flow network for
MinCostUnbalancedAssignment.java
If the sink and source nodes and weights are set in the
origin graph, sink and source logic is used in code.
|
| Graph |
class to hold a bipartite weighted graph.
|
| GraphUtil |
|
| GraphWithoutWeights |
|
| HopcroftKarp |
finds a maximum cardinality matching in a bipartite graph.
|
| HopcroftKarpRT2012 |
NOTE: this class is NOT READY FOR USE YET.
|
| MinCostUnbalancedAssignment |
A solver for the min-cost, unbalanced, weighted bipartite
assignment problem that uses weight scaling
to solve the perfect and imperfect
assignment problems, but not incremental
with a runtime complexity of
|
| MinCostUnbalancedAssignment.Forest |
|
| MinCostUnbalancedAssignment.LeftNode |
class specializing a fibonacci heap node to identify
a left node, a.k.a.
|
| MinCostUnbalancedAssignment.PathNode |
|
| MinCostUnbalancedAssignment.RightNode |
class specializing a fibonacci heap node to identify
a right node, a.k.a.
|
| MinCostUnbalancedAssignment.SinkNode |
class specializing a fibonacci heap node to identify
a sink node
|
| MinCostUnbalancedAssignment.SourceNode |
class specializing a fibonacci heap node to identify
a source
|
| MinHeapForRT2012 |
A min heap for the MinCostUnbalancedAssignment.
|
| PathNodes |
|
| ResidualDigraph |
|
| ResidualDigraph2 |
a residual digraph for use within refine method in
MinCostUnbalancedAssignment.java
|
| XFastTrieWrapper |
a wrapper for the XFastTrie to provide methods of a minimum
heap that can handle more than one node of the same key.
|
| YFastTrieWrapper |
a wrapper for the YFastTrie to provide methods of a minimum
heap that can handle more than one node of the same key.
|


The robust construction of these rigid forceps provides
a number of advantages as compared with a conventional
flexible miniature forceps.
The specially designed
sharp cutting jaws are close to the telescope,
therefore specimens can be taken under accurate
visual control.
These forceps have also been found valuable for the
removal of foreign bodies and pieces of tissue.
Sufficient
irrigation is still provided when a forceps is introduced
into the sheath.
Features:
High operational efficiency
Application specific design
Better durability
.
Designed as per prevailing quality standards, we offer our customers Urethral Sheath for the continuous irrigation with standard obturator, 21 fr.
Fabricated making use of superior quality raw material, this is highly durable and reliable in its use for various surgical operations.
Precision engineered by our expert professionals, this is light in weight, hygienic and safe to be used.
Offering the sheath at extremely cost effective prices makes our product highly demanded amongst our customer network.
.
Catering to the assorted necessities of our patrons, we are immersed in presenting a world-class compilation of Visual Obturator. Using optimal grade raw material and the contemporary techniques, this product is precisely made up by hard-working personnel as per the industry laid guidelines. As well, the presented product is inspected on predefined limitations of quality so as to present only flaw-free range from our end.
Features :
Fine finish
Durability
Precise design
.
Mini Perc is basically 12fr PCNL which can be connected to 15fr or 18fr external operating sheath.
Very handy instrument for the therapy of stones of the renal pelvis and staghorn calculi:
Suitable for children and adults
Minimal sheath size at highest stability
Optimum handling
Titanium and stainless steel construction for durability and low weight
Automatic closure and sealing at the working channel
.


Written by: Marta Kauffman & David Crane
Transcribed by: Eric Aasen
[Scene: The Hospital, Phoebe is arriving with Ross, Joey, and Rachel in tow.]
Phoebe: (to the nurse) Hi.
Nurse: Hi.
Phoebe: Hi, yeah, hi! I'm umm, Phoebe Buffay, and I have babies coming out of me.
Nurse: Okay. Have you started having contractions?
Phoebe: Not yet. Umm, I heard they really hurt, do they hurt?
Nurse: Well
Phoebe: Oh my God!
Ross: It's all right.
Nurse: Now, which of you is the father? (Points to Joey and Ross)
Phoebe: Oh no, none of them are the father. The father is my brother.
Nurse: (not sure what to do with that) Okay
Rachel: I am so gonna miss watching you freak people out like that!
Joey: Okay, uh Pheebs, quick. Look! This (His video camera) is for the babies to look at someday, so is-is there anything you want to say? Y'know before it all starts?
Phoebe: Oh, okay, umm, hi kids! Um, it's me, Aunt Phoebe. I can't wait to see you. Please don't hurt me!
(Monica and Chandler come running in.)
Ross: Hey, what took you guys so long? Your cab left when ours did!
(There's a pause as they figure out what to say.)
Monica: Well, we-we had to go back because I forget my jacket.
Chandler: That's right.
(Both Rachel and Ross stare at her for a moment.)
Rachel: You-you're not wearing a jacket.
Monica: Oh man! I did it again!
Phoebe: (standing up) Okay, so umm, somebody has to call Frank and Alice. (As she is talking Joey is sticking the camera under her skirt.) And then my mom wants to know-(notices Joey)-Joey, what are you doing?!
Joey: I gotta get the before shot!
(She shakes her head no.)
Opening Credits
[Scene: The delivery room, Rachel and Ross are entering.]
Rachel: Hi, Pheebs? Okay, so just spoke to the nurse and the reason that your doctor is late is because uh, she's not coming.
Phoebe: What?!
Ross: Apparently she fell in the shower and hit her head.

Ross: Look, Pheebs-Pheebs, it's gonna be okay.
Phoebe: That's easy for you to say, I don't see three kids coming out your vagina!
Rachel: Honey, listen, y'know what? The nurse said the doctor is wonderful.
Ross: Yeah, he's head of the department.
Phoebe: All rightOoh!
Monica: What?
Phoebe: I'm having my first contraction!
Chandler: Oh no.
Phoebe: Ooh, it's not bad.
Chandler: Okay.
Joey: Oh! (In an announcer type voice) And so the miracle of life begins, and aaiiyyyeeee! (He grabs his side and doubles over in pain.)
Chandler: Hey! You okay?
Joey: Ooh, something hurts!
Phoebe: Ooh, it's sympathy pains. Ohh, that's so sweet!
Joey: Are they? I didn't know I cared that much.
(The doctor, Dr. Harad, enters.)
Ross: Hello.
Dr. Harad: Hi! Phoebe, I'm Dr. Harad, I'm going to be delivering your babies.  I've been doing this for a long time. I'll be back in a minute to do your internal, in the meantime, just relax because everything here looks great. And also, I love Fonzie. (Exits)
Chandler: Did he just say, he loves Fonzie?
Monica: That's what it sounded like.
Chandler: All right
Frank: (entering) Hey!
All: Hey!
Frank: (To Phoebe) Hey! Am I late? Am I late? Nobody came out yet, right?
Phoebe: No-no-no! We haven't started yet. Where's Alice?
Frank: Uh, Delaware.  But don't worry, she told me all about the la-Mazada stuff.
Chandler: Yeah, that's when if you get the babies out by the end of the month, they give you 2% financing.
Frank: Yeah.
[Scene: The waiting room, Monica and Joey are sitting there.]
Rachel: (entering) Monica? You gonna be very proud of me. I just got us dates with two unbelievably cute nurses.
Joey: Oh my!
Rachel: They're male nurses.
Joey: Not in my head.
Rachel: Anyway, they want to take us out Saturday night! What do you say?
Monica: Umm. (Looks at Chandler who is using the phone.) Umm. Umm. I don't think so.
Rachel: What? What are you talking about?! You-you're the one who's been telling me to get over Ross and move on. I'm moving on, and you're moving on with me. Come on, give me one good reason why you don't wanna go.
Monica: Umm, why don't you give me something that would be a good reason and-and then I'll tell you if it's true.
Rachel: What?
Monica: Harder than it sounds. Isn't it?
Rachel: Okay, you're coming with me, and I also told them that if we're still here when they get off that we'll go down to the cafeteria and have some Jell-O with them.
Joey: (in a sexy voice) Yep! There's always room for Jell-O
Rachel: Joey, how do you make that dirty?
Joey: Oh, it's easy. Yeah, I-I can do it with anything. Watch uh, (snaps his fingers and in a sexy voice) Grandma's chicken salad
[Scene: The delivery room, Chandler, Frank, and Ross are with Phoebe.]
Joey: (entering) Ross! Get a shot of this. (He's carrying an issue of the USA Today and hands Ross the camera.) Hey babies! These are the headlines on the day you were born! Okay, now girl baby turn away and boy babies (Throws the paper away to reveal a copy of Playpen, which is the TV version of Playboy Magazine.) Check it out, huh?! This is what naked women looked like the month you were born. All right, now let's dive right into the good stuff. (Joey opens the magazine and Ross sticks the camera in it.)
Phoebe: Oh, okay, I'm having another one! This one doesn't hurt eitherOoh, yes it does! Ow! Ow! Ow! Ow! Ooh! (Checks under the blanket.) Oh, I was kinda hoping that was it.
Ross: Hey, where are Monica and Rachel anyway?
Joey: Oh, a couple of nurses asked them out. Maybe they're with them.
Chandler: Really? Male nurses?
Joey: Yeah, I was bummed too.
Chandler: So they're going on dates? When?
Joey: I think Saturday(groans in pain again).
Frank: (To Phoebe) What's with him?
Phoebe: Umm, sympathy pains. I thought it was really sweet at first, but now I think he's just trying to steal my thunder.
Dr. Harad: (entering) Okay!
Phoebe: Hey.
Dr. Harad: Let's see what we got here. Ohh, y'know, Fonzie dated triplets.
Chandler: This-this Fonzie person you keep referring too, is that uh, is that another doctor?
Dr. Harad: Oh no-no-no. Fonzie is the nickname of Arthur Fonzerelli. The Fonz.
Chandler: All right.
(Dr. Harad exits.)
Frank: It's not that weird, is it?
Phoebe: It's very weird! I don't want some guy down there telling me, I'm y'know, dilatedamundo!
Ross: To be fair, he doesnt seem to be impersonating Fonzie
Phoebe: (interrupting) What are you doing?!! Why are you defending him?! Just get me another doctor! One who is not crazy and who is not Fonzie!
Ross: Again, it's not that he
(Phoebe fakes pain to get Ross looking for another doctor.)
[Scene: The waiting room, Chandler is looking for Monica.]
Chandler: (spotting her) Oh-hey-hey-hey! There you are!
Monica: Umm, listen there's something I think you should know.
Chandler: Oh, is this about you-you dating the nurse? Yeah, Joey already told me, and I am so-so fine. I mean, you and I we're just, y'know, we're nothing, we're goofin' around.
Monica: Umm, actually I was about to tell you that I was, I was going to get out of it, but hey, if we're just goofing around then uh, maybe I will go out with him.
Chandler: Fine! Maybe I will too!
Joey: (entering from the elevator caring gifts for the kids) Hey, you guys! Look what I found in the giiiiiiift shop. (He doubles over in pain in front an old man in a wheel chair.)    (The old man waves him away.)
[Scene: The delivery room, Ross has returned with another doctor. This one, is well, younger.]
Ross: Okay, Phoebe, this Dr. Oberman. He has no strong feelings about Fonzie or any of the Happy Days gang.
Phoebe: Hi! And you're going into what grade?
Dr. Oberman: Umm, I'm actually a first year resident, but I get that a lot, you see, I-I graduated early
Phoebe: (interrupting) Uh-huh, me too. Ross, maybe I should've specified that I'd be needing a grown up doctor.
Dr. Oberman: Oh no, I'm fully qualified to
Phoebe: Shh! Doogie, shh! Doesn't anybody understand that I'm gonna be having babies soon? Huh? Go! Go little boy, go!
(He runs out and Frank watches him go.)
Frank: Oh cool! You made him cry!
[Scene: Another hospital room, Joey has now been admitted and his doctor is about to break the bad news to him, Monica, and Chandler.]
Joey's Doctor: Mr. Tribbiani, I'm afraid you've got kidney stones.
Joey: Umm, well, what else could it be?
Joey's Doctor: It's kidney stones.
Joey: Or?
Joey's Doctor: Kidney stones!
[Scene: The delivery room, Dr. Harad is back and checking on Phoebe.]
Dr. Harad: All right, you're getting there. Oh, and y'know, these babies are very, very lucky.
Phoebe: They are. Why?
Dr. Harad: They have the honor of being born on The Fonz's half-birthday.
Phoebe: Happy birthday!
Dr. Harad: Just-just to clarify, I'm not Fonzie. (Phoebe nods in agreement as he leaves.)
Rachel: Honey, y'know I just gotta tell you, I think this is such a terrific thing you're having these babies for Frank and Alice.
Phoebe: I know, it is.
Rachel: Yeah!

Rachel: Yeah!
Phoebe: I want to keep one. (Giggles in excitement.)
Rachel: Ohh, I'm gonna be on the news!
Commercial Break
[Scene: The delivery room, continued from earlier.]
Rachel: Okay, Phoebe, honey, you gotta be kidding. I mean, you know you cannot keep one of these babies!
Phoebe: Why not?! Maybe I can, you don't know!
Rachel: Yes! Yes! Yes, I do! I do know! Frank and Alice are gonna want to keep all of their children!
Phoebe: Maybe not! Y'know? Seriously, three babies are a handful maybe they're y'know, looking for a chance to unload one of them. Listen, I-I hate to miss an opportunity just because I didn't ask! Y'know?
Rachel: Phoebe, no! This is, this is insane.
Phoebe: Oh, just ask him!
Rachel: Me?!
Phoebe: I can't ask him! Do you have any idea how inappropriate that would be?! All I'm saying is just talk to Frank. Okay? Just, y'know, feel him out!
Rachel: No! Forget it! I am not gonna ask Frank to give you one of his kids!!
Phoebe: You're right.
(There's an awkward silence then suddenly Phoebe gets an idea.)
Phoebe: Tell him it's for you.
[Scene: Joey's room, his doctor, Chandler, and Monica are there.]
Monica: Feeling a little better sweetie?
Joey: Well, maybe a little. I wish you hadn't seen me throw up.
Monica: Me too.
Ross: (entering) Hey! I just heard. What's up?
Joey's Doctor: Kidney stones! Now, ordinarily Mr. Tribbiani, we try to break up the stones up with shock waves, but they're to close to the bladder now. Which means we can either wait for you to pass them or else go up the urethra
Joey: (interrupting) Whoa-whoa! No-no-no-no-no, nothing is going up! Okay? Up, up is not an optionwhat's a urethra? (Monica whispers what it is in his ear.) Are you crazy?!
[Scene: The delivery room, Rachel and Frank are there.]
Phoebe: (To Rachel) So did you ask him?
Rachel: No, I haven't had a chance to be alone with him yet.
Phoebe: Well, I'm kinda on a clock here.
Dr. Harad: (laughing) Oh Fonzie.
Rachel: Y'know who I always liked? Mork.
(Dr. Harad drops what he's doing and stares at her.)
Phoebe: Undo it. Undo it. Undo it.
Dr. Harad: Fonzie met Mork. Mork froze Fonzie.
Rachel: Yeah, but umm Yes, but, Fonzie was already cool, so he wasn't hurt, right?
Dr. Harad: Yeah, that's right.
Monica: (entering with Chandler) Hey!
Phoebe: Hi!
Monica: (To Phoebe) How are you doing?
Phoebe: Okay, doctor says any minute now.

Phoebe: Sorry Frank, I'm kinda in the middle of the last favor you asked me to do.
(A male nurse enters.)
Male Nurse: Hey!
Rachel: Hi!
Male Nurse: Rachel.
Rachel: Monica, this is Dan (points to him), one of the guys that we're gonna be going out with on Saturday. (Mouths "He's yours." to her.) Uh Dan, Monica.
Dan: Nice to meet you.
Monica: Hello Dan! I'm really looking forward to Saturday night! Really, really!
Chandler: So Dan, nurse not a doctor huh? Kinda girlie isn't it?
Monica: Chandler!
Dan: Nah that's okay. I'm just doing this to put myself through medical school.
Chandler: Oh.
Dan: And it didn't feel so girlie during the Gulf War.
Chandler: Sure. (Pause) And listen, thanks for doing that for us, by the way. (Retreats in defeat.)
Monica: So, why wait 'til Saturday, are you free tomorrow?
Dan: Sure! I'll get somebody to cover my shift.
Monica: Oh, great!
Chandler: (to another female nurse) Hey, how 'bout it? You, me, Saturday night?
Delivery Room Nurse: No.
Chandler: All right. Very good.
Phoebe: Oo, this is a big one. Eww! Arghhhh!!
[Cut to Joey's room, who's going throw his own contractions. Plus, he has Ross in a headlock.]
Joey: Ohh, get these things out of me!
Ross: Breathe! Breathe! Breathe throw the pain.
(Joey starts breathing hard)
Joey: I want the drugs Ross, I want the drugs! (He starts rocking back and forth, taking Ross with him.)
Ross: I do too! I do too!
Joey: Argh!
Ross: Argh!
Joey: Argh!
Ross: Argh!
[Scene: The waiting room, Frank is on the phone as Rachel approaches.]
Frank: Yeah, I love you. Okay, bye! (To Rachel) Hi!
Rachel: Hi!
Frank: That was Alice's mom, she said she left five hours ago.
Rachel: Oh, honey, dont worry. She's gonna make it on time.
Frank: Yeah.
Rachel: Yeah. So Frank, three babies.
Frank: (laughs) Not to me.
Rachel: Yeah, fair enough.
[Scene: The delivery room, later on, Rachel, Chandler, Monica, and Frank are there as Dr. Harad is checking out Phoebe.]
Dr. Harad: Okay, you're at ten centimeters. Time to start having some babies. All right, I want only the father in here please.
(They all kiss her and wish her luck.)
Monica: Bye Dan!
Dan: Uh, bye Monica.
Chandler: Bye, momi-moo.
(Everyone except Frank leaves.)
Dr. Harad: All right, I need a clamp, sterile towel, and channel 31.
Phoebe: What is that?
(Dan turns on the TV and the Happy Days theme song comes on.)
Phoebe: Oh my God!
Dr. Harad: Oh, no-no-no, it's a good one! Fonzie plays the bongos. All right, are you ready? It's time to start pushing.
[Cut to Joey's room, his doctor and Ross are there.]
Joey's Doctor: Are you ready? It's time to try peeing. (Joey makes a face like he is trying to pee.) Wait-wait-wait-wait-wait! It's almost time to try peeing. (Points at the bottle Joey is to pee into.)
[Cut to the delivery room.]
Dr. Harad: Okay, now push! That's it push! Just concentrate on pushing! Yeah, here we go!
Dan: I see the head.
Frank: Yes, it has a head!
Dr. Harad: All right. Keep pushing! Come on!
Frank: I can't believe there's somebody coming out of you right now. There's somebody coming out of you! Is it? Is it? It's my son.
Dr. Harad: All right. Here's your first baby.
[Cut to the waiting room, a triumphant Frank rushes in.]
Frank: YESSSSS!!!!! We got a baby boy!!
Chandler: Yes!
Frank: Frank Jr. Jr.!!
Rachel: Oh, how does he look? How does he look?
Frank: So gross! (He runs back to the delivery room.)
[Cut to the delivery room, Phoebe is about to give birth to the middle kid.]
Dr. Harad: Okay. You ready to push again?
Phoebe: I already had a baby. Leave me alone.
Frank: Okay, okay, come on, you can do it. You can do it!
(Phoebe screams in pain, and Frank screams with her.)
[Cut to the waiting room, a twice triumphant Frank returns.]
Frank: Yeah!! Little Leslie is here! We got another one! Oh my God, I can't believe I have two-two children. How scary is that? (He returns to the delivery room.)
[Cut to the delivery room, Phoebe is at it for the last time.]
Frank: Come on little Chandler, it's time to be born. Come on little Chandler! Come on!
Dr. Harad: All right, he's coming. He's coming!
(They both stare at the newborn.)
Frank: Hey, where's his thing?
[Cut to the waiting room, a thrice triumphant Frank returns again.]
Frank: Chandler's a girl!
Chandler: Oh God, kindergarten flashback.
Frank: They musta read the sonogram wrong. 'Cause they, 'cause they thought it was a boy, but Chandler's a girl! Chandler's a girl!
Chandler: Okay, keep saying it!
Alice: (running in from the elevator) Am I too late?!
Frank: No-no ah, everything's okay. Everybody's healthy there's 30 fingers and 30 toes.
Alice: We have our babies?
Frank: Yeah.
Alice: (Starting to cry) Oh, we have our babies.
(They hug. And quickly that hug turns into a heated make out session, right there on the waiting room couch. Chandler, Rachel, and Monica quickly make their exits.)
[Scene: Joey's room, he is recovering from his birth.]
Joey: Oh my God.
Ross: You did it, man.
Joey's Doctor: Would you like to see them? (He hands Joey a little jar.)
Joey: They're so small! (Both he and Ross look at them with satisfied looks on their faces.)
[Scene: A hallway, Monica and Dan are talking.]
Dan: So, I'll call you tomorrow.
Monica: Great!
(Dan leaves as Chandler enters.)

Monica: Well uh, you and I are just goofing around, I thought, why not goof around with him.
Chandler: Y'know, I don't know if you've ever looked up the term goofing around in the dictionary Well, I have, and the technical definition is, two friends who care a lot about each other and have amazing sex and just wanna spend more time together. But if you have this new fangled dictionary that gets you made at me, then we have to, y'know, get you my original dictionary. I am so bad at this.
Monica: I think you're better than you think you are.
Chandler: Really? Okay, so
Monica: (interrupting) Know when to stop.
Chandler: Y'know, I sensed that I should stop. So we're okay?
Monica: Yeah. All right, I'm gonna go tell Dan that it's not gonna happen. (They kiss and as she starts to leave, Chandler starts to dance. Without turning around.) Don't do the dance.
Chandler: Right!
[Scene: The delivery room, everyone except Rachel is there. Phoebe, Monica, and Ross are holding the babies.]
Monica: I think you're my favorite.
Phoebe: Which one do you have?
Monica: I don't care.
Rachel: (entering) Hi. (To Phoebe) Hey, hi! So uh, Frank and Alice wanted me to tell you that they're still outside making phone calls.

Phoebe: Oh. It was a long shot. Hey, you guys can I just like have a second alone with the babies.
All: Yeah, sure yeah. Yeah.
(They hand her the babies and leave them alone.)
Phoebe: So, here you are. It seems like yesterday I was talking to you in that little petri dish. Everyone said labor was the hardest thing I'd ever have to do, but they were wrong this is. Oh, I had the most fun with you guys! I wish I could take you home and see you everyday. Okay, I'll settle for being your favorite Aunt. I know Alice's sister has a pool, but you lived in me. Okay, so we're cool. Yeah, we're gonna be great. Little high fives! (Imitates the high fives.) Ahh! Ahh! Ahh! (One of the babies begins to cry.) Well, if you're gonna cry. (She starts crying.)
Ending Credits
[Scene: The delivery room, everyone is hanging out with Phoebe. Frank, Alice, and the kids aren't there.]
 You're amazing!
Phoebe: I know.
Rachel: So does it really hurt as bad as they say?
Phoebe: Yeah. You won't be able to take it.

Phoebe: They're gonna call her Chandler.
Chandler: That's kind of a masculine name, don't you think?
Phoebe: Works on you.
End


defer - Defered execution
The defer commands allow a developer to schedule actions to happen as part of the current variable scope terminating. This is most useful for dealing with cleanup activities. Since the defered actions always execute, and always execute in the reverse order from which the defer statements themselves execute, the programmer can schedule the cleanup of a resource (for example, a channel) as soon as that resource is acquired. Then, later if the procedure or lambda ends, either due to an error, or an explicit return, the cleanup of that resource will always occur.
Defers execution of some code until the current variable scope ends. Each argument is concatencated together to form the script to execute at deferal time. Multiple defer statements may be used, they are executed in the order of last-in, first-out. The return value is an identifier which can be used later with defer::cancel
Defers execution of a script while copying the current value of some variables, whose names specified in variableList, into the script. The script acts like a lambda but executes at the same level as the defer::with call. The return value is the same as ::defer::defer
The same as ::defer::with but uses all local variables in the variable list.
Cancels the execution of a defered action. The id argument is the identifier returned by ::defer::defer, ::defer::with, or ::defer::autowith. Any number of arguments may be supplied, and all of the IDs supplied will be cancelled.
package require defer 1 apply {{} { set fd [open /dev/null] defer::defer close $fd }}
Roy Keene
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category defer of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.
When proposing code changes, please provide unified diffs, i.e the output of diff -u.
Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.
Utility
Copyright © 2017, Roy Keene