Interface ProtonBuffer
-
- All Superinterfaces:
Comparable<ProtonBuffer>
- All Known Implementing Classes:
ProtonAbstractBuffer
,ProtonByteBuffer
,ProtonCompositeBuffer
,ProtonDuplicatedBuffer
,ProtonNettyByteBuffer
,ProtonNioByteBuffer
,ProtonSlicedBuffer
public interface ProtonBuffer extends Comparable<ProtonBuffer>
Buffer type abstraction used to provide users of the proton library with a means of using their own type of byte buffer types in combination with the library tooling.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description int
capacity()
ProtonBuffer
capacity(int newCapacity)
Adjusts the capacity of this buffer.ProtonBuffer
clear()
Reset the read and write offsets to zero and clears the position markers if set previously, this method is not required to reset the data previously written to this buffer.int
compareTo(ProtonBuffer buffer)
Compares the remaining content of the current buffer with the remaining content of the given buffer, which must not be null.ProtonBuffer
copy()
Create a deep copy of the readable bytes of this ProtonBuffer, the returned buffer can be modified without affecting the contents or position markers of this instance.ProtonBuffer
copy(int index, int length)
Returns a copy of this buffer's sub-region.ProtonBuffer
duplicate()
Create a duplicate of this ProtonBuffer instance that shares the same backing data store and but maintains separate position index values.ProtonBuffer
ensureWritable(int amount)
Ensures that the requested number of bytes is available for write operations in the current buffer, growing the buffer if needed to meet the requested writable capacity.byte[]
getArray()
Returns the backing array for this ProtonBuffer instance if there is such an array or throws an exception if this ProtonBuffer implementation has no backing array.int
getArrayOffset()
boolean
getBoolean(int index)
Gets a boolean from the specified index, this method will not modify the read or write index.byte
getByte(int index)
Gets a byte from the specified index, this method will not modify the read or write index.ProtonBuffer
getBytes(int index, byte[] destination)
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
.ProtonBuffer
getBytes(int index, byte[] destination, int offset, int length)
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
.ProtonBuffer
getBytes(int index, ByteBuffer destination)
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
until the destination's position reaches its limit.ProtonBuffer
getBytes(int index, ProtonBuffer destination)
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
until the destination becomes non-writable.ProtonBuffer
getBytes(int index, ProtonBuffer destination, int length)
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
.ProtonBuffer
getBytes(int index, ProtonBuffer destination, int offset, int length)
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
.char
getChar(int index)
Gets a 2-byte char from the specified index, this method will not modify the read or write index.double
getDouble(int index)
Gets a double from the specified index, this method will not modify the read or write index.float
getFloat(int index)
Gets a float from the specified index, this method will not modify the read or write index.int
getInt(int index)
Gets a int from the specified index, this method will not modify the read or write index.long
getLong(int index)
Gets a long from the specified index, this method will not modify the read or write index.int
getMaxWritableBytes()
Gets the current maximum number of bytes that can be written to this buffer.int
getReadableBytes()
int
getReadIndex()
short
getShort(int index)
Gets a short from the specified index, this method will not modify the read or write index.short
getUnsignedByte(int index)
Gets a unsigned byte from the specified index, this method will not modify the read or write index.long
getUnsignedInt(int index)
Gets a unsigned int from the specified index, this method will not modify the read or write index.int
getUnsignedShort(int index)
Gets a unsigned short from the specified index, this method will not modify the read or write index.int
getWritableBytes()
int
getWriteIndex()
boolean
hasArray()
boolean
isReadable()
boolean
isReadable(int size)
Check if the given number of bytes can be read from the buffer.boolean
isWritable()
boolean
isWritable(int size)
Check if the requested number of bytes can be written into this buffer.ProtonBuffer
markReadIndex()
Marks the current read index so that it can later be restored by a call toresetReadIndex()
, the initial mark value is 0.ProtonBuffer
markWriteIndex()
Marks the current write index so that it can later be restored by a call toresetWriteIndex()
, the initial mark value is 0.int
maxCapacity()
Returns the number of bytes that this buffer is allowed to grow to when write operations exceed the current capacity value.boolean
readBoolean()
Reads a boolean value from the buffer and advances the read index by one.byte
readByte()
Reads one byte from the buffer and advances the read index by one.ProtonBuffer
readBytes(byte[] target)
Reads bytes from this buffer and writes them into the destination byte array incrementing the read index by the value of the length of the destination array.ProtonBuffer
readBytes(byte[] target, int length)
Reads bytes from this buffer and writes them into the destination byte array incrementing the read index by the length value passed.ProtonBuffer
readBytes(byte[] target, int offset, int length)
Reads bytes from this buffer and writes them into the destination byte array incrementing the read index by the length value passed, the bytes are read into the given buffer starting from the given offset value.ProtonBuffer
readBytes(ByteBuffer destination)
Transfers this buffer's data to the specified destination starting at the currentreadIndex
until the destination's position reaches its limit, and increases thereadIndex
by the number of the transferred bytes.ProtonBuffer
readBytes(ProtonBuffer target)
Reads bytes from this buffer and writes them into the destination ProtonBuffer incrementing the read index by the value of the number of bytes written to the target.ProtonBuffer
readBytes(ProtonBuffer target, int length)
Reads bytes from this buffer and writes them into the destination ProtonBuffer incrementing the read index by the number of bytes written.ProtonBuffer
readBytes(ProtonBuffer target, int offset, int length)
Transfers this buffer's data to the specified destination starting at the currentreadIndex
and increases thereadIndex
by the number of the transferred bytes (=length
).double
readDouble()
Reads a double value from the buffer and advances the read index by eight.float
readFloat()
Reads a float value from the buffer and advances the read index by four.int
readInt()
Reads a integer value from the buffer and advances the read index by four.long
readLong()
Reads a long value from the buffer and advances the read index by eight.short
readShort()
Reads a short value from the buffer and advances the read index by two.ProtonBuffer
resetReadIndex()
Resets the current read index to the previously marked value.ProtonBuffer
resetWriteIndex()
Resets the current write index to the previously marked value.ProtonBuffer
setBoolean(int index, boolean value)
Sets the boolean value at the given write index in this buffer's backing data store.ProtonBuffer
setByte(int index, int value)
Sets the byte value at the given write index in this buffer's backing data store.ProtonBuffer
setBytes(int index, byte[] source)
Transfers the specified source array's data to this buffer starting at the specified absoluteindex
.ProtonBuffer
setBytes(int index, byte[] source, int offset, int length)
Transfers the specified source array's data to this buffer starting at the specified absoluteindex
.ProtonBuffer
setBytes(int index, ByteBuffer source)
Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
until the source buffer's position reaches its limit.ProtonBuffer
setBytes(int index, ProtonBuffer source)
Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
until the source buffer becomes unreadable.ProtonBuffer
setBytes(int index, ProtonBuffer source, int length)
Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
.ProtonBuffer
setBytes(int index, ProtonBuffer source, int offset, int length)
Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
.ProtonBuffer
setChar(int index, int value)
Sets the char value at the given write index in this buffer's backing data store.ProtonBuffer
setDouble(int index, double value)
Sets the double value at the given write index in this buffer's backing data store.ProtonBuffer
setFloat(int index, float value)
Sets the float value at the given write index in this buffer's backing data store.ProtonBuffer
setIndex(int readIndex, int writeIndex)
Used to set the read index and the write index in one call.ProtonBuffer
setInt(int index, int value)
Sets the int value at the given write index in this buffer's backing data store.ProtonBuffer
setLong(int index, long value)
Sets the long value at the given write index in this buffer's backing data store.ProtonBuffer
setReadIndex(int value)
Sets the read index for this buffer.ProtonBuffer
setShort(int index, int value)
Sets the short value at the given write index in this buffer's backing data store.ProtonBuffer
setWriteIndex(int value)
Sets the write index for this buffer.ProtonBuffer
skipBytes(int length)
Increases the currentreadIndex
of this buffer by the specifiedlength
.ProtonBuffer
slice()
Create a new ProtonBuffer whose contents are a subsequence of the contents of thisProtonBuffer
.ProtonBuffer
slice(int index, int length)
Create a new ProtonBuffer whose contents are a subsequence of the contents of thisProtonBuffer
.ByteBuffer
toByteBuffer()
Returns a ByteBuffer that represents the readable bytes contained in this buffer.ByteBuffer
toByteBuffer(int index, int length)
Returns a ByteBuffer that represents the given span of bytes from the readable portion of this buffer.String
toString(Charset charset)
Returns a String created from the buffer's underlying bytes using the specifiedCharset
for the newly created String.default Object
unwrap()
Return the underlying buffer object that backs thisProtonBuffer
instance, or null if there is no backing object.ProtonBuffer
writeBoolean(boolean value)
Writes a single boolean to the buffer and advances the write index by one.ProtonBuffer
writeByte(int value)
Writes a single byte to the buffer and advances the write index by one.ProtonBuffer
writeBytes(byte[] value)
Writes the contents of the given byte array into the buffer and advances the write index by the length of the given array.ProtonBuffer
writeBytes(byte[] value, int length)
Writes the contents of the given byte array into the buffer and advances the write index by the length value given.ProtonBuffer
writeBytes(byte[] value, int offset, int length)
Writes the contents of the given byte array into the buffer and advances the write index by the length value given.ProtonBuffer
writeBytes(ByteBuffer source)
Transfers the specified source buffer's data to this buffer starting at the currentwriteIndex
until the source buffer's position reaches its limit, and increases thewriteIndex
by the number of the transferred bytes.ProtonBuffer
writeBytes(ProtonBuffer source)
Transfers the specified source buffer's data to this buffer starting at the currentwriteIndex
until the source buffer becomes unreadable, and increases thewriteIndex
by the number of the transferred bytes.ProtonBuffer
writeBytes(ProtonBuffer source, int length)
Transfers the specified source buffer's data to this buffer starting at the currentwriteIndex
and increases thewriteIndex
by the number of the transferred bytes (=length
).ProtonBuffer
writeBytes(ProtonBuffer source, int offset, int length)
Transfers the specified source buffer's data to this buffer starting at the currentwriteIndex
and increases thewriteIndex
by the number of the transferred bytes (=length
).ProtonBuffer
writeDouble(double value)
Writes a single double to the buffer and advances the write index by eight.ProtonBuffer
writeFloat(float value)
Writes a single float to the buffer and advances the write index by four.ProtonBuffer
writeInt(int value)
Writes a single integer to the buffer and advances the write index by four.ProtonBuffer
writeLong(long value)
Writes a single long to the buffer and advances the write index by eight.ProtonBuffer
writeShort(short value)
Writes a single short to the buffer and advances the write index by two.
-
-
-
Method Detail
-
unwrap
default Object unwrap()
Return the underlying buffer object that backs thisProtonBuffer
instance, or null if there is no backing object. This method should be overridden in buffer abstraction when access to the underlying backing store is needed such as when wrapping pooled resources that need explicit release calls.- Returns:
- an underlying buffer object or other backing store for this buffer.
-
hasArray
boolean hasArray()
- Returns:
- true if this buffer has a backing byte array that can be accessed.
-
getArray
byte[] getArray()
Returns the backing array for this ProtonBuffer instance if there is such an array or throws an exception if this ProtonBuffer implementation has no backing array.Changes to the returned array are visible to other users of this ProtonBuffer.
- Returns:
- the backing byte array for this ProtonBuffer.
- Throws:
UnsupportedOperationException
- if this buffer type has no backing array.
-
getArrayOffset
int getArrayOffset()
- Returns:
- the offset of the first byte in the backing array belonging to this buffer.
- Throws:
UnsupportedOperationException
- if this buffer type has no backing array.
-
capacity
int capacity()
- Returns:
- the number of bytes this buffer can currently contain.
-
capacity
ProtonBuffer capacity(int newCapacity)
Adjusts the capacity of this buffer. If the new capacity is less than the current capacity, the content of this buffer is truncated. If the new capacity is greater than the current capacity, the buffer is appended with unspecified data whose length is new capacity - current capacity.- Parameters:
newCapacity
- the new maximum capacity value of this buffer.- Returns:
- this buffer for using in call chaining.
-
maxCapacity
int maxCapacity()
Returns the number of bytes that this buffer is allowed to grow to when write operations exceed the current capacity value.- Returns:
- the number of bytes this buffer is allowed to grow to.
-
ensureWritable
ProtonBuffer ensureWritable(int amount) throws IndexOutOfBoundsException, IllegalArgumentException
Ensures that the requested number of bytes is available for write operations in the current buffer, growing the buffer if needed to meet the requested writable capacity. This method will not alter the write offset but may change the value returned from the capacity method if new buffer space is allocated.- Parameters:
amount
- The number of bytes beyond the current write index needed.- Returns:
- this buffer for using in call chaining.
- Throws:
IllegalArgumentException
- if the amount given is less than zero.IndexOutOfBoundsException
- if the amount given would result in the buffer exceeding the maximum capacity for this buffer.
-
duplicate
ProtonBuffer duplicate()
Create a duplicate of this ProtonBuffer instance that shares the same backing data store and but maintains separate position index values. Changes to one buffer are visible in any of its duplicates. This method does not copy the read or write markers to the new buffer instance.- Returns:
- a new ProtonBuffer instance that shares the backing data as this one.
-
slice
ProtonBuffer slice()
Create a new ProtonBuffer whose contents are a subsequence of the contents of thisProtonBuffer
.The starting point of the new buffer starts at this buffer's current position, the marks and limits of the new buffer will be independent of this buffer however changes to the data backing the buffer will be visible in this buffer.
- Returns:
- a new
ProtonBuffer
whose contents are a subsequence of this buffer.
-
slice
ProtonBuffer slice(int index, int length)
Create a new ProtonBuffer whose contents are a subsequence of the contents of thisProtonBuffer
.The starting point of the new buffer starts at given index into this buffer and spans the number of bytes given by the length. Changes to the contents of this buffer or to the produced slice buffer are visible in the other.
- Parameters:
index
- The index in this buffer where the slice should begin.length
- The number of bytes to make visible to the new buffer from this one.- Returns:
- a new
ProtonBuffer
whose contents are a subsequence of this buffer.
-
copy
ProtonBuffer copy()
Create a deep copy of the readable bytes of this ProtonBuffer, the returned buffer can be modified without affecting the contents or position markers of this instance.- Returns:
- a deep copy of this ProtonBuffer instance.
-
copy
ProtonBuffer copy(int index, int length)
Returns a copy of this buffer's sub-region. Modifying the content of the returned buffer or this buffer does not affect each other at all. This method does not modify the value returned fromgetReadIndex()
orgetWriteIndex()
of this buffer.- Parameters:
index
- The index in this buffer where the copy should beginlength
- The number of bytes to copy to the new buffer from this one.- Returns:
- a new ProtonBuffer instance containing the copied bytes.
-
clear
ProtonBuffer clear()
Reset the read and write offsets to zero and clears the position markers if set previously, this method is not required to reset the data previously written to this buffer.- Returns:
- this buffer for using in call chaining.
-
toByteBuffer
ByteBuffer toByteBuffer()
Returns a ByteBuffer that represents the readable bytes contained in this buffer.This method should attempt to return a ByteBuffer that shares the backing data store with this buffer however if that is not possible it is permitted that the returned ByteBuffer contain a copy of the readable bytes of this ProtonBuffer.
- Returns:
- a ByteBuffer that represents the readable bytes of this buffer.
-
toByteBuffer
ByteBuffer toByteBuffer(int index, int length)
Returns a ByteBuffer that represents the given span of bytes from the readable portion of this buffer.This method should attempt to return a ByteBuffer that shares the backing data store with this buffer however if that is not possible it is permitted that the returned ByteBuffer contain a copy of the readable bytes of this ProtonBuffer.
- Parameters:
index
- The starting index in this where the ByteBuffer view should begin.length
- The number of bytes to include in the ByteBuffer view.- Returns:
- a ByteBuffer that represents the given view of this buffers readable bytes.
-
toString
String toString(Charset charset)
Returns a String created from the buffer's underlying bytes using the specifiedCharset
for the newly created String.
-
getReadableBytes
int getReadableBytes()
- Returns:
- the number of bytes available for reading from this buffer.
-
getWritableBytes
int getWritableBytes()
- Returns:
- the number of bytes that can be written to this buffer before the limit is hit.
-
getMaxWritableBytes
int getMaxWritableBytes()
Gets the current maximum number of bytes that can be written to this buffer. This is the same value that can be computed by subtracting the current write index from the maximum buffer capacity.- Returns:
- the maximum number of bytes that can be written to this buffer before the limit is hit.
-
getReadIndex
int getReadIndex()
- Returns:
- the current value of the read index for this buffer.
-
setReadIndex
ProtonBuffer setReadIndex(int value)
Sets the read index for this buffer.- Parameters:
value
- The index into the buffer where the read index should be positioned.- Returns:
- this buffer for use in chaining.
- Throws:
IndexOutOfBoundsException
- if the value given is greater than the write index or negative.
-
getWriteIndex
int getWriteIndex()
- Returns:
- the current value of the write index for this buffer.
-
setWriteIndex
ProtonBuffer setWriteIndex(int value)
Sets the write index for this buffer.- Parameters:
value
- The index into the buffer where the write index should be positioned.- Returns:
- this buffer for use in chaining.
- Throws:
IndexOutOfBoundsException
- if the value less than the read index or greater than the capacity.
-
setIndex
ProtonBuffer setIndex(int readIndex, int writeIndex)
Used to set the read index and the write index in one call. This methods allows for an update to the read index and write index to values that could not be set using simple setReadIndex and setWriteIndex call where the values would violate the constraints placed on them by the value of the other index.- Parameters:
readIndex
- The new read index to assign to this buffer.writeIndex
- The new write index to assign to this buffer.- Returns:
- this buffer for use in chaining.
- Throws:
IndexOutOfBoundsException
- if the values violate the basic tenants of readIndex and writeIndex
-
markReadIndex
ProtonBuffer markReadIndex()
Marks the current read index so that it can later be restored by a call toresetReadIndex()
, the initial mark value is 0.- Returns:
- this buffer for use in chaining.
-
resetReadIndex
ProtonBuffer resetReadIndex()
Resets the current read index to the previously marked value.- Returns:
- this buffer for use in chaining.
- Throws:
IndexOutOfBoundsException
- if the current write index is less than the marked read index.
-
markWriteIndex
ProtonBuffer markWriteIndex()
Marks the current write index so that it can later be restored by a call toresetWriteIndex()
, the initial mark value is 0.- Returns:
- this buffer for use in chaining.
-
resetWriteIndex
ProtonBuffer resetWriteIndex()
Resets the current write index to the previously marked value.- Returns:
- this buffer for use in chaining.
- Throws:
IndexOutOfBoundsException
- if the current read index is greater than the marked write index.
-
isReadable
boolean isReadable()
- Returns:
- true if the read index is less than the write index.
-
isReadable
boolean isReadable(int size)
Check if the given number of bytes can be read from the buffer.- Parameters:
size
- the size that is desired in readable bytes- Returns:
- true if the buffer has at least the given number of readable bytes remaining.
-
compareTo
int compareTo(ProtonBuffer buffer)
Compares the remaining content of the current buffer with the remaining content of the given buffer, which must not be null. Each byte is compared in turn as an unsigned value, returning upon the first difference. If no difference is found before the end of one buffer, the shorter buffer is considered less than the other, or else if the same length then they are considered equal.- Specified by:
compareTo
in interfaceComparable<ProtonBuffer>
- Returns:
- a negative, zero, or positive integer when this buffer is less than, equal to, or greater than the given buffer.
- See Also:
Comparable.compareTo(Object)
-
getBoolean
boolean getBoolean(int index)
Gets a boolean from the specified index, this method will not modify the read or write index.- Parameters:
index
- The index into the buffer where the value should be read.- Returns:
- the value read from the given index.
- Throws:
IndexOutOfBoundsException
- if the index is negative or past the current buffer capacity.
-
getByte
byte getByte(int index)
Gets a byte from the specified index, this method will not modify the read or write index.- Parameters:
index
- The index into the buffer where the value should be read.- Returns:
- the value read from the given index.
- Throws:
IndexOutOfBoundsException
- if the index is negative or past the current buffer capacity.
-
getUnsignedByte
short getUnsignedByte(int index)
Gets a unsigned byte from the specified index, this method will not modify the read or write index.- Parameters:
index
- The index into the buffer where the value should be read.- Returns:
- the value read from the given index.
- Throws:
IndexOutOfBoundsException
- if the index is negative or past the current buffer capacity.
-
getChar
char getChar(int index)
Gets a 2-byte char from the specified index, this method will not modify the read or write index.- Parameters:
index
- The index into the buffer where the value should be read.- Returns:
- the value read from the given index.
- Throws:
IndexOutOfBoundsException
- if the index is negative or past the current buffer capacity.
-
getShort
short getShort(int index)
Gets a short from the specified index, this method will not modify the read or write index.- Parameters:
index
- The index into the buffer where the value should be read.- Returns:
- the value read from the given index.
- Throws:
IndexOutOfBoundsException
- if the index is negative or past the current buffer capacity.
-
getUnsignedShort
int getUnsignedShort(int index)
Gets a unsigned short from the specified index, this method will not modify the read or write index.- Parameters:
index
- The index into the buffer where the value should be read.- Returns:
- the value read from the given index.
- Throws:
IndexOutOfBoundsException
- if the index is negative or past the current buffer capacity.
-
getInt
int getInt(int index)
Gets a int from the specified index, this method will not modify the read or write index.- Parameters:
index
- The index into the buffer where the value should be read.- Returns:
- the value read from the given index.
- Throws:
IndexOutOfBoundsException
- if the index is negative or past the current buffer capacity.
-
getUnsignedInt
long getUnsignedInt(int index)
Gets a unsigned int from the specified index, this method will not modify the read or write index.- Parameters:
index
- The index into the buffer where the value should be read.- Returns:
- the value read from the given index.
- Throws:
IndexOutOfBoundsException
- if the index is negative or past the current buffer capacity.
-
getLong
long getLong(int index)
Gets a long from the specified index, this method will not modify the read or write index.- Parameters:
index
- The index into the buffer where the value should be read.- Returns:
- the value read from the given index.
- Throws:
IndexOutOfBoundsException
- if the index is negative or past the current buffer capacity.
-
getFloat
float getFloat(int index)
Gets a float from the specified index, this method will not modify the read or write index.- Parameters:
index
- The index into the buffer where the value should be read.- Returns:
- the value read from the given index.
- Throws:
IndexOutOfBoundsException
- if the index is negative or past the current buffer capacity.
-
getDouble
double getDouble(int index)
Gets a double from the specified index, this method will not modify the read or write index.- Parameters:
index
- The index into the buffer where the value should be read.- Returns:
- the value read from the given index.
- Throws:
IndexOutOfBoundsException
- if the index is negative or past the current buffer capacity.
-
getBytes
ProtonBuffer getBytes(int index, ProtonBuffer destination)
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
until the destination becomes non-writable. This method is basically same withgetBytes(int, ProtonBuffer, int, int)
, except that this method increases thewriteIndex
of the destination by the number of the transferred bytes whilegetBytes(int, ProtonBuffer, int, int)
does not. This method does not modifyreadIndex
orwriteIndex
of the source buffer (i.e.this
).- Parameters:
index
- The index into the buffer where the value should be read.destination
- the destination buffer for the bytes to be read- Returns:
- this buffer for chaining
- Throws:
IndexOutOfBoundsException
- if the specifiedindex
is less than0
or ifindex + dst.writableBytes
is greater thanthis.capacity
-
getBytes
ProtonBuffer getBytes(int index, ProtonBuffer destination, int length)
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
. This method is basically same withgetBytes(int, ProtonBuffer, int, int)
, except that this method increases thewriteIndex
of the destination by the number of the transferred bytes whilegetBytes(int, ProtonBuffer, int, int)
does not. This method does not modifyreadIndex
orwriteIndex
of the source buffer (i.e.this
).- Parameters:
index
- the index in the buffer to start the read fromdestination
- the destination buffer for the bytes to be readlength
- the number of bytes to transfer- Returns:
- this buffer for chaining
- Throws:
IndexOutOfBoundsException
- if the specifiedindex
is less than0
, ifindex + length
is greater thanthis.capacity
, or iflength
is greater thandst.writableBytes
-
getBytes
ProtonBuffer getBytes(int index, ProtonBuffer destination, int offset, int length)
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
. This method does not modifyreadIndex
orwriteIndex
of both the source (i.e.this
) and the destination.- Parameters:
index
- The index into the buffer where the value should be read.destination
- The buffer where the bytes read will be written tooffset
- The offset into the destination where the write startslength
- The number of bytes to transfer- Returns:
- this buffer for chaining
- Throws:
IndexOutOfBoundsException
- if the specifiedindex
is less than0
, if the specifieddstIndex
is less than0
, ifindex + length
is greater thanthis.capacity
, or ifdstIndex + length
is greater thandst.capacity
-
getBytes
ProtonBuffer getBytes(int index, byte[] destination)
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
. This method does not modifyreadIndex
orwriteIndex
of this buffer- Parameters:
index
- The index into the buffer where the value should be read.destination
- The buffer where the bytes read will be written to- Returns:
- this buffer for chaining
- Throws:
IndexOutOfBoundsException
- if the specifiedindex
is less than0
or ifindex + dst.length
is greater thanthis.capacity
-
getBytes
ProtonBuffer getBytes(int index, byte[] destination, int offset, int length)
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
. This method does not modify#getReadIndex()
or#getWriteIndex()
of this buffer.- Parameters:
index
- The index into the buffer where the value should be read.destination
- The buffer where the bytes read will be written tooffset
- the offset into the destination to begin writing the bytes.length
- the number of bytes to transfer from this buffer to the target buffer.- Returns:
- this buffer for chaining
- Throws:
IndexOutOfBoundsException
- if the specifiedindex
is less than0
, if the specifiedoffset
is less than0
, ifindex + length
is greater thanthis.capacity
, or ifoffset + length
is greater thantarget.length
-
getBytes
ProtonBuffer getBytes(int index, ByteBuffer destination)
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
until the destination's position reaches its limit. This method does not modify#getReadIndex()
or#getWriteIndex()
of this buffer while the destination'sposition
will be increased.- Parameters:
index
- The index into the buffer where the value should be read.destination
- The buffer where the bytes read will be written to- Returns:
- this buffer for chaining
- Throws:
IndexOutOfBoundsException
- if the specifiedindex
is less than0
or ifindex + destination.remaining()
is greater than#capacity()
-
setByte
ProtonBuffer setByte(int index, int value)
Sets the byte value at the given write index in this buffer's backing data store.- Parameters:
index
- The index to start the write from.value
- The value to write at the given index.- Returns:
- a reference to this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if the index is negative or the write would exceed capacity.
-
setBoolean
ProtonBuffer setBoolean(int index, boolean value)
Sets the boolean value at the given write index in this buffer's backing data store.- Parameters:
index
- The index to start the write from.value
- The value to write at the given index.- Returns:
- a reference to this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if the index is negative or the write would exceed capacity.
-
setChar
ProtonBuffer setChar(int index, int value)
Sets the char value at the given write index in this buffer's backing data store.- Parameters:
index
- The index to start the write from.value
- The value to write at the given index.- Returns:
- a reference to this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if the index is negative or the write would exceed capacity.
-
setShort
ProtonBuffer setShort(int index, int value)
Sets the short value at the given write index in this buffer's backing data store.- Parameters:
index
- The index to start the write from.value
- The value to write at the given index.- Returns:
- a reference to this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if the index is negative or the write would exceed capacity.
-
setInt
ProtonBuffer setInt(int index, int value)
Sets the int value at the given write index in this buffer's backing data store.- Parameters:
index
- The index to start the write from.value
- The value to write at the given index.- Returns:
- a reference to this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if the index is negative or the write would exceed capacity.
-
setLong
ProtonBuffer setLong(int index, long value)
Sets the long value at the given write index in this buffer's backing data store.- Parameters:
index
- The index to start the write from.value
- The value to write at the given index.- Returns:
- a reference to this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if the index is negative or the write would exceed capacity.
-
setFloat
ProtonBuffer setFloat(int index, float value)
Sets the float value at the given write index in this buffer's backing data store.- Parameters:
index
- The index to start the write from.value
- The value to write at the given index.- Returns:
- a reference to this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if the index is negative or the write would exceed capacity.
-
setDouble
ProtonBuffer setDouble(int index, double value)
Sets the double value at the given write index in this buffer's backing data store.- Parameters:
index
- The index to start the write from.value
- The value to write at the given index.- Returns:
- a reference to this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if the index is negative or the write would exceed capacity.
-
setBytes
ProtonBuffer setBytes(int index, ProtonBuffer source)
Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
until the source buffer becomes unreadable. This method is basically same withsetBytes(int, ProtonBuffer, int, int)
, except that this method increases thereadIndex
of the source buffer by the number of the transferred bytes whilesetBytes(int, ProtonBuffer, int, int)
does not. This method does not modifyreadIndex
orwriteIndex
of the source buffer (i.e.this
).- Parameters:
index
- The index in this buffer where the write operation starts.source
- The source buffer from which the bytes are read.- Returns:
- this buffer for chaining
- Throws:
IndexOutOfBoundsException
- if the specifiedindex
is less than0
or ifindex + source.readableBytes
is greater thanthis.capacity
-
setBytes
ProtonBuffer setBytes(int index, ProtonBuffer source, int length)
Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
. This method is basically same withsetBytes(int, ProtonBuffer, int, int)
, except that this method increases thereadIndex
of the source buffer by the number of the transferred bytes whilesetBytes(int, ProtonBuffer, int, int)
does not. This method does not modifyreadIndex
orwriteIndex
of the source buffer (i.e.this
).- Parameters:
index
- The index in this buffer where the write operation starts.source
- The source buffer from which the bytes are read.length
- The number of bytes to transfer- Returns:
- this buffer for chaining
- Throws:
IndexOutOfBoundsException
- if the specifiedindex
is less than0
, ifindex + length
is greater thanthis.capacity
, or iflength
is greater thansource.readableBytes
-
setBytes
ProtonBuffer setBytes(int index, ProtonBuffer source, int offset, int length)
Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
. This method does not modifyreadIndex
orwriteIndex
of both the source (i.e.this
) and the destination.- Parameters:
index
- The index in this buffer where the write operation starts.source
- The source buffer from which the bytes are read.offset
- The offset into the source where the set begins.length
- The number of bytes to transfer- Returns:
- this buffer for chaining
- Throws:
IndexOutOfBoundsException
- if the specifiedindex
is less than0
, if the specifiedsourceIndex
is less than0
, ifindex + length
is greater thanthis.capacity
, or ifsourceIndex + length
is greater thansource.capacity
-
setBytes
ProtonBuffer setBytes(int index, byte[] source)
Transfers the specified source array's data to this buffer starting at the specified absoluteindex
. This method does not modifyreadIndex
orwriteIndex
of this buffer.- Parameters:
index
- The index in this buffer where the write operation starts.source
- The source buffer from which the bytes are read.- Returns:
- this buffer for chaining
- Throws:
IndexOutOfBoundsException
- if the specifiedindex
is less than0
or ifindex + source.length
is greater thanthis.capacity
-
setBytes
ProtonBuffer setBytes(int index, byte[] source, int offset, int length)
Transfers the specified source array's data to this buffer starting at the specified absoluteindex
. This method does not modifyreadIndex
orwriteIndex
of this buffer.- Parameters:
index
- The index in this buffer where the write operation starts.source
- The source buffer from which the bytes are read.offset
- The offset into the source where the set begins.length
- The number of bytes to transfer- Returns:
- this buffer for chaining
- Throws:
IndexOutOfBoundsException
- if the specifiedindex
is less than0
, if the specifiedoffset
is less than0
, ifindex + length
is greater thanthis.capacity
, or ifoffset + length
is greater thansource.length
-
setBytes
ProtonBuffer setBytes(int index, ByteBuffer source)
Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
until the source buffer's position reaches its limit. This method does not modifyreadIndex
orwriteIndex
of this buffer.- Parameters:
index
- The index in this buffer where the write operation starts.source
- The source buffer from which the bytes are read.- Returns:
- this buffer for chaining
- Throws:
IndexOutOfBoundsException
- if the specifiedindex
is less than0
or ifindex + source.remaining()
is greater thanthis.capacity
-
skipBytes
ProtonBuffer skipBytes(int length)
Increases the currentreadIndex
of this buffer by the specifiedlength
.- Parameters:
length
- the number of bytes in this buffer to skip.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- iflength
is greater thanthis.readableBytes
-
readByte
byte readByte()
Reads one byte from the buffer and advances the read index by one.- Returns:
- a single byte from the ProtonBuffer.
- Throws:
IndexOutOfBoundsException
- if there is no readable bytes left in the buffer.
-
readBytes
ProtonBuffer readBytes(byte[] target)
Reads bytes from this buffer and writes them into the destination byte array incrementing the read index by the value of the length of the destination array.- Parameters:
target
- The byte array to write into.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if the target array is larger than the readable bytes.
-
readBytes
ProtonBuffer readBytes(byte[] target, int length)
Reads bytes from this buffer and writes them into the destination byte array incrementing the read index by the length value passed.- Parameters:
target
- The byte array to write into.length
- The number of bytes to read into the given array.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if the length is larger than the readable bytes, or length is greater than the length of the target array, or length is negative.
-
readBytes
ProtonBuffer readBytes(byte[] target, int offset, int length)
Reads bytes from this buffer and writes them into the destination byte array incrementing the read index by the length value passed, the bytes are read into the given buffer starting from the given offset value.- Parameters:
target
- The byte array to write into.offset
- The offset into the given array where bytes are written.length
- The number of bytes to read into the given array.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if the offset is negative, or if the length is greater than the current readable bytes or if the offset + length is great than the size of the target.
-
readBytes
ProtonBuffer readBytes(ProtonBuffer target)
Reads bytes from this buffer and writes them into the destination ProtonBuffer incrementing the read index by the value of the number of bytes written to the target. The number of bytes written will be the equal to the writable bytes of the target buffer. The write index of the target buffer will be incremented by the number of bytes written into it.- Parameters:
target
- The ProtonBuffer to write into.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IllegalArgumentException
- if the target buffer is this buffer.IndexOutOfBoundsException
- if the target buffer has more writable bytes than this buffer has readable bytes.
-
readBytes
ProtonBuffer readBytes(ProtonBuffer target, int length)
Reads bytes from this buffer and writes them into the destination ProtonBuffer incrementing the read index by the number of bytes written. The write index of the target buffer will be incremented by the number of bytes written into it.- Parameters:
target
- The ProtonBuffer to write into.length
- The number of bytes to read into the given buffer.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if the length value is greater than the readable bytes of this buffer or is greater than the writable bytes of the target buffer..
-
readBytes
ProtonBuffer readBytes(ProtonBuffer target, int offset, int length)
Transfers this buffer's data to the specified destination starting at the currentreadIndex
and increases thereadIndex
by the number of the transferred bytes (=length
). This method does not modify the write index of the target buffer.- Parameters:
target
- The ProtonBuffer to write into.offset
- The offset into the given buffer where bytes are written.length
- The number of bytes to read into the given buffer.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if the offset is negative, or if the length is greater than the current readable bytes or if the offset + length is great than the size of the target.
-
readBytes
ProtonBuffer readBytes(ByteBuffer destination)
Transfers this buffer's data to the specified destination starting at the currentreadIndex
until the destination's position reaches its limit, and increases thereadIndex
by the number of the transferred bytes.- Parameters:
destination
- The target ByteBuffer to write into.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if the destination does not have enough capacity.
-
readBoolean
boolean readBoolean()
Reads a boolean value from the buffer and advances the read index by one.- Returns:
- boolean value read from the buffer.
- Throws:
IndexOutOfBoundsException
- if a value cannot be read from the buffer.
-
readShort
short readShort()
Reads a short value from the buffer and advances the read index by two.- Returns:
- short value read from the buffer.
- Throws:
IndexOutOfBoundsException
- if a value cannot be read from the buffer.
-
readInt
int readInt()
Reads a integer value from the buffer and advances the read index by four.- Returns:
- integer value read from the buffer.
- Throws:
IndexOutOfBoundsException
- if a value cannot be read from the buffer.
-
readLong
long readLong()
Reads a long value from the buffer and advances the read index by eight.- Returns:
- long value read from the buffer.
- Throws:
IndexOutOfBoundsException
- if a value cannot be read from the buffer.
-
readFloat
float readFloat()
Reads a float value from the buffer and advances the read index by four.- Returns:
- float value read from the buffer.
- Throws:
IndexOutOfBoundsException
- if a value cannot be read from the buffer.
-
readDouble
double readDouble()
Reads a double value from the buffer and advances the read index by eight.- Returns:
- double value read from the buffer.
- Throws:
IndexOutOfBoundsException
- if a value cannot be read from the buffer.
-
isWritable
boolean isWritable()
- Returns:
- true if the buffer has bytes remaining between the write index and the capacity.
-
isWritable
boolean isWritable(int size)
Check if the requested number of bytes can be written into this buffer.- Parameters:
size
- The number writable bytes that is being checked in this buffer.- Returns:
- true if the buffer has space left for the given number of bytes to be written.
-
writeByte
ProtonBuffer writeByte(int value)
Writes a single byte to the buffer and advances the write index by one.- Parameters:
value
- The byte to write into the buffer.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if there is no room in the buffer for this write operation.
-
writeBytes
ProtonBuffer writeBytes(byte[] value)
Writes the contents of the given byte array into the buffer and advances the write index by the length of the given array.- Parameters:
value
- The byte array to write into the buffer.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if there is no room in the buffer for this write operation.
-
writeBytes
ProtonBuffer writeBytes(byte[] value, int length)
Writes the contents of the given byte array into the buffer and advances the write index by the length value given.- Parameters:
value
- The byte array to write into the buffer.length
- The number of bytes to write from the given array into this buffer- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if there is no room in the buffer for this write operation.
-
writeBytes
ProtonBuffer writeBytes(byte[] value, int offset, int length)
Writes the contents of the given byte array into the buffer and advances the write index by the length value given. The bytes written into this buffer are read starting at the given offset into the passed in byte array.- Parameters:
value
- The byte array to write into the buffer.offset
- The offset into the given array to start reading from.length
- The number of bytes to write from the given array into this buffer- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if there is no room in the buffer for this write operation.
-
writeBytes
ProtonBuffer writeBytes(ProtonBuffer source)
Transfers the specified source buffer's data to this buffer starting at the currentwriteIndex
until the source buffer becomes unreadable, and increases thewriteIndex
by the number of the transferred bytes. This method is basically same withwriteBytes(ProtonBuffer, int, int)
, except that this method increases thereadIndex
of the source buffer by the number of the transferred bytes whilewriteBytes(ProtonBuffer, int, int)
does not.- Parameters:
source
- The source buffer from which the bytes are read.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- ifsource.readableBytes
is greater thanthis.writableBytes
-
writeBytes
ProtonBuffer writeBytes(ProtonBuffer source, int length)
Transfers the specified source buffer's data to this buffer starting at the currentwriteIndex
and increases thewriteIndex
by the number of the transferred bytes (=length
). This method is basically same withwriteBytes(ProtonBuffer, int, int)
, except that this method increases thereadIndex
of the source buffer by the number of the transferred bytes (=length
) whilewriteBytes(ProtonBuffer, int, int)
does not.- Parameters:
source
- The source buffer from which the bytes are read.length
- The number of bytes to transfer- Returns:
- this buffer for chaining
- Throws:
IndexOutOfBoundsException
- iflength
is greater thanthis.writableBytes
or iflength
is greater thensource.readableBytes
-
writeBytes
ProtonBuffer writeBytes(ProtonBuffer source, int offset, int length)
Transfers the specified source buffer's data to this buffer starting at the currentwriteIndex
and increases thewriteIndex
by the number of the transferred bytes (=length
). This method does not modify the read index of the source buffer.- Parameters:
source
- The source buffer from which the bytes are read.offset
- The offset in the source buffer to start writing into this buffer.length
- The number of bytes to transfer- Returns:
- this buffer for chaining
- Throws:
IndexOutOfBoundsException
- if the specifiedoffset
is less than0
, ifoffset + length
is greater thansource.capacity
, or iflength
is greater thanthis.writableBytes
-
writeBytes
ProtonBuffer writeBytes(ByteBuffer source)
Transfers the specified source buffer's data to this buffer starting at the currentwriteIndex
until the source buffer's position reaches its limit, and increases thewriteIndex
by the number of the transferred bytes.- Parameters:
source
- The source buffer from which the bytes are read.- Returns:
- this buffer for chaining
- Throws:
IndexOutOfBoundsException
- ifsource.remaining()
is greater thanthis.writableBytes
-
writeBoolean
ProtonBuffer writeBoolean(boolean value)
Writes a single boolean to the buffer and advances the write index by one.- Parameters:
value
- The boolean to write into the buffer.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if there is no room in the buffer for this write operation.
-
writeShort
ProtonBuffer writeShort(short value)
Writes a single short to the buffer and advances the write index by two.- Parameters:
value
- The short to write into the buffer.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if there is no room in the buffer for this write operation.
-
writeInt
ProtonBuffer writeInt(int value)
Writes a single integer to the buffer and advances the write index by four.- Parameters:
value
- The integer to write into the buffer.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if there is no room in the buffer for this write operation.
-
writeLong
ProtonBuffer writeLong(long value)
Writes a single long to the buffer and advances the write index by eight.- Parameters:
value
- The long to write into the buffer.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if there is no room in the buffer for this write operation.
-
writeFloat
ProtonBuffer writeFloat(float value)
Writes a single float to the buffer and advances the write index by four.- Parameters:
value
- The float to write into the buffer.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if there is no room in the buffer for this write operation.
-
writeDouble
ProtonBuffer writeDouble(double value)
Writes a single double to the buffer and advances the write index by eight.- Parameters:
value
- The double to write into the buffer.- Returns:
- this ProtonBuffer for chaining.
- Throws:
IndexOutOfBoundsException
- if there is no room in the buffer for this write operation.
-
-


http link: http://link.co.uk/to#something
https link: https://link.info?param url
link with trailing period: https://example.com. (FIXME: known failure)
this should not make a link: foo.bar
this is a link without leading space: badlatex.http://example.com
this is already a link with href: example.com
href example.com
href without http://, Engrafo should add it: example.com


PHOTOS: Fire breaks out in busy market in Lagos, Nigeria
by Yahoo News Photo StaffNigerian firefighters were battling two fires that broke out almost simultaneously at a busy market in central Lagos, the country’s largest city and commercial center.
Balogun Market, where the fires erupted, is one of Nigeria’s largest textile markets.
“We have split our team in two to fight both fires,” Ganiyu Olayiwola, head of the Federal Fire Service in Lagos, said.
The two fires do not appear to be related, he said, adding that it was not immediately clear if there were any casualties. Thick black smoke and flames were shooting up from five-story buildings surrounding the market as firetrucks attempted to get access to the fire.
Residents were throwing what belongings they could from the buildings and some people on the rooftops were using small buckets of water to try to stop the fire. The fire started in the morning and became a major blaze by midday, with firefighters trying to keep the flames from spreading.
The Balogun market sprawls across many blocks on Lagos Island. It is well known as one of the best places in Lagos to buy colorful Nigerian fabrics, apparel and shoes. Fires and other disasters are frequent on Lagos Island where the Balogun market is located.
In March, at least 20 people, most of them schoolchildren, died with the collapse of a three-story building housing a school, residential apartments and shops. (AFP)
See more news-related photo galleries and follow us on Yahoo News Photo Twitter and Tumblr .
_____
Download the Yahoo News app to customize your experience.
See more galleries from Yahoo News Photo:
- PHOTOS: Millions in Indian capital endure 'eye-burning' smog
- PHOTOS: Feeling the pain and joy of running the New York City Marathon
- PHOTOS: Jepkosgei wins NYC in 1st marathon, Kamworor takes men's
- PHOTOS: 46th annual NYC Halloween Parade
- PHOTOS: Yugoslavia's brutalist relics fascinate the Instagram generation
- PHOTOS: New protests rage in Chile after president's concessions rejected


collections
Parts
[de]composed
Dancing Under The Black Moon
Named Later
projects
shop
press
bio
contact


Pushing transparency beyond the norm
Many of the discussions that I have about transparency in research focus on the scrutiny of research methods and products. Transparency in research, people argue, is vital to demonstrate that the research was conducted in an ethical fashion and that the methods are sound. This understanding of transparency - to my mind at least - is extremely “data-centric” and focuses on the scrutiny and re-usability of data as the primary object of these actions. This data-centric understanding of transparency has undoubtedly been influenced by the rapid rise in FAIR data discussions that foreground the interoperability and re-usability of data as primary aspects of quality research.
In this project we are setting up a survey to assess data sharing practices amongst researchers on the African continent. Anelda, Thomas and I are all strong supporters of the Open Science movement, and optimising the transparency of our research and the re-usability of our data is, of course, very close to our hearts. Transparency in our research was never in question.
Nonetheless, when we came to planning how we would foreground transparency in our project design, we soon realised that we were not thinking nearly big enough. It became clear that we were missing a key opportunity to turn transparency into both a learning tool and a multifaceted tool for future research. By being transparent in all aspects of our project – not just in our data collection and analysis - we could potentially offer additional resources that could help future researchers. In particular, we asked ourselves, could we optimize transparency and re-usability in the more procedural aspects of project design to cut down the administrative burden for future researchers?
This discussion has not only been challenging, but also extremely exciting. It has pushed us to think about how we can build in re-usability elements into areas of our project that we’d never even considered. It also required us sometimes to fight against that “knee-jerk” reaction that we all sometimes encounter. The one where you have to sit yourself down and logically deconstruct why your automatic response is to not share, despite not being backed by any compelling reason. To date, these discussions have led us to commit to the following steps: Sharing the project proposal on the project website – not only to allow participants and downstream users to see what we want to do (and whether we’re getting it right), but also to be able to use the text as a guide for future applications Sharing our “work in progress” analysis of existing surveys, so that interested parties can see how we’ve got to the survey tool that we’re using Sharing not only our survey tool but also the larger question bank of questions that we developed. We we see this as a potential “plug and play” resource for future surveys Sharing our analysis code – not only so that readers can understand how we analysed the data, but also can re-use the code to analyse their own datasets gathered using our survey tool Sharing our website as a clone-able template. Many researchers lack the technical expertise/support to make a project website. We would like to offer them ours as a template if they find themselves in this situation Sharing templates for report production, so that anyone re-using our survey could potentially produce a standard report by inserting their data into the report template
We are hoping to demonstrate that by careful planning and a little creative effort we can create a range of tools that helps future researchers run surveys of their own. This is good for the researchers, and lowers the amount of set-up time they need before gathering data. It is good for us too, as (hopefully) more people will use our survey and expand our datasets. With such a win-win situation clearly visible, what is not to like?


|
PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <ringbuffer.h>
Public Member Functions | |
| RingBuffer (unsigned num_items, size_t item_size) | |
| virtual | ~RingBuffer () |
| bool | put (const void *val, size_t val_size=0) |
| Put an item into the buffer. More... | |
| bool | put (int8_t val) |
| bool | put (uint8_t val) |
| bool | put (int16_t val) |
| bool | put (uint16_t val) |
| bool | put (int32_t val) |
| bool | put (uint32_t val) |
| bool | put (int64_t val) |
| bool | put (uint64_t val) |
| bool | put (float val) |
| bool | put (double val) |
| bool | force (const void *val, size_t val_size=0) |
| Force an item into the buffer, discarding an older item if there is not space. More... | |
| bool | force (int8_t val) |
| bool | force (uint8_t val) |
| bool | force (int16_t val) |
| bool | force (uint16_t val) |
| bool | force (int32_t val) |
| bool | force (uint32_t val) |
| bool | force (int64_t val) |
| bool | force (uint64_t val) |
| bool | force (float val) |
| bool | force (double val) |
| bool | get (void *val, size_t val_size=0) |
| Get an item from the buffer. More... | |
| bool | get (int8_t &val) |
| bool | get (uint8_t &val) |
| bool | get (int16_t &val) |
| bool | get (uint16_t &val) |
| bool | get (int32_t &val) |
| bool | get (uint32_t &val) |
| bool | get (int64_t &val) |
| bool | get (uint64_t &val) |
| bool | get (float &val) |
| bool | get (double &val) |
| unsigned | space (void) |
| unsigned | count (void) |
| bool | empty () |
| bool | full () |
| unsigned | size () |
| void | flush () |
| bool | resize (unsigned new_size) |
| void | print_info (const char *name) |
Private Member Functions | |
| unsigned | _next (unsigned index) |
| RingBuffer (const RingBuffer &) | |
| RingBuffer | operator= (const RingBuffer &) |
Private Attributes | |
| unsigned | _num_items |
| const size_t | _item_size |
| char * | _buf |
| volatile unsigned | _head |
| insertion point in _item_size units More... | |
| volatile unsigned | _tail |
| removal point in _item_size units More... | |
Definition at line 49 of file ringbuffer.h.
| RingBuffer< data_type >::RingBuffer | ( | unsigned | num_items, |
| size_t | item_size | ||
| ) |
Definition at line 46 of file ringbuffer.cpp.
References _buf, and ~RingBuffer().
|
virtual |
|
private |
|
private |
Definition at line 62 of file ringbuffer.cpp.
References _num_items.
Referenced by flush(), and full().
| unsigned RingBuffer< data_type >::count | ( | void | ) |
Definition at line 380 of file ringbuffer.cpp.
References _num_items, and space().
| bool RingBuffer< data_type >::empty | ( | ) |
Definition at line 68 of file ringbuffer.cpp.
Referenced by flush().
| void RingBuffer< data_type >::flush | ( | ) |
Definition at line 86 of file ringbuffer.cpp.
References _buf, _head, _item_size, _next(), _tail, empty(), and put().
| bool __EXPORT::RingBuffer::force | ( | const void * | val, |
| size_t | val_size = 0 |
||
| ) |
| bool RingBuffer< data_type >::force | ( | int8_t | val | ) |
Definition at line 190 of file ringbuffer.cpp.
References force().
| bool RingBuffer< data_type >::force | ( | uint8_t | val | ) |
Definition at line 196 of file ringbuffer.cpp.
References force().
| bool RingBuffer< data_type >::force | ( | int16_t | val | ) |
Definition at line 202 of file ringbuffer.cpp.
References force().
| bool RingBuffer< data_type >::force | ( | uint16_t | val | ) |
Definition at line 208 of file ringbuffer.cpp.
References force().
| bool RingBuffer< data_type >::force | ( | int32_t | val | ) |
Definition at line 214 of file ringbuffer.cpp.
References force().
| bool RingBuffer< data_type >::force | ( | uint32_t | val | ) |
Definition at line 220 of file ringbuffer.cpp.
References force().
| bool RingBuffer< data_type >::force | ( | int64_t | val | ) |
Definition at line 226 of file ringbuffer.cpp.
References force().
| bool RingBuffer< data_type >::force | ( | uint64_t | val | ) |
Definition at line 232 of file ringbuffer.cpp.
References force().
| bool RingBuffer< data_type >::force | ( | float | val | ) |
Definition at line 238 of file ringbuffer.cpp.
References force().
| bool RingBuffer< data_type >::force | ( | double | val | ) |
Definition at line 244 of file ringbuffer.cpp.
References force().
| bool RingBuffer< data_type >::full | ( | ) |
Definition at line 74 of file ringbuffer.cpp.
References _head, _next(), and _tail.
| bool __EXPORT::RingBuffer::get | ( | void * | val, |
| size_t | val_size = 0 |
||
| ) |
Get an item from the buffer.
| val | Item that was gotten |
| bool RingBuffer< data_type >::get | ( | int8_t & | val | ) |
Definition at line 299 of file ringbuffer.cpp.
| bool RingBuffer< data_type >::get | ( | uint8_t & | val | ) |
Definition at line 305 of file ringbuffer.cpp.
| bool RingBuffer< data_type >::get | ( | int16_t & | val | ) |
Definition at line 311 of file ringbuffer.cpp.
| bool RingBuffer< data_type >::get | ( | uint16_t & | val | ) |
Definition at line 317 of file ringbuffer.cpp.
| bool RingBuffer< data_type >::get | ( | int32_t & | val | ) |
Definition at line 323 of file ringbuffer.cpp.
| bool RingBuffer< data_type >::get | ( | uint32_t & | val | ) |
Definition at line 329 of file ringbuffer.cpp.
| bool RingBuffer< data_type >::get | ( | int64_t & | val | ) |
Definition at line 335 of file ringbuffer.cpp.
| bool RingBuffer< data_type >::get | ( | uint64_t & | val | ) |
Definition at line 341 of file ringbuffer.cpp.
| bool RingBuffer< data_type >::get | ( | float & | val | ) |
Definition at line 347 of file ringbuffer.cpp.
| bool RingBuffer< data_type >::get | ( | double & | val | ) |
Definition at line 353 of file ringbuffer.cpp.
|
private |
| void RingBuffer< data_type >::print_info | ( | const char * | name | ) |
Definition at line 409 of file ringbuffer.cpp.
References _buf, _head, _item_size, _num_items, and _tail.
| bool __EXPORT::RingBuffer::put | ( | const void * | val, |
| size_t | val_size = 0 |
||
| ) |
| bool RingBuffer< data_type >::put | ( | int8_t | val | ) |
Definition at line 113 of file ringbuffer.cpp.
References put().
| bool RingBuffer< data_type >::put | ( | uint8_t | val | ) |
Definition at line 119 of file ringbuffer.cpp.
References put().
| bool RingBuffer< data_type >::put | ( | int16_t | val | ) |
Definition at line 125 of file ringbuffer.cpp.
References put().
| bool RingBuffer< data_type >::put | ( | uint16_t | val | ) |
Definition at line 131 of file ringbuffer.cpp.
References put().
| bool RingBuffer< data_type >::put | ( | int32_t | val | ) |
Definition at line 137 of file ringbuffer.cpp.
References put().
| bool RingBuffer< data_type >::put | ( | uint32_t | val | ) |
Definition at line 143 of file ringbuffer.cpp.
References put().
| bool RingBuffer< data_type >::put | ( | int64_t | val | ) |
Definition at line 149 of file ringbuffer.cpp.
References put().
| bool RingBuffer< data_type >::put | ( | uint64_t | val | ) |
Definition at line 155 of file ringbuffer.cpp.
References put().
| bool RingBuffer< data_type >::put | ( | float | val | ) |
Definition at line 161 of file ringbuffer.cpp.
References put().
| bool RingBuffer< data_type >::put | ( | double | val | ) |
Definition at line 167 of file ringbuffer.cpp.
References force(), and put().
| bool RingBuffer< data_type >::resize | ( | unsigned | new_size | ) |
Definition at line 390 of file ringbuffer.cpp.
References _buf, _head, _item_size, _num_items, and _tail.
| unsigned RingBuffer< data_type >::size | ( | ) |
Definition at line 80 of file ringbuffer.cpp.
References _buf, and _num_items.
| unsigned RingBuffer< data_type >::space | ( | void | ) |
Definition at line 359 of file ringbuffer.cpp.
References _head, _num_items, and _tail.
Referenced by count().
|
private |
Definition at line 168 of file ringbuffer.h.
Referenced by flush(), print_info(), resize(), RingBuffer(), and size().
|
private |
insertion point in _item_size units
Definition at line 169 of file ringbuffer.h.
Referenced by empty(), flush(), full(), print_info(), resize(), and space().
|
private |
Definition at line 167 of file ringbuffer.h.
Referenced by flush(), print_info(), and resize().
|
private |
Definition at line 166 of file ringbuffer.h.
Referenced by _next(), count(), print_info(), resize(), size(), and space().
|
private |
removal point in _item_size units
Definition at line 170 of file ringbuffer.h.
Referenced by empty(), flush(), full(), print_info(), resize(), and space().


There are three different types of tutorials that can be contributed to the website:
- Write a new tutorial in Markdown (preferred option)
- Contribute an existing PDF tutorial (with or without the source code)
- Contribute an existing Wiki tutorial (e.g. a tutorial on GitHub or GitLab)
They are described in more detail below.
Writing a new tutorial in Markdown
Markdown is our preferred format, because it is the most flexible. Markdown is a lightweight, readable markup language that can be easily converted to many different formats. Tutorials written in Markdown can be displayed in html in a web browser or easily converted to printable PDF documents. Because Markdown is very readable, it also makes it easier to maintain and update tutorials.
Tutorials written in Markdown should be saved into the file README.md
. If you write the tutorial in Markdown you do not need to include any PDF files with the tutorial.
In the tutorial template repository there is an example tutorial written in Markdown. More Markdown syntax is given in the Markdown style guide.
References can be added to a Markdown tutorial using Jekyll-scholar. An example is given in the tutorial template repository.
Although you should be able to preview the tutorial by looking at the repository on GitHub, some objects will not be in the correct format, because the website uses a custom stylesheet with a few extra extensions. The best way to preview what the tutorial will look like on the website is to build a local copy of the site. Then simply add a link to your tutorial to config.yml
and recompile the website to preview it. (The website will compile faster if you remove all other tutorials from config.yml
).
Contributing an existing PDF tutorial
Sometimes it may be the case that you already have an existing tutorial for BEAST2 that would be difficult to convert to Markdown. As long as you have a PDF file for the tutorial we can still use it! In this case just add the PDF file to the root of the GitHub project, and write a small description of the tutorial in README.md
and you’re done!
Contribute an existing Wiki tutorial
If a tutorial is already on a GitHub or GitLab Wiki it should already be written in Markdown and could be ported very easily for Taming the BEAST. Keep in mind that the Taming the BEAST website allows more flexibility for the tutorial style and allows references and figure captions. In addition, the tutorial would be available in a central location with other BEAST2 tutorials, bundled with all the data and XML files needed to run it.


Alrighty, Well I'm a junior in college, have been wanting to do mushrooms since senior summer of high school, but plans have always found a way to fall through. So finally in late october, I had heard from a buddy of mine he could get his hands on a good amount of shrooms for a reasonable amount of $.  So I call up a few people, roommates, cousin, brother, planning on eating them upstate and check out the lively autumn scenery. It sounded too good to be true, and of course, plans fell through.
 Pussies, alright, me and my roommate will do it ourselves tonight.
 It was my roommates second time doing 'em.  But I was aware of this beforehand and supressed it, never feeling nauseous or anything of the sort the rest of the night.
Around an hour later, it begins. A buzzing of awareness in my head, elevated thought and perception, so we decide to go walk around.  Talking about the sensation we're experiencing, the 'oversimplification of everyday life' as my roommate puts it.
We pass a cafe-like deal and I want to fuckin go in and see mad people, but my roommate suggests that could be bad, so I listen to Mr. Experience and we keep on our walk. We walk around campus, my roommate stops in a building to urinate, I'm standin in this little lobby-like deal staring at this painting, haha, its moving. The new, high-tech building was just recently constructed and it felt like I was in some Alien spacecraft with air-tight sealed doors. We stop to watch a herring or pelican or one of those long necked fuckers, reminds us of a dinosaur with its slow graceful movements and jagged figure. Resting on a dock near a pond we inspect the water and the surroundings. The water, a black basin of liquid life, moving, its alive. The reflection of the trees in the pond imitate roots and veins, a system of capillaries and arteries which extend deep into this sphere, this core of energy and life (earth)...finally, mushrooms!
We return tripping, and begin watching sex and the city with our other roommate, paying attention to the content of the show (couldn't fuckin believe it) and even the slightest sense of humor had us giggling like little schoolgirls at the sight of a dogs junk.
So we pull out the chessboard, wow, incredible. How could someone create such a game?! My concept of the game was completely altered, it was no longer a checkerboard with more complicated pieces, but a battlefield, each piece representing an offensive and defensive element collaborating in a formation on an assault with one objective: to kill your opponent. All the while, swishing my tongue around in my mouth, taking huge gulps of water, wishing there were some beautiful woman around to enjoy every bodily sensation, every sample of touch, every operation any part of the body could possible pull off. Maybe sex and the city had something to do with this, I am not sure, but realize oh crap, have to focus on the game again.
We roll the fatty, about to leave, I pick up a baseball, which I hadn't done in a while, begin bouncing it off of everything, visualizing the angle and expected route, preparing to react before it even touches the wall. Man, I miss baseball and the intensity. And then we leave to go to our friend's to smoke.
Well, we get there, talking up a storm, and I'm usually not an outgoing guy, charming whoever I see etc. Then we smoke. I would have to say I could be a pothead. Ismoke almost everyday at school. Snd after we smoke, its like an off switch. All of a sudden everything shuts down, no more vivid colors, no more exaggerated highlights on contours of the face, no more buzzing feeling in the brain.
We confess this to our friends, one girl wanted to buy mushrooms from us, so we say alright and head back to our place. We get to our place and OZ is on. Well, mass paranoia sets in.  We leave our place and there are 3 public safey officers standing outside across a small grass field, conversing with each other. We really start bugging out now. We take a long route back to our friends place, sell her the stuff, tell her not to smoke weed cuz it just fucks it all up, and she leaves. We talk to our boys about how we're paranoid, tell them to call up the girl we just sold stuff to and tell her not to mention our names or anything like that.
We leave. When we leave, there are 2 bike cops perched outside with their backs towards us. I signal to shaun and we take another roundabout route back to our place.  We are only a little ways from our place, walking behind a student and her mother. As we walk, the same two bike cops ride up along next to us, I am nanometers from taking off for my life, but they've seen my face. I glance at the chinese bike cop and we make eye contact for a split second.  I flip out, inspect my wallet, I have like 200 bucks in there (planning to go upstate for the weekend). I am shaking like a leaf. I take the money out, stop, think about running off, then put it in my boxers and continue walking.
We get around the corner seconds later, with the bike cops and a couple of public safety officers standing a couple doors down from our place, where a small frat party was going on. I figure, well, this is it, I'm fucked, mom, dad, I'm sorry, 3 strikes and you're out. Please, god, if you let this go, I promise I will never smoke again. We walk past the cops, whom I look at briefly, avoiding eye contact (DILUTED EYES OMFG) and feel their gaze upon us.
Time is around 11pm. We're inside, whew, but they can barge up here any time they want. I begin washing dishes and tell my roommate to put on some water to boil and make some mac&cheese. I run the water to muffle my voice and tell him not to look out the window, because of course they'd be monitoring us.   So I drop the rest of the OZ of shrooms into the toilet, my other roommate comes back moments after, can't believe what we've done, we tell our story, still can't believe it. We sit waiting for our doom to come the rest of the night, finally pass out at around 4am. Nothing ever happened.
Now that happened friday, october 24th, haven't smoked since, and am still true to my word of NEVER again. The effect marijuana had on my mind after such an extraordinary experience on mushrooms has negated almost every assumption I had on the benefits of marijuana. Paranoia amplified, mind clouded. I haven't even had the urge to smoke it since, and my roommate hasn't smoked either, he says he will tho. But I take this experience as a sign, to stop my trend of nothingness (smoking marijuana), to stay focused (one thing marijuana never did for me). Marijuana took over my mind just like a weed takes over a garden and convinced me into pouring my precious mushrooms into the sewer. There are many other pleasures from the earth which exceed marijuana, and I am hoping to experience as many as possible.
'Your mind is a garden, weed is a contamination.'
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.


General Election 2019: Polling station dos and don'ts
Millions of Brits will head out on December 12 and decide who gets to run the country at such a pivotal time in its history.
With the Brexit deadline around the corner, and fiery debates on the NHS, education and and taxation raging on, voters across the country will be eager to head to the polls.
We’re lucky to live in a country where people have this freedom, but there’s a few basic rules to follow when casting your ballot.
It’s important to make sure your vote actually counts and that you don’t end up breaking the law.
So here’s a guide to what you should and shouldn’t do at UK polling stations.
Taking pictures
It isn’t against the law to take a cheeky selfie at a polling station but doing it anywhere near a voting booth is strongly discouraged.
Advertisement Advertisement
There’s a risk you could inadvertently reveal how someone else has voted, which could land you with a six month prison sentence or a £5,000 fine.
It’s illegal to share a picture of a ballot paper under the Section 66 of the Representation of the People Act 1983, including your own.
Advice from the Electoral Commission says: ‘Due to the potential breach of the law, intentionally or not, we strongly advise against any form of photography taken inside a polling station.
‘However, if a voter would like to highlight their participation in the elections, we suggest this is done outside the polling station before or after they vote.’
Dogs at polling stations
Bringing your pet as you cast your vote has become a massive trend in recent years.
Every election our hearts are warmed with social media posts showing our four legged friends witnessing democracy in action.
But they might be asked to wait outside the station, particularly if it’s busy.
And they can’t vote themselves. Obviously.
Showing up drunk
It isn’t against the law to get absolutely steaming before casting your ballot but it isn’t encouraged either.
Staff can’t turn you away just because it looks like you’ve been drinking but they could ask you to come back when you’ve sobered up if you’re being too rowdy.
If you’re really disruptive, there’s a chance the police could arrest you for being drunk and disorderly, as they would anywhere.
Advertisement Advertisement
Even if you aren’t under the influence of alcohol or drugs, don’t be loud or make a nuisance of yourself.
Bringing your family
It’s fine to bring your children to the polling station but they shouldn’t touch the ballot paper.
If you have a few young ones with you then staff can keep an eye on them while you cast your vote.
Bringing you entire extended family could be seen as a bit weird but there’s no rule against it.
Large groups of any kind could be asked to wait outside if there’s a risk of disturbing voters.
Make it clear who you’re voting for
It’d be a shame if your vote didn’t count because you’d marked the paper in the wrong way.
You can put a tick, cross, or colour in the box, but as long as it is clear who you’re voting for and don’t try and chose multiple candidates.

If you make a mistake and accidentally vote for the wrong person, go to the desk and explain what happened to staff, who will be able to cancel your ballot and give you a new one.
Some people chose to deliberately spoil their ballot to express their frustration with the political system.
Advertisement
Protesters have been known to tick every box, write all of the ballot paper, and, of course, draw a penis on it.
Just make sure the genitalia isn’t only marked in a single box or you might end up voting for someone you don’t want.
Taking your own pens and pencils
You may have heard conspiracy theories about votes marked with pencil being rubbed out during the Brexit referendum.
This would have been a difficult plot to orchestrate and of course it wasn’t true, but that didn’t stop some people standing outside polling stations handing out pens in June 2016.
It’s completely fine to bring your own pens or pencils, as long as you can clearly indicate you you’re voting for.
The reason why pencils are provided at polling stations is because ink from a pen can smudge or spill on the paper and risk spoiling a ballot.
Ink might spread when the ballot is folded making it look like someone has voted more than once.
Dismissing fraud fears, the Electoral Commission said: ‘The use of pencils does not in itself increase the likelihood of electoral fraud.
‘Legislation has built specific safeguards into the process, such as the requirement for seals to be attached to ballot boxes at the close of poll.
Advertisement
‘By law, campaigners are also entitled to be present at that stage and to attach their own seals if they wish.
‘At the start of the count, they can then observe those same seals being broken.
‘Tampering with ballot papers is a serious offence and if anyone has evidence that ballot papers are being tampered with, they should report this to the police.’
Bringing a friend into the polling booth
Voting is seen as a private thing and you should do it on your own if you’re able to.
If you cannot read the ballot paper or have a disability then a friend or family member may be allowed to help you.
The Electoral Commission advises staff talk directly to the voter about this rather than the helper.
Covering your face
Polling station staff will be looking out for people trying to impersonate someone else on the register to vote twice.
But there’s no specific rule for voters to show their face and they don’t need to bring proof of ID.
Swaying voters
Voters aren’t allowed to wear clothing promoting a particular party, like t-shirts with campaign slogans on them.
Clearly showing your political allegiance could get you turned away from the polling station, as could talking loudly about politics.
Staff want to make no one is pressured into changing their votes and that everyone feels free to make up their own minds.
But there are no rules against wearing a party’s colours, so go ahead if that’s how you want to show your support.
You might see party officials outside the station. They can be there but they have to wear a rosette to make it clear who they are.
They’re not allowed to act in an intimidating fashion, hang around in large groups or try and hand out literature, so tell a member of staff if they do.
Don’t reveal how someone else voted
This is probably the most important rule of them all.
We mentioned this under the rules about taking photos but it’s worth re-iterating.
Even if you didn’t mean to it could land you in jail or with a hefty fine.
Got a story for Metro.co.uk?
Get in touch with our news team by emailing us at<EMAIL_ADDRESS>For more stories like this, check our news page.


| DiscreteWavelets Toolbox |
Estimate the noise level of a vector or matrix
s = NoiseEstimate(v,h)
s=NoiseEstimate(v,h) takes as input a matrix or vector v and an orthogonal filter h and returns an estimate of the noise level of v.
NoiseEstimate(v) is computed via by first computing one iteration of the wavelet transformation wt built from h. Then the level is estimated via the formula MAD(wt)/.6745. See Section 9.2 for more details.
Create a noisy sine vector and estimate the noise level.
x=0:.0001:.9999; v=sin(2*pi*x); %Create a vector of sine values n=randn(1,10000); %Create a noise vector t=.15; %Set a noise level y=v+t*n; %Create the noisy vector s=NoiseEstimate(y,Coif(1))
The estimate is
s = 0.1503
© 2007-2008 Patrick Van Fleet


The CSS background properties are used to define the background effects for elements.
In these chapters, you will learn about the following CSS background properties:
- background-color
- background-image
- background-repeat
- background-attachment
- background-position
CSS background-color
The background color of a page is set like this:
body {
background-color: lightblue;
}
Other Elements
You can set the background color for any HTML elements:
Here, the<h1>, <p>, and <div> elements will have different background colors:
h1 {
background-color: green;
}
div {
background-color: lightblue;
}
p {
background-color: yellow;
}
Opacity / Transparency
The opacity property specifies the opacity/transparency of an element. It can take a value from 0.0 - 1.0. The lower value, the more transparent:
div {
background-color: green;
opacity: 0.3;
}
Transparency using RGBA
IIf you do not want to apply opacity to child elements, like in our example above, use RGBA color values. The following example sets the opacity for the background color and not the text:
div {
background: rgba(0, 128, 0, 0.3) /* Green background with 30% opacity */
};
CSS Background Image
The background-image property specifies an image to use as the background of an element. By default, the image is repeated so it covers the entire element.
The background image for a page can be set like this:
body {
background-image: url("paper.gif");
}
CSS background-attachment
The background-attachment property specifies whether the background image should scroll or be fixed (will not scroll with the rest of the page):
body {
background-image: url("img_tree.png");
background-repeat: no-repeat;
background-position: right top;
background-attachment: fixed;
}
CSS background - Shorthand property
To shorten the code, it is also possible to specify all the background properties in one single property. This is called a shorthand property.
body {
background-color: #ffffff;
background-image: url("img_tree.png");
background-repeat: no-repeat;
background-position: right top;
}


8. Manage multiple icebergs¶
Now that the simple configuration has been tested and done, it is possible, to extend the cluster, to activate the multiple icebergs mechanism.
Icebergs mechanism allows to split cluster into parts, in order to:
Distribute load over multiple managements nodes.
Isolate part of the cluster from the others.
It is important to understand what is an iceberg in BlueBanquise.
8.1. Iceberg elements¶
Each iceberg is composed of:
A set of dedicated management nodes (can be bare metal servers, VMs, containers, etc.).
Some hosts part of this iceberg, and managed by the iceberg management nodes.
Iceberg isolated management networks, called iceX-Y by default, with X the iceberg number (starting from 1).
An Ansible group, with all management nodes and hosts part of the iceberg.
Icebergs are connected together using a simple hierarchical pattern: an iceberg can be a top, meaning it is the top in the hierarchy, or be a standard iceberg, meaning it will refer to a master iceberg (the top iceberg in 2 levels hierarchy, or another standard iceberg if more levels).
The following schema resume the notion:
Few notes about this schema:
Icebergs can be connected to any administration networks.
Managements of a standard iceberg are expected to be connected to both administration network, i.e. on one of their internal iceberg administration network, but also on one of the administration network of their master iceberg.
Services will work as a chain. For example, time will come from the top iceberg (or an external source) and each time server will take as source the time server of its master iceberg.
Note that this architecture is flexible, and can be adapted to create isolated icebergs (i.e. having multiple fully isolated clusters in the same BlueBanquise configuration).
Note also that using iceberg related groups, it is possible to define variables dedicated to each iceberg (for example, define a different time zone, a different domain name, etc.). However, and this is important, variables defined at group_vars/equipment_X level should never be used in icebergs groups, i.e. group_vars/icebergX, as it is impossible to determine the “winner” between both values.
8.2. Configuring top iceberg¶
8.2.1. Understanding mechanism¶
By default, iceberg mechanism is deactivated, and so all hosts are considered member of iceberg1.
Sorry, as a physician, I start counting at 1 when speaking of physical things, and so icebergs are numbered at 1 by default. However, nothing prevent using 0 as a start point when activating icebergs mechanism.
This automation is achieved by j2 variable j2_current_iceberg:
j2_current_iceberg: "{% if not icebergs_system %}{{ iceberg_naming+'1' }}{% else %}{{ group_names | select('match','^'+iceberg_naming+'[0-9]+') | list | unique | sort | first | join }}{% endif %}"
If icebergs_system is set to false, then iceberg is iceberg_naming+’1’ = iceberg1. If set to true, then j2_current_iceberg will look check groups the current hosts is member of, and look for a group with pattern iceberg_naming+’[0-9]+’, and use it to determine current iceberg.
Then, other values will be deduced from this:
j2_current_iceberg_number: "{{ j2_current_iceberg | replace(iceberg_naming,' ') | trim }}"
j2_current_iceberg_network: "{{ management_networks_naming + (j2_current_iceberg_number|string) }}"
j2_current_iceberg_number is simply the j2_current_iceberg without the “iceberg” string, so the iceberg number, here “1”.
j2_current_iceberg_network is the addition of the default network naming and the iceberg number, so here “ice1”.
Note also that 2 variables are here to simplify developments of templates:
j2_icebergs_groups_list: “{{ groups | select(‘match’,’^’+iceberg_naming+’[0-9]+’) | list }}”
j2_number_of_icebergs: “{{ groups | select(‘match’,’^’+iceberg_naming+’[0-9]+’) | list | length }}”
Refer to file icebergs.yml in j2_variables in group_vars/all (do not edit them if you do not master the stack).
8.2.2. Enabling iceberg mechanism¶
Note: do not play any role from now, until hosts are in their iceberg group.
To activate icebergs mechanism, open file group_vars/all/general_settings/general.yml, set icebergs_system to true.
8.2.3. Create iceberg 1¶
We now need to create the iceberg1 group, define its variables, and add hosts into it.
Create dedicated folder in inventory/cluster/:
mkdir /etc/bluebanquise/inventory/cluster/icebergs/
Then create file /etc/bluebanquise/inventory/cluster/icebergs/iceberg1, and add the following content:
[iceberg1:vars]
iceberg_master = top
iceberg_level = 1
[iceberg1]
This will create an Ansible group called iceberg1, with 2 associated variables.
iceberg_master defines if the iceberg is a top, or a standard iceberg linked to a master.
iceberg_level defines the level of this iceberg in the services chain. This is for example used to calculate stratum value of time servers, etc.
Note: iceberg_level could be automatically calculated. However, having it has a variable allows the system administrator to tune it to desired ways.
Let’s check current groups status:
[root@mngt1-1 ~]# ansible-inventory --graph
@all:
...
|--@iceberg1:
|--@ungrouped:
[root@mngt1-1 ~]#
iceberg1 group has been created, and is empty. Now add management(s) and nodes of the current iceberg into it.
To do so, edit again file /etc/bluebanquise/inventory/cluster/icebergs/iceberg1 and under [iceberg1] simply add hosts:
[iceberg1:vars]
iceberg_master = top
iceberg_level = 1
[iceberg1]
management1
login1
c[001:004]
Note: it is possible to add ranges of nodes, like in this example c[001:004]. This is a different syntax than clustershell.
Check again groups:
[root@mngt1-1 ~]# ansible-inventory --graph
@all:
...
|--@iceberg1:
| |--management1
| |--login1
| |--c001
| |--c002
| |--c003
| |--c004
|--@ungrouped:
[root@mngt1-1 ~]#
And push again configuration using the default playbook for each host. It is possible to see what is going to be modified using –diff –check at ansible-playbook invocation.
There should not be major modifications in configuration.
8.2.4. Create iceberg 2¶
Create now a second iceberg, with iceberg1 as master.
Create file /etc/bluebanquise/inventory/cluster/icebergs/iceberg2, with the following content:
[iceberg2:vars]
iceberg_master = iceberg1
iceberg_level = 2
[iceberg2]
This new iceberg is not a top iceberg, and so refer to its master, here iceberg1.
Configure a new management, called management2, that will be in charge of iceberg2. According to icebergs definition, management2 must be connected to both ice1-1 network and ice2-1 network.
For convenience, create a dedicated folder in cluster directory to store all nodes related to each iceberg, and move current nodes into iceberg1 directory.
mkdir -p /etc/bluebanquise/inventory/cluster/nodes/iceberg1/
mkdir /etc/bluebanquise/inventory/cluster/nodes/iceberg2/
mv /etc/bluebanquise/inventory/cluster/*.yml /etc/bluebanquise/inventory/cluster/nodes/iceberg1/
A warning may be displayed during playbook execution for now, because nodes/iceberg2/ is still empty.
Now create management2 file /etc/bluebanquise/inventory/cluster/nodes/iceberg2/management.yml:
mg_managements:
children:
equipment_typeM:
hosts:
management2:
bmc:
name: bmanagement2
ip4: <IP_ADDRESS>
mac: 08:00:27:0d:41:97
network: ice1-1
network_interfaces:
enp0s3:
ip4: <IP_ADDRESS>
mac: 08:00:27:de:41:21
network: ice1-1
enp0s8:
ip4: <IP_ADDRESS>
mac: 08:00:27:de:42:23
network: ice2-1
This host is connected to both icebergs, and will be pushed from ice1-1 and act as a pusher (management) on ice2-1.
And add management2 to iceberg2, by editing /etc/bluebanquise/inventory/cluster/icebergs/iceberg2 and adding management2 under [iceberg2]:
[iceberg2:vars]
iceberg_master = iceberg1
iceberg_level = 2
[iceberg2]
management2
Play again playbooks on management1, so management2 is added into dhcp, pxe, dns, hosts, etc. configuration files.
Once done, use standard pxe boot procedure to deploy OS on management2.
Now, few steps has to be followed in a specific order in order to deploy configuration on it.
8.2.5. Deploy management configuration¶
First, it is needed that management2 mount over nfs the repositories and the BlueBanquise configuration from management1.
Ensure management2 is part of a group that will mount the repositories and ansible, in nfs.yml. If no, you can create a custom group for that, that would regroup all non top iceberg management.
Copy current management1 playbook:
cp /etc/bluebanquise/playbooks/management1.yml /etc/bluebanquise/playbooks/management2.yml
and change target host inside to match management2.
Once done, deploy repositories_client role, by forcing management2 to be temporary part of iceberg1:
ansible-playbook /etc/bluebanquise/playbooks/management2.yml -t repositories_client --extra-vars j2_current_iceberg=iceberg1
Then deploy repositories_server role, and nfs_client role, so that management2 can get repositories localy and distribute them for iceberg2:
ansible-playbook /etc/bluebanquise/playbooks/management2.yml -t repositories_server,nfs_client --extra-vars j2_current_iceberg=iceberg1
Now, management2 can be autonomous. Deploy the whole configuration on it:
ansible-playbook /etc/bluebanquise/playbooks/management2.yml
And proceed as usual to add more hosts into iceberg2 and deploy them, this time from management2.


Feature
Crossfader Magazine, "Killing and Dying in CALL OF DUTY: WWII", 7 Dec 2017
Crossfader Magazine, "What VR Gets Wrong About Reality, Virtual and Otherwise", 25 Feb 2017
Review
Crossfader Magazine, "Crossfader Magazine's Game of the Year 2017: TACOMA; GRAVITY RUSH 2", 30 Jan 2017
Crossfader Magazine,"Indiecade 2017: Festival Highlights: BURY ME, MY LOVE; EVERYTHING IS GOING TO BE OKAY; THE NORWOOD SUITE; OBLIGE", 14 Oct 2017
Crossfader Magazine, "WAR FOR THE PLANET OF THE APES Review", 18 July 2017
Crossfader Magazine, "Why Aren't You Watching THE AMERICANS?", 18 April 2017
Crossfader Magazine, "Early Impressions: GHOST RECON: WILDLANDS, 2 March 2017
Crossfader Magazine, "YAKUZA 0 Review", 9 Feb 2017
Crossfader Magazine, "Gaming Highlights 2016: AMBIENT MIXTAPE 16", 24 Jan 2017
Crossfader Magazine, "Crossfader Magazine's Game of the Year 2016: THE WITNESS; INSIDE", 21 Jan 2017


{% extends 'admin/master.html' %} {% block body %}
Hey there everyone.Let's try something simple here,right?..


See: Description
| Interface | Description |
|---|---|
| GraphicsNode |
The base class for all graphics nodes.
|
| Mask |
Describes a mask.
|
| Selectable |
Interface describing object that can be selected or have selections
made on it.
|
| Selector |
Interface which allows selection of GraphicsNodes and their contents.
|
| ShapePainter |
Renders the shape of a
ShapeNode . |
| Class | Description |
|---|---|
| AbstractGraphicsNode |
A partial implementation of the
GraphicsNode interface. |
| CanvasGraphicsNode |
The graphics node container with a background color.
|
| CompositeGraphicsNode |
A CompositeGraphicsNode is a graphics node that can contain graphics nodes.
|
| CompositeShapePainter |
A shape painter which consists of multiple shape painters.
|
| FillShapePainter |
A shape painter that can be used to fill a shape.
|
| GVTTreeWalker |
GVTTreeWalker objects are used to navigate a GVT tree or subtree. |
| ImageNode |
A graphics node that represents an image described as a graphics node.
|
| Marker |
A Marker describes a GraphicsNode with a reference point that can be used to
position the Marker at a particular location and a particular policy for
rotating the marker when drawing it.
|
| MarkerShapePainter |
A shape painter that can be used to paint markers on a shape.
|
| PatternPaint |
The PatternPaint class provides a way to fill a Shape with a a pattern
defined as a GVT Tree.
|
| PatternPaintContext |
PaintContext for the ConcretePatterPaint
paint implementation. |
| ProxyGraphicsNode |
A graphics node which provides a placeholder for another graphics node.
|
| RasterImageNode |
A graphics node that represents a raster image.
|
| RootGraphicsNode |
The top-level graphics node of the GVT tree.
|
| ShapeNode |
A graphics node that represents a shape.
|
| StrokeShapePainter |
A shape painter that can be used to draw the outline of a shape.
|
| UpdateTracker |
This class tracks the changes on a GVT tree
|
Copyright © 2022 Apache Software Foundation. All Rights Reserved.


Multibeam Survey Extents 2014
Australian Bathymetry and Topography 2009
High Resolution Multibeam Bathymetry