DecoratingTextFieldDelegate
public final class DecoratingTextFieldDelegate : NSObject
Adds formatting (decoration) characters to text field’s content according to a variable pattern. Can be used for payment card number formatting, phone number formatting, etc.
-
DecoratingTextFieldDelegate
will call this function passing current data string as a parameter every time the data string changes, the returned pattern will subsequently be used to format the data string passed.Declaration
Swift
public let patternForDataString: (String) -> String
-
A character that is not a formatting character.
Declaration
Swift
public let patternPlaceholderForDataCharacter: Character
-
A predicate to filter non-data characters from user’s input. No matter what user tries to put into the textfield, only characters for which
isDataCharacter
returnstrue
will appear in the text field.Declaration
Swift
public let isDataCharacter: (Character) -> Bool
-
Initializes a delegate with a fixed pattern
Example:
A 16-digit VISA payment card pattern might look like this
####-####-####-####
'#'
is apatternPlaceholderForDataCharacter
and ‘-
’ is a formatting (decorating) character.Declaration
Swift
public convenience init( pattern: String, patternPlaceholderForDataCharacter: Character, isDataCharacter: @escaping (Character) -> Bool)
Parameters
pattern
A string containing data placeholder and formatting characters.
patternPlaceholderForDataCharacter
A character that is not a formatting character.
isDataCharacter
A predicate to filter non-data characters from user’s input. No matter what user tries to put into the textfield, only characters for which
isDataCharacter
returnstrue
will appear in the text field. -
Intializes a delegate with a fixed pattern
Example:
A 16-digit VISA payment card pattern might look like this
####-####-####-####
'#'
is apatternPlaceholderForDataCharacter
and ‘-
’ is a formatting (decorating) character. Furthermore, to support various kinds of payment cards a more complex behaviour may need to be implemented where the first 6 digits of a payment card number will define total length and formatting pattern for any valid card number starting with those 6 digits. This behaviour can be implemented by usingpatternForDataString
.Declaration
Swift
public init( patternForDataString: @escaping (String) -> String, patternPlaceholderForDataCharacter: Character, isDataCharacter: @escaping (Character) -> Bool)
Parameters
patternForDataString
DecoratingTextFieldDelegate
will call this function passing current data string as a parameter every time the data string changes, the returned pattern will subsequently be used to format the data string passed.patternPlaceholderForDataCharacter
A character that is not a formatting character.
isDataCharacter
A predicate to filter non-data characters from user’s input. No matter what user tries to put into the textfield, only characters for which
isDataCharacter
returnstrue
will appear in the text field. -
Decorate a string consisting of data characters (see
isDataCharacter
) into a string converted usingpatternForDataString
Declaration
Swift
public func decorateString(_ dataString: String) -> String
Parameters
dataString
A string containing only data characters (see
isDataCharacter
).Return Value
The converted string from the input.
-
Strips formatting (decoration) characters from the input string, checking each character using
isDataCharacter
and removing it from the input.Declaration
Swift
public func undecorateString(_ decoratedString: String) -> String
Parameters
dataString
A string contained any kind of characters
Return Value
The undecorated string from the input.
-
Please refer to the documentation for
UITextFieldDelegate.textField(_:, shouldChangeCharactersIn:, replacementString:)
.Declaration
Swift
public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool


Quick Start#
This guide walks through a quick introduction to MatX to get familiar with the types and basic functionality. For more extensive documentation, please look at the following sources:
Example and API documentation
Example code in the examples/ directory
Jupyter notebook tutorials in the docs_input/notebooks/ directory
Adding MatX to your project#
MatX is a single header file to include in your project called matx.h
. Simply add the matx/include directory to your compiler’s
include search path, and add #include "matx.h"
. All core MatX functions are in a top-level matx
namespace, while more specific functions have
a nested namespace. For example, the visualization pieces of MatX are under matx::viz
.
Tensor Views#
The most common data type in MatX is the tensor (tensor_t). The tensor is used for both viewing and managing any underlying GPU or host memory. While dynamically-typed languages like Python or MATLAB will implicitly allocate and manage data for the user, MatX requires either a one-time explicit memory allocation, or various ways of providing your own buffer. This gives more control over the lifetime of the data, and allows reusing memory regions for different operations.
A tensor is created using the following syntax:
auto t = make_tensor<float>({10, 20});
In this example we request a floating point tensor with rank 2 (2D array). The constructor arguments specify the shape of the tensor (10x20), or the size of each dimension. The number of elements in the list determines the rank of the tensor. MatX supports any arbitrary rank tensor, so the dimensions can be as long as you wish.
If the shape of the tensor is known at compile time, a static tensor can be created for a performance improvement when accessing elements of the tensor:
auto t = make_static_tensor<float, 10, 20>();
Note that for a static tensor the shape is moved to the template parameters instead of function arguments.
After calling the make function, MatX will allocate CUDA managed memory large enough to accommodate the specified tensor size. Users can also
pass their own pointers in a different for of the make_
family of functions to allow for more control over buffer types and ownership
semantics.
With our view t
created above, we now have managed memory allocated sufficiently large to hold our values, but at this point the data
in the tensor is undefined. To set individual values in a view, we can use operator()
:
t(2,2) = 5.5;
t(4,6) = -10f;
The same operator can be used to get values:
float f = t(2,2) // f is now 5.5
operator()
takes as many parameters as the rank of the tensor:
auto f0 = t0(); // t0 is a rank-0 tensor (scalar)
auto f1 = t1(5); // t1 is a rank-1 tensor (scalar)
Tensors can also be initialized using initializer list syntax using the SetVals
function:
auto myT = make_tensor<float>({3, 3});
myT.SetVals({{1,2,3}, {4,5,6}, {7,8,9}});
In other languages it’s very common to initialize a tensor with a set of values on creation (ones, zeros, ranges). This will be covered later in the tutorial when we discuss operators, and it should become clear why we initialize this way.
Note
For more information about creating tensors, including advanced usage, see the Creating Tensors documentation
Getting shapes and sizes#
The dimensions of the tensor are stored internally in a type named tensorShape_t. This tensor shape contains the rank and dimensions of the
tensor view, but does not contain any information about type or storage. The shape can be retrieved using the Shape
call:
auto shape = t.Shape();
Shape()
is similar to NumPy’s shape
attribute.
The number of dimensions in a tensor can be retrieved using the Rank()
member. Since the rank is known at compile time, this function
uses the constexpr
modifier:
auto r = t.Rank();
The size of each individual dimension can be fetched using Size()
:
auto t1size = t1.Size(0); // Size of vector t1
auto t2rows = t2.Size(0); // Rows in t2
auto t2cols = t2.Size(1); // Cols in t2
Slicing and dicing#
As the name implies, t
is a view into a region of memory. When the initial view is created and memory is allocated, the tensor view is
of the entire 10x20 contiguous block of memory. Often we don’t want to see the entire block of memory, but only want to view a subset of the
underlying data. To do this, we use the slice
operator:
auto tCube = slice(t, {3, 5}, {6, 8}); // Cube of t using rows 3-5 and cols 5-7
auto tRectS = slice(t, {0, 0}, {matxEnd, matxEnd}, {2, 2}); // Rectangle with stride of 2 in both dimensions
auto tCol = slice<1>(t, {0, 4}, {matxEnd, matxDropDim}); // Create a 1D tensor with only column 5
auto tRow = slice<1>(t, {4, 0}, {matxDropDim, matxEnd}); // Create a 1D tensor with only row 5
slice
returns a new view of the tensor using start, stop, and optional stride parameters. Since views are simply
light-weight views into memory, none of these variants modify the data; they return an object with new parameters describing
how the data is viewed. The resulting variables can be used exactly as the original view above:
auto cubeRows = tCube.Size(0); // 3
auto cubeCols = tCube.Size(1); // 3
auto colSize = tCol.Size(0); // 10 since the original tensor had 10 rows
auto rowSize = tRow.Size(0); // 20 since the original tensor had 20 columns
All view functions can be used on any type of existing view:
auto tCubeP = permute(slice(t, {3, 5}, {6, 8}), {1, 0});
The above code takes the same cube as before, but permutes the cube view by swapping the two dimensions.
slice
is not limited to only tensors; it can be used on any operator as input:
slice(eye(t.Shape()), {3, 5}, {6, 8});
Permuting#
Permuting a tensor is done using the permute
function:
auto t = make_tensor<float>({10, 20});
auto tp = permute(t, {1,0});
tp
is now a view into t
where the rows and columns are swapped (transpose). permute
is not limited to matrices, though:
auto t4 = make_tensor<float>({10, 20, 5, 2});
auto tp4 = permute(t, {1,3,2,0});
t4p
is now a permuted view of the original 4D tensor, but with the dimensions swapped as ordered in the initializer list. Just like
with slice
, permute
works on operators as well.
Note that since no data is moved, permuting a tensor can be detrimental to performance, depending on the context. Permuting usually changes the strides of dimensions such that the memory access patterns are no longer optimal, and accessing the permuted view continuously can be very slow. If a permuted view will be accessed repeatedly, it’s recommended to copy the permuted view into a new tensor so that the new layout is contiguous. Using the variables from above:
auto t4pc = make_tensor<float>(tp4.Shape());
copy(t4pc, t4p);
t4pc
will now contain the permuted data, but in contiguous memory. Copying a tensor (or operator) can also be done by the assignment
operator:
(t4pc = t4p).run();
Reshaping#
Ultimately memory is always laid out linearly regardless of how we choose to view it. We can take advantage of this property by allowing a reshaped view of an existing view. This is commonly done when we want to take a tensor of one rank and view the data as if it were a tensor of a different rank. The product of dimensions in one rank must equal the product of dimensions in the other rank. For example, to take a 1D tensor of size 16 and reshape into a 2D tensor of shape 4x4:
auto t1 = make_tensor<float>({16});
auto t2 = t1.View({4,4});
t2
is now a view into the same memory as t1
, but viewed as a different rank. Any modifications to one tensor will be seen in the
other since no data was copied.
Increasing dimensionality#
Sometimes it’s useful to increase the rank of an existing view to match the dimensions of another tensor. For example, to add a vector onto all rows in a matrix, you can clone the tensor to a higher rank to match the other tensor:
auto t1 = make_tensor<int>({16});
auto t2 = make_tensor<float>({16, 16});
// ... Initialize tensors
auto t1c = clone<2>(t1, {16, matxKeepDim});
t1c
is now a new tensor view where each row is a replica of the tensor t1
. Again, this is just a view and no data was modified or
allocated, so modifying a row/column in either of these tensors will affect the other.
The keyword matxKeepDim
tells MatX which dimensions should be kept from the original tensor and where it should be in the new tensor.
In this example we used it in the columns place of the shape, but we also could have used {matxKeepDim, 16}
and we would have a 2D
view where all columns of t1c
matches t1
.
Note in some cases MatX’s broadcasting feature can be used instead of clone
. This allows an implicit expansion of ranks during an
element-wise operation. For example, adding a 4D tensor to a 1D tensor will work as long as the outer dimension of the 4D tensor matches
that of the 1D tensor. Broadcasting is covered in the documentation. clone
is much more powerful since it gives more control over which
dimensions are cloned instead of assuming the outer dimensions.
Creating a view from an existing pointer#
While using tensor views with CUDA managed memory is very convenient, there are situations where managed memory is not ideal. Integrating MatX into an existing codebase, or wanting more control over the memory copies are both times when using standard CUDA memory allocations is a better option. All constructors in the tensor_t class also allow a manually-allocated pointer to be passed in. MatX will not attempt to allocate or free any memory when this constructor is used, and it is up to the caller to manage the memory lifecycle:
float *my_device_ptr; // Assume my_device_ptr is allocated somewhere
auto t2 = make_tensor<float>(my_device_ptr, {20,100});
t2(1,1) = 5; // Error! Don't do this!
In the example above, t2
is a new view pointing to the existing device-allocated memory. Unlike with managed memory, operator()
cannot be used on t2
from the host side or the code may crash.
Operator expressions#
Tensors aren’t much use by themselves if all we can do is view them in various ways. MatX provides two main ways to perform computations on tensor views: operator expressions and executors.
Operator expressions provide a way to use algebraic expressions using tensor views and operators to generate an element-wise GPU kernel at compile-time. For example:
auto a = make_tensor<float>({10, 20});
auto b = make_tensor<float>({10, 20});
auto c = make_tensor<float>({10, 20});
(c = a + b).run();
Ignoring that the data is unitialized, the first three lines simply create three 2D tensors with the same dimensions, while the last line runs an
operator for the equation c = a + b. In MatX terminology, an operator is a type that creates a CUDA kernel at compile-time to perform the
element-wise operation c = a + b. The = operator is used as a deferred assignment operator expressions to avoid ambiguity with the regular assignment
operator =
. The run
method takes an optional stream parameter, and executes the operation in the CUDA stream specified. Operators can use
expressions of any length, and normal precedence rules apply.
Tensor views can be mixed with scalars and operator functions:
auto op = (c = (a*a) + b / 2.0 + abs(a));
This expression squares each element in a
, divides each element in b
by 2, adds the result to a
, and finally adds the resulting
tensor to the absolute value of every element in a
. The result of the computation will be stored in the tensor view c
.
Again, the entire expression is generated at compile time and a kernel is stored in the variable op
, but the kernel is not launched on the device.
To launch the operator in a CUDA stream, we use the run
function:
op.run(stream);
run
can be thought of as a way to launch the operator/kernel into a CUDA stream, similar to the traditional triple angle bracket notation (<<<>>>).
In MatX terminology, this is called an executor since it causes work to be executed on the device. It’s often not necessary to store the operator at
all if the execution is immediate, the two lines above can be combined:
(c = (a*a) + b / 2.0 + abs(a)).run(stream);
Sometimes the data we are using in an expression can be generated on-the-fly rather than coming from memory. Window functions, diagonal matrices, and the identity matrix are all examples of this. MatX provides “generators” that can be used inside of expressions to generate data:
(c = (a*a) + ones(a.Shape())).run(stream);
The example above uses the ones
generator to create a tensor with only the value 1
matching the shape of a (10x20). ones
simply returns the
value 1
any time an element of it is requested, and no data is ever loaded from memory.
Implicit in the run
call above is a CUDA executor type. As a beta feature, MatX also supports executing code on the host using a different executor.
To run the same code on the host, a SingleThreadHostExecutor
can be passed into run
:
(c = (a*a) + ones(a.Shape())).run(SingleThreadHostExecutor{});
Instead of a CUDA stream, we pass an executor to run
that instructs MatX to execute the code on the host instead of the device using a single CPU thread.
Unlike CUDA calls, host executors are synchronous, and the line above will block until finished executing.
A quick note about assignment#
MatX heavily relies on a deferred or lazy execution model where expressions are not executed at the time of assignment. This allows the library to
closely match the programming model of the GPU so that there are no surprises as to when code is executed. To facilitate the asynchronous model,
MatX overloads the assignment operator (=) to indicate a deferred execution. The deferred assignment can be executed using the run()
method on
the expression. A statement as simple as the following:
(A = B).run()
should be viewed as a deferred assignment of tensor B into tensor A (deep copy) that executes on the device when run()
happens. The result of the
lazy assignment expression can also be assigned into a temporary variable:
auto op = (A = B + C);
In the code above, the =
on the right side indicates lazy assignment, while the =
on the left side executes the copy constructor on the new
variable op
. The pattern above is expected to be infrequently used since expressions are typically executed on the same line as the definition,
but sometimes it’s useful for debugging purposes to look at the type of the expression. More complex expressions follow the same rules:
IFELSE(A > 5, B = A, C = B).run()
Remember that since the assignment operator is deferred in both cases above, none of these assignments will happen until A > 5
is executed on the
device, at which point only one of these assignments will occur.
Initialization of operators and generators#
As mentioned above, it’s common in high-level languages to initialize a tensor/array with a known set of values. For example, generating a range of linearly- spaced values, all ones, or a diagonal matrix. These are all operations that do not need to be generated and stored in memory before using since they are all generated from a formula. MatX calls these types of operators a generator, indicating that they generate data without storage.
Similar to high-level languages, generators can store their values in existing tensors like so:
auto t1 = make_tensor<float>({100});
(t1 = linspace_x(t1.Shape(), 1.0f, 100.0f)).run();
Similar to the set
calls above, instead of an algebraic equation we are storing the output of generator linspace_x
into the tensor t1
.
linspace_x
takes 3 parameters: the shape of the tensor (in this case we match t1), the start value, and the stop value. Since there are 100 elements
in our tensor, it will generate a sequence of 1.0, 2.0, 3.0, etc, and store it in t1
.
Why not just make a shorthand version of linspace_x
that stores directly in a tensor? The reason is that generators can be used as part of a larger
expression and are not limited to simply assigning to a tensor. Expanding on our last example:
auto t1 = make_tensor<float>({100});
(t1 = ones<float>(t1.Shape()) + linspace_x(t1.Shape(), 1.0f, 100.0f) * 5.0).run();
Instead of setting t1
to a range, we multiply the range by 5.0, and add that range to a vector of ones using the ones
generator. Without any
intermediate storage, we combined two generators, a multiply, and an add operator into a single kernel.
Transforms#
As mentioned above, the run
function takes an executor describing where to launch the work. In the examples above run
the operator
expressions created a single fused element-wise operation. Often the type of operation we are trying to do cannot be expressed as
an element-wise operator and therefor can’t be fused with other operations without synchronization. These classes of operators are called transforms.
Transforms can be used anywhere operators are used:
(B = fft(A) * C).run(stream);
The fft
transform above performs a 1D FFT on the tensor A
, multiplies the output by C
, and stores it in B
. Since the FFT
may require synchronizing before performing the multiply, MatX can internally create a temporary buffer for the FFT output and free it when
the expression goes out of scope.
Unless documented otherwise, transforms work on tensors of a specific size. Matrix multiplies require a 2D tensor (matrix), 1D FFTs require
a 1D tensor (vector), etc. If the dimension of the tensor is higher than the expected dimension, all higher dimensions will be batched. In the FFT
call above, if A
and B
are 4D tensors, the inner 3 dimensions will launch a batched 1D FFT with no change in syntax.
As mentioned above, the same tensor views can be used in operator expressions before or after transforms:
(a = b + 2).run(stream);
(c = matmul(a, d)).run(stream);
Or fused in a single line:
(c = matmul(b + 2, d)).run(stream);
The code above executes a kernel to store the result of b + 2
into a
, then subsequently performs the matrix multiply C = A * B
. Since
the operator and matrix multiply are launched in the same CUDA stream, they will be executed serially.
Common reduction executors are also available, such as sum()
, mean()
, max()
, etc:
auto t4 = make_tensor<float>({100, 100, 100, 100});
auto t0 = make_tensor<float>();
(t0 = sum(t4)).run();
The above code performs an optimized sum reduction of t4
into t0
. Currently reduction type exectors can take operators as an input. Please
see the documentation for a list of which ones are compatible.
For more information about operation fusion, see Operator Fusion.
Random numbers#
MatX can generate random numbers using the cuRAND library as the backend. Random number generation consumes memory on the device, so the construction is slightly different than other types above:
auto t2 = make_tensor<float>({100, 50});
auto randOp = random<float>(t.Shape(), NORMAL);
The code above creates a 100x50 2D tensor, followed by a random operator that produces normally-distributed numbers with the same shape as t2
.
Using the random operator above uses the same assignment as with any operator, and when the values are fetched on the device a new random number will be generated for each element.
(t2 = randOp*5 + randOp).run(stream);
In the example above randOp
is accessed twice. On each access a new random number is generated.
That’s it!#
This quick start guide was intended to give a very brief introduction to the concepts behind MatX, and how these concepts apply to the code. There’s a lot more to explore in MatX and far more functions than could be listed here. For more examples we recommend browsing through the examples to see how to perform real tasks using MatX, and the API guide to see an exhaustive list of functions and operators.


Calendar
News & Updates
Subscribe & Follow
Volunteer
Donate
Programs
Graduates
Software Agency
Partner
Join Us
Support Refcode
Spring 2022 Refcode Cohort
Graduates and volunteers from the Spring 2022 Refcode class.
Cathy Ho
Website
GitHub Profile
LinkedIn Profile
Chalew Deghebo
Website
GitHub Profile
LinkedIn Profile
Habo Alo
Website
GitHub Profile
LinkedIn Profile
Kaeden Tun
Website
GitHub Profile
LinkedIn Profile
Malek Alarmash
Website
GitHub Profile
LinkedIn Profile
MHD Alghazouli
Website
GitHub Profile
LinkedIn Profile
Mohamad Alo
Website
GitHub Profile
LinkedIn Profile
Mohammed Ghazal
Website
GitHub Profile
LinkedIn Profile
Mohammed Jafer Ahmed
Website
GitHub Profile
LinkedIn Profile
Rouaa Alarmash
Website
GitHub Profile
LinkedIn Profile
Vini Pietscher
Website
GitHub Profile
LinkedIn Profile
Yousef Zeitone
Website
GitHub Profile
LinkedIn Profile


|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Condition
Condition factors out the Object monitor
methods (wait
, notify
and notifyAll
) into distinct objects to
give the effect of having multiple wait-sets per object, by
combining them with the use of arbitrary Lock
implementations.
Where a Lock replaces the use of synchronized methods
and statements, a Condition replaces the use of the Object
monitor methods.
Conditions (also known as condition queues or condition variables) provide a means for one thread to suspend execution (to "wait") until notified by another thread that some state condition may now be true. Because access to this shared state information occurs in different threads, it must be protected, so a lock of some form is associated with the condition. The key property that waiting for a condition provides is that it atomically releases the associated lock and suspends the current thread, just like Object.wait.
A Condition instance is intrinsically bound to a lock.
To obtain a Condition instance for a particular Lock
instance use its newCondition()
method.
As an example, suppose we have a bounded buffer which supports
put and take methods. If a
take is attempted on an empty buffer, then the thread will block
until an item becomes available; if a put is attempted on a
full buffer, then the thread will block until a space becomes available.
We would like to keep waiting put threads and take
threads in separate wait-sets so that we can use the optimization of
only notifying a single thread at a time when items or spaces become
available in the buffer. This can be achieved using two
Condition
instances.
class BoundedBuffer { final Lock lock = new ReentrantLock(); final Condition notFull = lock.newCondition(); final Condition notEmpty = lock.newCondition(); final Object[] items = new Object[100]; int putptr, takeptr, count; public void put(Object x) throws InterruptedException { lock.lock(); try { while (count == items.length) notFull.await(); items[putptr] = x; if (++putptr == items.length) putptr = 0; ++count; notEmpty.signal(); } finally { lock.unlock(); } } public Object take() throws InterruptedException { lock.lock(); try { while (count == 0) notEmpty.await(); Object x = items[takeptr]; if (++takeptr == items.length) takeptr = 0; --count; notFull.signal(); return x; } finally { lock.unlock(); } } }(The
ArrayBlockingQueue
class provides
this functionality, so there is no reason to implement this
sample usage class.)
A Condition implementation can provide behavior and semantics that is different from that of the Object monitor methods, such as guaranteed ordering for notifications, or not requiring a lock to be held when performing notifications. If an implementation provides such specialized semantics then the implementation must document those semantics.
Note that Condition instances are just normal objects and can
themselves be used as the target in a synchronized statement,
and can have their own monitor wait
and
notification
methods invoked.
Acquiring the monitor lock of a Condition instance, or using its
monitor methods, has no specified relationship with acquiring the
Lock
associated with that Condition or the use of its
waiting
and signalling
methods.
It is recommended that to avoid confusion you never use Condition
instances in this way, except perhaps within their own implementation.
Except where noted, passing a null value for any parameter
will result in a NullPointerException
being thrown.
When waiting upon a Condition, a "spurious wakeup" is permitted to occur, in general, as a concession to the underlying platform semantics. This has little practical impact on most application programs as a Condition should always be waited upon in a loop, testing the state predicate that is being waited for. An implementation is free to remove the possibility of spurious wakeups but it is recommended that applications programmers always assume that they can occur and so always wait in a loop.
The three forms of condition waiting (interruptible, non-interruptible, and timed) may differ in their ease of implementation on some platforms and in their performance characteristics. In particular, it may be difficult to provide these features and maintain specific semantics such as ordering guarantees. Further, the ability to interrupt the actual suspension of the thread may not always be feasible to implement on all platforms.
Consequently, an implementation is not required to define exactly the same guarantees or semantics for all three forms of waiting, nor is it required to support interruption of the actual suspension of the thread.
An implementation is required to clearly document the semantics and guarantees provided by each of the waiting methods, and when an implementation does support interruption of thread suspension then it must obey the interruption semantics as defined in this interface.
As interruption generally implies cancellation, and checks for interruption are often infrequent, an implementation can favor responding to an interrupt over normal method return. This is true even if it can be shown that the interrupt occurred after another action may have unblocked the thread. An implementation should document this behavior.
| Method Summary | |
|---|---|
void |
await()
Causes the current thread to wait until it is signalled or interrupted . |
boolean |
await(long time,
TimeUnit unit)
Causes the current thread to wait until it is signalled or interrupted, or the specified waiting time elapses. |
long |
awaitNanos(long nanosTimeout)
Causes the current thread to wait until it is signalled or interrupted, or the specified waiting time elapses. |
void |
awaitUninterruptibly()
Causes the current thread to wait until it is signalled. |
boolean |
awaitUntil(Date deadline)
Causes the current thread to wait until it is signalled or interrupted, or the specified deadline elapses. |
void |
signal()
Wakes up one waiting thread. |
void |
signalAll()
Wakes up all waiting threads. |
| Method Detail |
|---|
void await() throws InterruptedException
interrupted
.
The lock associated with this Condition is atomically released and the current thread becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:
signal()
method for this
Condition and the current thread happens to be chosen as the
thread to be awakened; or
signalAll()
method for this
Condition; or
interrupts
the current
thread, and interruption of thread suspension is supported; or
In all cases, before this method can return the current thread must re-acquire the lock associated with this condition. When the thread returns it is guaranteed to hold this lock.
If the current thread:
interrupted
while waiting
and interruption of thread suspension is supported,
InterruptedException
is thrown and the current thread's
interrupted status is cleared. It is not specified, in the first
case, whether or not the test for interruption occurs before the lock
is released.
Implementation Considerations
The current thread is assumed to hold the lock associated with this
Condition when this method is called.
It is up to the implementation to determine if this is
the case and if not, how to respond. Typically, an exception will be
thrown (such as IllegalMonitorStateException
) and the
implementation must document that fact.
An implementation can favor responding to an interrupt over normal method return in response to a signal. In that case the implementation must ensure that the signal is redirected to another waiting thread, if there is one.
InterruptedException
- if the current thread is interrupted (and
interruption of thread suspension is supported).void awaitUninterruptibly()
The lock associated with this condition is atomically released and the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happens:
signal()
method for this
Condition and the current thread happens to be chosen as the
thread to be awakened; or
signalAll()
method for this
Condition; or
In all cases, before this method can return the current thread must re-acquire the lock associated with this condition. When the thread returns it is guaranteed to hold this lock.
If the current thread's interrupted status is set when it enters
this method, or it is interrupted
while waiting, it will continue to wait until signalled. When it finally
returns from this method its interrupted status will still
be set.
Implementation Considerations
The current thread is assumed to hold the lock associated with this
Condition when this method is called.
It is up to the implementation to determine if this is
the case and if not, how to respond. Typically, an exception will be
thrown (such as IllegalMonitorStateException
) and the
implementation must document that fact.
long awaitNanos(long nanosTimeout) throws InterruptedException
The lock associated with this condition is atomically released and the current thread becomes disabled for thread scheduling purposes and lies dormant until one of five things happens:
signal()
method for this
Condition and the current thread happens to be chosen as the
thread to be awakened; or
signalAll()
method for this
Condition; or
interrupts
the current
thread, and interruption of thread suspension is supported; or
In all cases, before this method can return the current thread must re-acquire the lock associated with this condition. When the thread returns it is guaranteed to hold this lock.
If the current thread:
interrupted
while waiting
and interruption of thread suspension is supported,
InterruptedException
is thrown and the current thread's
interrupted status is cleared. It is not specified, in the first
case, whether or not the test for interruption occurs before the lock
is released.
The method returns an estimate of the number of nanoseconds remaining to wait given the supplied nanosTimeout value upon return, or a value less than or equal to zero if it timed out. This value can be used to determine whether and how long to re-wait in cases where the wait returns but an awaited condition still does not hold. Typical uses of this method take the following form:
synchronized boolean aMethod(long timeout, TimeUnit unit) { long nanosTimeout = unit.toNanos(timeout); while (!conditionBeingWaitedFor) { if (nanosTimeout > 0) nanosTimeout = theCondition.awaitNanos(nanosTimeout); else return false; } // ... }
Design note: This method requires a nanosecond argument so as to avoid truncation errors in reporting remaining times. Such precision loss would make it difficult for programmers to ensure that total waiting times are not systematically shorter than specified when re-waits occur.
Implementation Considerations
The current thread is assumed to hold the lock associated with this
Condition when this method is called.
It is up to the implementation to determine if this is
the case and if not, how to respond. Typically, an exception will be
thrown (such as IllegalMonitorStateException
) and the
implementation must document that fact.
An implementation can favor responding to an interrupt over normal method return in response to a signal, or over indicating the elapse of the specified waiting time. In either case the implementation must ensure that the signal is redirected to another waiting thread, if there is one.
nanosTimeout
- the maximum time to wait, in nanoseconds
InterruptedException
- if the current thread is interrupted (and
interruption of thread suspension is supported).boolean await(long time, TimeUnit unit) throws InterruptedException
awaitNanos(unit.toNanos(time)) > 0
time
- the maximum time to waitunit
- the time unit of the time argument.
InterruptedException
- if the current thread is interrupted (and
interruption of thread suspension is supported).boolean awaitUntil(Date deadline) throws InterruptedException
The lock associated with this condition is atomically released and the current thread becomes disabled for thread scheduling purposes and lies dormant until one of five things happens:
signal()
method for this
Condition and the current thread happens to be chosen as the
thread to be awakened; or
signalAll()
method for this
Condition; or
interrupts
the current
thread, and interruption of thread suspension is supported; or
In all cases, before this method can return the current thread must re-acquire the lock associated with this condition. When the thread returns it is guaranteed to hold this lock.
If the current thread:
interrupted
while waiting
and interruption of thread suspension is supported,
InterruptedException
is thrown and the current thread's
interrupted status is cleared. It is not specified, in the first
case, whether or not the test for interruption occurs before the lock
is released.
The return value indicates whether the deadline has elapsed, which can be used as follows:
synchronized boolean aMethod(Date deadline) { boolean stillWaiting = true; while (!conditionBeingWaitedFor) { if (stillwaiting) stillWaiting = theCondition.awaitUntil(deadline); else return false; } // ... }
Implementation Considerations
The current thread is assumed to hold the lock associated with this
Condition when this method is called.
It is up to the implementation to determine if this is
the case and if not, how to respond. Typically, an exception will be
thrown (such as IllegalMonitorStateException
) and the
implementation must document that fact.
An implementation can favor responding to an interrupt over normal method return in response to a signal, or over indicating the passing of the specified deadline. In either case the implementation must ensure that the signal is redirected to another waiting thread, if there is one.
deadline
- the absolute time to wait until
InterruptedException
- if the current thread is interrupted (and
interruption of thread suspension is supported).void signal()
If any threads are waiting on this condition then one is selected for waking up. That thread must then re-acquire the lock before returning from await.
void signalAll()
If any threads are waiting on this condition then they are all woken up. Each thread must re-acquire the lock before it can return from await.
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.


{% extends "website/base.html" %} {% block body_block %}
Please check your username and password and try again.
Sign up here! Forgotten your password?


Configure JIRA Capture
Once you are able to login to the Metal Toad JIRA website and able to create issues lets configure JIRA Capture. Follow the steps located below:
- Click the JIRA Capture icon in the upper right hand corner of your browser (blue person with three dots above it) to open the extension.
- Next click the settings icon (grey gear) if the configuration fields are not already visible on the left hand side of the your browser.
- Fill in Server URL with metaltoad.atlassian.net
- Fill in Username with your supplied login username for JIRA
- Fill in Password with your supplied login password for JIRA
- Click the save button


In this section we’ll walkthrough how to trigger your lambda function in response to inbound email. This overview is based on the SpartaApplication sample code if you’d rather jump to the end result.
Assume that we have already verified our email domain with AWS. This allows our domain’s email to be handled by SES.
We’ve been asked to write a lambda function that logs inbound messages, including the metadata associated with the message body itself.
There is also an additional requirement to support immutable infrastructure, so our service needs to manage the S3 bucket to which message bodies should be stored. Our service cannot rely on a pre-existing S3 bucket. The infrastructure (and associated security policies) together with the application logic is coupled.
We’ll start with an empty lambda function and build up the needed functionality.
import (
spartaSES "github.com/mweagle/Sparta/v3/aws/ses"
)
func echoSESEvent(ctx context.Context, sesEvent spartaSES.Event) (*spartaSES.Event, error) {
logger, _ := ctx.Value(sparta.ContextKeyRequestLogger).(*zerolog.Logger)
configuration, configErr := sparta.Discover()
logger.Info().
Err(configErr).
Interface("Configuration", configuration).
Msg("Discovery results")
}
At this point we would normally continue processing the SES event, using Sparta types until the official events are available.
However, before moving on to the event processing, we need to take a detour into dynamic infrastructure because of the immutable infrastructure requirement.
This requirement implies that our service must be self-contained: we can’t assume that the S3 bucket already exists. How can our locally compiled code access AWS-created resources?
The immutable infrastructure requirement makes this lambda function a bit more complex. Our service needs to:
Let’s first take a look at how the SES lambda handler provisions a new S3 bucket via the MessageBodyStorage type:
func appendSESLambda(api *sparta.API,
lambdaFunctions []*sparta.LambdaAWSInfo)
[]*sparta.LambdaAWSInfo {
// Our lambda function will need to be able to read from the bucket, which
// will be handled by the S3MessageBodyBucketDecorator below
lambdaFn, _ := sparta.NewAWSLambda(sparta.LambdaName(echoSESEvent),
echoSESEvent,
sparta.IAMRoleDefinition{})
// Setup options s.t. the lambda function has time to consume the message body
lambdaFn.Options = &sparta.LambdaFunctionOptions{
Description: "",
MemorySize: 128,
Timeout: 10,
}
// Add a Permission s.t. the Lambda function automatically manages SES registration
sesPermission := sparta.SESPermission{
BasePermission: sparta.BasePermission{
// SES only supports wildcard ARNs
SourceArn: "*",
},
InvocationType: "Event",
}
// Store the message body
bodyStorage, _ := sesPermission.NewMessageBodyStorageResource("Special")
sesPermission.MessageBodyStorage = bodyStorage
The MessageBodyStorage
type (and the related MessageBodyStorageOptions type)
cause our SESPermission handler to add an S3 ReceiptRule
at the head of the rules list. This rule instructs SES to store the message body in the supplied bucket before invoking our lambda function.
The single parameter "Special"
is an application-unique literal value that is used to create a stable CloudFormation
resource identifier so that new buckets are not created in response to stack update requests.
Our SES handler then adds two ReceiptRules:
sesPermission.ReceiptRules = make([]sparta.ReceiptRule, 0)
sesPermission.ReceiptRules = append(sesPermission.ReceiptRules,
sparta.ReceiptRule{
Name: "Special",
Recipients<EMAIL_ADDRESS>TLSPolicy: "Optional",
})
sesPermission.ReceiptRules = append(sesPermission.ReceiptRules,
sparta.ReceiptRule{
Name: "Default",
Recipients: []string{},
TLSPolicy: "Optional",
})
Our lambda function is required to access the message body in the dynamically created MessageBodyStorage
resource, but
the S3 resource Arn is only defined after the service is provisioned. The solution to this is to reference the
dynamically generated BucketArnAllKeys()
value in the sparta.IAMRolePrivilege
initializer:
// Then add the privilege to the Lambda function s.t. we can actually get at the data
lambdaFn.RoleDefinition.Privileges = append(lambdaFn.RoleDefinition.Privileges,
sparta.IAMRolePrivilege{
Actions: []string{"s3:GetObject", "s3:HeadObject"},
Resource: sesPermission.MessageBodyStorage.BucketArnAllKeys(),
})
The last step is to register the SESPermission
with the lambda info:
// Finally add the SES permission to the lambda function
lambdaFn.Permissions = append(lambdaFn.Permissions, sesPermission)
At this point we’ve implicitly created an S3 bucket via the MessageBodyStorage
value. Our lambda function now needs to dynamically determine the AWS-assigned bucket name.
Our echoSESEvent
function needs to determine, at execution time, the MessageBodyStorage
S3 bucket name. This is done via sparta.Discover()
:
configuration, configErr := sparta.Discover()
logger.Info().
Err(configErr).
Interface("Configuration", configuration).
Msg("Discovery results")
// The message bucket is an explicit `DependsOn` relationship, so it'll be in the
// resources map. We'll find it by looking for the dependent resource with the "AWS::S3::Bucket" type
bucketName := ""
for _, eachResourceInfo := range configuration.Resources {
if eachResourceInfo.ResourceType == "AWS::S3::Bucket" {
bucketName = eachResourceInfo.Properties["Ref"]
}
}
if "" == bucketName {
return nil, errors.Errorf("Failed to discover SES bucket from sparta.Discovery: %#v", configuration)
}
The sparta.Discover()
function returns a DiscoveryInfo structure. This
data is published into the Lambda’s environment variables to enable it to discover other
resources published in the same Stack.
The structure includes the stack’s Pseudo Parameters
as well information about any immediate resource dependencies.
Eg, those that were explicitly marked as DependsOn
. See the discovery documentation for more details.
As we only have a single dependency, our discovery filter is:
// The message bucket is an explicit `DependsOn` relationship, so it'll be in the
// resources map. We'll find it by looking for the dependent resource with the "AWS::S3::Bucket" type
bucketName := ""
for _, eachResourceInfo := range configuration.Resources {
if eachResourceInfo.ResourceType == "AWS::S3::Bucket" {
bucketName = eachResourceInfo.Properties["Ref"]
}
}
if "" == bucketName {
return nil, errors.Errorf("Failed to discover SES bucket from sparta.Discovery: %#v", configuration)
}
The rest of echoSESEvent
satisfies the other requirements, with a bit of help from the SES event types:
// Get the metdata about the item...
svc := s3.New(session.New())
for _, eachRecord := range sesEvent.Records {
logger.Info().
Str("Source", eachRecord.SES.Mail.Source).
Str("MessageID", eachRecord.SES.Mail.MessageID).
Str("BucketName", bucketName).
Msg("SES Event")
if "" != bucketName {
params := &s3.HeadObjectInput{
Bucket: aws.String(bucketName),
Key: aws.String(eachRecord.SES.Mail.MessageID),
}
resp, err := svc.HeadObject(params)
logger.Info().
Interface("Metadata", resp).
Err(err).
Msg("SES MessageBody")
}
}
return &sesEvent, nil
With the lambdaFn
fully defined, we can provide it to sparta.Main()
and deploy our service. The workflow below is shared by all SES-triggered lambda function:
echoSESEvent
).sparta.NewAWSLambda()
LambdaAWSInfo
struct so that the lambda function is triggered.Additionally, if the SES handler needs to access the raw email message body:
sesPermission.NewMessageBodyStorageResource("Special")
value to store the message bodysesPermission.MessageBodyStorage
fieldsesPermission.[]IAMPrivilege
that includes the sesPermission.MessageBodyStorage.BucketArnAllKeys()
Arnsparta.Discover()


Javascript Iterators and Generators
Our motivating example
The Pomodoro Technique for time management
The pomodoro technique is a time management tool which
alternates between periods of focused work and shorter periods of rest.
- Focus on a task for 25 minutes
- Rest for 5 minutes
- Focus on a task for 25 minutes
- Rest for 5 minutes
- Focus on a task for 25 minutes
- Rest for 5 minutes
- Focus on a task for 25 minutes
- Rest for 20 minutes
Code for the pomodoro timer
In JavaScript an iterator is an object which defines a sequence and potentially a return value upon its termination.
interface Iterator {
next(): {
done: boolean, // True if there are more
// elements in the sequence
value: any // The latest element of the sequence
};
}
const arrayIterator = [1, 2, 3][Symbol.iterator]();
console.log(arrayIterator.next());
// { value: 1, done: false }
console.log(arrayIterator.next());
// { value: 2, done: false }
console.log(arrayIterator.next())
// { value: 3, done: false }
console.log(arrayIterator.next())
// { value: undefined, done: true }
Code for the pomodoro timer using iterators
Critique of the code (again)
While custom iterators are a useful tool, their creation requires careful programming due to the need to explicitly maintain their internal state. Generator functions provide a powerful alternative: they allow you to define an iterative algorithm by writing a single function whose execution is not continuous.
function *countToThree() {
yield 1; // Pass control
yield 2;
yield 3;
}
const counting = countToThree();
console.log(counting.next());
// { value: 1, done: false }
console.log(counting.next());
// { value: 2, done: false }
Code for the pomodoro timer using generators
Chrome's Javascript Engine


GD - Sketch
Search
Browse
Add Your Company
Company Description
Available Positions
External
Company Description
{{ companyDescription }}
Job Listings:
Application Link
Job Title
Apply
{{job.title}}
Last
Next
External Links
{{ Object.keys(externalLinks).find(key => externalLinks[key] === link) }}


Friend Finder
________________________________________________________________________________
Answer a few basic questions.
Then find the friend with the greatest compatibility!
Go to Survey


'use strict';
// GRAPH_OT_extrapolation_type
/**
* FCurve extrapolation types, before its first keyframe and after its last keyframe.
* @enum {number}
* @readonly
*/
var Extrapolation = {
/** Keeps a constant value. */
CONSTANT: 0,
/** Continues as straight lines. */
LINEAR: 1,
};
module.exports = Extrapolation;


| 003:174 Khan | : |
So they returned with Grace and Bounty from Allah. No harm touched them; and they followed the good Pleasure of Allah. And Allah is the Owner of Great Bounty. |
| 003:174 Maulana | : |
So they returned with favour from Allah and (His) grace; no evil touched them, and they followed the pleasure of Allah. And Allah is the Lord of mighty grace. |
| 003:174 Pickthal | : |
So they returned with grace and favour from Allah, and no harm touched them. They followed the good pleasure of Allah, and Allah is of Infinite Bounty. |
| 003:174 Rashad | : |
They have deserved GOD's blessings and grace. No harm ever touches them, for they have attained GOD's approval. GOD possesses infinite grace. |
| 003:174 Sarwar | : |
They returned with the favors and the bounties of God untouched by evil and followed by the pleasure of God. God's favor is great. |
| 003:174 Shakir | : |
So they returned with favor from Allah and (His) grace, no evil touched them and they followed the pleasure of Allah; and Allah is the Lord of mighty grace. |
| 003:174 Sherali | : |
So they returned with a mighty favour from ALLAH and a great bounty, while no evil had touched them; and they followed the pleasure of ALLAH; and ALLAH is the Lord of great bounty. |
| 003:174 Yusufali | : |
And they returned with Grace and bounty from Allah: no harm ever touched them: For they followed the good pleasure of Allah: And Allah is the Lord of bounties unbounded. |
Concepts/Themes Covered: أركان الإسلام > التوحيد > توحيد الله تعالي > صفات الله تعالى > ذو فضل Pillars of Islam> Islamic> Oneness of Allah> His Glory's Characteristics> The Full of Bounty to Mankind الجهاد > الشهداء > منزلتهم وما أعد الله لهم Jihad>The Martyrs> Their Rank and What Allah has Prepared for them الجهاد > الغزوات > غزوة حمراء الأسد Jihad> The Holy Battles> Hamra'a Al-Asad Battle الجهاد > نتائج الحرب > الهزيمة Jihad> The War Results> The Defeat
This tool uses eight English parallel translations for the Holy Quran imported from Mr. Clay Smith. You can also visit Qurany Concepts for browsing the Quran themes or topics. If you want to search the Holy Quran for keywords, please visit Qurany Keywords.


THE UNSEEN WELLES A film review by Jeff Meyer Copyright 1988 Jeff Meyer
Seen at the Seattle Film Festival:
I'm not sure whether to call this a retrospective or a review of newly-released work. Come to think of it, it hardly matters -- it seems unlikely that you will ever see the majority of the films I'm about to describe. Most of them were brought up by Gary Graver, a cinematographer who worked with Welles during the last two decades of his life. I've heard Graver called any number of things -- a talented collaborator of Welles, a hanger-on who has lived off Welles "memorabilia," and other sobriquets; I'll leave it that I haven't the slightest idea one way or another. I'm glad that he provided the clips and films that he did; they were certainly of interest to anyone who has followed Welles career in the cinema, and his isolation from the mainstream of the film industry.
Whether the average viewer would enjoy the majority of works shown here... that's another question. Two parts of THE UNSEEN WELLES, "Fountain of Youth," a wonderful half-hour TV pilot for an Orson Welles weekly television playhouse, and OTHELLO (1952), shown in a new 35mm print, were real treats (more about them later). The rest of the clips, however, while being of interest to the film historian, were not what could be called of general interest. Most were very unfinished, and showed the signs of extremely limited budgets and production values. It was impressive to see how clever Welles could be with a Super-8 movie camera; but the average film viewer would have been bored stiff, I think. The trailer of F FOR FAKE, clips from his unfinished works THE MERCHANT OF VENICE, THE DEEP, and others were often rather tedious and extremely unfinished (no editing, sometimes no sound).
The only set of clips I was fascinated with were from a film Welles attempted around 1967 to 1972 (I believe -- it's a bit fuzzy at the moment) called THE OTHER SIDE OF THE WIND. The story deals with a Raoul-Walsh-like director (played by John Huston) who is being financed by several producers to do a film marketed at the EASY RIDER audience. The film deals with a party the director throws at his ranch, where many sixties new-wave film makers are invited to attend, all with cameras in hand. The film yanks back and forth between different cameras' point of views, and it's a nice touch, though a bit tedious towards the end (however, it was unclear whether this would have been edited down or not when released). Also interesting was spotting some of the actors in it: Huston, Robert Walden (Rossi of "Lou Grant"), and a few others whose names have faded in the last month (damn, I have to start writing these columns when I get home...). The second set of clips were of two men and a women driving through the rain at night on a desert highway, and is one of the most erotic sequences I can remember. The final sequences were of a young man (who looked and sounded a *hell* of a lot like an 18-year-old John Savage) chasing around a naked girl, apparently under Huston's direction; Huston's character never appears, but his voice instructs both in such a way that you wonder if it's supposed to be a scene in Huston's movie, or whether the two are really performing their run-around with Huston providing sardonic comment. Also, I was never sure whether the sequences' very "Sixties" appearance were real or the result of Welles wanting to make it *look* that way -- the man could affect current fashions faster than "People" magazine. Very impressive, though the production values were again dismayingly poor; Graver says that the film is co-owned by himself and Welles' longtime associate/lover, Oja Palinkas, and that when and if they get the money, they will work at editing it and releasing it (not-too-subtle hinting there; I'm surprised a plate wasn't passed around).
The rest of the evening (except for OTHELLO and the TV pilot) were clips of Welles doing magic (really boring) and some out-takes from test film. No redeeming value whatsoever. Considering the show got out so late (I left at 11:10 on a Monday night, and the German TV documentary "The Making of OTHELLO" had still not been shown), I think Graver could have cut much of this out. I refrain from mooning over the cinematic and photographic leftovers of Marilyn Monroe that seem so prolific; Orson Welles smoking a cigar for Japanese commercials is even less interesting to me (for obvious reasons).
The evening was still a success, however; "Fountain of Youth" was a delightfully droll story about a romantic triangle between a Narcissistic young actress, an equally vain tennis pro, and a clever professor whose work with glands acts as a potent weapon against his rival. This is *witty* comedy, and I wish to heaven that someone would sell the pilot to the people releasing Golden Age television on video -- this is a gem. Unseen for years, it was Welles' effort to compete with the likes of "Texaco Theater" and other television dramas; directing, writing and narrating, he brought the pilot in on time and under budget, often using slides and silhouettes in an appealing manner that added to the "gossip column" atmosphere of the play. CBS paid him for the pilot and then put it on the shelf. They finally showed it during the summer when faced with an empty half-hour slot when Edward R. Murrow fell ill. This was the only time "Fountain of Youth" was ever broadcast, but it went on to win the Peabody Award that year, which must have been sweet to Welles after having been shunned by the network. If it ever comes out on video, I recommend that you get it. This is the kind of thing that they don't do on television anymore (not even "American Playhouse" -- they're all 1-1/2 to 2 hours long), and Welles' made it a high point of the genre. The story unfolds like one of Woody Allen's amusing short stories: snappy, sardonic and assuming a reasonably intelligent audience.
The other work was OTHELLO; shot in black and white in Spain in an ancient castle, it is full of Wellesian camera tricks and angles -- wonderful moving shots of Welles (as Othello) striding through the ancient halls, the pillars dividing the shots. Halliwell asks if this was the best way to film Shakespeare; I don't know if it serves as a fit introduction to the Moor for the first-time reader, but it is a kick to someone who enjoys lively cinematography and who has seen OTHELLO several times before. An interesting mix: some Olivier-like symbolism (the hanging cage), moderately good acting (not great, though) and the feeling that you're watching a suspense movie at times (I half expected Alan Ladd to walk in with a trench coat at the end).
Moriarty, aka Jeff Meyer INTERNET<EMAIL_ADDRESS>Manual UUCP: {uw-beaver, sun, microsoft}!fluke!moriarty
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Technology Enthusiast
Retail manager turned technology enthusiast seeking a programming role where I can work in a team to build apps that maximize organizations’ creativity and potential.
Retail manager turned technology enthusiast seeking a programming role where I can work in a team to build apps that maximize organizations’ creativity and potential.
I have a knack for technology and I've been able to pick up skills quickly while working in a variety of settings. I enjoy growing my toolbelt through building projects like interactive games.
I started my journey of becoming a Software Engineer less than four months ago and It all started at Code Tenderloin. I have created some awesome projects and filled up almost everyday with tons of self study. Basically I get up in the morning and go down to the coffee shop and I’m there tell it closes. I do my best everyday and I have put together an awesome portfolio website that I would love for you all to see! Just click the link above!


{{ post.title }}
{{ post.excerpt }}
Read More
--- layout: default published: true ---
Welcome, welcome. My name's David Charles and I blog about the world of ideas and adventures. I also write and publish pay what you want books of slow travel. Enjoy.


Utility, miscellanies
In order to lower interdependency between packages, put commonly used thing in this.
There should not be any dependencies in this package to other packages.
- Constants
- Types
- Calculations
Constants
Any constants that are used multiple places.
Types
Any types that are used multiple places.
Calculations
Some calculations.


"As engineers, we were going to be in a position to change the world - not just study it". By: Henry Petroski
We want to give a special thanks to the National Science Foundation for supporting our research!
We want to give a special thanks to the American Chemistry Society for supporting our research!


Polynomial Interpolation Web GUI with GeoGebra
You can add points via the menu, then click Interpolate to show the interpolation polynomial function.
Browser support
Every up-to-date browser including Microsoft Edge. The code makes use of ES modules, thus IE 11 is not supported.
References
Author
ComFreek, you can find me on github.com/ComFreek


1. Introduction
The Orientation Sensor API extends the Generic Sensor API [GENERIC-SENSOR] to provide generic information describing the device’s physical orientation in relation to a three dimensional Cartesian coordinate system.
The AbsoluteOrientationSensor
class inherits from the OrientationSensor
interface and
describes the device’s physical orientation in relation to the Earth’s reference coordinate system.
Other subclasses describe the orientation in relation to other stationary directions, such as true north, or non stationary directions, like in relation to a devices own z-position, drifting towards its latest most stable z-position.
The data provided by the OrientationSensor
subclasses are similar to data from DeviceOrientationEvent
, but the Orientation Sensor API has the following significant differences:
-
The Orientation Sensor API represents orientation data in WebGL-compatible formats (quaternion, rotation matrix).
-
The Orientation Sensor API satisfies stricter latency requirements.
-
Unlike
DeviceOrientationEvent
, theOrientationSensor
subclasses explicitly define which low-level motion sensors are used to obtain the orientation data, thus obviating possible interoperability issues. -
Instances of
OrientationSensor
subclasses are configurable viaSensorOptions
constructor parameter.
2. Use Cases and Requirements
The use cases and requirements are discussed in the Motion Sensors Explainer document.
3. Examples
const sensor= new AbsoluteOrientationSensor(); const mat4= new Float32Array( 16 ); sensor. start(); sensor. onerror= event=> console. log( event. error. name, event. error. message); sensor. onchange= () => { sensor. populateMatrix( mat4); };
const sensor= new AbsoluteOrientationSensor({ frequency: 60 }); const mat4= new Float32Array( 16 ); sensor. start(); sensor. onerror= event=> console. log( event. error. name, event. error. message); function draw( timestamp) { window. requestAnimationFrame( draw); try { sensor. populateMatrix( mat4); } catch ( e) { // mat4 has not been updated. } // Drawing... } window. requestAnimationFrame( draw);
4. Security and Privacy Considerations
There are no specific security and privacy considerations beyond those described in the Generic Sensor API [GENERIC-SENSOR].
5. Model
The OrientationSensor
class extends the Sensor
class and provides generic interface
representing device orientation data.
To access the orientation sensor’s latest reading, the user agent must invoke request sensor access abstract operation for each of the low-level sensors used by the concrete orientation sensor. The table below describes mapping between concrete orientation sensors and permission tokens defined by low-level sensors.
| OrientationSensor sublass | Permission tokens |
|---|---|
AbsoluteOrientationSensor
| "accelerometer ", "gyroscope ", "magnetometer "
|
A latest reading per sensor of orientation type includes an entry whose key is "quaternion" and whose value contains a four element list. The elements of the list are equal to components of a unit quaternion [QUATERNIONS] [Vx * sin(θ/2), Vy * sin(θ/2), Vz * sin(θ/2), cos(θ/2)] where V is the unit vector (whole elements are Vx, Vy, and Vz) representing the axis of rotation, and θ is the rotation angle about the axis defined by the unit vector V.
Note: The quaternion components are arranged in the list as [q1, q2, q3, q0] [QUATERNIONS], i.e. the components representing the vector part of the quaternion go first and the scalar part component which is equal to cos(θ/2) goes after. This order is used for better compatibility with the most of the existing WebGL frameworks, however other libraries could use a different order when exposing quaternion as an array, e.g. [q0, q1, q2, q3].
The AbsoluteOrientationSensor
class is a subclass of OrientationSensor
which represents the Absolute
Orientation Sensor.
The absolute orientation sensor is a high-level sensor which is created through sensor-fusion of the low-level motion sensors:
-
accelerometer that measures acceleration,
-
gyroscope that measures angular velocity, and
-
magnetometer that measures magnetic field.
Note: Corresponding low-level sensors are defined in [ACCELEROMETER], [GYROSCOPE], and [MAGNETOMETER]. Regardless, the fusion is platform specific and can happen in software or hardware, i.e. on a sensor hub.
For the absolute orientation sensor the value of latest reading["quaternion"] represents the rotation of a device hosting motion sensors in relation to the Earth’s reference coordinate system defined as a three dimensional Cartesian coordinate system (x, y, z), where:
-
x-axis is a vector product of y.z that is tangential to the ground and points east,
-
y-axis is tangential to the ground and points towards magnetic north, and
-
z-axis points towards the sky and is perpendicular to the plane made up of x and y axes.
The device’s local coordinate system is the same as defined by low-level motion sensors.
Note: Figure below represents the case where device’s local coordinate system and the Earth’s reference coordinate system are aligned, therefore, orientation sensor’s latest reading would represent 0 (rad) [SI] rotation about each axis.
6. API
6.1. The OrientationSensor Interface
typedef (Float32Array or Float64Array or DOMMatrix );
RotationMatrixType interface :
OrientationSensor Sensor {readonly attribute FrozenArray <double >?;
quaternion void (
populateMatrix RotationMatrixType ); };
targetMatrix
6.1.1. OrientationSensor.quaternion
Returns a four-element FrozenArray
whose elements contain the components of the unit quaternion representing the device orientation.
In other words, this attribute returns latest reading["quaternion"].
6.1.2. OrientationSensor.populateMatrix()
The populateMatrix()
method populates the given object with rotation matrix
which is converted from the value of latest reading["quaternion"] [QUATCONV], as shown below:
where:
-
W = cos(θ/2)
-
X = Vx * sin(θ/2)
-
Y = Vy * sin(θ/2)
-
Z = Vz * sin(θ/2)
The rotation matrix is flattened in targetMatrix object according to the column-major order, as described in populate rotation matrix algorighm.
populateMatrix()
method must
run these steps or their equivalent:
-
If targetMatrix is not of type defined by
RotationMatrixType
union, throw a "TypeError
"DOMException
and abort these steps. -
If targetMatrix is of type
Float32Array
orFloat64Array
with a size less than sixteen, throw a "TypeError
"DOMException
and abort these steps. -
Let quaternion be the value of latest reading["quaternion"]
-
If quaternion is
null
, throw a "NotReadableError
"DOMException
and abort these steps. -
Let x be the value of quaternion[0]
-
Let y be the value of quaternion[1]
-
Let z be the value of quaternion[2]
-
Let w be the value of quaternion[3]
-
If targetMatrix is of
Float32Array
orFloat64Array
type, run these sub-steps:-
Set targetMatrix[0] = 1 - 2 * y * y - 2 * z * z
-
Set targetMatrix[1] = 2 * x * y - 2 * z * w
-
Set targetMatrix[2] = 2 * x * z + 2 * y * w
-
Set targetMatrix[3] = 0
-
Set targetMatrix[4] = 2 * x * y + 2 * z * w
-
Set targetMatrix[5] = 1 - 2 * x * x - 2 * z * z
-
Set targetMatrix[6] = 2 * y * z - 2 * x * w
-
Set targetMatrix[7] = 0
-
Set targetMatrix[8] = 2 * x * z - 2 * y * w
-
Set targetMatrix[9] = 2 * y * z + 2 * x * w
-
Set targetMatrix[10] = 1 - 2 * x * x - 2 * y * y
-
Set targetMatrix[11] = 0
-
Set targetMatrix[12] = 0
-
Set targetMatrix[13] = 0
-
Set targetMatrix[14] = 0
-
Set targetMatrix[15] = 1
-
-
If targetMatrix is of
DOMMatrix
type, run these sub-steps:-
Set targetMatrix.m11 = 1 - 2 * y * y - 2 * z * z
-
Set targetMatrix.m12 = 2 * x * y - 2 * z * w
-
Set targetMatrix.m13 = 2 * x * z + 2 * y * w
-
Set targetMatrix.m14 = 0
-
Set targetMatrix.m21 = 2 * x * y + 2 * z * w
-
Set targetMatrix.m22 = 1 - 2 * x * x - 2 * z * z
-
Set targetMatrix.m23 = 2 * y * z - 2 * x * w
-
Set targetMatrix.m24 = 0
-
Set targetMatrix.m31 = 2 * x * z - 2 * y * w
-
Set targetMatrix.m32 = 2 * y * z + 2 * x * w
-
Set targetMatrix.m33 = 1 - 2 * x * x - 2 * y * y
-
Set targetMatrix.m34 = 0
-
Set targetMatrix.m41 = 0
-
Set targetMatrix.m42 = 0
-
Set targetMatrix.m43 = 0
-
Set targetMatrix.m44 = 1
-
6.2. The AbsoluteOrientationSensor Interface
[Constructor (optional SensorOptions sensorOptions )]interface :
AbsoluteOrientationSensor OrientationSensor { };
To Construct an AbsoluteOrientationSensor Object the user agent must invoke the construct a Sensor object abstract operation.
7. Acknowledgements
Tobie Langel for the work on Generic Sensor API.
8. Conformance
Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.
All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]
A conformant user agent must implement all the requirements listed in this specification that are applicable to user agents.
The IDL fragments in this specification must be interpreted as required for conforming IDL fragments, as described in the Web IDL specification. [WEBIDL]


Sparks Javascript Framework
Bitchin'
-
What is Sparks?
- It's a Javascript framework built upon MochiKit covering:
- Data structures
- Events
- Presentation
- Effects
- Asynchrony
-
Why write another framework?
- Sparks is an approach to client-side frameworks based around transparency. Instead of giving you monolithic objects with approachabilty only at the top level, Sparks is built upon itself; Each layer builds on the strength of the ones beneath it, allowing developers to choose their own level of detail, instead of being forced down a single, rigid path.
-
What isn't Sparks?
- Sparks is not intended to be a out-of-the-box widget set. It's not a DSL. It won't overload your basic Javascript objects.
- What's "transparency" mean? Layers?
-
Sparks takes inheritance and contractualness very seriously. For a simple example, the Button object is a Widget, which is an Event Source. All objects in this chain are real objects with distinct roles - there is no padding of the dependency tree just for the sake of it.


Location of Plastic SCM command line client.
It can be a binary name or a full path to the executable. If you don't specify a full path then the target binary
must be present in one of system PATH
directories. "cm
" will be used if left empty.


Ayodhya Verdict: 10 key points from SC's historic Ram Janmabhoomi-Babri Masjid land dispute judgment
Supreme Court's historic verdict in the Ram Janmabhoomi-Babri Masjid land dispute case by the five-judge Constitution Bench was unanimous
The Supreme Court of India (SC), on November 9, delivered its historic verdict in the Ayodhya land dispute case.
The nation’s top court ruled that disputed land will be given to the Centre. The Centre will form a scheme to setup a trust within three months. The trust will monitor and manage construction of a temple. The Sunni Waqf Board will be given an alternate and suitable five acre land at a prominent place in Ayodhya.
Also read: Supreme Court awards land to Hindu side; Muslims to get alternative plot for mosque
Here are 10 key points from SC’s historic verdict:
> The disputed site in Ayodhya, Uttar Pradesh will be given to the Centre. The Centre will setup a trust within three months for construction of a temple. The trust will manage the temple’s construction.
> The Muslim parties will be given a five-acre "suitable" plot in Ayodhya.
> The verdict by the five-judge Constitution Bench was unanimous.
> SC said that Ram Lalla, as a deity, can be a juristic entity. However, the ‘janmabhoomi’ cannot be a juristic entity.
> The apex court dismisses the Single Leave Petition filed by Shia Waqf Board challenging 1946 Faizabad Court order.
> The Centre has been asked to grant representation in the trust to Nirmohi Akhara if deemed fit by the government.
> Nirmohi Akhara suit claiming shebait rights has been time barred and hence dismissed, the SC ruled. Shebait is someone, who seeks the perpetual right to worship at a particular religious site.
> The judgement was delivered by a five-judge Constitutional Bench comprising outgoing Chief Justice of India (CJI) Ranjan Gogoi and Justices SA Bobde (CJI elect), DY Chandrachud, Ashok Bhushan and S Abdul Nazeer.
> The matter before the apex court was an appeal against the verdict delivered by the Allahabad High Court in 2010. The High Court had, in the absence of a title, divided the 2.7 acre disputed land in Ayodhya, Uttar Pradesh equally between the three primary parties -- Ram Lalla Virajman, Nirmohi Akhara and Uttar Pradesh Sunni Central Waqf Board.
> Ahead of the judgement in the sensitive case, security had been beefed up across the country. Special measures had been taken by security forces in Ayodhya, Uttar Pradesh where the disputed site is situated. Section 144 was imposed in Uttar Pradesh, among other parts of the country.
(This story will be updated when more details are available)


Design Status
This is a prototype.
Purpose
This flask web app uses computer vision to automatically count wheat heads on wheat photos. Manual wheat counting is tedious. This is an attempt to solve that problem.
Dataset
The two models that power this app were trained using data from the Kaggle Global Wheat Detection competition.
The data is licenced under an open source MIT licence.
More Info
1-- The models were trained using image augmentation to help them generalize i.e. produce accurate results irrespective of where in the world the photos were taken. However, this capability needs to be tested further.
2-- The models were trained on wheat images from the following regions:
usask_1, arvalis_1, arvalis_3, inrae_1, ethz_1, rres_1
If you submit dataset images that are from these regions then the output from the app will be very accurate. This is because the models memorized those images during training. If you want to test this app it's better to submit images that were not part of the training set. These would be images from the validation set or from the private test set.
3-- Model performance was validated on photos from these regions:
usask_1, arvalis_2
4-- Due to server costs this demo will be live only until the end of June 2020. However, all the code is available on Github under an MIT licence. If you find this app helpful you are welcome to use the code to host this app on your own server.
Published Design
The design code and the step-by-step process used to train and test the models has been published on Kaggle. You can find the open source notebook here. The test results are also available in the notebook.


Shodan API¶
You can save your Shodan API Key (https://www.shodan.io) to use it with Habu.
API Key Configuration¶
The configuration it’s really simple. Use the following command with your API Key:
$ habu.config.set SHODAN_APIKEY put-here-your-shodan-api-key
Usage¶
The command habu.shodan allows you to query for a specific IP address, like this:
$ habu.shodan <IP_ADDRESS>
asn AS15169
isp Google
hostnames eze04s06-in-f4.1e100.net, gru09s17-in-f36.1e100.net
country_code US
region_code CA
city Mountain View
org Google
open_ports tcp/443, tcp/80
It supports four output formats: txt (default), csv, json and nmap (will be shown below).
The JSON output prints the whole Shodan API response.
The CSV output it’s good to process with other tools/script or save to a database.
Cache¶
By default, the command uses a requests cache, to no send repeated queries to the Shodan API.
If you want to disable the cache, use the option ‘–no-cache’.
Scan Open Ports with Nmap¶
If you want to use Nmap to scan only the ports that Shodan sees has open, you can use the ‘nmap’ output format as the port specification, like this:
$ nmap -v -p $(habu.shodan --format nmap <IP_ADDRESS>) <IP_ADDRESS>
Starting Nmap 7.80 ( https://nmap.org ) at 2019-11-13 23:33 -03
Initiating Ping Scan at 23:33
Scanning <IP_ADDRESS> [2 ports]
Completed Ping Scan at 23:33, 0.01s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 23:33
Completed Parallel DNS resolution of 1 host. at 23:33, 0.01s elapsed
Initiating Connect Scan at 23:33
Scanning eze04s06-in-f4.1e100.net (<IP_ADDRESS>) [2 ports]
Discovered open port 443/tcp on <IP_ADDRESS>
Discovered open port 80/tcp on <IP_ADDRESS>
Completed Connect Scan at 23:33, 0.04s elapsed (2 total ports)
Nmap scan report for eze04s06-in-f4.1e100.net (<IP_ADDRESS>)
Host is up (0.020s latency).
PORT STATE SERVICE
80/tcp open http
443/tcp open https
Read data files from: /usr/bin/../share/nmap
Nmap done: 1 IP address (1 host up) scanned in 0.09 seconds
Note: Obviously, you can customize the Nmap options. For example, to detect operating systems and service versions.


Action(ID)¶
base classes — bpy_struct
, ID
-
class
bpy.types.
Action
(ID)¶ A collection of F-Curves for animation
-
fcurves
¶ The individual F-Curves that make up the action
Type: ActionFCurves
bpy_prop_collection
ofFCurve
, (readonly)
-
frame_range
¶ The final frame range of all F-Curves within this action
Type: float array of 2 items in [-inf, inf], default (0.0, 0.0), (readonly)
-
groups
¶ Convenient groupings of F-Curves
Type: ActionGroups
bpy_prop_collection
ofActionGroup
, (readonly)
-
id_root
¶ Type of ID block that action can be used on - DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING
Type: enum in [‘ACTION’, ‘ARMATURE’, ‘BRUSH’, ‘CAMERA’, ‘CACHEFILE’, ‘CURVE’, ‘FONT’, ‘GREASEPENCIL’, ‘COLLECTION’, ‘IMAGE’, ‘KEY’, ‘LIGHT’, ‘LIBRARY’, ‘LINESTYLE’, ‘LATTICE’, ‘MASK’, ‘MATERIAL’, ‘META’, ‘MESH’, ‘MOVIECLIP’, ‘NODETREE’, ‘OBJECT’, ‘PAINTCURVE’, ‘PALETTE’, ‘PARTICLE’, ‘LIGHT_PROBE’, ‘SCENE’, ‘SOUND’, ‘SPEAKER’, ‘TEXT’, ‘TEXTURE’, ‘WINDOWMANAGER’, ‘WORLD’, ‘WORKSPACE’], default ‘ACTION’
-
pose_markers
¶ Markers specific to this action, for labeling poses
Type: ActionPoseMarkers
bpy_prop_collection
ofTimelineMarker
, (readonly)
-
classmethod
bl_rna_get_subclass
(id, default=None)¶ Parameters: id (string) – The RNA type identifier. Returns: The RNA type or default when not found. Return type: bpy.types.Struct
subclass
-
classmethod
bl_rna_get_subclass_py
(id, default=None)¶ Parameters: id (string) – The RNA type identifier. Returns: The class or default when not found. Return type: type
-
Inherited Properties
Inherited Functions
References


|
|
|
Configuring Extractors, Tokenizers, TokenMergers and Normalizers
|
Introduction
Extractors locate and extract data from either a string, a DOM node tree, or a list of SAX events.
An Extractor must be the first object in an index's process workflow.
Tokenizers may then be used to split the data. If a Tokenizer is used, then it must be followed by a TokenMerger.
Normalizers may then used to process those terms into a standard form for storing in an index.
Unless you're using a new extractor or normalizer class, they should all be built by the default server configuration, but for completeness we'll go through the configuration below.
Example: Extractors
Example extractor configurations:
01 <subConfig type="extractor" id="SimpleExtractor">
02 <objectType>extractor.SimpleExtractor</objectType>
03 </subConfig>
04
05 <subConfig type="extractor" id="ProxExtractor"<
06 <objectType>extractor.SimpleExtractor</objectType>
07 <options>
08 <setting type="prox">1</setting>
09 <setting type="reversable">1</setting>
10 </options>
11 </subConfig>
Explanation: Extractors
There's obviously not much to say about the first subConfig for SimpleExtractor.
It just does one thing and doesn't have any paths or settings to set.
The second subConfig, for ProxExtractor is a little more complex.
Firstly at line 8, it has the setting "prox", to tell the extractor to maintain which element in the record the data was extracted from.
This is important if you want to be able to conduct proximity, adjacency or phrase searches on the data extracted later.
The second setting, "reversable" on line 9, tells the extractor to maintain this location information in such a way that we can use it to identify where the data originally came from later on
If this setting is not set, or is set to 0, the location will be maintained in such a way that it is only possible to tell if two pieces of data were extracted from the same element.
Some of the currently available extractors:
- SimpleExtractor Extract the data exactly as it appears, but without any XML tags. Whether or not leading/trailing whitespace should be kept or stripped it configurable.
- TeiExtractor Extract text, respecting processing instructions specified by TEI tags, without any XML tags.
- TaggedTermExtractor Each term has already been tagged in XML. Extract the terms and information from the XML tags. (Often used on the results of NLP tasks)
- TemplateTermExtractor Each term has already been tagged in XML. Extract the terms and information from the XML tags. What, and where to extract the information from in configurable. (Often used on the results of NLP tasks)
Example: Tokenizers
[ Coming soon ]
Explanation: Tokenizers
Some of the currently available tokenizers:
- SimpleTokenizer: Splits data into tokens at all occurences of the string specified in 'char' setting, defaults to splitting at all whitespace.
- RegexpSubTokenizer: Carries out a regular expression substitution, replacing a pattern specified in 'regexp' setting (default supplied, covers many common word delimiters, but too complex to repeat here), with string specified in 'char' setting (defaults to single whitespace), before splitting at whitespace.
- RegexpFindTokenizer: Uses a complex regular expression to identify common language tokens (eg regular words, hyphenated words, acronyms, email addresses, URLs, gene alleles, o'clock, O'Reilly, don't, I'll, monetary amounts, percentages). The Regular expression to use to identify words is configurable in the 'regexp' setting - but such configuration is not advisable!
- RegexpFindOffsetTokenizer: As above, but also maintains the character position in the string where each token began.
- RegexpFindPunctuationOffsetTokenizer: As above, but with punctuation characters subtracted from the offset.
- SuppliedOffsetTokenizer: Splits data at whitespace, and maintains precalculated characters offsets. Often used on the results of NLP Tools. Offsets must be supplied in the form: This/0 is/5 my/8 sentence./11
- SentenceTokenizer: Uses a regular expression (not configurable) to identify senteces, ignoring puctuation within commonly occuring abbreviations.
- LineTokenizer: Splits the data at newline characters
- DateTokenizer: Identifies any temporal date / time strings within the data and returns only these. The 'dayfirst' setting can be used to specify whether to assume UK or US conventions in ambiguous cases: 0 = US style, month first (default), 1 = UK style.
- PythonTokenizer: Used to tokenize Python source code into token/type, maintains character offsets.
Example: TokenMergers
[ Coming soon ]
Explanation: TokenMergers
Some of the currently available tokenMergers:
- SimpleTokenMerger: Simplest case: merges identical tokens into a single index entry, taking care of number of occurences and location (at XML element level only). All other TokenMergers inherit these abilities.
- ProximityTokenMerger: As SimpleTokenMerger, but additionally takes care of the position of tokens within the tokenized data.
- OffsetProximityTokenMerger: As ProximityTokenMerger, but additionally takes care of character offset of tokens within tokenized data.
- SequenceRangeTokenMerger: Takes pairs of tokens and joins them into a range to treat as an index entry. This can be useful for numbers or dates (e.g. 1,2,2,3,5,6 --> 1-2, 2-3, 5-6)
- MinMaxRangeTokenMerger: Takes a number of tokens and finds the minimum and maximum to use the extents of a range to treat as an index entry (e.g. 1,2,2,3,5,6 --> 1-6).
- NGramTokenMerger: Joins adjacent tokens into a single index entry. 'nValue' setting specifies the number of adjacent terms to join, the default is 2 (e.g. 'this', 'is', 'my', 'sentence' --> 'this is', 'is my', 'my sentence'). This can be particularly useful in linguistic analysis.
- ReconstructTokenMerger: [ Coming soon ]
Example: Normalizers
Example normalizer configurations:
01 <subConfig type="normalizer" id="CaseNormalizer">
02 <objectType>normalizer.CaseNormalizer</objectType>
03 </subConfig>
04
05 <subConfig type="normalizer" id="StoplistNormalizer">
06 <objectType>normalizer.StoplistNormalizer</objectType>
07 <paths>
08 <path type="stoplist">stopwords.txt</path>
09 </paths>
10 </subConfig>
Explanation: Normalizers
Nomalizers usually just do one pre-defined job, so there aren't many options or paths to set.
The second example (lines 5-10) is a rare exception.
This is a StoplistNormalizer, and requires a path of type 'stoplist' (line 7).
The stoplist file should have one word per line.
The normalizer will remove all occurences of these words from the data.
Some of the currently available normalizers:
- CaseNormalizer: Convert the term to lower case (eg Fish and Chips -> fish and chips)
- PossessiveNormalizer: Remove trailing possessive from the term (eg squirrel's -> squirrel, princesses' -> princesses)
- ArticleNormalizer: Remove leading definite or indefinite article (the fish -> fish)
- PrintableNormalizer: Remove any non-printable characters
- StripperNormalizer: Remove printable punctuation characters: " % # @ ~ ! * { }
- StoplistNormalizer: Remove words from a given stoplist, given in a path of type 'stoplist' (<path type="stoplist">stoplist.txt</path>) The stoplist file should have one word per line.
DateStringNormalizer: Convert a Date object extracted by DateExtractor into an ISO8601 formatted string.
DEPRECATED in favour of DateTokenizer.
- DiacriticNormalizer: Remove all diacritics from characters. (eg é -> e)
- IntNormalizer: Convert a string into an integer (eg '2' -> 2)
- StringIntNormalizer: Convert an integer into a 0 padded string (eg 2 -> '000000000002')
- EnglishStemNormalizer: Convert an English word into a stemmed form, according to the Porter2 algorithm. (eg Fairy -> fairi) You must have run the possessive normalizer before running this normalizer for it to work properly.
- KeywordNormalizer: Convert an exact extracted string into keywords.
- ProximityNormalizer: Convert an exact extracted string into keywords maintaining proximity information.
- ExactExpansionNormalizer: Sample implementation of an acronym and contraction expanding normalizer. Eg 'XML' -> 'Extensible Markup Language'
- WordExpansionNormalizer: Sample implementation of an acronym expander when dealing with words rather than exact strings. Eg 'XML' -> 'Extensible', 'Markup', 'Language'


Nothing found
Nothing was found
in this category.
Try search
Nothing was found
in these categories.
Try search
Nothing was found
on the current page.
Try search


API Documentation
API Entry Point
Getting home resource
All Records
Getting all records
Creative Work
Getting a creative work provenance template
Getting a creative work template
Getting one creative work
Updating a creative work
Updating a creative work provenance information
Creative Works
Creating a new creative work
Getting all creative works
Unauthorized creation of a new work
Signups
Getting the signup form
Registering a user
User
Getting a user
Getting user settings template
Updating a user's password
Users
Getting all users
Web Page
Getting a web page template
Getting one web page
Updating a web page
Web Pages
Creating a new web page
Getting all web pages


HTTP Technology Detection¶
If you want to know which technologies are in use by a web site, you can use the habu.http.tech command, like this:
$ habu.http.tech https://woocommerce.com
Google Tag Manager unknown
MySQL unknown
Nginx unknown
PHP unknown
Prototype unknown
RequireJS unknown
WooCommerce 3.8.0
WordPress 5.2.4
WordPress VIP unknown
Yoast SEO 10.0.1
This command only makes one HTTP request, so it’s very stealthy.
The database used to detect the technologies it’s the ‘apps.json’ file, by the Wappalyzer project (https://www.wappalyzer.com).
How Was Detected Each Technology?¶
If you want to know that, use the ‘-v’ or ‘–verbose’ option, and the information will be shown, like in the following example:
$ habu.http.tech -v https://woocommerce.com
Google Tag Manager detected by HTML body with regex googletagmanager\.com/ns\.html[^>]+></iframe>
Nginx detected by Server HTTP header = nginx
Prototype detected by HTML body with regex (?:prototype|protoaculous)(?:-([\d.]*[\d]))?.*\.js
RequireJS detected by HTML body with regex require.*\.js
WooCommerce detected by meta generator tag with regex WooCommerce ([\d.]+)
WordPress detected by link HTTP header = <https://woocommerce.com/wp-json/>; rel="https://api.w.org/"
WordPress detected by HTML body with regex /wp-(?:content|includes)/
WordPress detected by HTML body with regex <link[^>]+s\d+\.wp\.com
WordPress detected by meta generator tag with regex ^WordPress ?([\d.]+)?
WordPress VIP detected by x-powered-by HTTP header = WordPress.com VIP <https://wpvip.com>
Yoast SEO detected by HTML body with regex <!--
If you want to disable the cache, use the option ‘–no-cache’.


- [PUT Command]
@SYS:SPPATTERN1SWFRCRSOVR=Parameter
- [GET Command]
-
@SYS:SPPATTERN1SWFRCRSOVR=?
Operating & retrieving Subwoofer Crossover Frequency Setting state for Speaker Pattern1.
[Parameters]
40 Hz
PUT: setting to 40 Hz / GET: indicating its setting at 40 Hz.
60 Hz
PUT: setting to 60 Hz / GET: indicating its setting at 60 Hz.
80 Hz
PUT: setting to 80 Hz / GET: indicating its setting at 80 Hz.
90 Hz
PUT: setting to 90 Hz / GET: indicating its setting at 90 Hz.
100 Hz
PUT: setting to 100 Hz / GET: indicating its setting at 100 Hz.
110 Hz
PUT: setting to 110 Hz / GET: indicating its setting at 110 Hz.
120 Hz
PUT: setting to 120 Hz / GET: indicating its setting at 120 Hz.
160 Hz
PUT: setting to 160 Hz / GET: indicating its setting at 160 Hz.
200 Hz
PUT: setting to 200 Hz / GET: indicating its setting at 200 Hz.


Class CustomOdbcCommandBuilder
Custom Command builder for ODBC to avoid primary key problems with builtin ones derived (transposed into VB.NET) from https://www.cogin.com/articles/CustomCommandBuilder.php Copyright by Dejan Grujic 2004. http://www.cogin.com
Namespace: DBaddin
Assembly: DBaddin.dll
Syntax
public class CustomOdbcCommandBuilder : CustomCommandBuilder
Constructors
| Improve this Doc View SourceCustomOdbcCommandBuilder(DataTable, OdbcConnection, DataColumn[], Collection)
Declaration
public CustomOdbcCommandBuilder(DataTable dataTable, OdbcConnection connection, DataColumn[] allColumns, Collection schemaDataTypeCollection)
Parameters
| Name | Description |
|---|---|
| dataTable | |
| connection | |
| allColumns | |
| schemaDataTypeCollection |
Methods
| Improve this Doc View SourceDeleteCommand()
Creates Delete command
Declaration
public override DbCommand DeleteCommand()
Returns
| Description |
|---|
OdbcCommand for deleting |
Overrides
| Improve this Doc View SourceInsertCommand()
Creates Insert command with support for Autoincrement (Identity) fields
Declaration
public override DbCommand InsertCommand()
Returns
| Description |
|---|
OdbcCommand for inserting |
Overrides
| Improve this Doc View SourceUpdateCommand()
Creates Update command
Declaration
public override DbCommand UpdateCommand()
Returns
| Description |
|---|
OdbcCommand for updating |


MINERVA
Home
Signin
Signup
MINERVA
Your Daily
Code Review Tool
MINERVA
is a simple code review tool that makes the process work for your team.
Ship high quality code.
Signup now
Email :
Password :
Remember me
Submit
-- or signin with --
Google
Twitter
Github
MINERVA
BETA
Dashboard
Profile Settings
Logout
Tags: JavaScript, PHP, Python
Job: Stundet @ NU
View Issues
Upload Code
Import Code
Email Notify
Recent Activity
Issue With Python Snake.
Semicolon not Working.
Load Checkpoint with TensorFlow.
Python Import Data to CSV
Flume Vs Scoop Hadoop
Hadoop Ecosystem and BigData
Structured and Unstructured Data
MongoDB and Cassandra
Graph Databases in Real Lifes
Cassandra Query Language
View Issues
×
Backend Code for View Issues Goes Here
Import Code
×
Upload Code:
(or)
Import Code
×
Link of Code:
Email Notify
×
From:
To:
Subject:
Message: