Freely available under the terms of the MIT license.
Loulabelle is a compiler (or transpiler), which translates programs written in Lua version 5.2 to JavaScript (ECMAScript 2015 ES6), and a runtime support library, which enables the execution of such translated programs in a JavaScript environment such as a Web browser or Node.js.
Programs compiled by Loulabelle can be used anywhere that JavaScript code can be used, for example as the scripts to control a Web page, or in a smaller role, as supporting scripts that interact with other scripts written in JavaScript.
This reference manual assumes the reader is familiar with Lua 5.2 and ECMAScript 2015 ES6. The manual is styled after the Lua reference manual, but discusses information specific to Loulabelle. As such, it happens to discuss implementation details before the larger points. Please feel free to skip ahead to section 4 and section 7 for a discussion about the interoperability of Lua and JavaScript programs.
Loulabelle is free software, and is provided as usual with no guarantees, as stated in its license. The implementation described in this manual is available at the Loulabelle official web site, www.spaceflint.com/loulabelle.
This section describes the Loulabelle implementation of the basic concepts of the Lua language.
Lua types boolean
, number
and string
are implemented as the corresponding types in JavaScript. Note that strings in JavaScript
are encoded in UNICODE, while most Lua implementations support 8-bit strings.
Lua nil
is implemented as JavaScript undefined
.
The Lua table
is implemented as the following JavaScript object.
{ luatable: true, array: [], hash: new Map(), metatable: undefined, id: undefined }
luatable
is a truthy value that is used in type checks,
array
and hash
are, respectively,
Array
and Map
JavaScript objects for the array and hash parts of the table,
metatable
is an optional reference to a metatable,
and finally, id
is only assigned if the table is passed to the tostring
function,
which uses an incrementing counter to simulate a unique address value for each table.
The Lua function
is implemented as a JavaScript
generator function,
which provides a mechanism to yield
execution, and in turn, to emulate synchronous
execution and Lua coroutines. Because generator functions are slower than normal JavaScript functions,
Loulabelle also provides the function coroutine.fastcall
to call Lua functions as normal
JavaScript functions, which are faster but cannot yield or suspend.
The Lua coroutine
is implemented as a JavaScript object,
which contains the property luacoroutine
that tracks the
state of the coroutine, and also participates in type checks.
Other properties in this object are id
which was described above,
generator
which references the coroutine function,
status
which is the status string returned by the coroutine.status
library function, stack
which is an array that contains the Lua call stack,
and protected
, which indicates execution within
a pcall
or xpcall
scope.
While the JavaScript objects representing the Lua table and coroutine have been briefly discussed, the reader is strongly advised to interact with these objects exclusively through the Loulabelle core library, which exposes a JavaScript API, discussed in section 4.
The Loulabelle library function type
behaves the same
and returns the same results as its Lua namesake.
Functions in Lua may return multiple values, and this is implemented in Loulabelle by always returning an array, even if the array has no elements (which would indicate the function did not return any result).
Loulabelle assigns a property named env
in each JavaScript function
object, and this property references the environment table for the function.
Typically, this env
property references the global environment table.
A reference to the Lua variable _ENV
(either implicitly or explictly)
in a function is translated a reference to a local variable in JavaScript (called env
)
which is assigned from the env
property of the same function. Note that as in
Lua 5.2, references to global variables, as well as to _G
(the global table),
are done through the implicit _ENV
variable.
The library function load
can bind a function to a custom environment:
local f2 = load(string.dump(f), nil, nil, custom_env_table)This works the same in Loulabelle, but please note a few points:
string.dump
merely
returns the function passed as a parameter, without any modification.
(Note that at the time that Lua code is executing in the JavaScript
environment, the function is actually a JavaScript function object.)load
does not
support compilation from source code, as that would
require bundling the compiler with the core library.After the Loulabelle compiler has been invoked on itself to produce a JavaScript version of the compiler, and that compiled version of the compiler is executing in a JavaScript environment, it can compile a function from Lua source code while specifying a custom environment:
local compiler = require "Loulabelle" local func, err = compiler("filename.lua", "source code text", { env = custom_env_table })
As with Lua 5.2 environments, changing the value of _ENV
or _G
before calling a function will not have an effect on the function,
which is bound to an environment when its containing chunk is loaded.
But note that unlike in Lua 5.2, the debug
library in Loulabelle
does not provide a mechanism to override the value of the bound _ENV
.
Loulabelle provides error handling facilities in the functions error
,
pcall
, xpcall
and debug.traceback
, all of
which work the same as in Lua 5.2.
In terms of JavaScript, error handling is implemented via JavaScript
try...catch
statements, and the error
function throws an error string,
or some other error value, depending on the parameter passed to it.
For direct invocation of a Lua function from JavaScript
code, the Loulabelle xpcall
API function
may be used instead of the unprotected call
API function, or call
can just be enclosed
in a JavaScript try...catch
block.
__gc
method is not supported:
Object finalizers are not supported and not invoked.__mode
property is not supported:
Weak tables are not supported, table entries are
garbage-collected only after all references to
them are deleted.
These facilities are not supported because JavaScript
does not provide callbacks from its garbage collector,
and because WeakMap
is not enumerable. For similar reasons, the collectgarbage
Lua library function is not provided.
As in Lua 5.2, metamethods may yield (or suspend).
Loulabelle fully supports Lua coroutines. Each
thread of execution, including the first loaded chunk,
occurs in the context of a coroutine. This coroutine
context, or coroutine object, is a JavaScript object
that is accessible in Lua as an object with type
"thread"
.
In JavaScript, the coroutine object associated with
the currently-executing thread is referenced by the
property co
in the global runtime object.
Within this coroutine object, the property
main
is set to a boolean true
for the thread of the first loaded chunk.
In Lua code, the same object reference is returned as
an opaque value by the function coroutine.running
,
which also returns the main
boolean flag
as its second result.
As well as normal coroutines, created by
coroutine.create
, and wrapped coroutines,
created by coroutine.wrap
, Loulabelle
supports two more types of coroutines.
Spawned coroutines, created by coroutine.spawn
,
are detached from the creating coroutine, and begin
execution asynchronously and independently. They are
scheduled via a call to JavaScript
setTimeout
with a zero timeout, and should not be started explicitly.
Callback coroutines, created by coroutine.jscallback
,
are normal JavaScript functions (not generator functions)
that can be passed to JavaScript code, or attached to
browser events. When the function is executed, it
creates a temporary coroutine, calls a specified Lua
function, and passes its first result on to the caller.
Coroutines in Loulabelle can yield, as in Lua, via a
call to coroutine.yield
but can also
suspend, via a call to coroutine.suspend
.
A suspended coroutine does not pass control back to
its calling coroutine. Instead it just suspends execution,
presumably while waiting for some event to occur
and cause it to resume execution. For example, the
coroutine.sleep
function suspends the
current coroutine after installing a timeout
callback which calls coroutine.resume
.
Loulabelle strives to implement the Lua language precisely according to the Lua 5.2 specification, however there are a few minor points of difference.
continue
statement.
goto
statement is limited in
Loulabelle because JavaScript itself does not support
a goto statement. While it is possible to simulate
goto statements using loops and switches, this was
deemed unnecessary. In Loulabelle, a goto statement
may target a statement ...
break
statement; orcontinue
statement.#
, when applied
to tables, may return a different result in Loulabelle.
In Loulabelle, the table length is calculated by starting
from the JavaScript length
property of the
array part of the Lua table, and repeatedly decrementing
it as long as it indexes undefined
(i.e. nil
) entries.
local a, b, c = func1(x, y, func2())multiple results returned from
func2
may be passed to func1
after the
y
parameter, and the second and third
results returned from func1
may be
assigned to b
and c
.
Loulabelle checks if the return value is a multiple-value array
using JavaScript Array.isArray
.
When mixing JavaScript and Lua objects in Lua code,
it is important to keep this multiple value rule in
mind. Avoid passing a JavaScript array as the last
parameter in a Lua function call, or as the last value
in the array part of a table constructor. Instead,
pass at least one more parameter (even nil
).
JavaScript
statement lets Loulabelle
programs directly embed JavaScript code. The syntax
of the statement is:
JavaScript("stmt_string", arg1, ...argN)
where stmt_string
is a quoted
string constant containing JavaScript code,
with these considerations:
$1
through $N
(quoted within the string) that reference
parameters arg1
through
argN
.$L
references the
global runtime object $lua
.$$
translates to
a single $
sign.{
or }
or ;
(curly braces, semicolon)."public var "
(11 characters, including the last space), the initial
word public
is dropped, and the result is
written at the very top of the compiled output.
The identifier JavaScript
is not,
strictly speaking, a reserved word. It has a special
meaning only in the form of a function call statement.
Example JavaScript
statement:
local context = {} local callback_id JavaScript("$1=window.requestAnimationFrame($2)", callback_id, (coroutine.jscallback( ::update_stack_frame:: JavaScript("console.log('in callback')") function(context, timestamp) context.timestamp = timestamp end, context))) context.callback_id = callback_idThis example illustrates a few important points.
$1=...
in the example,
where $1
references the local variable
callback_id
). However, it cannot
assign directly into tables (or global variables).coroutine.jscallback
,
to make sure that $2
is a function
reference. Without the parentheses, $2
would be a reference to an array containing that
function reference that.
JavaScript
statement can be
nested inside a function definition that is one
of the parameters to a higher-level
JavaScript
statement.JavaScript
statement does not
cause line number debug information to be recorded.
To force line number information to be written at
the top of a function, a dummy label such as
::update_stack_frame::
is needed.
Note that the name of the label is arbitrary.
To account for the dynamic types in Lua, and the
metamethod mechanism, the Loulabelle compiler has
to generate code that checks the actual types of
objects at runtime. For example, the expression
a + b
, when types of the local variables
a
and b
are not known,
is translated to the following:
v3 = (typeof v1 === 'number' && typeof v2 === 'number' ? v1 + v2 : yield*$lua.add(v1, v2, true));
On the other hand, if the compiler knows for certain
that a
and b
are numbers,
then the generated code is shorter and faster: v3=(v1+v2);
Using type annotations to tell the compiler to assume a specific type for expressions and local variables, enables the compiler to make the optimizations described above, and skip some type checks when generating code.
The type annoations are:
assume_number
- assumes a number
type. This skips type checks in arithmetic
expressions, and references the array
part in table indexing. Numeric constants,
numeric for
loop variables, and
the string length operator (#
) all
assume the number type by default, as well as
arithmetic expressions with operands that are all
known to be a number type.
assume_string
- assumes a string
type. This skips type checks in the string
concatenation operator (..
), and
references the hash
part in table
indexing. String constants assume the string
type by default, as well as concatenation expressions
with operands that are all known to be a string type.assume_function
- assumes a function
type. This skips type checks in function calls.
Note that this type is not assumed by default, not
even for local function
definitions.assume_nometa
- assumes a table that
is known to not have an associated metatable. Note
that this affects only table access, in that getting
will not invoke the __index
metamethod,
and setting will not invoke the __newindex
metamethod. Note also that this type is not assumed
by default.assume_untyped
- discards any type
annotation associated with a local variable or an
expression. This restores the variable or expression
to an 'untyped' state, and disables any subsequent
optimizations based for that variable or expression.local a = 4 -- type of a is number local b = x() -- type of b is not known local c = 4 + assume_number(b) -- type of c is number local d = y() -- tpye of d is not known assume_number(b, d) -- types of b and d are now number local e = c + b * b -- type of e is number
This section describes interoperability between the JavaScript environment, and any Lua code compiled by Loulabelle into JavaScript. It also includes a description of various Loulabelle API functions that are can be invoked from JavaScript code.
All API functions and properties are contained in the
global runtime object $lua
.
A Lua function is compiled into the following JavaScript:
$lua.func( function* func() { // JavaScript code translated from Lua source code }, $lua.env, // or func.env function(s){return eval(s)}, // or undefined 'filename.lua', // or func.file 1) // line number );
$lua.func
is a small utility function
which stores additional properties on the function
object func
which is passed as the
first parameter. The following properties are stored:
func.self
, assigned from the first
parameter, is a reference to the function itself.func.env
, assigned from the second
parameter, is a reference to the Lua environment for
the function. For a chunk function (the outermost
function in a compiled chunk), this is passed as
$lua.env
, to reference the global
environment. For functions defined within a chunk,
this is passed as func.env
, which
references the environment of the encompassing
function or chunk.func.eval
, assigned from the third
parameter, is a recompiler utility function. Functions
passed to load
and
coroutine.fastcall
need to be recompiled, and if the function references
any upvalues, it must be recompiled in the same
context or scope in which it was defined. The
recompiler utility function can provide that original
context. For functions that do not reference upvalues,
the third parameter is passed as undefined
.
(Note that Loulabelle will not be able to detect
upvalue references in functions that reference
upvalues only through JavaScript
statements.)func.file
, assigned from the fourth
parameter, is the name of the source file. For a
chunk function (the outermost function in a compiled
chunk), this is the source file name string. For
functions defined within a chunk, this is passed as
func.file
, which references the name
of the encompassing function or chunk.func.line
, assigned from the fifth
parameter, is the line number of the function
definition.func.fast
is a utility function
that is used in the fastcall
mechanism;
see coroutine.fastcall
.Note that like in Lua, a Lua source file is compiled by Loulabelle into a chunk, which is effectively a single JavaScript function that contains all the translated statements from the Lua source file:
$lua.chunk( $lua.func ( ... ) );
JavaScript scripts compiled by Loulabelle from Lua can be loaded into a JavaScript environment (such as a Web browser or Node.js) the same way that any other JavaScript script is loaded. However, the Loulabelle core library must be loaded first, to set up the global runtime object and the Lua environment.
A very simple HTML page example may look like this:
<!DOCTYPE html>
Note in this example that core.js
, the
Loulabelle core library, is loaded and executed first.
Only then, main.js
, which would be the
Loulabelle JavaScript translation of a Lua chunk,
is loaded.
It is not valid to load more than one chunk in this
way. Lua code should use the Lua require
function to load additional chunks. However, compiled
chunks can be modified to start with $lua.preload_chunk
,
instead of $lua.chunk
, and this enables
preloading chunks in advance. For more on this, refer
to the discussion in section 6.3.
All functions and properties listed below are contained
in the global runtime object $lua
.
Almost all API functions are generator functions,
which means they can be invoked using the
yield*
expression if invoked from a generator function:
JavaScript("yield*$L.tostring(123)")
If invoked from a normal function, the JavaScript
function next
should be used. For example,
var str = $lua.tostring(123).next().valueHere, the Loulabelle API generator function
tostring
is invoked (generated) with parameter 123
,
and iterated once via a call to next
.
call
call (name, func, arg1, ...argN)
Calls the Lua function func
, passing
it a variable number of parameters specified in
arg1
through argN
.
The first parameter name
is the name
of the called function, as it should appear in the
Lua call stack entry created for the function, or
if passed as undefined
, inhibits the
creation of a call stack entry.
As discussed in section 3, the last
parameter is checked to see if it is an array, using
Array.isArray
.
If the check succeeds, call
assumes
the last parameter is an array of multiple values,
and unpacks those values as additional parameters
for the function call.
When using call
to call functions with
non-Lua JavaScript objects, it is important to keep
this multiple value rule in mind. Avoid passing a
JavaScript array as the last parameter. Instead,
pass at least one more parameter (even undefined
).
The call
function returns an array that
contains the results returned from the Lua function.
error
error (msg, level)
Generates an error message. If msg
is a string, level
specifies which
call stack entry to use for decorating the error
message, where 0
means the current
stack entry, 1
(the default) means
the calling entry, and so on. A value of
-1
means to not decorate the message.
traceback
traceback (msg, level)
Generates a formatted stack trace. The parameters
are similar to the parameters for error
,
described above, except that a value of -1
for the level
parameter is not valid.
type
type (v)Returns the type name for the Lua value
v
as a string (not wrapped in an array).
Generates an error
if the value is not
a valid Lua type.
table
table (vals, n1, n2)
Creates a Lua table using the values passed in the
JavaScript array vals
. This array
specifies both key-value pairs, and sequential values.
The key-value pairs must come first, followed by
the sequential values. The array may be empty, if
an empty table should be created.
The parameter n1
, which must be an even
number, and can be zero, specifies the number of
key-value pairs in the array. The parameter
n2
specifies the number of sequential
values in the array.
Generates an error
if a key in the
key-value segment of the array is NaN
or
undefined
. Otherwise the return value
is a JavaScript object that represents a Lua table.
This returned object is not wrapped in an array.
As discussed in section 3, the last
parameter is checked to see if it is an array, using
Array.isArray
.
If the check succeeds, table
assumes
the last parameter is an array of multiple values,
and unpacks those values as additional sequential
values.
When using table
to create a table which
references non-Lua JavaScript objects, it is important
to keep this multiple value rule in mind. Avoid
passing a JavaScript array as the last element in
the vals
array. Instead, pass at least
one more parameter (even undefined
).
Note in the example below that n1
is
specified as 10
, for the first five
key-value pairs, and n2
is specified as
4
for the following four sequential values.
var t = $lua.table([ "a", 'val_a', "b", 'val_b', "c", undefined, true, 'val_true', false, 'val_false', 123, 456, 111, 789 ],10,4).next().value
len
len (v)
Returns the length of the Lua value v
,
which may be a string or a table. May invoke the
__len
metamethod for a table, and
generates an error
for an unsupported
type. Returns the length as a number, not wrapped
in an array.
get
get (tbl, key, name)
Extracts the value of the key key
from the table tbl
. The key should
be any valid value that can index into a table.
May invoke the __index
metamethod.
May generate an error
, in which case,
the name
parameter, if provided,
is used to decorate the error message. Returns
the value directly, not wrapped in an array.
set
set (tbl, key, name, val)
Sets the value of the key key
in the table tbl
to value val
.
The key should be any valid value that can index
into a table. May invoke the __newindex
metamethod. May generate an error
,
in which case, the name
parameter,
if provided, is used to decorate the error message.
This function does not return any results.
gmt
gmt (v, typeof_v, who)
If v
is a table, returns the metatable
associated with the table, without respecting the
__metatable
property. If v
is not a table, returns the shared metatable for
values of the type of v
, which may be
passed in the parameter typeof_v
, or
else will be determined from v
itself.
The parameter who
, if provided, is used
to decorate the generated error
. The
returned table reference is not wrapped in an array.
smt
smt (v, mt)
Assigns the metatable mt
for table
v
, if v
is a table, or
the shared metatable for values of the type of
v
. Does not respect the
__metatable
property. This function
does not return any results, and may generate an
error
.
tonumber
tonumber (s)
Parses the string s
as a number
according the Lua rules for a numeric constant
presented in section 3.1 of the Lua reference manual.
Returns a number, or undefined
if the
string cannot be converted to a number. The return
value is not wrapped in an array.
tostring
tostring (v)
Converts the value v
to a string, using
a __tostring
metamethod if available.
Where Lua generally uses the memory address of an
object in order to give tables and coroutines a unique
string representation, Loulabelle uses an incrementing
counter to produce a similar result.
Note that when converting a number, Lua uses
sprintf("%.14g")
, which produces results
that may differ from JavaScript conversions, whether
toString
or
toPrecision
is used.
As the Lua reference manual suggests, for complete
control over the output, use string.format
.
next
next (tbl, key)
Given a key key
in table tbl
,
returns the next key. If key
is undefined
,
returns the first key. Enumeration starts with the
array part of the table, then switches to the hash part.
The return value is not wrapped in an array.
The iterator for next
is kept as part of
the table being iterated, and will be invalidated if
next
is invoked for a key that does not
match the current key in the iterator. Avoid multiple
concurrent next
loops on the same table.
xpcall
xpcall (msgh, func, args_array)
Calls func
in a protected scope,
passing it the arguments in the JavaScript array
args_array
. The parameter
msgh
specifies the message handler
generator function to invoke in case of error,
and can be specified as $lua.dflt_msgh
if no message handler is needed, for a
pcall
-like behavior rather than
xpcall
-like behavior.
Returns an array where the first element is
a boolean
that indicates if the call
succeeded without errors. If true
,
the array also contains the zero or more results
returned from the called function. If
false
, the array contains the error
message in the second element.
cocreate
cocreate (f)
Creates a coroutine object for the function f
.
The coroutine is initially suspended and must be resumed
before it begins executing. This function returns an
array containing a single element, the coroutine object.
The coroutine object has a method resume
,
a normal function (not a generator), which accepts
a JavaScript array of arguments, and resumes execution
of the coroutine, passing it those arguments. This
method does not return a value: If the resumed
coroutine yields, it will itself invoke the
resume
method on the coroutine being
yielded to, passing it the values to yield, and then
return control.
coresume
coresume (co, arg1, ...argN)
Resumes coroutine co
, passing it a
variable number of parameters specified in
arg1
through argN
.
Returns an array containing the values yielded by
or returned from the coroutine being resumed.
cosuspend
cosuspend ()
Suspends the current coroutine, which is the coroutine
object referenced by $lua.co
.
Unlike a Lua yield, a suspended coroutine does not automatically cause execution to resume in another coroutine. The suspend mechanism is designed to accomodate the asynchronous nature of JavaScript. Lua code may schedule some asynchronous JavaScript operation, such as an XMLHttpRequest, suspend itself, and have the asynchronous callback resume it. For example, JavaScript code embedded in a Lua function:
JavaScript("var co=$L.co") JavaScript("setTimeout(co.resume,5000)") JavaScript("yield*$L.cosuspend()")
The first line saves the current coroutine, because
some other coroutine may be scheduled by the time the
setTimeout callback fires. The second line sets up
a five second timer with a callback that resumes the
current coroutine. And the third line, which can only
be executed in a generator function (such as a Lua
function), suspends the current coroutine. If writing
non-generator JavaScript code, the third line can be
rewritten as: $lua.cosuspend().next()
cowrap
cowrap (func)
Creates a function that wraps and drives a coroutine. Returns an array containing a generator function in the first element, and a coroutine object in the second element. Each invocation of the generator function causes the coroutine to resume, passing it any parameters passed to the generator function.
require_lua
require_lua (url)
In the Web browser, creates a new SCRIPT
element to asynchronously load a script. In a Web worker,
or in Node.js, loads the script synchronously, using
importScripts
or require
,
respectively.
The loaded script is expected to have been compiled by Loulabelle
such that it contains a single call to $lua.chunk
which wraps all other code in the chunk, as discussed
at the top of section 4.
Returns a (generator) function representing the loaded chunk. This returned function is not wrapped in an array.
require_js
require_js (url)
In the Web browser, creates a new SCRIPT
element to asynchronously load a script. In a Web worker,
or in Node.js, loads the script synchronously, using
importScripts
or require
,
respectively.
Unlike require_lua
, this function is
intended to load non-Lua JavaScript code. There is
no return value, and the invoking code should check
if the script loaded successfully.
require_css
require_css (url, media)
In the Web browser, creates a new LINK
element to asynchronously load a CSS file. In a Web worker,
or in Node.js, this functions does not do anything.
The media
parameter, which defaults to
the string screen
if omitted, is
assigned to the media
property of the
created element.
fastcall
fastcall (f)
This normal, non-generator JavaScript function
performs a dynamic, on-the-fly recompilation of the
Loulabelle-translated generator function passed in
f
, into a normal, non-generator
JavaScript function. The new function is stored
into a property named fast
in the
supplied function f
, and then the
new function is returned, not wrapped in an array.
This section describes parameter-checking utility functions in the Loulabelle API. These are useful when writing JavaScript code which needs to validate any parameters passed to it from Lua code.
error_arg
error_arg (num, msg)
Generates this error
:
bad argument #(num) to 'function' (msg)
error_argtype
error_argtype (got, num, exp)
Generates this error
:
bad argument #(num) to 'function' ((exp) expected, got (got))
error_argexp
error_argexp (num, check)
If num
is smaller than check
,
generates this error
:
bad argument #(num) to 'function' (value expected)
checkstring
checkstring (arg, num)
If the arg
parameter is a string, returns it.
If it is a number, converts the number to a string and returns it.
Otherwise calls error_argtype
with num
.
The return value is not wrapped in an array.
checknumber
checknumber (arg, num)
If the arg
parameter is a number, returns it.
If it is a string that can be converted using tonumber
,
converts the string to a number and returns it.
Otherwise calls error_argtype
with num
.
The return value is not wrapped in an array.
checktable
checktable (arg, num)
Returns nothing if arg
is a Lua table.
Otherwise calls error_argtype
with num
.
checkfunction
checkfunction (arg, num)
Returns nothing if arg
is a Lua function.
Otherwise calls error_argtype
with num
.
checkcoroutine
checkcoroutine (arg, num)
Returns nothing if arg
is a Lua coroutine.
Otherwise calls error_argtype
with num
.
Not implemented: collectgarbage
, dofile
, loadfile
.
load (func, source, mode, env)
Clones the Lua generator function passed in
func
as a new generator function which
will use the environment table passed in the
parameter env
, which can be passed as
_ENV
or _G
for the
default environment.
Ignores parameters source
and mode
.
See also section 2.2.
The function is recompiled by calling JavaScript
toString()
on the input function, and compiling the resulting source code
using the recompiler utility function assigned to
the eval
property of the original function,
as discussed at the top of section 4.
(But note that if the function references upvalues only
through JavaScript
statements, the eval
property will not
be set, and the converted function will not compile
correctly.)
next (table [, index])
The iterator used to track calls to this function is associated with the table being iterator. Concurrent iteration over different indexes will impact performance by forcing the iterator to be repeatedly invalidated. Note that functionality will not be impacted in any way. See also the next API function in section 4.8. For example, try to avoid code like this:
k1 = next(t) -- iterator advances to second element while k1 do k2 = next(t) -- iterator restarts at first element while k2 do k2 = next(t, k2) end k1 = next(t, k1) -- iterator restarts, positions to k1 end
In this example, the outer and inner loop share
the same internal iterator, which has to be
repeatedly invalidated, restated and repositioned.
Prefer to use the functions pairs
and
ipairs
, which use dedicated iterators,
and are not subject to this performance issue.
print (···)
Similar to Lua print, uses tostring
on all input parameters to construct an output string.
See there for considerations about number conversion.
If the global printwriter
is a Lua function,
it is called with this function with the output string.
Otherwise, the default behavior is to call JavaScript
console.log
with the output string.
Coroutines in Loulabelle can suspend/resume in
addition to a normal Lua resume/yield combination.
This is discussed in more detail in section 2.6
and in the cosuspend
API function.
coroutine.spawn (f, arg1, ...argN)
setTimeout
with a zero timeout. Returns the new coroutine.
Note that JavaScript is a single-threaded environment, and only one thread of JavaScript executes at the same time. (For sake of simplicity, we ignore worker threads.)
This example illustrates cooperating multithreading using asynchronous coroutines:
local main = coroutine.running() local f = function(three, four, six) print (three) coroutine.resume(main) print (four) coroutine.suspend() print (six) end print '#1' local co = coroutine.spawn(f, '#3', '#4', '#6') print '#2' coroutine.suspend() print '#5' coroutine.resume(co)
The output is #1 #2 #3 #4 #5 #6
. Note
that spawn
or resume
do
not immediately cause another thread to run. The
currently-running thread (whichever one it is) must
suspend itself before any other thread can run.
coroutine.suspend ()
Suspends the current coroutine. Unlike a Lua yield,
a suspended coroutine does not automatically cause
execution to resume in another coroutine.
The suspend mechanism is designed to accomodate the
asynchronous nature of JavaScript. Lua code may
schedule some asynchronous JavaScript operation,
such as an XMLHttpRequest, suspend itself, and have
the asynchronous callback resume it. See also the
cosuspend
API function.
Note that some care should be taken when one coroutine may be resumed by more than one callback at the same time. For example, if the same suspended coroutine can be resumed either by a button click or an XMLHttpRequest callback, the coroutine may need some way to identify which callback caused it to resume.
coroutine.sleep (ms)
Suspends execution of the current coroutine for a duration
of ms
milliseconds, using the JavaScript
setTimeout
function.
coroutine.status (co)
The only difference from the standard Lua function
of the same name is that this function may also
return the status asyncwait
which
indicates the coroutine has suspended itself using
coroutine.suspend
or cosuspend
.
Note that a status of suspended
, as in
Lua, indicates the coroutine has not started running
yet, or has called yield
.
coroutine.wrap (f)
coroutine.jscallback (func, arg1, ...argN)
JavaScript callbacks are typically normal functions,
whereas Loulabelle-translated Lua functions are
generator functions. The jscallback
function makes it simple to connect Lua functions to
JavaScript callbacks, as shown in the example in section 3.6.
The returned function is normal JavaScript function
(not generator functions) which acts as the callback
wrapper. When this wrapper is called, it creates a
temporary coroutine with the call stack at the point
of the call to jscallback
. Then the Lua
function is called in the context of the temporary
coroutine. The Lua function receives the parameters
passed to jscallback
as well as any
parameters passed in the invocation of the
callback wrapper.
The first result from the Lua function is returned to the caller of the callback wrapper. Note that if the Lua function yields or suspends, instead of returning, this also returns control to the callback wrapper, but in this case, nothing is returned to the caller of the callback wrapper.
Note that the temporary coroutine created for
the duration of the callback is not subject to a
pcall
or xpcall
protected
scope that was established during the creation of
the callback, i.e. when jscallback
was called.
coroutine.jsconvert (jsobj, luatbl)
This function converts between Lua tables and JavaScript objects and vice versa. It is not directly related to coroutine management.
If jsobj
is nil
, the
function recursively traverses the Lua table in
luatbl
and constructs a JavaScript
object that contains all boolean
,
number
and string
values in the table, and any tables referenced by it.
Values in any other type are ignored.
If jsobj
is not nil
, the
function recursively traverses the JavaScript object
and populates the Lua table luatbl
with the properties from the JavaScript object.
This function may make non-Lua JavaScript objects
accessible to the Lua caller of this function.
Be advised that using Lua functions such as
tostring
or type
on
non-Lua objects may generate various forms of the
error: unexpected type in getmetatable
.
coroutine.mutex ()
Returns a mutex table object which can be used to synchronize between threads. The object provides the following methods:
lock
- suspends the caller
(using coroutine.suspend
)
until the mutex can be acquired, then returns true
.trylock
- if the mutex is not
acquired, acquires it and return true
,
otherwise returns false
without suspending.unlock
- releases an acquired mutex,
and resumes the first thread that tried to acquire the
mutex while it was locked.All methods expect a single parameter, the mutex table object, and can be invoked using the Lua colon syntax for method calls.
coroutine.fastcall (func, arg1, ...argN)
Performs a dynamic, on-the-fly recompilation of the
Lua function func
, into a normal,
non-generator JavaScript function. In many
JavaScript engines, JavaScript generator functions
do not enjoy the same JavaScript JIT compiler
optimizations that are available to non-generator
functions. The fastcall
mechanism
makes it possible to optimize specific Lua
functions that require higher performance.
The converted, "fast" version of the function is
cached for future invocations, by storing it in the
fast
property of the function object.
Any function called by func
will also
be fastcall
-converted and cached: This
is done by converting any call to function
fn
with a call to function
fn.fast
instead. As discussed at the
top of section 4, this fast
property is initially a utility function that
fastcall
-converts the function, and
overwrites the fast
property with the
converted function.
Note that functions converted by fastcall
cannot use any asynchronous features that depend on
generators, such as coroutines and require
.
The fastcall
recompiler works by
calling JavaScript toString()
on the input function.
Then, under the assumption that the function was
created by Loulabelle, rewrites yield*
expressions as direct function calls. Finally,
the converted function is recompiled using the
recompiler utility function assigned to the
eval
property of the original function,
as discussed at the top of section 4.
(But note that if the function references upvalues only
through JavaScript
statements, the eval
property will not
be set, and the converted function will not compile
correctly.)
As in Lua, the require
function is
provided in the global environment. The
package
table provides only two
fields: package.loaded
which caches
(or can be used to preload) modules, and
package.Loulabelle
which is the
Loulabelle version number and set to 5203
.
require (modname)
Invokes require_lua
to load a script file from a relative URL that is
composed of modname
concatenated with
the suffix .js
.
The script is loaded and executed, and per the
discussion in section 4 and in
require_lua
,
the script is expected to contain a single call
to $lua.chunk
, which makes the loaded
chunk accessible to Loulabelle.
The loaded chunk is then called, and its result is
recorded in the package.loaded
table,
and returned to the caller.
A chunk may be preloaded in advance of a call to
require
, by replacing the call to
$lua.chunk
with a call to
$lua.preload_chunk
.
At the top of the compiled chunk, instead of:
$lua.chunk( $lua.func ( ... ) );
Change to:
$lua.preload_chunk('new_chunk_name', $lua.func ( ... ) );
Preloading can also be used to bundle several chunks
into one file, and change chunk names.
The Loulabelle compiler itself makes use of this
technique; see the build.sh
example
in the Loulabelle compiler
folder.
Strings in Loulabelle are JavaScript strings, encoded in UNICODE, while most Lua implementations support 8-bit strings.
string.format
in Loulabelle supports
only 20 digits of precision in the various floating
point number formats, as opposed to 99 digits in Lua.
Patterns and Regular Expressions
Loulabelle does not support Lua patterns. Instead,
the full JavaScript regular expression engine is
available for use anywhere that a Lua pattern can
be used. To use a regular expression string, wrap
it in a call to string.regex
. For example:
local pattern = string.regex("([A-Z])([a-z]*)") local iterator = string.gmatch("Quick Brown Fox", pattern) while true do local cap1, cap2 = iterator() if cap1 then print (cap1, cap2) else break end end
If you limit the use of patterns and regular expressions to only those features common to both, then the following polyfill can be used in programs that have to run under Lua as well as Loulabelle.
string.regex = string.regex or function(s) return s end
string.dump (f)
Returns the input function f
. This is
merely intended to maintain compatibility with Lua
code that uses the result of string.dump
in a call to load
,
as in the example in section 2.2.
string.regex (s)
Records the regular expression s
in the
table of known regular expressions, for use by one
of the pattern functions: string.find
,
string.match
, string.gmatch
,
and string.gsub
.
string.index (haystack, needle, init)
Searches for the string needle
in string haystack
, optionally starting
at position init
(default is 1).
Returns the index of occurence, or nil
if not found.
Unlike the init
parameter to
string.find
, negative positions
do not count back from the end of the string.
The search is done using the JavaScript function
indexOf
.
string.rindex (haystack, needle, init)
Searches backwards for the string needle
in string haystack
, optionally starting
at position init
(default is #haystack
)
and going back towards the beginning of the string.
Returns the index of occurence, or nil
if not found.
Unlike the init
parameter to
string.find
, negative positions
do not count back from the end of the string.
The search is done using the JavaScript function
lastIndexOf
.
string.startswith (string, prefix, index)
Checks if string
, starting at position
index
(default to 1), starts with the
sub-string #prefix
.
The check is done using the JavaScript function
startsWith
.
string.endswith (string, suffix, length)
Checks if string
,
of length length
(default to #string
),
ends with the sub-string #suffix
.
The check is done using the JavaScript function
endsWith
.
string.trim (s)
Returns the string s
with whitespace
removed from both ends of the string.
Uses JavaScript function
trim
.
string.ltrim (s)
Returns the string s
with whitespace
removed from the left end of the string.
Uses JavaScript function
trimLeft
.
string.rtrim (s)
Returns the string s
with whitespace
removed from the right end of the string.
Uses JavaScript function
trimRight
.
os
library,
and even those provide limited functionality.
os.clock ()
Returns a time value measured in seconds. Note that
unlike the os.clock
function in Lua,
this is not CPU time. Uses
performance.now()
in the browser, and process.hrtime
in Node.js.
os.date (format, time)
The only formats supported are "*t"
to
return the results in a table (in which the field
isdst
is always false
),
or "%c"
(the default) to return a full
date string.
The format
string may optionally start
with '!'
to select UTC time rather than
local time.
os.time ([table])
If the field isdst
in the table is
true
, the time zone difference from UTC
is added to the result. This is not necessarily
desired or correct.
os.setlocale (locale, category)
Sets the current locale for the string collator,
which is initially set to a default JavaScript
Intl.Collator
object. Therefore category
can only
be specified as "all"
or "collate"
,
if not omitted. The locale
is passed
to the Intl.Collator
constructor.
This function does not return the current locale.
debug
library:
debug.getmetatable
,
debug.setmetatable
,
and debug.traceback
.
compiler
folder.
To invoke the compiler, you may need to set the
LUA_PATH
environment variable to include
the compiler folder.
export LOULABELLE=~/Loulabelle/compiler export LUA_PATH=$LOULABELLE/?.lua lua $LOULABELLE/main.lua [options] inputfileThe options are:
-h
: display usage-o
: optimize function calls and turn off call stack-G
: disallow assignment to globals without table reference-J
: disallow JavaScript statements-A
: disallow assume keywords-L name
: set object name for JavaScript (default $lua)-n name
: set chunk name (default same as inputfile argument)
The source Lua program is read from inputfile
if specified, otherwise from standard input. The compiled
JavaScript program is written to standard output.
build.sh
shell script in the
compiler
folder combines the various
modules that make up the compiler into a single
Loulabelle.js
file. This compiled
compiler can be preloaded into a web application:
<!DOCTYPE html>
In this example, webapp.js
is the
compiled form of webapp.lua
, which might
contain the following Lua code:
local Loulabelle = require "Loulabelle" local chunk_text = "print (_VERSION)" local chunk_name = 'test.lua' local func, err = Loulabelle(chunk_name, chunk_text, { env = _G, debug=true }) if not err then func() endThe third parameter to the compiler is a table of options:
version
:
If this field is true, the compiler immediately
returns with a version string and version number,
e.g. return "1.0", 1.0
jsobject
:
The name of the global runtime object. The default
name is $lua
. All compiled Lua code in
the same JavaScript environment should use the
same name.
debug
:
If this field is false, "release" or optimized
output is selected rather than "debug" output:
The generated code is slightly faster, does not
include Lua call stack and line number information,
and is minimized.
JavaScript
:
If this field is false, the compiler will not
recognize the JavaScript
statement.
globals
:
If this field is false, the compiler will detect
assignments to global variables, and raise an error.
assumes
:
If this field is false, the compiler will not
recognize the assume_...
keywords, in either statement or expression form.
env
:
If this field is omitted, the compiler returns a
string containing JavaScript source code. If this
field is specified, the compiler returns a JavaScript
function that was compiled from the source code string,
and had its Lua environment set to the value specified
in this field, which should be a Lua table.


Bengal lynching case: 12 arrested
by Special CorrespondentA dozen men have been arrested in connection with the lynching of two persons on suspicion of cattle theft in Cooch Behar district of West Bengal.
The incident took place on Thursday in Mathabanga area when Rabiul Islam and Prakash Das were taking two cows in a van. They were stopped by the locals and beaten up. The police admitted them to a hospital but they died of their injuries.
The State Assembly has recently passed the West Bengal (Prevention of Lynching) Bill, 2019, and it is awaiting the Governor’s assent.


We hustle with you to facilitate investment in your startup. If the deal goes through we take 2% commission from our investor and we take 3% or 1 Lakh in commission, whatever is greater, from you.
Why ? Because we make matches between investors and startups that add value in each other far beyond money.


@Alright - Yes thats the ac_pubkey I used. As for the nomp output -
<EMAIL_ADDRESS>start /home/vulcanmaster/knomp
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/node_modules/stratum-pool/node_modules/equihashverify/build/Release/:$PWD/node_modules/equihashverify/build/Release/ node init.js
2019-03-16 22:55:08 [POSIX] [Connection Limit] (Safe to ignore) POSIX module not installed and resource (connection) limit was not raised
2019-03-16 22:55:08 [Master] [CLI] CLI listening on port 17117
2019-03-16 22:55:08 [PPLNT] [zex] TimeShare processing setup with redis (<IP_ADDRESS>:6379)
2019-03-16 22:55:08 [Master] [PoolSpawner] Spawned 1 pool(s) on 1 thread(s)
2019-03-16 22:55:09 [Website] [Server] Website started on <IP_ADDRESS>:8080
2019-03-16 22:55:09 [Payments] [zex] zex requireShielding: false
2019-03-16 22:55:09 [Payments] [zex] zex minConf: 10
2019-03-16 22:55:09 [Payments] [zex] zex payments txfee reserve: 0.0001
2019-03-16 22:55:09 [Payments] [zex] zex maxBlocksPerPayment: 3
2019-03-16 22:55:09 [Payments] [zex] zex PPLNT: false, time period: 0.51
2019-03-16 22:55:09 [Payments] [zex] Payment processing setup with daemon (zexcoin@<IP_ADDRESS>:3357) and redis (<IP_ADDRESS>:6379)
2019-03-16 22:55:09 [Switching] [Setup] (Thread 1) Loading last proxy state from redis
2019-03-16 22:55:09 [Pool] [zex] (Thread 1) Share processing setup with redis (<IP_ADDRESS>:6379)
2019-03-16 22:55:09 [Pool] [zex] (Thread 1) No rewardRecipients have been setup which means no fees will be taken
2019-03-16 22:55:09 [Pool] [zex] (Thread 1) Block template polling has been disabled


Filtering User Accounts by Online Users
How to filter user accounts to only view users who are currently logged in to this site using the User Accounts module.
This filter is integrated with the Users Online module. The Users Online module must be enabled by a SuperUser for this filter to work.
- Navigate to Admin > User Accounts - OR - Go to a User Accounts module.
- Click the Online link. This displays the matching user account records.
Filtering User Accounts by Online Users Only


Courses By Best Teachers
We will provide you best courses of every subject.Courses cover all subjects and you will surely find courses as per your interest.
{% load static %}
We will provide you best courses of every subject.Courses cover all subjects and you will surely find courses as per your interest.
We provide you books covering all departments and clubs like Electronics,Mechanical,Computer Science,etc.Books can be uploaded by anyone on the platform.


blue_st_sdk.advertising_data package¶
Submodules¶
blue_st_sdk.advertising_data.ble_advertising_data module¶
ble_advertising_data
The ble_advertising_data module keeps the information contained within the advertising data coming from Bluetooth devices.
-
class
blue_st_sdk.advertising_data.ble_advertising_data.
BLEAdvertisingData
[source]¶ Bases:
object
Interface that defines the advertising data.
-
get_address
()[source]¶ Get the device MAC address.
- Returns:
- str: The device MAC address.
- Raises:
NotImplementedError
if the method has not been implemented.
-
get_device_id
()[source]¶ Get the device identifier.
- Returns:
- int: The device identifier.
- Raises:
NotImplementedError
if the method has not been implemented.
-
get_device_type
()[source]¶ Get the device’s type.
- Returns:
- The device’s type.
- Raises:
NotImplementedError
if the method has not been implemented.
-
get_feature_mask
()[source]¶ Get the bitmask that keeps track of the available features.
- Returns:
- The bitmask that keeps track of the available features.
- Raises:
NotImplementedError
if the method has not been implemented.
-
get_name
()[source]¶ Get the device name.
- Returns:
- str: The device name.
- Raises:
NotImplementedError
if the method has not been implemented.
-
get_protocol_version
()[source]¶ Get the device protocol version.
- Returns:
- int: The device protocol version.
- Raises:
NotImplementedError
if the method has not been implemented.
-
get_tx_power
()[source]¶ Get the device transmission power in mdb.
- Returns:
- int: The device transmission power in mdb.
- Raises:
NotImplementedError
if the method has not been implemented.
-
is_device_sleeping
()[source]¶ Check whether the device is sleeping.
- Returns:
- True if the device is sleeping, False otherwise.
- Raises:
NotImplementedError
if the method has not been implemented.
-
blue_st_sdk.advertising_data.ble_advertising_data_parser module¶
ble_advertising_data_parser
The ble_advertising_data_parser module contains tools to parse the advertising data coming from Bluetooth devices.
-
class
blue_st_sdk.advertising_data.ble_advertising_data_parser.
BLEAdvertisingDataParser
[source]¶ Bases:
object
Interface to parse the advertising data sent by a Bluetooth device.
-
classmethod
parse
(advertising_data)[source]¶ Parse the BLE advertising_data.
- Args:
- advertising_data (list): BLE advertising_data.
- Returns:
blue_st_sdk.advertising_data.blue_st_advertising_data.BLEAdvertisingData
: The advertising data information sent by the device.- Raises:
NotImplementedError
if the method has not been implemented.
-
classmethod
blue_st_sdk.advertising_data.blue_st_advertising_data module¶
blue_st_advertising_data
The blue_st_advertising_data module keeps the information contained within the advertising data coming from Bluetooth devices implementing the Blue ST protocol.
-
class
blue_st_sdk.advertising_data.blue_st_advertising_data.
BlueSTAdvertisingData
(name, tx_power, address, device_id, device_type, protocol_version, feature_mask, sleeping)[source]¶ Bases:
blue_st_sdk.advertising_data.ble_advertising_data.BLEAdvertisingData
Advertising data sent by a device that follows the BlueST protocol.
-
__init__
(name, tx_power, address, device_id, device_type, protocol_version, feature_mask, sleeping)[source]¶ Constructor.
- Args:
name (str): The device name. tx_power (int): The device transmission power. address (str): The device MAC address. device_id (int): The device identifier. device_type (
blue_st_sdk.node.NodeType
): The type of thenode.protocol_version (int): The device Protocol Version. feature_mask (int): The bitmask that keeps track of the available
features.sleeping (bool): The device sleeping status.
-
get_feature_mask
()[source]¶ Get the bitmask that keeps track of the available features.
- Returns:
- The bitmask that keeps track of the available features.
-
get_protocol_version
()[source]¶ Get the device protocol version.
- Returns:
- int: The device protocol version.
-


A Look At How The ESRB Rates Video Games
by Luke PlunkettDanny O’Dwyer’s Noclip documentary series recently got the chance to visit America's Entertainment Software Rating Board (ESRB), and see just how the organisation works.
The 44-minute video touches on a number of topics. First, it’s a pretty good history of the ESRB, detailing their origins in the wake of social and political hysteria surrounding video game violence in the 1990s.
Next, it goes behind the scenes, meets several key employees and shows not just how the ESRB works in the U.S., but how they cooperate with other international ratings boards as well.
Finally, and perhaps least satisfactorily, it raises the question of what the ESRB is going to do in the future, and how they’re reacting to more contemporary controversies like lootboxes. Here, the ESRB’s answers aren’t going to impress anyone hoping the organisation is as opposed to publisher’s predatory pricing strategies as consumers are.


--- layout: post title: Dynamic number of tests - JUnit4 date: 2014-02-12 06:28:26.000000000 +00:00 type: post published: true status: publish categories: [] tags: [] meta: _edit_last: '36016338' _publicize_pending: '1' author: login: velmuruganv email<EMAIL_ADDRESS>display_name: velmuruganv first_name: '' last_name: '' ---
In our project I have several JUnit tests that e.g. take every file from a directory and run a test on it. If I implement a testEveryFileInDirectory method in the TestCase this shows up as only one test that may fail or succeed. But I am interested in the results on each individual file. How can I write a TestCase / TestSuite such that each file shows up as a separate test e.g. in the graphical testrunner of eclipse? (Coding an explicit test method for each file is not an option.)
[code lang="java"]
package com.vel.qa.tests.detailedtests;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class ParameterizedTest {
@Before
public void method() {
System.out.println("Set Up method ");
}
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
// load the files as you want from the directory
System.out.println("Parameters");
Collection<Object[]> data = new ArrayList<Object[]>();
for (int i = 0; i < 10; i++) {
File file = new File("file_name_" + i);
Object[] fileArg1 = new Object[] { file };
data.add(fileArg1);
}
return data;
}
private File fInput;
// Constructor with arguments
public ParameterizedTest(File input) {
System.out.println("constructor");
this.fInput = input;
}
// This test will be called multiple times depends on size of the parameters
// set at the @paramenters method.
@Test
public void test() {
System.out.println("test called ");
// do more validation based on your requirements.
}
@After
public void tearDown() {
}
}
[/code]
The results of the above program looks like as shown below.
[caption id="attachment_100" align="alignnone" width="620"] junit_graphical_results_eclipse[/caption]


This page tracks the new paper links made to my list of DPS 2013 papers.
Page maintained by Ke-Sen Huang.
If you have additions or changes, send an e-mail.
August 23, 2013
- An Interactive System for Set Reconstruction from Multiple Input Sources
August 15, 2013
- Building Efficient Fur Pipeline for a Low Cost Production of Creature-based Feature Film
- MorphoLogical Anti-Aliasing in Production
(PDF)
August 4, 2013
- Liquids in ¡§The Croods¡¨
July 17, 2013
- Page published
- Towards Higher Quality Character Performance in Previz
kesen.huang@gmail.com


REGISTRATION
If you are already a user click
login
First Name:
Last Name:
Email:
Password:
Address:
Phone_number:
India's No.1 Destination For House Properties


Lato Black 900
This is a paragraph rendered in Lato Regular.
Lato Bold 700
This is a paragraph rendered in Lato Regular.


{% extends "layout-v2.html" %} {% block pageTitle %} NHS Cervical screening management system {% endblock %} {% block header %} {% include '../components/header-3.html' %} {% endblock %} {%block content%} {{ backLink({ "href": "prior-notification-12-manage", "text": "Back to Manage emails", "classes" : "nhsuk-u-margin-bottom-4" }) }}
<EMAIL_ADDRESS>will be removed from the mailing list and no longer receive notification emails.


{% extends "email_base.html" %} {% block title %}{{ investor.name }} just saved your page!{% endblock %} {% block heading %}Hey, {{ user.name }}!{% endblock %} {% block content %}
You can check them out here!
If you want to edit your account information, please click here.
Regards,
the INCUB8 Team


{% extends "base.html" %} {% block title %} Facility Search Results {% endblock %} {% block content %} Back to search {% if facility_query and pc_query %}
No records found. Please enter different search parameters.
{% elif facility_list %} {% for facility in facility_list %}


Derek Eder
@derekeder
Here's a page I've started checking every day: the @ChiPublicHealth page on COVID-19. Updated daily, it shows the current status, risk level and actions you should take https://www.chicago.gov/city/en/depts/cdph/provdrs/health_protection_and_response/svcs/2019-novel-coronavirus--2019-ncov-.html
3/10/2020, 9:58:33 AM
Favs: 9
Retweets: 2
link


Create a client from given session cookie, or have the login/register function generate a session afterwards.
A session cookie to use instead of generating a new cookie.
Generates a new session cookie from the server.
Returned promise resolves with cookie string starting with "JSESSIONID=..."
Get session cookie to use instead of logging in/registering every time.
Returns session cookie.
Get sent submissions as iterable pages (arrays of task object).
Returns an async iterator containing page tasks.
Get submsissions as children of corresponding tasks.
Returned promise contains an array of objects with the task name and previously sent submsisions.
Generates a new session cookie, and authenticates cookie with a login request.
Credentials used for logging in.
Returns client object with authenticated cookie.
Generates a new session cookie, and authenticates cookie with a register request.
Credentials used for registering.
Returns client object with authenticated cookie.
Sends submission and returns task object containing the test results.
Returns task object containing the test results inside the public field Task.sentSubmissions
.
Get tasks from category as async iterator.
Category id to get tasks from.
Returns an async iterator containing category tasks.
Get tasks from competition as async iterator.
Competition id to get tasks from.
Returns an async iterator containing competition tasks.
Generated using TypeDoc
Class representing the API client used for making different requests


The Vmrun remote base uses the vmrun command to implement a cloud remoter base. The Vmrun remoter base has been tested with Vmware fusion on the mac.
In order to use the Vmrun remoter base you will need to setup a few things. First, you will need to have the Vmware fusion installed and vmrun command in your path. The default location of the vmrun binary is /Library/Application Support/VMware Fusion/vmrun. You will then of course need a virtual machine installed and available. Once you have your instance installed and running, you need to setup your ssh keys so that poolparty can ssh into the instance. Get the ip of you instnace with ifconfig inside the running instance. For example:
ssh<EMAIL_ADDRESS>"mkdir /root/.ssh && chmod 600 /root/.ssh" scp my_key.pub root@<IP_ADDRESS>:/root/.ssh/authorized_keys
provide a using :vmrun block in your clouds.rb for example:
using :vmrun do vmx_hash(::File.expand_path("~/Documents/Virtual\ Machines.localized/Ubuntu-jaunty.vmwarevm/Ubuntu-jaunty.vmx") => '<IP_ADDRESS>') end The vmx file fulfills a similar purpose as the ami id in ec2. Note that expand path. vmrun return fuill paths, so we must provide full paths so things match up later. W Vmrun does not provide a meta server like ec2 has, so you need to list the ip address of your VM. For this reason it is recommended that you use NAT addressing on your VM to maintain consistent addressing across different physical networks.
Also, note that vmrun does not copy the VM to a new distinct VM on each run, so if you want to be able to start from a known state, you should make a snapshot before using your vm with poolparty. Then, you can rollback to this initial state if you want to ensure you can repeat a fresh cloud-start.


There are many ways that one can manipulate and store data, and depending upon how that data will be used and accessed determines which method would be the best option. Two of the most popular forms of storing data are arrays and hashes, and each has their own qualities that can make them an ideal choice. Lets explore them both, starting with arrays.
Arrays store data by using a zero-based integered indexing system. A zero-based indexing system means that the first slot of the array is always zero and the array has as many slots as there are for each piece of data to have its own slot yielding a number of slots equivalent to the number of data pieces, which is also known as its length, minus one. For instance, if someone had an array called "lunch" that had three things in it, say an apple, a soda, and a sandwich, and wanted to access the soda, they would have to call the name of the array and the index where the soda is located. In this case they would say 'puts lunch[1]'. This is good to use if they wanted to iterate through an array and access elements in order or get one particular thing from the array.
Hashes are similar to arrays except that hashes do not use zero-based indexing as keys to store items. Instead hashes keep groups of data together, regardless of object type, and stores it under another key name, not a prenumbered slot. Hashes allow a computer to perform more complex filtering and selection operations. One thing that make hashes stand out is its quick lookup capability in faster than linear time. Hashes must have unique keys since that is where the information of values will be stored, but the values don't have to be unique. When using hashes, the function is typically performedd much faster than arrays so it would be ideal if I had a gigantic amount of data and wanted to access certain pieces of it. For the interest of time, the example will show its everyday functionality in how it deals with normal list of data and how the keys work.
So as you can see, both have their uses in the world of programming, it just depends on how you want to manipulate and manage your data and the efficiency with which you choose to operate!
| T-1 | T-2 | T-3 | T-4 | T-5 | T-6 | T-7 | T-8 |
| C-1 | C-3 | C-4 | C-5 | C-6 | C-7 | C-8 | C-9 |


HIDE USER : after creating your backdoor user, bear in mind that it can be seen on login screen and in preferences. to avoid this, you need to make your user hidden. use :
> sudo dscl . create /Users/myuser IsHidden 1
where myuser is your username
if you later want to make it unhidden, just change the IsHidden value to 0. that is :
> sudo dscl . create /Users/myuser IsHidden 0
Don’t forget that your home directory can be easily seen too, that is if u set it to default. move your directory to a directory that is not easily seen. lets say var/ directory.
> sudo mv /Users/myuser /var/myuser
the following command then updates the myuser directory to the new one /var/
> sudo dscl . -create /Users/hiddenuser NFSHomeDirectory /var/hiddenuser
this then removes the myuser public sharepoint folder
> sudo dscl . -delete "/SharePoints/myuser's Public Folder"
reference: https://support.apple.com/en-au/HT203998 for more


J lets you express your ideas tersely, but it is up to you to make sure they are good ideas. Since each keystroke in a J sentence can summon up billions of machine cycles, you must make sure that you don't force the interpreter into a bad choice of algorithm. This will be hard at first, when you are struggling to figure out what the interpreter is doing, never mind how it is doing it; fortunately the interpreter gives you tools to measure the performance of your code.
If you run the JforC script with
load 'system\packages\misc\jforc.ijs'
it will define the verb Ts. Ts stands for 'time and space' and it tells you how long it takes to run a given J sentence, and how much space the interpreter used during the execution. For example:
a3 =. i. 1000
Ts '+/\ a3'
4.3581e_5 5248
We define a noun a3, and we calculate the running total of its items. It took 0.00004 seconds to create the 1000-item running total, and used 5248 bytes. We could have done the whole operation in one line with Ts '+/\ i. 1000', but the monad i. uses time and space too, so if we want to find out only what is used by +/\, we make sure that's all we measure.
We can use Ts to start to understand what can make J programs slow. Let's define a verb to do the addition operation:
sum =: dyad : 'x + y'"0
sum is an exact replacement for dyad +, having the same rank and function. Replacing + with sum does not change the result of a sentence:
+/\ i. 7
0 1 3 6 10 15 21
sum/\ i. 7
0 1 3 6 10 15 21
But the performance is quite different, as we can measure:
a10 =. i. 10
1000 Ts '+/\ a10'
2.68191e_5 1280
Because +/\ is so fast, we give Ts a left argument to report the average time over 1000 runs. If we just ran the sentence once, the result would be corrupted by small timing variations introduced by the operating system. sum/\ is not so fast so we run it only once:
Ts 'sum/\ a10'
0.00181867 3648
Quite a difference: in this running total sum seems to be about 50 times slower than + . Let's just try adding a list to itself (remember that u~ y is equivalent to y u y):
1000 Ts '+~ a10'
2.68191e_5 896
100 Ts 'sum~ a10'
0.00033021 2560
Yes, sum is definitely slower than +, though only by a factor of 10 or so this time. Why should it be slower? The answer is, Because it deals with atoms. Since J verb-definitions are not compiled, but interpreted line-by-line on each execution, every single time we add two numbers with sum, the interpreter has to parse 'x + y' and perform the addition. Why, it's a miracle that it only slows down by a factor of 10! The lesson is that if you define verbs with small rank, the interpretive overhead will be significant.
Still, that doesn't fully explain why sum/\ is so much slower than +/\ . Let's investigate further by increasing the size of the operand:
a20 =. i. 20
1000 Ts '+/\ a20'
2.68191e_5 1280
Ts 'sum/\ a20'
0.00728641 3648
+/\ is unchanged when we move to a list of 20 items--the operation is so fast that time is being spent starting the verb rather than running it--but sum/\ slows down noticeably. Interesting; let's try bigger and bigger operands:
a40 =. i. 40
1000 Ts '+/\ a40'
2.76572e_5 1408
Ts 'sum/\ a40'
0.0299561 4160
a100 =. i. 100
1000 Ts '+/\ a100'
2.76572e_5 1664
Ts 'sum/\ a100'
0.185741 5184
a400 =. i. 400
1000 Ts '+/\ a400'
3.77143e_5 3200
Ts 'sum/\ a400'
3.00367 11328
Holy cow! On a 400-item list, sum/\ is 80000 times slower than +/\! What happened?
Recall what monad sum/\ is really doing. It applies monad sum/ to the first item of the list; then to the list made of the first 2 items; then the list made of the first 3 items; and so on. At each evaluation of monad sum/, the dyad sum verb is interleaved between the items and the result is evaluated right-to-left. The problem is, the interpreter doesn't analyze sum to know that it is associative--that x sum (y sum z) is the same as (x sum y) sum z--so it doesn't know that it can use the result from one subset as an input to the operation for the next subset, and it winds up performing every single addition: for the 400th item it adds all 400 numbers together. That's why its time increases as the square of the length of the list.
Monad +/\ is fast because the interpreter knows that dyad + is associative, and therefore it reuses the result from one subset as input to the next, producing each item of the result with a single addition.
Well then, can we give a hint to the interpreter that sum is associative? Alas, no, but we have another trick up our sleeve. Consider monad sum/\., which applies monad sum/ to successive suffixes. If the interpreter is clever, it will notice that if it starts with the smallest suffix--the one made up of just the last item--and processes the suffixes in order of increasing size, it will always be evaluating x sum (previous suffix result), and right-to-left evaluation implies that the result of the previous suffix can always be used as the right operand to each application of monad sum, without needing any knowledge of associativity. Let me tell you, this interpreter is nothing if not clever, and that's just what it does. All we have to do is to convert our sum/\ into a variant of sum/\. . The way to do that is simple: we reverse the order of the items, apply sum/\., and reverse the order again:
sum/\.&.|. i. 7
0 1 3 6 10 15 21
This arises enough to be a standard J idiom: use it whenever you need to apply an associative verb on prefixes. It's much faster:
Ts 'sum/\.&.|. a400'
0.014805 59264
Still not as fast as +/\, but the suffix version uses time proportional to the number of items rather than the square of the number of items.
Use Large Verb-Ranks! and Integrated Rank Support
'Think big' is a watchword not just for program design, but for coding as well. Starting a primitive has a small cost, but if you start a primitive for each atom of a large array, the cost will add up. To reduce the time spent starting primitives, apply them to the biggest operands possible. This means, Use as large a verb-rank as you can. See what a difference a tiny change can make:
a =. i. 100000 10
Ts 'a -@+ a'
3.96384 4.19552e6
Ts 'a -@:+ a'
0.12801 8.3895e6
These two verbs produce identical results, but -@+ is 30-fold slower than -@:+ on this large operand. The reason is that -@+ has rank 0 (taken from the rank of +), while -@:+ has infinite rank. Rank 0 means that each pair of atoms is fed individually through the verb. So, when -@+ is executed, two primitives are started for each pair of atoms, one to add and the other to change the sign. Execution of -@:+ requires only two primitive-starts for the entire array.
You do not need to worry much about the ranks at which individual primitives are applied, because of an important feature of J called integrated rank support. When a verb with integrated rank support is used as the u in u"n, the resulting verb runs with a single primitive-start and the application of the verb on the proper cells is handled within the primitive. So,
100 Ts 'a + a'
0.0623949 4.19501e6
100 Ts 'a +"0 a'
0.248846 4.19526e6
100 Ts 'a +"1 a'
0.0681035 4.19526e6
100 Ts 'a +"2 a'
0.0626361 4.1952e6
All these forms produce identical results. The weak dependence of the speed on the rank is typical of a verb with integrated rank support. Fastest execution is achieved when the verb is used alone, but the form u"n still runs fast, and the higher the rank, the less the loop-control overhead. The Special Code page referred to in the previous section includes the long list of the primitives with integrated rank support. You will see there that u/, u/\, and the like are also taken care of.
The practical effect of integrated rank support is that you don't need to worry much about using the largest possible rank for primitives. In compounds and verbs that you write, you do need to keep the rank high:
Ts '(<a:;1) { a'
0.00939758 525568
Ts '1 {"1 a'
0.00952329 525184
Integrated rank support in dyad { gives the two forms equal performance. Look what happens when we replace the { by a user-defined verb with the same function:
from =. {
Ts '(<a:;1) from a'
0.00953335 525760
Ts '1 from"1 a'
0.365966 525696
from lacks integrated rank support, even though it is defined to have the same function as {, and it suffers when it is applied to each 1-cell. This is a good reason for you to learn the J primitives and not replace them with mnemonic equivalents.
Here is a list of things to keep in mind, starting with the most important. Some of these tips will not be understandable until you have mastered tacit programming.
Avoid Boxing, Especially Small Boxes
An unboxed array is stored packed into sequential memory locations. An array of boxes is stored as sequential headers, where each header points to the contents of the box; the contents of each box is stored in its own memory area.
Operations on the contents of an array of boxes require much more complicated addressing than operations on an unboxed array, and are therefore slower. In addition, the storage required for the headers can dwarf that for the data if the contents of each box are small.
For these reasons, you should try to use unboxed arrays when speed is paramount, and if you need boxing, make the contents of each box as large as possible. In C terms, you should use a structure of arrays rather than an array of structures. Most C programmers find the array of structures more pleasing. In C there is no penalty for using it, but J is different.
Use the Dyad i. Family: Dyad i. i: e. -., Monad ~. ~: u/.
Dyad i. is the most highly polished code in the J interpreter. It has more algorithms, based on operand size and type, than you'd ever code yourself. Use it whenever you can. Other primitives also use this fast code: these are dyads e. i: -. and monad ~. ~: u/ .
Use u&.> (u each) To Operate Inside Boxes
If you need to open boxes, do something to the contents, and box them up again, the way to do it is with the form u&.> which bypasses most of the overhead of creating a list of boxes. This form is recommended for either monadic or dyadic u . It is even worth using if one of the operands is an unboxed scalar, as the unboxing will have no effect and the reboxing will be fast.
&.> is given the name each in the J startup scripts.
Special forms of dyad m} and dyad , modify or extend an array without copying the array. Use these whenever possible. The forms are:
name =. x m} name
name =: x m} name
name =. name , x
name =: name , x
Use Compounds Recognized by the Interpreter
The interpreter recognizes a great many compounds and has special code to perform the compound functions. For example, we have learned that u@:v y gives the same result as u v y, but it does not follow that the two forms are identical: +/@:, y is faster than +/ , y . How do you know what forms are handled with special code?
An appendix to the Dictionary gives a list of special code
in the interpreter (press F1 to bring up help; then click on 'Dic' at the top
of the page to bring up the Contents page; the appendices are listed at the end
of the contents). There we see that
there is special code for f/@:, so we know to use that form. Similarly, farther along we see that x i.&1@:< y has special coding, so we know to prefer that form over (x < y) i. 1 . This list changes from release to release, so
you should review it occasionally. A few
of the more important ones are:
Combine enfile with another operation: ($,) and u/@,
Use x ($,) y rather than x $ , y and u/@, y rather than u/ , y . In each case the interpreter can avoid making a copy of the data for the , operation.
Use unboxed x in x { y
If the x operand of x { y is a rank-2 array (in which each item specifies one cell of y), you should code x (<"1@[ { ]) y rather than (<"1 x) { y . The result is the same, but the first form creates the result directly without computing the boxed lists of x .
Search a constant list using preinterpreted m&i.
If you are going to do many searches through the same list of data m, you will do well to create a search verb
name =: m&i. NB. m&e. and -.&n work too, and some others
The compound m&i. is interpreted when name is assigned, and the interpreter builds an index for m and saves it as part of the verb, so that it doesn't have to be calculated each time the verb is used.
Note that it doesn't help you to use m&i. in a line in an explicit verb, because each line in an explicit verb is interpreted afresh each time it is executed.
Use i.&1@:u to find the first item where x u y is true
The natural way to find the first item where x u y is true is (x u y) i. 1 . The inefficiency in this code is that the entire x u y is calculated before the search is made for the first 1, which is needless computation for all the items after the first 1.
The form x i.&1@:u y produces the same result, but the interpreter can see what you are up to, and it stops computing u when the first 1 is found.
x i.&1@:u y always gives the correct answer, but it performs the fast abbreviated search only when the operands have rank less than 2 and u is one of = ~: < <: > >: E. e.
Variations of this form produce related results. i: rather than i. searches for the last occurrence; 0 rather than 1 searches for an item that is false. In place of i.&1, +/ counts the occurrences, +./ tests whether any of the results is true, *./ tests whether all the results are true, and I. gives all the indices at which the result is true.
The version with E. is the verb to use to find one string in another: x i.&1@:E. y finds the starting position of the first occurrence of the string x in the string y .
(u i. 1:) is an alternative way to write i.&1@:u .
Shining a Light: The J Performance Monitor
A magnet makes it easy to pick up a needle, but it won't much help you find a needle in a haystack. Likewise, being able to time and tune individual sentences will not suffice to let you improve the performance of a large J program. A large program spends most of its time executing a small subset of its code, and any improvements you make to other areas are simply wasted effort. I remember a case where a 20,000-line assembler-language program was spending 30% of its time executing a single machine instruction--and that instruction turned out to be unnecessary! What you need is a tool that will direct your attention to the areas where a speedup will really matter.
The J Performance Monitor will show you how much time is spent executing each line of your application. You can run the Lab on the Performance Monitor to see all the facilities available, or you can jump right into timing your code with the simple sequence
load 'jpm'
Do this once to load the tool. Then, for each timing run, execute
start_jpm_ 1e7
357142
The operand of start_jpm_ is the size in bytes of the trace buffer, and the result is the number of trace entries that can fit in the buffer. A trace entry is added for each line executed, and for entry and exit of explicit definitions (i. e. verbs defined with verb define).
run the
code you want to time
viewtotal_jpm_ ''
J will display a popup window with information about the time spent in each verb. An example display is
+---------+------+--------+--------+-----+----+---+
|name |locale|all |here |here%|cum%|rep|
+---------+------+--------+--------+-----+----+---+
|accpay |base |0.001435|0.000829| 57.8| 58 |1 |
|intrep |base |0.000213|0.000213| 14.8| 73 |1 |
|accint |base |0.000393|0.000147| 10.2| 83 |1 |
|stretch |base |0.000142|0.000142| 9.9| 93 |1 |
|intexpand|base |0.000105|0.000105| 7.3|100 |1 |
|[total] | | |0.001435|100.0|100 | |
+---------+------+--------+--------+-----+----+---+
The columns contain the following information:
name the name of the verb
locale the locale the verb was running in
all the amount of time spent in this verb including time spent in verbs called by this verb
here the amount of time spent in this verb but not including time spent in verbs called by this verb
here% the here time as a percentage of total time
cum% cumulative total of here%
rep the number of times the verb was executed
You should focus your attention on the here column. If you see a verb that is taking longer than you think it should, double-click on its name to look at the details of its execution. Double-clicking on accpay will pop up another window showing
+--------+--------+---+----------------------------------+
|all |here |rep|accpay |
+--------+--------+---+----------------------------------+
|0.000041|0.000041|1 |monad |
|0.000040|0.000040|1 |[8] if. 4~:#y do. |
|0.000000|0.000000|0 |[9] 'imm frq int pay' return. end.|
|0.000054|0.000054|1 |[10] 'm f i p'=.y |
|0.000116|0.000116|1 |[11] len=.$p=.f#p%f |
|0.000724|0.000131|1 |[12] j=.}.len accint f intrep i |
|0.000322|0.000322|1 |[13] r=.j*+/\p%m}.1,(m-1)}.j |
|0.000137|0.000137|1 |[14] (len$(-f){.1)#r |
|0.001435|0.000841|1 |total monad |
+--------+--------+---+----------------------------------+
We see that line 13 takes the most time. Clicking on the column heading will sort the lines using that column as a key, making it easy for you to concentrate on the individual lines that are taking the most time.
You should be aware of one quirk. The Performance Monitor will account for the time spent in every line of a named verb that is explicitly defined (i. e. defined using verb define or 3 : or 4 :). Other verbs are accounted for only as a whole, not line-by-line. You may be surprised to find that a verb defined by
opaqueverb =: verb define"0
<definition here>
)
will not be treated line-by-line. Yes, there is an explicit definition, but opaqueverb is not that definition: opaqueverb is a compound produced by the rank conjunction " . If you want to look inside opaqueverb, you need to define it like so:
opaqueverb =: limpidverb"0
limpidverb =: verb define
<definition here>
)
The J Performance Monitor makes it easy to give your code a good finish by pounding down the nails that are sticking up. As of J6.01 there are a few quirks you need to work around: you cannot have a verb with the same name as a locale; you must close a detail window before you create a new one; and time spent in explicit modifiers is not correctly accounted for.


care palliative {border-style COVID- px;} staff #ffffff;} hospice response services disease community coronavirus pandemic data resources health influenza patients SARS articles protocols respiratory role Ebola acute etÂ provision training supportive hospital include management px; rapid rapidly treatment {font-family Hospice bereavement care, changes font-size identified improve included including inform inpatient measures people providing settings studies volunteers West decision double; end help make pandemics psychosocial specific support syndrome systems telephone using virus Africa, Data EVD Elsevier Health Hong PPE Pain Severe Symptom adopting avian border-color border-width casualty centers clinical collection communication ebola essential evidence impact mass monitoring national protocols, provide research solid; standardized study symptom teams technology terminal {font-style {font-weight BSc, Cicely Palliative Respiratory Saunders [â€"], according admissions article assess bold camaraderie centre considering control courier; deal dying em; ensuring epidemic ethical events funded guidelines holistic hospices hospitals important interviews involved limited model need outbreak psychological pt;} public recommended resource respond scarce shift studies, symptoms terminally units use utilization workers â€¢Lack


openfam::fam::fam_initialize
Initialize the OpenFAM library.
Synopsis
void fam_initialize(const char *groupName, Fam_Options *options);
Description
This method is required to be the first method called when a processing element uses the OpenFAM library. It initializes internal data structures within the library that allow the processing element to participate in the application. Normally, called by all PEs at the start of the program.
Input Arguments
| Name | Description |
|---|---|
| groupName | Name that defines an application group. All cooperating PEs must provide the same group name. |
| options | Pre-defined options that a processing element provides to the OpenFAM library. |
fam_initialize()
takes a defined object of type Fam_Options
as input
typedef struct { char *defaultRegionName; char *cisServer; char *grpcPort; char *libfabricProvider; char *famThreadModel; char *cisInterfaceType; char *openFamModel; char *famContextModel; char *numConsumer; char *runtime; } Fam_Options;
| Name | Description | Default Value |
|---|---|---|
| defaultRegionName | Default region name. Currently ignored by the implementation. | "default" |
| cisServer | Client Interface Server to be used by OpenFam APIs. The value is given as cisServer IPaddress string. | "<IP_ADDRESS>" |
| grpcPort | Port to be used by OpenFam client interface service operations. | "8787" |
| libfabricProvider | Libfabric provider to be used by OpenFam libfabric datapath operations. The supported options are "sockets", "verbs;ofi_rxm" and "psm2". | "sockets" |
| famThreadModel | Threading model used. Currently ignored by the implementation. | "FAM_THREAD_SERIALIZE" |
| cisInterfaceType | Communication interface type to be used between processing element and Client interface service. Supported types are "rpc" and "direct". | "rpc" |
| openFamModel |
Type of OpenFAM memory allocator model implementation used by OpenFAM API.
Supported allocator implementations are:
|
"memory_server" |
| famContextModel | Context model used. Currently ignored by the implementation. | "FAM_CONTEXT_DEFAULT" |
| numConsumer | Number of consumer threads for shared memory model using the nvmm allocator. | "1" |
| runtime | FAM runtime environment used. Supported values are "PMIX", "PMI2", "NONE". | "PMIX" |
The application should set the options value to zero to use the default option values.
Fam_Options *fm = (Fam_Options*)malloc(sizeof(Fam_Options));
memset((void *)fm, 0, sizeof(Fam_Options));
Return Values
None. Throws Fam_Exception
on error.
Fam Error Numbers
| Error | Description |
|---|---|
| FAM_ERR_INVALID | API called with incorrect parameters. |
| FAM_ERR_LIBFABRIC | Libfabric error occurred. |
| FAM_ERR_RPC | Communication error from grpc layer. |
| FAM_ERR_RPC_CLIENT_NOTFOUND | RPC service not available. |
| FAM_ERR_MEMSERV_LIST_EMPTY | Memory service not initialized. |
Notes
Additional fields may be specified in options in the future to support parameters or other variables that have traditionally been provided to the runtime via environment variables.
The following options are not supported in current implementation and should always be set to zero to use the default values.
Alternatively, the application can pass these options using configuration files. See Configuration Files for details.
However, fam_initialize()
routine will give precedence to the options passed as Fam_Options
argument over the options present in configuration files.
Example
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <fam/fam.h> #include <fam/fam_exception.h> using namespace std; using namespace openfam; int main(void) { fam *myFam = new fam(); Fam_Options *fm = (Fam_Options*)malloc(sizeof(Fam_Options)); memset((void *)fm, 0, sizeof(Fam_Options)); // Set specific options that are needed by the implementation fm->cisServer = strdup("<IP_ADDRESS>"); fm->libfabricProvider = strdup("sockets"); try { myFam->fam_initialize("myApplication", fm); printf("FAM initialized\n"); } catch (Fam_Exception& e) { printf("FAM Initialization failed: %s\n", e.fam_error_msg()); myFam->fam_abort(-1); // abort the program // note that fam_abort currently returns after signaling // so we must terminate with the same value return -1; } myFam->fam_finalize("myApplication"); printf("FAM finalized\n"); return 0; }


in the World
(2018)
DENSITY BY COUNTRY
Here, I'm creating Choropleth world maps to look at restaurant density by country.
DENSITY OF RESTAURANTS BY COUNTRY
The plot below shows the country locations and the number of restaurants for each. It
becomes clear right away that India has a disproportionally large number of restaurants
compared to the others.
TOP 3 CUISINE (DENSITY OF RESTAURANT BY COUNTRY)
There are some quick conclusions to be made. It was made clear before that India has the highest overall density, but now we can see that it has the highest density of restaurants for all 3 of the most prevalent cuisines. We also expected for there to be many Chinese and Fast Food restaurants. But still, there is a large disparity shown here between Indian cuisine and other cuisine types. But since we are only looking at 15 countries and the data doesn't account for all restaurants, it's still too early to make definitive conclusions.
Indian Cuisine
Chinese Cuisine
Fast Food Cuisine
PRICE/RATING
Here, I'm creating a bar chart to look at average price and rating for each country.
AVERAGE PRICE AND RATING BY COUNTRY
Here, I'm interested in seeing if there is any correlation to be found between price and rating. Also, there may be an effect on these two features depending on the country, so it is important to make judgements based on previous information on restaurant density for each country.
BEST RATED
Here, I'm creating bar charts to visualize the best rated restaurants and cuisines for each country.
BEST RATED RESTAURANTS
Since there are 15 countries to look through, I instead just took the two countries with the greatest number of restaurants (India and United States). We can see some interesting patterns occuring. For India, there's a clear upward trend. We expect there to be less highly rated restaurants, which is about expected. But for the US, we can see that the greatest number of restaurants are around the "Good" range (3.6-4.3). Of course, again we cannot reach any strong conclusions just based off of this, since India has thousands of more sample points than the US. Click the images below for a closer look:
City Cuisines
Here, I'm creating 5 bar charts to look at the number of cuisine types for the 5 cities with the greatest number of restaurants. This visualization has a dropdown menu to switch between the 5 cities.
Cuisine Type Distribution in Cities
These 5 bar charts are from the 5 cities with the greatest number of restaurants. In line with what was found previously (India has the highest density of restaurants), all 5 cities are in India. We have to be careful when observing these charts, as they are on much different scales (different yAxis values). New Delhi has an enormously large number of restaurants in comparison to the other Indian cities. Some trends we can see are that the 3 consistently popular cuisines are Indian, Chinese, and Fast Food. Also, we can see that the largest difference, ratio-wise, seems to be between the cities of Faridabad and Ghaziabad (the first two cities in the dropdown menu). The rest seem to have relatively less fluctuation in terms of the ratio of each cuisine type to the whole.


Pin a fixed-height footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS. A fixed navbar has been added with padding-top: 60px; on the body > .container.
padding-top: 60px;
body > .container
Back to the default sticky footer minus the navbar.


According to him, he belongs to Shatta Movement Nation and not Ghana because some Ghanaians do not reason as expected
He made this known while reacting to the fact that Beyonce’s album of which he was featured on was nominated for Grammys but some Ghanaians doubted him.

Some users on social media don’t seem to be happy for the SM boss and have openly showed that they do not like the feat he has achieved with his music.
Source:MyNewsGh.com/Ayeh Offei-Akoto/2019


public class Material extends java.lang.Object implements Bufferable
| Modifier and Type | Field and Description |
|---|---|
private org.joml.Vector3f |
color |
private float |
diffusePower |
private boolean |
hasTexture |
private int |
sceneBuffer |
private int |
sceneBufferOffset |
private float |
specularExponent |
private float |
specularPower |
private int |
textureId |
| Constructor and Description |
|---|
Material(Texture2D texture)
Creates a textured material
|
Material(org.joml.Vector3f color)
Creates a solid-color material
|
| Modifier and Type | Method and Description |
|---|---|
org.joml.Vector3f |
getColor() |
float |
getDiffusePower() |
int |
getSceneBuffer()
the
Scene lights buffer where the object is written. |
int |
getSceneBufferOffset()
offset in the
Scene lights buffer where the object is written. |
static int |
getSize()
size of the buffer which will be occupied by
#writeToBuffer(ByteBuffer, int)) |
float |
getSpecularExponent() |
float |
getSpecularPower() |
int |
getTextureId() |
boolean |
hasTexture() |
void |
setColor(org.joml.Vector3f color) |
void |
setDiffusePower(float diffuse_power) |
void |
setHasTexture(boolean use_texture) |
void |
setSceneBuffer(int sceneBuffer)
Do not use this unless you really know what you're doing!
|
void |
setSceneBufferOffset(int sceneBufferOffset)
Do not use this unless you really know what you're doing!
|
void |
setSpecularExponent(float specular_exponent) |
void |
setSpecularPower(float specular_power) |
void |
setTextureId(int texture_id) |
void |
update()
Updates the
Scene buffers if there exists a GameObject which has that material and is registered in a Scene |
void |
writeToBuffer(java.nio.ByteBuffer buff,
int offset)
Writes the object's data to a buffer.
|
private org.joml.Vector3f color
private boolean hasTexture
private int textureId
private float diffusePower
private float specularPower
private float specularExponent
private int sceneBufferOffset
private int sceneBuffer
public Material(Texture2D texture)
texture
- - the Texture2D
to be usedpublic Material(org.joml.Vector3f color)
color
- - color for the material to havepublic void writeToBuffer(java.nio.ByteBuffer buff, int offset)
Bufferable
writeToBuffer
in interface Bufferable
buff
- - buffer to write inoffset
- - offset from the start of the bufferpublic static int getSize()
#writeToBuffer(ByteBuffer, int))
public void update()
Scene
buffers if there exists a GameObject
which has that material and is registered in a Scene
public org.joml.Vector3f getColor()
public void setColor(org.joml.Vector3f color)
public boolean hasTexture()
public void setHasTexture(boolean use_texture)
public int getTextureId()
public void setTextureId(int texture_id)
public float getDiffusePower()
public void setDiffusePower(float diffuse_power)
public float getSpecularPower()
public void setSpecularPower(float specular_power)
public float getSpecularExponent()
public void setSpecularExponent(float specular_exponent)
public int getSceneBufferOffset()
Scene
lights buffer where the object is written.GameObject
with this material is registered in a Scene
, otherwise an integer between 0 and the length of the OpenGL buffer getSceneBuffer()
public void setSceneBufferOffset(int sceneBufferOffset)
sceneBufferOffset
- getSceneBufferOffset()
public int getSceneBuffer()
Scene
lights buffer where the object is written.GameObject
with this material is registered in a Scene
, otherwise a valid OpenGL buffer pointerpublic void setSceneBuffer(int sceneBuffer)
sceneBuffer
- getSceneBuffer()