|
Elektra
0.9.4
|
One of the usual questions for a standard benchmark is, how much more or less time two or more different programs take to execute on the same hardware. This tutorial will introduce some tools and techniques that will help you to answer this question. For that purpose we compare the time it takes for certain YAML storage plugins to translate YAML data into Elektra’s key set structure. Most of the techniques we describe here should be applicable too, if you want to compare the run-time of other parts of Elektra. If you want to know why a certain part of Elektra takes a long time to execute, then you might also be interested in the profiling tutorial.
If you have never translated the code base of Elektra before, then please take a look here before you continue.
Usually you want to compare the execution time of the fastest version of a compiled binary. For that purpose it makes sense to change the CMake build type to Release
, which means that the generated build system will optimize the code and strip debug symbols. You should also disable the logger and debug code. An example CMake command that uses Ninja as build tool could look like this:
Elektra already includes a tool that helps you to benchmark the get
and set
methods of a certain plugin called `benchmark_plugingetset`. To show you how to use benchmark_plugingetset
, we create a file named test.yamlcpp.in
with the following content:
and save it in the folder benchmarks/data
:
. As you can see the filename has to use the pattern:
, where $plugin
specifies the name of the plugin the benchmark tool should call. We can now call the get
method of the plugin ../../src/plugins/yamlcpp/README.md "YAML CPP" using the following shell command
``` build/bin/benchmark_plugingetset benchmarks/data user yamlcpp get
# of config file plugin method
time build/bin/benchmark_plugingetset benchmarks/data user yamlcpp get #> 0.00 real 0.00 user 0.00 sys ```
. As you can see in the output above a real configuration file that tests the performance of the ../../src/plugins/yamlcpp/README.md "YAML CPP" plugin should be much larger.


[gecode-users] Makefile patch for building in non-source dir
Christian Schulte
cschulte at kth.se
Mon Oct 12 20:21:13 CEST 2009
The fixed packages are up now.
Cheers, Christian
--
Christian Schulte, www.ict.kth.se/~cschulte/
-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Guido Tack
Sent: Monday, October 12, 2009 7:38 PM
To: Denys Duchier
Cc: users at gecode.org
Subject: Re: [gecode-users] Makefile patch for building in non-source dir
Thanks, Denys. It was actually a bug in our Makefile that only
occurred on systems that don't have a recent enough flex/bison
installed. It's fixed in the trunk and the 3.2.0 tag now, and we'll
update the source packages accordingly (as it only affects the build
system).
Cheers,
Guido
Denys Duchier wrote:
> Hi Guys,
>
> I always compile in a directory that is a sibling of the source
> directory. With 3.2.0 from svn I was getting the following error:
>
> make[1]: *** No rule to make target `gecode/flatzinc/
> parser.tab.cpp', needed by `gecode/flatzinc/parser.tab.o'. Stop.
>
> Adding the VPATH definition shown below to Makefile.in fixed that
> problem.
>
> Cheer,
>
> --Denys
>
> Index: Makefile.in
> ===================================================================
> --- Makefile.in (revision 9875)
> +++ Makefile.in (working copy)
> @@ -52,6 +52,7 @@
> export docdir= @docdir@
> export top_srcdir = @top_srcdir@
> export top_builddir = .
> +export VPATH = $(top_builddir):$(top_srcdir)
>
> # Install to different root directory
> DESTDIR=
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users
More information about the gecode-users
mailing list


MySQL
MySQL is one of the most well known traditional relational database management system (RDBMS).This type of database presents data to users as a relationship between tables and has a set of commands that allow users to manipulate the relationships between tables. Critics of MySQL say that it's very hard to alter these type of databases and that the schemas(fields) of the databases need to be fixed in advance.
Here's are a couple of MySQL databases:


--- layout: post title: Extending party games to mobile date: 2006-05-02 00:00:00 categories: amusing interfaces-&-interaction play ---
Extending party games to mobile: "Perhaps the most interesting aspect of this is that I could imagine participating in a game with my group of close friends. Each round is a quick “I’m thinking of you, and about who you are” sort of casual interaction. I’d want maybe 3 or 4 rounds a day, not too much."
Lurking in my personal LazyWeb is a game where you physically pass your phone around to play... for no reason other than I can imagine it being quite neat, chucking the game from person to person as it clicks and whirrs...


DCCS
HOME
CONTACT US
ABOUT
Anthropogenic Total CO2 Emissions(GtC/Year)
coordinates
Year
Submit
prints array over here


--- layout: post title: InterPro categories: - Bioinformatics - Genomics - Perl - Programming tags: - Bioinformatics - Functional Genomics - InterPro - Perl published: true comments: true ---
InterPro is an integrated database of predictive protein "signatures" used for the classification and automatic annotation of proteins and genomes. InterPro classifies sequences at superfamily, family and subfamily levels, predicting the occurrence of functional domains, repeats and important sites. InterPro adds in-depth annotation, including GO terms, to the protein signatures.
Search InterPro with Perl:
iprscan_soaplite.pl (SOAP::Lite)
iprscan_xmlcompile.pl (XML::Compile::SOAP)
usage:
perl iprscan_soaplite.pl Seqfile --email<EMAIL_ADDRESS>this for more information.


{% extends 'mentorship/base.html' %} {% block body %}
This Code of conduct has been adapted from the PuPPy Code of Conduct as well as the PyCon Code of Conduct
PuPPy US is a community local user group intended for networking and collaboration in the developer community. The PuPPy Mentorship Application was designed to enable development of further connections and relationships between PuPPy community members. As such, users of this application agree to abide by the PuPPy community code of conduct.
We value the participation of each member of the Python community and want all users of the PuPPy Mentorship App to have an enjoyable and fulfilling experience. Accordingly, all users are expected to show respect and courtesy to other users across the application, and at all local user group events, whether officially sponsored by PuPPy or not.
To make clear what is expected, all users, collaborators, and volunteers for this platform are required to conform to the following Code of Conduct. Maintainers will enforce this code throughout use of this platform.
PuPPy is dedicated to providing a positive experience for everyone, regardless of age, gender identity and expression, sexual orientation, disability, physical appearance, body size, ethnicity, nationality, race, or religion (or lack thereof), education, or socio-economic status.
Examples of behavior that contributes to creating a positive environment include:
Examples of unacceptable behavior by participants include:
If a user engages in behavior that violates this code of conduct, the PuPPy Mentorship App maintainers may take any action they deem appropriate, including warning the offender or expulsion from the application.
(Need content here)
(Need content here)


amazon-chime-sdk
/
com.amazonaws.services.chime.sdk.meetings.session
/
MeetingSessionStatusCode
/
AudioJoinedFromAnotherDevice
AudioJoinedFromAnotherDevice
AudioJoinedFromAnotherDevice
The attendee joined from another device.


Modal Manager with VanillaJS
open-popin #1
open-popin #2
Content of my popin #1
Fermer
Content of my popin #2
Fermer


Hello.
I’m Elizabeth Miller and I’m an art director, senior UX designer, and front-end developer working in lovely, sunny Portland, Oregon.
I maintain a strong, formal design sensibility alongside a love for how things are built, how we manage that process, and how we keep it all centered on the user.
As user experience matures, users are less enticed by feature-centric products: they seek value and a higher quality experience. We need to consider outcome (worth) at the same time as output (performance).
Embracing this shift requires a rethinking and retooling of the development and design philosophies. It requires the features we provide to not only be vetted, stable, and quickly available, but also to be informative, entertaining, and meaningful.
My Process: Empathize & Iterate
- Identify objectives
- Identify users
- Make a plan
- Gather data
- Integrate learnings
- Choose a direction
- Build
- Test
- *Iterate through steps 5-8 as needed.
Tools
- adobe
- sketch/ux pin/adobe xd
- sublime
- bootstrap
- jekyll
- git
- sass/less
- gitlab/github
- drupal/wordpress
- angular/react
- gulp/grunt/rake + node.js
- kanban
Methodologies
- human-centered design
- agile software development
- multivariate testing
- task analysis/user interviews
- users in real life
- WCAG 2.0 + 508 compliancy
- color accessibility
- animation strategies


We havent seen this probe appear online yet.
Still need to install it? Read the installation instructions


Blaue Elfe by
frau poncho illustration
Brain Appetite by
frau poncho illustration
Lady at Night by
frau poncho illustration
Lazy Evening by
frau poncho illustration
Lila Elfe by
frau poncho illustration
Magic by
frau poncho illustration
Mysterious by
frau poncho illustration
Nighthawks by
frau poncho illustration
Sample AAC
Sample FLAC
Sample MP3
Sample OGA
Sample WAV
Sample WEBA
Big Buck Bunny
Sample OGV
Elephants Dream
Sample HTML
Rancid - Time Bomb
Grandmaster Borg - Resistance Is Futile


Async is a utility module which provides straight-forward, powerful functions
for working with asynchronous JavaScript. Although originally designed for
use with Node.js and installable via npm install async
,
it can also be used directly in the browser.
Async is also installable via:
bower install async
component install
caolan/async
jam install async
spm install async
Async provides around 20 functions that include the usual 'functional'
suspects (map
, reduce
, filter
, each
…) as well as some common patterns
for asynchronous control flow (parallel
, series
, waterfall
…). All these
functions assume you follow the Node.js convention of providing a single
callback as the last argument of your async
function.
async.map(['file1','file2','file3'], fs.stat, function(err, results){
// results is now an array of stats for each file
});
async.filter(['file1','file2','file3'], fs.exists, function(results){
// results now equals an array of the existing files
});
async.parallel([
function(){ ... },
function(){ ... }
], callback);
async.series([
function(){ ... },
function(){ ... }
]);
There are many more functions available so take a look at the docs below for a full list. This module aims to be comprehensive, so if you feel anything is missing please create a GitHub issue for it.
If you get an error like RangeError: Maximum call stack size exceeded.
or other stack overflow issues when using async, you are likely using a synchronous iterator. By synchronous we mean a function that calls its callback on the same tick in the javascript event loop, without doing any I/O or using any timers. Calling many callbacks iteratively will quickly overflow the stack. If you run into this issue, just defer your callback with async.setImmediate
to start a new call stack on the next tick of the event loop.
This can also arise by accident if you callback early in certain cases:
async.eachSeries(hugeArray, function iterator(item, callback) {
if (inCache(item)) {
callback(null, cache[item]); // if many items are cached, you'll overflow
} else {
doSomeIO(item, callback);
}
}, function done() {
//...
});
Just change it to:
async.eachSeries(hugeArray, function iterator(item, callback) {
if (inCache(item)) {
async.setImmediate(function () {
callback(null, cache[item]);
});
} else {
doSomeIO(item, callback);
//...
Async guards against synchronous functions in some, but not all, cases. If you are still running into stack overflows, you can defer as suggested above, or wrap functions with async.ensureAsync
Functions that are asynchronous by their nature do not have this problem and don't need the extra callback deferral.
If JavaScript's event loop is still a bit nebulous, check out this article or this talk for more detailed information about how it works.
Make sure to always return
when calling a callback early, otherwise you will cause multiple callbacks and unpredictable behavior in many cases.
async.waterfall([
function (callback) {
getSomething(options, function (err, result) {
if (err) {
callback(new Error("failed getting something:" + err.message));
// we should return here
}
// since we did not return, this callback still will be called and
// `processData` will be called twice
callback(null, result);
});
},
processData
], done)
It is always good practice to return callback(err, result)
whenever a callback call is not the last statement of a function.
This section is really about bind
, not about async
. If you are wondering how to
make async
execute your iterators in a given context, or are confused as to why
a method of another library isn't working as an iterator, study this example:
// Here is a simple object with an (unnecessarily roundabout) squaring method
var AsyncSquaringLibrary = {
squareExponent: 2,
square: function(number, callback){
var result = Math.pow(number, this.squareExponent);
setTimeout(function(){
callback(null, result);
}, 200);
}
};
async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){
// result is [NaN, NaN, NaN]
// This fails because the `this.squareExponent` expression in the square
// function is not evaluated in the context of AsyncSquaringLibrary, and is
// therefore undefined.
});
async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){
// result is [1, 4, 9]
// With the help of bind we can attach a context to the iterator before
// passing it to async. Now the square function will be executed in its
// 'home' AsyncSquaringLibrary context and the value of `this.squareExponent`
// will be as expected.
});
The source is available for download from
GitHub.
Alternatively, you can install using Node Package Manager (npm
):
npm install async
As well as using Bower:
bower install async
Development: async.js - 29.6kb Uncompressed
So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5.
Usage:
<script type="text/javascript" src="async.js"></script>
<script type="text/javascript">
async.map(data, asyncProcess, function(err, results){
alert(results);
});
</script>
Some functions are also available in the following forms:
<name>Series
- the same as <name>
but runs only a single async operation at a time<name>Limit
- the same as <name>
but runs a maximum of limit
async operations at a timeeach
, eachSeries
, eachLimit
forEachOf
, forEachOfSeries
, forEachOfLimit
map
, mapSeries
, mapLimit
filter
, filterSeries
, filterLimit
reject
, rejectSeries
, rejectLimit
reduce
, reduceRight
detect
, detectSeries
, detectLimit
sortBy
some
, someLimit
every
, everyLimit
concat
, concatSeries
series
parallel
, parallelLimit
whilst
, doWhilst
until
, doUntil
during
, doDuring
forever
waterfall
compose
seq
applyEach
, applyEachSeries
queue
, priorityQueue
cargo
auto
retry
iterator
times
, timesSeries
, timesLimit
Applies the function iterator
to each item in arr
, in parallel.
The iterator
is called with an item from the list, and a callback for when it
has finished. If the iterator
passes an error to its callback
, the main
callback
(for the each
function) is immediately called with the error.
Note, that since this function applies iterator
to each item in parallel,
there is no guarantee that the iterator functions will complete in order.
Arguments
arr
- An array to iterate over.iterator(item, callback)
- A function to apply to each item in arr
.
The iterator is passed a callback(err)
which must be called once it has
completed. If no error has occurred, the callback
should be run without
arguments or with an explicit null
argument. The array index is not passed
to the iterator. If you need the index, use forEachOf
.callback(err)
- Optional A callback which is called when all iterator
functions
have finished, or an error occurs.Examples
// assuming openFiles is an array of file names and saveFile is a function
// to save the modified contents of that file:
async.each(openFiles, saveFile, function(err){
// if any of the saves produced an error, err would equal that error
});
// assuming openFiles is an array of file names
async.each(openFiles, function(file, callback) {
// Perform operation on file here.
console.log('Processing file ' + file);
if( file.length > 32 ) {
console.log('This file name is too long');
callback('File name too long');
} else {
// Do work to process file here
console.log('File processed');
callback();
}
}, function(err){
// if any of the file processing produced an error, err would equal that error
if( err ) {
// One of the iterations produced an error.
// All processing will now stop.
console.log('A file failed to process');
} else {
console.log('All files have been processed successfully');
}
});
Related
Like each
, except that it iterates over objects, and passes the key as the second argument to the iterator.
Arguments
obj
- An object or array to iterate over.iterator(item, key, callback)
- A function to apply to each item in obj
.
The key
is the item's key, or index in the case of an array. The iterator is
passed a callback(err)
which must be called once it has completed. If no
error has occurred, the callback should be run without arguments or with an
explicit null
argument.callback(err)
- Optional A callback which is called when all iterator
functions have finished, or an error occurs.Example
var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"};
var configs = {};
async.forEachOf(obj, function (value, key, callback) {
fs.readFile(__dirname + value, "utf8", function (err, data) {
if (err) return callback(err);
try {
configs[key] = JSON.parse(data);
} catch (e) {
return callback(e);
}
callback();
})
}, function (err) {
if (err) console.error(err.message);
// configs is now a map of JSON data
doSomethingWith(configs);
})
Related
Produces a new array of values by mapping each value in arr
through
the iterator
function. The iterator
is called with an item from arr
and a
callback for when it has finished processing. Each of these callback takes 2 arguments:
an error
, and the transformed item from arr
. If iterator
passes an error to its
callback, the main callback
(for the map
function) is immediately called with the error.
Note, that since this function applies the iterator
to each item in parallel,
there is no guarantee that the iterator
functions will complete in order.
However, the results array will be in the same order as the original arr
.
Arguments
arr
- An array to iterate over.iterator(item, callback)
- A function to apply to each item in arr
.
The iterator is passed a callback(err, transformed)
which must be called once
it has completed with an error (which can be null
) and a transformed item.callback(err, results)
- Optional A callback which is called when all iterator
functions have finished, or an error occurs. Results is an array of the
transformed items from the arr
.Example
async.map(['file1','file2','file3'], fs.stat, function(err, results){
// results is now an array of stats for each file
});
Related
Alias: select
Returns a new array of all the values in arr
which pass an async truth test.
The callback for each iterator
call only accepts a single argument of true
or
false
; it does not accept an error argument first! This is in-line with the
way node libraries work with truth tests like fs.exists
. This operation is
performed in parallel, but the results array will be in the same order as the
original.
Arguments
arr
- An array to iterate over.iterator(item, callback)
- A truth test to apply to each item in arr
.
The iterator
is passed a callback(truthValue)
, which must be called with a
boolean argument once it has completed.callback(results)
- Optional A callback which is called after all the iterator
functions have finished.Example
async.filter(['file1','file2','file3'], fs.exists, function(results){
// results now equals an array of the existing files
});
Related
The opposite of filter
. Removes values that pass an async
truth test.
Related
Aliases: inject
, foldl
Reduces arr
into a single value using an async iterator
to return
each successive step. memo
is the initial state of the reduction.
This function only operates in series.
For performance reasons, it may make sense to split a call to this function into
a parallel map, and then use the normal Array.prototype.reduce
on the results.
This function is for situations where each step in the reduction needs to be async;
if you can get the data before reducing it, then it's probably a good idea to do so.
Arguments
arr
- An array to iterate over.memo
- The initial state of the reduction.iterator(memo, item, callback)
- A function applied to each item in the
array to produce the next step in the reduction. The iterator
is passed a
callback(err, reduction)
which accepts an optional error as its first
argument, and the state of the reduction as the second. If an error is
passed to the callback, the reduction is stopped and the main callback
is
immediately called with the error.callback(err, result)
- Optional A callback which is called after all the iterator
functions have finished. Result is the reduced value.Example
async.reduce([1,2,3], 0, function(memo, item, callback){
// pointless async:
process.nextTick(function(){
callback(null, memo + item)
});
}, function(err, result){
// result is now equal to the last value of memo, which is 6
});
Alias: foldr
Same as reduce
, only operates on arr
in reverse order.
Returns the first value in arr
that passes an async truth test. The
iterator
is applied in parallel, meaning the first iterator to return true
will
fire the detect callback
with that result. That means the result might not be
the first item in the original arr
(in terms of order) that passes the test.
If order within the original arr
is important, then look at detectSeries
.
Arguments
arr
- An array to iterate over.iterator(item, callback)
- A truth test to apply to each item in arr
.
The iterator is passed a callback(truthValue)
which must be called with a
boolean argument once it has completed. Note: this callback does not take an error as its first argument.callback(result)
- Optional A callback which is called as soon as any iterator returns
true
, or after all the iterator
functions have finished. Result will be
the first item in the array that passes the truth test (iterator) or the
value undefined
if none passed. Note: this callback does not take an error as its first argument.Example
async.detect(['file1','file2','file3'], fs.exists, function(result){
// result now equals the first file in the list that exists
});
Related
Sorts a list by the results of running each arr
value through an async iterator
.
Arguments
arr
- An array to iterate over.iterator(item, callback)
- A function to apply to each item in arr
.
The iterator is passed a callback(err, sortValue)
which must be called once it
has completed with an error (which can be null
) and a value to use as the sort
criteria.callback(err, results)
- Optional A callback which is called after all the iterator
functions have finished, or an error occurs. Results is the items from
the original arr
sorted by the values returned by the iterator
calls.Example
async.sortBy(['file1','file2','file3'], function(file, callback){
fs.stat(file, function(err, stats){
callback(err, stats.mtime);
});
}, function(err, results){
// results is now the original array of files sorted by
// modified date
});
Sort Order
By modifying the callback parameter the sorting order can be influenced:
//ascending order
async.sortBy([1,9,3,5], function(x, callback){
callback(null, x);
}, function(err,result){
//result callback
} );
//descending order
async.sortBy([1,9,3,5], function(x, callback){
callback(null, x*-1); //<- x*-1 instead of x, turns the order around
}, function(err,result){
//result callback
} );
Alias: any
Returns true
if at least one element in the arr
satisfies an async test.
The callback for each iterator call only accepts a single argument of true
or
false
; it does not accept an error argument first! This is in-line with the
way node libraries work with truth tests like fs.exists
. Once any iterator
call returns true
, the main callback
is immediately called.
Arguments
arr
- An array to iterate over.iterator(item, callback)
- A truth test to apply to each item in the array
in parallel. The iterator is passed a `callback(truthValue)`` which must be
called with a boolean argument once it has completed.callback(result)
- Optional A callback which is called as soon as any iterator returns
true
, or after all the iterator functions have finished. Result will be
either true
or false
depending on the values of the async tests.
Note: the callbacks do not take an error as their first argument. Example
async.some(['file1','file2','file3'], fs.exists, function(result){
// if result is true then at least one of the files exists
});
Related
Alias: all
Returns true
if every element in arr
satisfies an async test.
The callback for each iterator
call only accepts a single argument of true
or
false
; it does not accept an error argument first! This is in-line with the
way node libraries work with truth tests like fs.exists
.
Arguments
arr
- An array to iterate over.iterator(item, callback)
- A truth test to apply to each item in the array
in parallel. The iterator is passed a callback(truthValue)
which must be
called with a boolean argument once it has completed.callback(result)
- Optional A callback which is called as soon as any iterator returns
false
, or after all the iterator functions have finished. Result will be
either true
or false
depending on the values of the async tests.
Note: the callbacks do not take an error as their first argument.
Example
async.every(['file1','file2','file3'], fs.exists, function(result){
// if result is true then every file exists
});
Related
Applies iterator
to each item in arr
, concatenating the results. Returns the
concatenated list. The iterator
s are called in parallel, and the results are
concatenated as they return. There is no guarantee that the results array will
be returned in the original order of arr
passed to the iterator
function.
Arguments
arr
- An array to iterate over.iterator(item, callback)
- A function to apply to each item in arr
.
The iterator is passed a callback(err, results)
which must be called once it
has completed with an error (which can be null
) and an array of results.callback(err, results)
- Optional A callback which is called after all the iterator
functions have finished, or an error occurs. Results is an array containing
the concatenated results of the iterator
function.Example
async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){
// files is now a list of filenames that exist in the 3 directories
});
Related
Run the functions in the tasks
array in series, each one running once the previous
function has completed. If any functions in the series pass an error to its
callback, no more functions are run, and callback
is immediately called with the value of the error.
Otherwise, callback
receives an array of results when tasks
have completed.
It is also possible to use an object instead of an array. Each property will be
run as a function, and the results will be passed to the final callback
as an object
instead of an array. This can be a more readable way of handling results from
series
.
Note that while many implementations preserve the order of object properties, the ECMAScript Language Specification explicitly states that
The mechanics and order of enumerating the properties is not specified.
So if you rely on the order in which your series of functions are executed, and want this to work on all platforms, consider using an array.
Arguments
tasks
- An array or object containing functions to run, each function is passed
a callback(err, result)
it must call on completion with an error err
(which can
be null
) and an optional result
value.callback(err, results)
- An optional callback to run once all the functions
have completed. This function gets a results array (or object) containing all
the result arguments passed to the task
callbacks.Example
async.series([
function(callback){
// do some stuff ...
callback(null, 'one');
},
function(callback){
// do some more stuff ...
callback(null, 'two');
}
],
// optional callback
function(err, results){
// results is now equal to ['one', 'two']
});
// an example using an object instead of an array
async.series({
one: function(callback){
setTimeout(function(){
callback(null, 1);
}, 200);
},
two: function(callback){
setTimeout(function(){
callback(null, 2);
}, 100);
}
},
function(err, results) {
// results is now equal to: {one: 1, two: 2}
});
Run the tasks
array of functions in parallel, without waiting until the previous
function has completed. If any of the functions pass an error to its
callback, the main callback
is immediately called with the value of the error.
Once the tasks
have completed, the results are passed to the final callback
as an
array.
Note: parallel
is about kicking-off I/O tasks in parallel, not about parallel execution of code. If your tasks do not use any timers or perform any I/O, they will actually be executed in series. Any synchronous setup sections for each task will happen one after the other. JavaScript remains single-threaded.
It is also possible to use an object instead of an array. Each property will be
run as a function and the results will be passed to the final callback
as an object
instead of an array. This can be a more readable way of handling results from
parallel
.
Arguments
tasks
- An array or object containing functions to run. Each function is passed
a callback(err, result)
which it must call on completion with an error err
(which can be null
) and an optional result
value.callback(err, results)
- An optional callback to run once all the functions
have completed successfully. This function gets a results array (or object) containing all
the result arguments passed to the task callbacks.Example
async.parallel([
function(callback){
setTimeout(function(){
callback(null, 'one');
}, 200);
},
function(callback){
setTimeout(function(){
callback(null, 'two');
}, 100);
}
],
// optional callback
function(err, results){
// the results array will equal ['one','two'] even though
// the second function had a shorter timeout.
});
// an example using an object instead of an array
async.parallel({
one: function(callback){
setTimeout(function(){
callback(null, 1);
}, 200);
},
two: function(callback){
setTimeout(function(){
callback(null, 2);
}, 100);
}
},
function(err, results) {
// results is now equals to: {one: 1, two: 2}
});
Related
Repeatedly call fn
, while test
returns true
. Calls callback
when stopped,
or an error occurs.
Arguments
test()
- synchronous truth test to perform before each execution of fn
.fn(callback)
- A function which is called each time test
passes. The function is
passed a callback(err)
, which must be called once it has completed with an
optional err
argument.callback(err, [results])
- A callback which is called after the test
function has failed and repeated execution of fn
has stopped. callback
will be passed an error and any arguments passed to the final fn
's callback.Example
var count = 0;
async.whilst(
function () { return count < 5; },
function (callback) {
count++;
setTimeout(function () {
callback(null, count);
}, 1000);
},
function (err, n) {
// 5 seconds have passed, n = 5
}
);
The post-check version of whilst
. To reflect the difference in
the order of operations, the arguments test
and fn
are switched.
doWhilst
is to whilst
as do while
is to while
in plain JavaScript.
Repeatedly call fn
until test
returns true
. Calls callback
when stopped,
or an error occurs. callback
will be passed an error and any arguments passed
to the final fn
's callback.
The inverse of whilst
.
Like doWhilst
, except the test
is inverted. Note the argument ordering differs from until
.
Like whilst
, except the test
is an asynchronous function that is passed a callback in the form of function (err, truth)
. If error is passed to test
or fn
, the main callback is immediately called with the value of the error.
Example
var count = 0;
async.during(
function (callback) {
return callback(null, count < 5);
},
function (callback) {
count++;
setTimeout(callback, 1000);
},
function (err) {
// 5 seconds have passed
}
);
The post-check version of during
. To reflect the difference in
the order of operations, the arguments test
and fn
are switched.
Also a version of doWhilst
with asynchronous test
function.
Calls the asynchronous function fn
with a callback parameter that allows it to
call itself again, in series, indefinitely.
If an error is passed to the callback then errback
is called with the
error, and execution stops, otherwise it will never be called.
async.forever(
function(next) {
// next is suitable for passing to things that need a callback(err [, whatever]);
// it will result in this function being called again.
},
function(err) {
// if next is called with a value in its first parameter, it will appear
// in here as 'err', and execution will stop.
}
);
Runs the tasks
array of functions in series, each passing their results to the next in
the array. However, if any of the tasks
pass an error to their own callback, the
next function is not executed, and the main callback
is immediately called with
the error.
Arguments
tasks
- An array of functions to run, each function is passed a
callback(err, result1, result2, ...)
it must call on completion. The first
argument is an error (which can be null
) and any further arguments will be
passed as arguments in order to the next task.callback(err, [results])
- An optional callback to run once all the functions
have completed. This will be passed the results of the last task's callback.Example
async.waterfall([
function(callback) {
callback(null, 'one', 'two');
},
function(arg1, arg2, callback) {
// arg1 now equals 'one' and arg2 now equals 'two'
callback(null, 'three');
},
function(arg1, callback) {
// arg1 now equals 'three'
callback(null, 'done');
}
], function (err, result) {
// result now equals 'done'
});
Or, with named functions:
async.waterfall([
myFirstFunction,
mySecondFunction,
myLastFunction,
], function (err, result) {
// result now equals 'done'
});
function myFirstFunction(callback) {
callback(null, 'one', 'two');
}
function mySecondFunction(arg1, arg2, callback) {
// arg1 now equals 'one' and arg2 now equals 'two'
callback(null, 'three');
}
function myLastFunction(arg1, callback) {
// arg1 now equals 'three'
callback(null, 'done');
}
Or, if you need to pass any argument to the first function:
async.waterfall([
async.apply(myFirstFunction, 'zero'),
mySecondFunction,
myLastFunction,
], function (err, result) {
// result now equals 'done'
});
function myFirstFunction(arg1, callback) {
// arg1 now equals 'zero'
callback(null, 'one', 'two');
}
function mySecondFunction(arg1, arg2, callback) {
// arg1 now equals 'one' and arg2 now equals 'two'
callback(null, 'three');
}
function myLastFunction(arg1, callback) {
// arg1 now equals 'three'
callback(null, 'done');
}
Creates a function which is a composition of the passed asynchronous
functions. Each function consumes the return value of the function that
follows. Composing functions f()
, g()
, and h()
would produce the result of
f(g(h()))
, only this version uses callbacks to obtain the return values.
Each function is executed with the this
binding of the composed function.
Arguments
functions...
- the asynchronous functions to composeExample
function add1(n, callback) {
setTimeout(function () {
callback(null, n + 1);
}, 10);
}
function mul3(n, callback) {
setTimeout(function () {
callback(null, n * 3);
}, 10);
}
var add1mul3 = async.compose(mul3, add1);
add1mul3(4, function (err, result) {
// result now equals 15
});
Version of the compose function that is more natural to read.
Each function consumes the return value of the previous function.
It is the equivalent of compose
with the arguments reversed.
Each function is executed with the this
binding of the composed function.
Arguments
functions...
- the asynchronous functions to composeExample
// Requires lodash (or underscore), express3 and dresende's orm2.
// Part of an app, that fetches cats of the logged user.
// This example uses `seq` function to avoid overnesting and error
// handling clutter.
app.get('/cats', function(request, response) {
var User = request.models.User;
async.seq(
_.bind(User.get, User), // 'User.get' has signature (id, callback(err, data))
function(user, fn) {
user.getCats(fn); // 'getCats' has signature (callback(err, data))
}
)(req.session.user_id, function (err, cats) {
if (err) {
console.error(err);
response.json({ status: 'error', message: err.message });
} else {
response.json({ status: 'ok', message: 'Cats found', data: cats });
}
});
});
Applies the provided arguments to each function in the array, calling
callback
after all functions have completed. If you only provide the first
argument, then it will return a function which lets you pass in the
arguments as if it were a single function call.
Arguments
fns
- the asynchronous functions to all call with the same argumentsargs...
- any number of separate arguments to pass to the functioncallback
- the final argument should be the callback, called when all
functions have completed processingExample
async.applyEach([enableSearch, updateSchema], 'bucket', callback);
// partial application example:
async.each(
buckets,
async.applyEach([enableSearch, updateSchema]),
callback
);
Related
Creates a queue
object with the specified concurrency
. Tasks added to the
queue
are processed in parallel (up to the concurrency
limit). If all
worker
s are in progress, the task is queued until one becomes available.
Once a worker
completes a task
, that task
's callback is called.
Arguments
worker(task, callback)
- An asynchronous function for processing a queued
task, which must call its callback(err)
argument when finished, with an
optional error
as an argument. If you want to handle errors from an individual task, pass a callback to q.push()
.concurrency
- An integer
for determining how many worker
functions should be
run in parallel. If omitted, the concurrency defaults to 1
. If the concurrency is 0
, an error is thrown.Queue objects
The queue
object returned by this function has the following properties and
methods:
length()
- a function returning the number of items waiting to be processed.started
- a function returning whether or not any items have been pushed and processed by the queuerunning()
- a function returning the number of items currently being processed.workersList()
- a function returning the array of items currently being processed.idle()
- a function returning false if there are items waiting or being processed, or true if not.concurrency
- an integer for determining how many worker
functions should be
run in parallel. This property can be changed after a queue
is created to
alter the concurrency on-the-fly.push(task, [callback])
- add a new task to the queue
. Calls callback
once
the worker
has finished processing the task. Instead of a single task, a tasks
array
can be submitted. The respective callback is used for every task in the list.unshift(task, [callback])
- add a new task to the front of the queue
.saturated
- a callback that is called when the queue
length hits the concurrency
limit,
and further tasks will be queued.empty
- a callback that is called when the last item from the queue
is given to a worker
.drain
- a callback that is called when the last item from the queue
has returned from the worker
.paused
- a boolean for determining whether the queue is in a paused statepause()
- a function that pauses the processing of tasks until resume()
is called.resume()
- a function that resumes the processing of queued tasks when the queue is paused.kill()
- a function that removes the drain
callback and empties remaining tasks from the queue forcing it to go idle.Example
// create a queue object with concurrency 2
var q = async.queue(function (task, callback) {
console.log('hello ' + task.name);
callback();
}, 2);
// assign a callback
q.drain = function() {
console.log('all items have been processed');
}
// add some items to the queue
q.push({name: 'foo'}, function (err) {
console.log('finished processing foo');
});
q.push({name: 'bar'}, function (err) {
console.log('finished processing bar');
});
// add some items to the queue (batch-wise)
q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {
console.log('finished processing item');
});
// add some items to the front of the queue
q.unshift({name: 'bar'}, function (err) {
console.log('finished processing bar');
});
The same as queue
only tasks are assigned a priority and completed in ascending priority order. There are two differences between queue
and priorityQueue
objects:
push(task, priority, [callback])
- priority
should be a number. If an array of
tasks
is given, all tasks will be assigned the same priority.unshift
method was removed.Creates a cargo
object with the specified payload. Tasks added to the
cargo will be processed altogether (up to the payload
limit). If the
worker
is in progress, the task is queued until it becomes available. Once
the worker
has completed some tasks, each callback of those tasks is called.
Check out these animations for how cargo
and queue
work.
While queue passes only one task to one of a group of workers at a time, cargo passes an array of tasks to a single worker, repeating when the worker is finished.
Arguments
worker(tasks, callback)
- An asynchronous function for processing an array of
queued tasks, which must call its callback(err)
argument when finished, with
an optional err
argument.payload
- An optional integer
for determining how many tasks should be
processed per round; if omitted, the default is unlimited.Cargo objects
The cargo
object returned by this function has the following properties and
methods:
length()
- A function returning the number of items waiting to be processed.payload
- An integer
for determining how many tasks should be
process per round. This property can be changed after a cargo
is created to
alter the payload on-the-fly.push(task, [callback])
- Adds task
to the queue
. The callback is called
once the worker
has finished processing the task. Instead of a single task, an array of tasks
can be submitted. The respective callback is used for every task in the list.saturated
- A callback that is called when the queue.length()
hits the concurrency and further tasks will be queued.empty
- A callback that is called when the last item from the queue
is given to a worker
.drain
- A callback that is called when the last item from the queue
has returned from the worker
.idle()
, pause()
, resume()
, kill()
- cargo inherits all of the same methods and event calbacks as queue
Example
// create a cargo object with payload 2
var cargo = async.cargo(function (tasks, callback) {
for(var i=0; i<tasks.length; i++){
console.log('hello ' + tasks[i].name);
}
callback();
}, 2);
// add some items
cargo.push({name: 'foo'}, function (err) {
console.log('finished processing foo');
});
cargo.push({name: 'bar'}, function (err) {
console.log('finished processing bar');
});
cargo.push({name: 'baz'}, function (err) {
console.log('finished processing baz');
});
Determines the best order for running the functions in tasks
, based on their requirements. Each function can optionally depend on other functions being completed first, and each function is run as soon as its requirements are satisfied.
If any of the functions pass an error to their callback, the auto
sequence will stop. Further tasks will not execute (so any other functions depending on it will not run), and the main callback
is immediately called with the error. Functions also receive an object containing the results of functions which have completed so far.
Note, all functions are called with a results
object as a second argument,
so it is unsafe to pass functions in the tasks
object which cannot handle the
extra argument.
For example, this snippet of code:
async.auto({
readData: async.apply(fs.readFile, 'data.txt', 'utf-8')
}, callback);
will have the effect of calling readFile
with the results object as the last
argument, which will fail:
fs.readFile('data.txt', 'utf-8', cb, {});
Instead, wrap the call to readFile
in a function which does not forward the
results
object:
async.auto({
readData: function(cb, results){
fs.readFile('data.txt', 'utf-8', cb);
}
}, callback);
Arguments
tasks
- An object. Each of its properties is either a function or an array of
requirements, with the function itself the last item in the array. The object's key
of a property serves as the name of the task defined by that property,
i.e. can be used when specifying requirements for other tasks.
The function receives two arguments: (1) a callback(err, result)
which must be
called when finished, passing an error
(which can be null
) and the result of
the function's execution, and (2) a results
object, containing the results of
the previously executed functions.concurrency
- An optional integer
for determining the maximum number of tasks that can be run in parallel. By default, as many as possible.callback(err, results)
- An optional callback which is called when all the
tasks have been completed. It receives the err
argument if any tasks
pass an error to their callback. Results are always returned; however, if
an error occurs, no further tasks
will be performed, and the results
object will only contain partial results.Example
async.auto({
get_data: function(callback){
console.log('in get_data');
// async code to get some data
callback(null, 'data', 'converted to array');
},
make_folder: function(callback){
console.log('in make_folder');
// async code to create a directory to store a file in
// this is run at the same time as getting the data
callback(null, 'folder');
},
write_file: ['get_data', 'make_folder', function(callback, results){
console.log('in write_file', JSON.stringify(results));
// once there is some data and the directory exists,
// write the data to a file in the directory
callback(null, 'filename');
}],
email_link: ['write_file', function(callback, results){
console.log('in email_link', JSON.stringify(results));
// once the file is written let's email a link to it...
// results.write_file contains the filename returned by write_file.
callback(null, {'file':results.write_file, 'email':'user@example.com'});
}]
}, function(err, results) {
console.log('err = ', err);
console.log('results = ', results);
});
This is a fairly trivial example, but to do this using the basic parallel and series functions would look like this:
async.parallel([
function(callback){
console.log('in get_data');
// async code to get some data
callback(null, 'data', 'converted to array');
},
function(callback){
console.log('in make_folder');
// async code to create a directory to store a file in
// this is run at the same time as getting the data
callback(null, 'folder');
}
],
function(err, results){
async.series([
function(callback){
console.log('in write_file', JSON.stringify(results));
// once there is some data and the directory exists,
// write the data to a file in the directory
results.push('filename');
callback(null);
},
function(callback){
console.log('in email_link', JSON.stringify(results));
// once the file is written let's email a link to it...
callback(null, {'file':results.pop(), 'email':'user@example.com'});
}
]);
});
For a complicated series of async
tasks, using the auto
function makes adding
new tasks much easier (and the code more readable).
Attempts to get a successful response from task
no more than times
times before
returning an error. If the task is successful, the callback
will be passed the result
of the successful task. If all attempts fail, the callback will be passed the error and
result (if any) of the final attempt.
Arguments
opts
- Can be either an object with times
and interval
or a number.times
- The number of attempts to make before giving up. The default is 5
.interval
- The time to wait between retries, in milliseconds. The default is 0
.opts
is a number, the number specifies the number of times to retry, with the default interval of 0
. task(callback, results)
- A function which receives two arguments: (1) a callback(err, result)
which must be called when finished, passing err
(which can be null
) and the result
of
the function's execution, and (2) a results
object, containing the results of
the previously executed functions (if nested inside another control flow).callback(err, results)
- An optional callback which is called when the
task has succeeded, or after the final failed attempt. It receives the err
and result
arguments of the last attempt at completing the task
.The retry
function can be used as a stand-alone control flow by passing a callback, as shown below:
// try calling apiMethod 3 times
async.retry(3, apiMethod, function(err, result) {
// do something with the result
});
// try calling apiMethod 3 times, waiting 200 ms between each retry
async.retry({times: 3, interval: 200}, apiMethod, function(err, result) {
// do something with the result
});
// try calling apiMethod the default 5 times no delay between each retry
async.retry(apiMethod, function(err, result) {
// do something with the result
});
It can also be embedded within other control flow functions to retry individual methods that are not as reliable, like this:
async.auto({
users: api.getUsers.bind(api),
payments: async.retry(3, api.getPayments.bind(api))
}, function(err, results) {
// do something with the results
});
Creates an iterator function which calls the next function in the tasks
array,
returning a continuation to call the next one after that. It's also possible to
“peek” at the next iterator with iterator.next()
.
This function is used internally by the async
module, but can be useful when
you want to manually control the flow of functions in series.
Arguments
tasks
- An array of functions to run.Example
var iterator = async.iterator([
function(){ sys.p('one'); },
function(){ sys.p('two'); },
function(){ sys.p('three'); }
]);
node> var iterator2 = iterator();
'one'
node> var iterator3 = iterator2();
'two'
node> iterator3();
'three'
node> var nextfn = iterator2.next();
node> nextfn();
'three'
Creates a continuation function with some arguments already applied.
Useful as a shorthand when combined with other control flow functions. Any arguments passed to the returned function are added to the arguments originally passed to apply.
Arguments
function
- The function you want to eventually apply all arguments to.arguments...
- Any number of arguments to automatically apply when the
continuation is called.Example
// using apply
async.parallel([
async.apply(fs.writeFile, 'testfile1', 'test1'),
async.apply(fs.writeFile, 'testfile2', 'test2'),
]);
// the same process without using apply
async.parallel([
function(callback){
fs.writeFile('testfile1', 'test1', callback);
},
function(callback){
fs.writeFile('testfile2', 'test2', callback);
}
]);
It's possible to pass any number of additional arguments when calling the continuation:
node> var fn = async.apply(sys.puts, 'one');
node> fn('two', 'three');
one
two
three
Calls callback
on a later loop around the event loop. In Node.js this just
calls process.nextTick
; in the browser it falls back to setImmediate(callback)
if available, otherwise setTimeout(callback, 0)
, which means other higher priority
events may precede the execution of callback
.
This is used internally for browser-compatibility purposes.
Arguments
callback
- The function to call on a later loop around the event loop.Example
var call_order = [];
async.nextTick(function(){
call_order.push('two');
// call_order now equals ['one','two']
});
call_order.push('one')
Calls the iterator
function n
times, and accumulates results in the same manner
you would use with map
.
Arguments
n
- The number of times to run the function.iterator
- The function to call n
times.callback
- see map
Example
// Pretend this is some complicated async factory
var createUser = function(id, callback) {
callback(null, {
id: 'user' + id
})
}
// generate 5 users
async.times(5, function(n, next){
createUser(n, function(err, user) {
next(err, user)
})
}, function(err, users) {
// we should now have 5 users
});
Related
Caches the results of an async
function. When creating a hash to store function
results against, the callback is omitted from the hash and an optional hash
function can be used.
If no hash function is specified, the first argument is used as a hash key, which may work reasonably if it is a string or a data type that converts to a distinct string. Note that objects and arrays will not behave reasonably. Neither will cases where the other arguments are significant. In such cases, specify your own hash function.
The cache of results is exposed as the memo
property of the function returned
by memoize
.
Arguments
fn
- The function to proxy and cache results from.hasher
- An optional function for generating a custom hash for storing
results. It has all the arguments applied to it apart from the callback, and
must be synchronous.Example
var slow_fn = function (name, callback) {
// do something
callback(null, result);
};
var fn = async.memoize(slow_fn);
// fn can now be used as if it were slow_fn
fn('some name', function () {
// callback
});
Undoes a memoize
d function, reverting it to the original, unmemoized
form. Handy for testing.
Arguments
fn
- the memoized functionWrap an async function and ensure it calls its callback on a later tick of the event loop. If the function already calls its callback on a next tick, no extra deferral is added. This is useful for preventing stack overflows (RangeError: Maximum call stack size exceeded
) and generally keeping Zalgo contained.
Arguments
fn
- an async function, one that expects a node-style callback as its last argumentReturns a wrapped function with the exact same call signature as the function passed in.
Example
function sometimesAsync(arg, callback) {
if (cache[arg]) {
return callback(null, cache[arg]); // this would be synchronous!!
} else {
doSomeIO(arg, callback); // this IO would be asynchronous
}
}
// this has a risk of stack overflows if many results are cached in a row
async.mapSeries(args, sometimesAsync, done);
// this will defer sometimesAsync's callback if necessary,
// preventing stack overflows
async.mapSeries(args, async.ensureAsync(sometimesAsync), done);
Returns a function that when called, calls-back with the values provided. Useful as the first function in a waterfall
, or for plugging values in to auto
.
Example
async.waterfall([
async.constant(42),
function (value, next) {
// value === 42
},
//...
], callback);
async.waterfall([
async.constant(filename, "utf8"),
fs.readFile,
function (fileData, next) {
//...
}
//...
], callback);
async.auto({
hostname: async.constant("https://server.net/"),
port: findFreePort,
launchServer: ["hostname", "port", function (cb, options) {
startServer(options, cb);
}],
//...
}, callback);
Alias: wrapSync
Take a sync function and make it async, passing its return value to a callback. This is useful for plugging sync functions into a waterfall, series, or other async functions. Any arguments passed to the generated function will be passed to the wrapped function (except for the final callback argument). Errors thrown will be passed to the callback.
Example
async.waterfall([
async.apply(fs.readFile, filename, "utf8"),
async.asyncify(JSON.parse),
function (data, next) {
// data is the result of parsing the text.
// If there was a parsing error, it would have been caught.
}
], callback)
If the function passed to asyncify
returns a Promise, that promises's resolved/rejected state will be used to call the callback, rather than simply the synchronous return value. Example:
async.waterfall([
async.apply(fs.readFile, filename, "utf8"),
async.asyncify(function (contents) {
return db.model.create(contents);
}),
function (model, next) {
// `model` is the instantiated model object.
// If there was an error, this function would be skipped.
}
], callback)
This also means you can asyncify ES2016 async
functions.
var q = async.queue(async.asyncify(async function (file) {
var intermediateStep = await processFile(file);
return await somePromise(intermediateStep)
}));
q.push(files);
Logs the result of an async
function to the console
. Only works in Node.js or
in browsers that support console.log
and console.error
(such as FF and Chrome).
If multiple arguments are returned from the async function, console.log
is
called on each argument in order.
Arguments
function
- The function you want to eventually apply all arguments to.arguments...
- Any number of arguments to apply to the function.Example
var hello = function(name, callback){
setTimeout(function(){
callback(null, 'hello ' + name);
}, 1000);
};
node> async.log(hello, 'world');
'hello world'
Logs the result of an async
function to the console
using console.dir
to
display the properties of the resulting object. Only works in Node.js or
in browsers that support console.dir
and console.error
(such as FF and Chrome).
If multiple arguments are returned from the async function, console.dir
is
called on each argument in order.
Arguments
function
- The function you want to eventually apply all arguments to.arguments...
- Any number of arguments to apply to the function.Example
var hello = function(name, callback){
setTimeout(function(){
callback(null, {hello: name});
}, 1000);
};
node> async.dir(hello, 'world');
{hello: 'world'}
Changes the value of async
back to its original value, returning a reference to the
async
object.


Demo is available at: http://www.textangular.com (Or editable Plunkr Demo)
To upgrade from version 1.2.2 or earlier you need to follow these steps:
src/textAngular.css
file, you will need to include this or a copy of it with your own modifications.rangy-core
and rangy-saveselection
modules, alternatively you can include the compressed version (textAngular-rangy.min.js
) in the dist folderAngularJS
≥ 1.2.x
Rangy
≥ 1.2.x
, Both rangy-core and rangy-saveselection are required. (There is a minified combination of these two included in the dist folder)Font-Awesome
≥ 4.x
for the default icons on the toolbarBootstrap
≥ 3.x
for the default styles (Can use bootstrap-css-only
as in bower requirements)NOTE: Our textAngular-sanitize.js
and angular.js’s angular-sanitize.js
are the SAME file, you must include one or the other but not both. We highly recommend using textAngular-sanitize.js
as it loosens some parts of the sanitizer that are far too strict for our uses and adds some more features we need.
Via Bower:
Run bower install textAngular
from the command line.
Include script tags similar to the following:
html
<link rel='stylesheet' href='/bower_components/textAngular/src/textAngular.css'>

Via NPM:
Run npm install textangular
from the command line.
Include script tags similar to the following:
html
<link rel='stylesheet' href='/node_modules/textangular/src/textAngular.css'>

Via CDNJS:
Include script tags similar to the following:
html

Via jsDelivr:
Include script tag similar to the following: (For details on how this works see: https://github.com/jsdelivr/jsdelivr#load-multiple-files-with-single-http-request)
html

Via Github
Download the code from https://github.com/fraywing/textAngular/releases/latest, unzip the files then add script tags similar to the following:
html
<link rel='stylesheet' href='/path/to/unzipped/files/src/textAngular.min.css'>

rangy-core.js
and rangy-saveselection.js
) or textAngular-rangy.min.js
in your project using script tagstextAngular-sanitize.js
or textAngular-sanitize.min.js
in your project using script tagstextAngularSetup.js
and textAngular.js
) or textAngular.min.js
(textAngularSetup.js is included inside textAngular.min.js)textAngular
in your app module, for example: angular.module('myModule', ['textAngular'])
.ng-model="htmlVariable"
attribute where htmlVariable
is the scope variable that will hold the HTML entered into the editor:
html

OR
html
<text-angular ng-model="htmlVariable"></text-angular>
This acts similar to a regular AngularJS / form input if you give it a name attribute, allowing for form submission and AngularJS form validation.Have fun!
Important Note: Though textAngular supports the use of all attributes in it’s input, please note that angulars ng-bind-html WILL strip out all of your style attributes if you are using angular-sanitize.js
.
For Additional options see the github Wiki.
textAngular uses execCommand
for the rich-text functionality.
That being said, its still a fairly experimental browser feature-set, and may not behave the same in all browsers - see http://tifftiff.de/contenteditable/compliance_test.html for a full compliance list.
It has been tested to work on Chrome, Safari, Opera, Firefox and Internet Explorer 8+.
If you find something, please let me know - throw me a message, or submit a issue request!

tag and aren’t showing the video.

. This invokes our custom renderers to convert the
tags back into the youtube video you expect.
tagsdocument.execCommand("AutoUrlDetect", false, false)
. See #475 for details."textAngular Error: An editor with the name already exists"
occursWhen checking out, you need a node.js installation, running npm install
and then bower install
will get you setup with everything to run the unit tests and minification.
All changes should be done in the lib folder, running grunt compile
to compile the app or use grunt watch
to compile the files as you save them.
When you are ready to create A PR check that grunt
passes without errors and you have created tests for your feature if necessary.
This project is licensed under the MIT license.
Special thanks to all the contributions thus far!
For a full list see: https://github.com/fraywing/textAngular/graphs/contributors


Movimiento para transformar desde la sociedad civil el sistema político. El poder de las decisiones y el dinero en manos de los ciudadanos, no de los políticos.
splitfunds branch and a couple manual sendtoaddress calls
I did the manuals just to ensure consolidation of the 0 value block finds
but couple floating point errors stilll
Yes, CFEK did have some issues, but I sent most of it out and fixed itself
ComputerGenie 👴👴👴22-Dec-18 02:50 PM
$(echo "scale=8; (math_here)" | bc) ?
ComputerGenie 👴👴👴22-Dec-18 03:03 PM
if [[ "$Amount" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then
Amount=$(echo "scale=8; ($Amount)" | bc)
else
Amount=$(printf "%.14f" $Amount)
Amount=$(echo "scale=8; ($Amount)" | bc)
fi
that's what my consolidator uses (keeps to 8 decimal places and fixes any sci notation)(edited)
zatJUM22-Dec-18 04:07 PM
@webworker01 Did you set LC_NUMERIC="en_US.UTF-8"?
[KMD] Splitting 26 extra UTXOs
./splitfunds.sh: line 112: printf: 349818471.99999999997: invalid number
zatJUM22-Dec-18 04:41 PM
Are you sure it's a floating point error?
Error message is the same I had here with ./stats
(decimal separator)
ComputerGenie 👴👴👴22-Dec-18 06:27 PM
349818471.99999999997 is supposed to be 349818472
why make it either, why not use the actual numbers (since nothing in crypto is .99999999997 anyway)?
1
smk762 - dracocanis ominator23-Dec-18 01:02 AM
another day, another server... managed to get a mailserver setup yesterday, then make it not appear spammy, then allow another server ip to send through it and also not look spammy. a litle more of a challenge than I thought, but seems to be delivering now.
2
ComputerGenie 👴👴👴23-Dec-18 08:26 AM
oc=$((SPLIT_COUNT))
for ((i = 1; i <= $oc ; i++)); do
if [[ $i == $oc ]]; then
PerAmount=$(printf "%0.8f\n" $(bc -l <<<"($amount / $oc) + ($amount % $oc)"))
else
PerAmount=$(printf "%0.8f\n" $(bc -l <<<"($amount / $oc)"))
fi
value=$(printf "%016x" ${PerAmount//.} | dd conv=swab 2>/dev/null | rev)
Probably wrong code (since you hardcoded len etc...), but similar seems like less work than "satoshi math" and "change"....
edit: not sure why there would even be a loop here anyway, rather than like outbits=$revValue"2321"$NN_PUBKEY"ac" outbits=$(eval printf "%0.s$outbits" {1..$oc})...(edited)
heh, guess it needs decimal put back in for the final echo
ComputerGenie 👴👴👴23-Dec-18 08:30 PM
doesn't it need the +1 for change ?
...
actually where is the change at all
Is there some reason for creating change?(edited)
It would seem to me that if you tell it to make 20 UTXOs you wouldn't expect it to create 21...
ComputerGenie 👴👴👴23-Dec-18 09:24 PM
So, you're saying that if a NN has 1 UTXO of 10 and they notarize, then the notarization takes the entire 10?

ComputerGenie 👴👴👴23-Dec-18 09:34 PM
if the utxo isn't 0.0001 then it won't be selected for notarization at all
logically, every UTXO should be valid and if it's more than the NN should get change in the tx that uses it
it's silly as fek to not notarize a chain because NNs don't micromanage every UTXO to exactly 0.0001
jl777c23-Dec-18 09:34 PM
and how exactly do all notaries figure out what all the other notaries will want the change? all notaries need 100% exact rawtx to sign
ok, you can design a more efficient notarizer network
in my judgement adding any more complexity to the already complex system would make it more error prone and unreliable
but thats me, if you are better at coding, then be my guest, nothing prevents notarization tx having change (and more expensive txfess)
it just seemed an order of magnitude simpler to not deal with change
1
since if the notary used exact utxo, there is no change, you dont know how much change there will be
ComputerGenie 👴👴👴23-Dec-18 09:37 PM
in my judgement adding any more complexity to the already complex system would make it more error prone and unreliable
3 scripts in 2 languages using 6 executables isn't exactly "non-complex"
jl777c23-Dec-18 09:37 PM
exactly my point
making it almost 10 times more complex to eliminate splitting funds, just not worth it. just my opinion and since i was the one that implemented, it is what was done
the bandwidth needed would grow a lot if the actual rawtx needs to be broadcast and also slower as we would need to iterate based on signers
you would need a totally separate change management and rawtx constructor, and networking packets to deal with an extra cycle
but having something that differentiates from active notaries vs inactive, simplifies it a lot
so i did
ComputerGenie 👴👴👴23-Dec-18 09:39 PM
and also slower as we would need to iterate based on signers
then I guess I need to stfu now, because that's how I thought it was already working (A does their bit sends to B who adds their bit and so on)
jl777c23-Dec-18 09:41 PM
it is done in parallel
ComputerGenie 👴👴👴23-Dec-18 09:41 PM
which is why I thought it was "stoopid" that if I'm adding my bit that I couldn't just add change bit as well
jl777c23-Dec-18 09:41 PM
and just the signatures are broadcast
ComputerGenie 👴👴👴23-Dec-18 09:41 PM
ahhhh k
jl777c23-Dec-18 09:42 PM
then the IDENTICAL rawtx is reconstructed from the various clues about what each node should be signing and the signatures extracted from the broadcast inserted into the rawtx
to make a valid signed tx (most of the time)
I estimate success rate if there was change as a possibility, would be down below 50%
ComputerGenie 👴👴👴23-Dec-18 09:43 PM
well, my being totally wrong about how it works, in the 1st place, explains why I was wrong about the rest
hangs head in shame
jl777c23-Dec-18 09:47 PM
well, assuming i would do something silly, is maybe a bit silly. but not understanding the details of notarization means you are not one of half a dozen people who actually do


You can use variables or references when defining the parameters. Below are some of the system level variable:
AllOutputBefore
: All output files before this step.
History:N-X
: Output file "X" in the n-th job.
InputFile
: The initial input files which maps to files you provide when you create a job.
InputFile:N
: The n-th file in input files.
Job
: Job ID.
JobName
: Job name.
LastOutput
: Output files of last step.
LastOutput:N
: The n-th output file of last step (in alphabetical order).
Output:N-M
: The output file M produced by the n-th step (in alphabetical order).
Suffix:X
: Output file(s) with a "X" suffix in last step.
Suffix:N-X
: Output file(s) with a "X" suffix in the n-th step.
Suffix:N-X-M
: The m-th output file with a "X" suffix in the n-th step.
ThreadN
: The number of CPUs in the running node.
UserBin
: Path where BioQueue will install software to for a specific user.
Workspace
: Local storage path for the job.
All variables should be surrounded by curly-braces, like {% verbatim %}{{ThreadN}}{% endverbatim %}
.


--- title: Functions in R author: Corey Pembleton date: '2019-03-31' slug: building-functions-in-r categories: ["R", "Tutorial"] tags: ["purrr"] thumbnailImagePosition: "left" thumbnailImage: "/img/purrr.png" output: blogdown::html_page: highlight: tango ---
This post covers the fundamental functions and approaches in Charlotte and Hadley Wickham’s Writing functions in R datacamp course.
The five course sections provide an introduction to writing and using functions in R, loosely summarized as:
The Hadley’s drill a point down: if you’ve copy and pasted something more than twice - it’s time to write a function!
Their recommennded process is this: create all of the parts inside the function outside of it first, than add it to the curly brackets (function(x){}
) in a way that makes sense according to the inputs.
All of these matter! Give a function a descriptive name, have name arguments (e.g. what goes into the function’s ()) in a way which makes sense, and ensure the argument order is logical. Argument order should be with data arguments first, and detail arguments second:
mean_ci <- function(x, level = 0.95) { #x = data, level = detail
se <- sd(x) / sqrt(length(x))
alpha <- 1 - level
mean(x) + se * qnorm(c(alpha / 2, 1 - alpha / 2))
}
Another best practice is adding return statements to functions to give messages such as warnings or errors to users of the function:
mean_ci <- function(x, level = 0.95) {
if (length(x) == 0) {
warning("`x` was empty", call. = FALSE)
return(c(-Inf, Inf))
} else {
se <- sd(x) / sqrt(length(x))
alpha <- 1 - level
mean(x) + se * qnorm(c(alpha / 2, 1 - alpha / 2))
}
seq_along()
warning()
qnorm()
return()
function()
Why learn to write functions programmatically? Because in many cases (and pretty much every case I’ve seen professionally) functions often need to be flexible enough to take multiple arguments to achieve a desired result, and often needs to perform multiple tasks sequentially to give a single desired output.
Functional programming is first introduced by showing how to create a function which takes another function as an argument. So instead of repeating the same process with a single-function usage:
col_median <- function(df) {
output <- numeric(length(df))
for (i in seq_along(df)) {
output[[i]] <- median(df[[i]])
}
output
}
#new function with only difference being median() is replaced with mean()
col_mean <- function(df) {
output <- numeric(length(df))
for (i in seq_along(df)) {
output[[i]] <- mean(df[[i]])
}
output
}
The col_summary()
function below can take a function as an argument instead - think sapply()
or lapply()
.
col_summary <- function(df, fun) { #fun can be median or mean
output <- numeric(ncol(df))
for (i in seq_along(df)) {
output[[i]] <- fun(df[[i]])
}
output
}
What’s a better step than writing a function which takes a function as an argument? The map_()
family of functions in the purrr package.
The map functions in purrr work by “first taking a vector, .x
, as the first argument, then return .f
applied to each element of .x
”. Map functions take additional arugments of .f
with ...
.
There are some interesting ways of how .f
can be specified within a mapping function:
By defining an anonymous function within the map()
:
Or, smoother yet, defining an anonymous function as a formula with the ~
:
This is very useful, and I’ve used this approach in multiple occasions, especially in nested dataframes, or as this example shows, across a split dataframe:
#where cyl is mtcars split() by a grouping variable (cyl)
map(cyl, function(df) lm(mpg ~ wt, data = df))
#which is the same as:
map(cyl, ~ lm(mpg ~ wt, data = .))
From the top, and extracting one of the variables using a combination of summary()
and `map_dbl()
:
This chapter goes over some important considerations when it comes to functional programming: how to deal with errors in the map family of functions, and more advanced multiple argument inputs and processing their outputs.
It isn’t very glamorous, but what is suggested is creating “safe” functions with purrr::safely()
, and extracting the successful instance. For instance, in the following list there is one url that will cause the map()
output to fail ( due to asdf not being a url), even for the other two successful strings:
urls <- list("example" = "http://example.org", "rproj" = "http://www.r-project.org",
"asdf" = "http://asdfasdasdkfjlda")
purrr::map(urls, readLines)
#Warning message: URL 'http://asdfasdasdkfjlda/': status was 'Couldn't resolve host name'
#Error: cannot open the connection to 'http://asdfasdasdkfjlda'
Whereas by using purrr::safely()
, I can extract the successful cases:
To run x
function across y
vector, map()
can be used here just like lapply()
:
n <- list(5, 10, 20)
map(n, rnorm)
#[[1]]
#[1] 0.4907515 -0.4560749 1.2945899 -1.0598452 1.0723190
#
#[[2]]
# [1] 2.34129640 -0.56043998 1.08288931 1.55218967 0.91355529 0.53500625
# [7] 1.18360627 0.05123708 0.30351433 0.06820386
#
#[[3]]
# [1] 0.02583432 -1.06354413 0.32748503 0.51576915 -0.34135875 -0.42845792
# [7] 1.44046599 -0.89893656 0.25438159 1.52441570 1.22505382 1.01317309
#[13] 0.15274974 -0.73192319 -0.60792292 -1.67418024 1.92924421 1.31669983
#[19] 0.29092385 -1.39645626
And to specify one or more of the arguments which can be input to rnorm()
such as mean or sd, we could do so by specifying these arguments in a list using map2()
; following the order of the arguments of the function:
Functions with two arguments or more can use pmap()
by listing the arguments as the first argument in pmap()
. Note that it is best practice to have the argument names within the list match those of the function:
n <- list(5, 10, 20)
mean <- list(1, 5, 10)
sd <- list(0.1, 1, 0.1)
pmap(list(mean = mean, n = n, sd = sd), rnorm)
And another cool function, which I haven’t quite figured out how I would use in a practical setting is invoke_map()
, used to run multiple functions and their params at once:
The walk family of functions in purrr are designed as map functions for extracting the side-effects of functions such as printing outputs, plotting, and saving files to disk. In the very useful example provided, map + walk2 allows me to create plots for each grouped variable and apply unique path names to each:
plots <- mtcars %>%
split(mtcars$cyl) %>%
map(~ ggplot(., aes(mpg, wt)) + geom_point())
paths <- paste0(names(plots), ".pdf")
walk2(paths, plots, ggsave)
This is massively helpful - I’ll be revisiting old approaches where I try to use map2 to extract side effects and replace it with walk / walk2.
safely()
transpose()
is_null()
readLines()
map2()
pmap()
invoke_map()
walk()
walk2()
pwalk()
The last course section is all about good housekeeping. Creating functions which are reliable and avoid three common problems in functional programming:
The tidyverse of packages uses a different set of lookup rules within a function’s argument than base R as a means of increasing efficiency in programming. The difference is that functions can call upon variables within the data directly without needing to prefix with a dat$
call. Think ggplot
or dplyr::filter
:
ggplot(mpg, aes(displ, cty)) + geom_point() #displ and cty direct variable lookup
filter(mtcars, disp > 400)
This is a beauty of the tidyverse, however it can bring on some challenges if there are values with the same name as the inputs of the function in the global environment, or if there are names which are the same in the dataframe input. The solutions suggested in the course is to write a warning in the function to prevent that those don’t already exist prior to the function executing - simple enough.
All in all a pretty fun course, it helped me go over a few concepts I was already familiar with, and introduced new topics entirely in functional programming. The next stage is to start regularly using these (especially map + walk functions) in my workflow to master them.


This guide covers Rails integration with Rack and interfacing with other Rack components.
After reading this guide, you will know:
WARNING: This guide assumes a working knowledge of Rack protocol and Rack concepts such as middlewares, url maps and Rack::Builder
.
Rack provides a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.
Explaining Rack is not really in the scope of this guide. In case you are not familiar with Rack’s basics, you should check out the Resources section below.
ApplicationName::Application
is the primary Rack application object of a Rails
application. Any Rack compliant web server should be using
ApplicationName::Application
object to serve a Rails
application. Rails.application
refers to the same application object.
rails server
rails server
does the basic job of creating a Rack::Server
object and starting the webserver.
Here’s how rails server
creates an instance of Rack::Server
Rails::Server.new.tap do |server| require APP_PATH Dir.chdir(Rails.application.root) server.start end
The Rails::Server
inherits from Rack::Server
and calls the Rack::Server#start
method this way:
class Server < ::Rack::Server def start ... super end end
Here’s how it loads the middlewares:
def middleware middlewares = [] middlewares << [Rails::Rack::Debugger] if options[:debugger] middlewares << [::Rack::ContentLength] Hash.new(middlewares) end
Rails::Rack::Debugger
is primarily useful only in the development environment. The following table explains the usage of the loaded middlewares:
| Middleware | Purpose |
|---|---|
Rails::Rack::Debugger |
Starts Debugger |
Rack::ContentLength |
Counts the number of bytes in the response and set the HTTP Content-Length header |
rackup
To use rackup
instead of Rails’ rails server
, you can put the following inside config.ru
of your Rails application’s root directory:
# Rails.root/config.ru require ::File.expand_path('../config/environment', __FILE__) use Rack::Debugger use Rack::ContentLength run Rails.application
And start the server:
$ rackup config.ru
To find out more about different rackup
options:
$ rackup --help
Many of Action Dispatcher’s internal components are implemented as Rack middlewares. Rails::Application
uses ActionDispatch::MiddlewareStack
to combine various internal and external middlewares to form a complete Rails Rack application.
NOTE: ActionDispatch::MiddlewareStack
is Rails equivalent of Rack::Builder
, but built for better flexibility and more features to meet Rails’ requirements.
Rails has a handy rake task for inspecting the middleware stack in use:
$ rake middleware
For a freshly generated Rails application, this might produce something like:
use ActionDispatch::Static use Rack::Lock use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x000000029a0838> use Rack::Runtime use Rack::MethodOverride use ActionDispatch::RequestId use Rails::Rack::Logger use ActionDispatch::ShowExceptions use ActionDispatch::DebugExceptions use ActionDispatch::RemoteIp use ActionDispatch::Reloader use ActionDispatch::Callbacks use ActiveRecord::ConnectionAdapters::ConnectionManagement use ActiveRecord::QueryCache use ActionDispatch::Cookies use ActionDispatch::Session::CookieStore use ActionDispatch::Flash use ActionDispatch::ParamsParser use Rack::Head use Rack::ConditionalGet use Rack::ETag run MyApp::Application.routes
Purpose of each of this middlewares is explained in the Internal Middlewares section.
Rails provides a simple configuration interface config.middleware
for adding, removing and modifying the middlewares in the middleware stack via application.rb
or the environment specific configuration file environments/<environment>.rb
.
You can add a new middleware to the middleware stack using any of the following methods:
config.middleware.use(new_middleware, args)
- Adds the new middleware at the bottom of the middleware stack.
config.middleware.insert_before(existing_middleware, new_middleware, args)
- Adds the new middleware before the specified existing middleware in the middleware stack.
config.middleware.insert_after(existing_middleware, new_middleware, args)
- Adds the new middleware after the specified existing middleware in the middleware stack.
# config/application.rb # Push Rack::BounceFavicon at the bottom config.middleware.use Rack::BounceFavicon # Add Lifo::Cache after ActiveRecord::QueryCache. # Pass { page_cache: false } argument to Lifo::Cache. config.middleware.insert_after ActiveRecord::QueryCache, Lifo::Cache, page_cache: false
You can swap an existing middleware in the middleware stack using config.middleware.swap
.
# config/application.rb # Replace ActionDispatch::ShowExceptions with Lifo::ShowExceptions config.middleware.swap ActionDispatch::ShowExceptions, Lifo::ShowExceptions
The middleware stack behaves just like a normal Enumerable
. You can use any Enumerable
methods to manipulate or interrogate the stack. The middleware stack also implements some Array
methods including []
, unshift
and delete
. Methods described in the section above are just convenience methods.
Append following lines to your application configuration:
# config/application.rb config.middleware.delete "Rack::Lock"
And now if you inspect the middleware stack, you’ll find that Rack::Lock
will not be part of it.
$ rake middleware (in /Users/lifo/Rails/blog) use ActionDispatch::Static use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x00000001c304c8> use Rack::Runtime ... run Blog::Application.routes
If you want to remove session related middleware, do the following:
# config/application.rb config.middleware.delete "ActionDispatch::Cookies" config.middleware.delete "ActionDispatch::Session::CookieStore" config.middleware.delete "ActionDispatch::Flash"
And to remove browser related middleware,
# config/application.rb config.middleware.delete "Rack::MethodOverride"
Much of Action Controller’s functionality is implemented as Middlewares. The following list explains the purpose of each of them:
ActionDispatch::Static
config.serve_static_assets
is true.Rack::Lock
env["rack.multithread"]
flag to false
and wraps the application within a Mutex.ActiveSupport::Cache::Strategy::LocalCache::Middleware
Rack::Runtime
Rack::MethodOverride
params[:_method]
is set. This is the middleware which supports the PUT and DELETE HTTP method types.ActionDispatch::RequestId
X-Request-Id
header available to the response and enables the ActionDispatch::Request#uuid
method.Rails::Rack::Logger
ActionDispatch::ShowExceptions
ActionDispatch::DebugExceptions
ActionDispatch::RemoteIp
ActionDispatch::Reloader
ActionDispatch::Callbacks
ActiveRecord::ConnectionAdapters::ConnectionManagement
rack.test
key in the request environment is set to true
.ActiveRecord::QueryCache
ActionDispatch::Cookies
ActionDispatch::Session::CookieStore
ActionDispatch::Flash
config.action_controller.session_store
is set to a value.ActionDispatch::ParamsParser
params
.ActionDispatch::Head
GET
requests and serves them as so.Rack::ConditionalGet
GET
” so that server responds with nothing if page wasn’t changed.Rack::ETag
TIP: It’s possible to use any of the above middlewares in your custom Rack stack.
The following shows how to replace use Rack::Builder
instead of the Rails supplied MiddlewareStack
.
Clear the existing Rails middleware stack
# config/application.rb
config.middleware.clear
Add a config.ru
file to Rails.root
# config.ru use MyOwnStackFromScratch run Rails.application


| Opcode/Instruction | Op/En | 64/32 bit Mode Support | CPUID Feature Flag | Description |
| 0F 38 1C /r1 PABSB mm1, mm2/m64 | RM | V/V | SSSE3 | Compute the absolute value of bytes in mm2/m64 and store UNSIGNED result in mm1. |
| 66 0F 38 1C /r PABSB xmm1, xmm2/m128 | RM | V/V | SSSE3 | Compute the absolute value of bytes in xmm2/m128 and store UNSIGNED result in xmm1. |
| 0F 38 1D /r1 PABSW mm1, mm2/m64 | RM | V/V | SSSE3 | Compute the absolute value of 16-bit integers in mm2/m64 and store UNSIGNED result in mm1. |
| 66 0F 38 1D /r PABSW xmm1, xmm2/m128 | RM | V/V | SSSE3 | Compute the absolute value of 16-bit integers in xmm2/m128 and store UNSIGNED result in xmm1. |
| 0F 38 1E /r1 PABSD mm1, mm2/m64 | RM | V/V | SSSE3 | Compute the absolute value of 32-bit integers in mm2/m64 and store UNSIGNED result in mm1. |
| 66 0F 38 1E /r PABSD xmm1, xmm2/m128 | RM | V/V | SSSE3 | Compute the absolute value of 32-bit integers in xmm2/m128 and store UNSIGNED result in xmm1. |
| VEX.128.66.0F38.WIG 1C /r VPABSB xmm1, xmm2/m128 | RM | V/V | AVX | Compute the absolute value of bytes in xmm2/m128 and store UNSIGNED result in xmm1. |
| VEX.128.66.0F38.WIG 1D /r VPABSW xmm1, xmm2/m128 | RM | V/V | AVX | Compute the absolute value of 16- bit integers in xmm2/m128 and store UNSIGNED result in xmm1. |
| VEX.128.66.0F38.WIG 1E /r VPABSD xmm1, xmm2/m128 | RM | V/V | AVX | Compute the absolute value of 32- bit integers in xmm2/m128 and store UNSIGNED result in xmm1. |
| VEX.256.66.0F38.WIG 1C /r VPABSB ymm1, ymm2/m256 | RM | V/V | AVX2 | Compute the absolute value of bytes in ymm2/m256 and store UNSIGNED result in ymm1. |
| VEX.256.66.0F38.WIG 1D /r VPABSW ymm1, ymm2/m256 | RM | V/V | AVX2 | Compute the absolute value of 16-bit integers in ymm2/m256 and store UNSIGNED result in ymm1. |
| VEX.256.66.0F38.WIG 1E /r VPABSD ymm1, ymm2/m256 | RM | V/V | AVX2 | Compute the absolute value of 32-bit integers in ymm2/m256 and store UNSIGNED result in ymm1. |
Notes: 1. See note in Section 2.4, “Instruction Exception Specification” in the Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 2A and Section 22.25.3, “Exception Conditions of Legacy SIMD Instructions Operating on MMX Registers” in the Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 3A.
| Op/En | Operand 1 | Operand 2 | Operand 3 | Operand 4 |
| RM | ModRM:reg (w) | ModRM:r/m (r) | NA | NA |
(V)PABSB/W/D computes the absolute value of each data element of the source operand (the second operand) and stores the UNSIGNED results in the destination operand (the first operand). (V)PABSB operates on signed bytes, (V)PABSW operates on 16-bit words, and (V)PABSD operates on signed 32-bit integers. The source operand can be an MMX register or a 64-bit memory location, or it can be an XMM register, a YMM register, a 128-bit memory location, or a 256-bit memory location. The destination operand can be an MMX, an XMM or a YMM register. Both operands can be MMX registers or XMM registers. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16byte boundary or a general-protection exception (#GP) will be generated.
In 64-bit mode, use the REX prefix to access additional registers. 128-bit Legacy SSE version: The source operand can be an XMM register or a 128-bit memory location. The destination is not distinct from the first source XMM register and the upper bits (VLMAX-1:128) of the corresponding YMM register destination are unmodified. VEX.128 encoded version: The source operand is an XMM register or 128-bit memory location. The destination operand is an XMM register. The upper bits (VLMAX-1:128) of the corresponding YMM register destination are zeroed. VEX.256 encoded version: The first source operand is a YMM register or a 256-bit memory location. The destination operand is a YMM register.
Note: VEX.vvvv is reserved and must be 1111b, VEX.L must be 0; otherwise instructions will #UD.
PABSB (with 64 bit operands) Unsigned DEST[7:0] ← ABS(SRC[7:0]) Repeat operation for 2nd through 7th bytes Unsigned DEST[63:56] ← ABS(SRC[63:56]) PABSB (with 128 bit operands) Unsigned DEST[7:0] ← ABS(SRC[7:.0]) Repeat operation for 2nd through 15th bytes Unsigned DEST[127:120] ← ABS(SRC[127:120]) PABSW (with 64 bit operands) Unsigned DEST[15:0] ← ABS(SRC[15:0]) Repeat operation for 2nd through 3rd 16-bit words Unsigned DEST[63:48] ← ABS(SRC[63:48]) PABSW (with 128 bit operands) Unsigned DEST[15:0] ← ABS(SRC[15:0]) Repeat operation for 2nd through 7th 16-bit words Unsigned DEST[127:112] ← ABS(SRC[127:112]) PABSD (with 64 bit operands) Unsigned DEST[31:0] ← ABS(SRC[31:0]) Unsigned DEST[63:32] ← ABS(SRC[63:32]) PABSD (with 128 bit operands) Unsigned DEST[31:0] ← ABS(SRC[31:0]) Repeat operation for 2nd through 3rd 32-bit double words Unsigned DEST[127:96] ← ABS(SRC[127:96]) PABSB (128-bit Legacy SSE version) DEST[127:0] ← BYTE_ABS(SRC) DEST[VLMAX-1:128] (Unmodified) VPABSB (VEX.128 encoded version) DEST[127:0] ← BYTE_ABS(SRC) DEST[VLMAX-1:128] ← 0 VPABSB (VEX.256 encoded version) Unsigned DEST[7:0]← ABS(SRC[7:.0]) Repeat operation for 2nd through 31st bytes Unsigned DEST[255:248] ← ABS(SRC[255:248]) PABSW (128-bit Legacy SSE version) DEST[127:0] ← WORD_ABS(SRC) DEST[VLMAX-1:128] (Unmodified) VPABSW (VEX.128 encoded version) DEST[127:0] ← WORD_ABS(SRC) DEST[VLMAX-1:128] ← 0 VPABSW (VEX.256 encoded version) Unsigned DEST[15:0]← ABS(SRC[15:0]) Repeat operation for 2nd through 15th 16-bit words Unsigned DEST[255:240] ← ABS(SRC[255:240]) PABSD (128-bit Legacy SSE version) DEST[127:0] ← DWORD_ABS(SRC) DEST[VLMAX-1:128] (Unmodified) VPABSD (VEX.128 encoded version) DEST[127:0] ← DWORD_ABS(SRC) DEST[VLMAX-1:128] ← 0 VPABSD (VEX.256 encoded version) Unsigned DEST[31:0] ← ABS(SRC[31:0]) Repeat operation for 2nd through 7th 32-bit double words Unsigned DEST[255:224] ← ABS(SRC[255:224])
| PABSB: | __m64 _mm_abs_pi8 (__m64 a) |
| (V)PABSB: | __m128i _mm_abs_epi8 (__m128i a) |
| VPABSB: | __m256i _mm256_abs_epi8 (__m256i a) |
| PABSW: | __m64 _mm_abs_pi16 (__m64 a) |
| (V)PABSW: | __m128i _mm_abs_epi16 (__m128i a) |
| VPABSW: | __m256i _mm256_abs_epi16 (__m256i a) |
| PABSD: | __m64 _mm_abs_pi32 (__m64 a) |
| (V)PABSD: | __m128i _mm_abs_epi32 (__m128i a) |
| VPABSD: | __m256i _mm256_abs_epi32 (__m256i a) |
None.
See Exceptions Type 4; additionally
| #UD | If VEX.L = 1. If VEX.vvvv != 1111B. |


Home
About Me
Projects
Links
Home
About Me
Projects
Links
menu
GitHub: github.com/GlennHS
Phone: +44 7572 354460
Email<EMAIL_ADDRESS>GitHub: github.com/GlennHS
Email<EMAIL_ADDRESS>Phone: +44 7572 354460
LinkedIn
Glenn Hamilton-Smith
filter_1
Python Files
file_download
Conway's Game Of Life
file_download
Discord Bot
file_download
Dungeon Randomizer
filter_2
JavaScript Files
file_download
Cipher Tools
file_download
Array Tutorial
file_download
Massive Help Sheet
filter_3
Literature Reviews and Coursework
file_download
Fuzzy Control Systems in Autonomous Vehicle Braking
file_download
Neural Networks and Genetic Algorithms Coursework (co-written with George Swallow)
file_download
The Ethical and Practical Connotations of Tracking Achievement and Effort in Modern Education
arrow_upward


Demo For Ticker Library
Whats happening here ?
Function: Sum of Series 0,1,2 ..... 99999
Executing a for loop of 100,000 records
In Each frame or Tick we execute only 100 records
Try interacting with button | canvas
The heavier process won't slow down the interaction
Index :
Summation :
Count of Loop callback that get called after each chunk of loop:
1. Interact While Loop is executing:
Click
2. Interact on Canvas by moving the mouse:


JavaScript is disabled on your browser.
Skip navigation links
Overview
Package
Class
Tree
Deprecated
Index
Help
Prev Letter
Next Letter
Frames
No Frames
All Classes
A
B
C
D
E
F
G
H
I
L
M
O
P
Q
R
S
T
U
V
P
ProjectDao
- Interface in
edu.cnm.deepdive.mobilepunch.model.dao
The interface Project dao.
ProjectEntity
- Class in
edu.cnm.deepdive.mobilepunch.model.entities
The type Project entity.
ProjectEntity(ClientEntity)
- Constructor for class edu.cnm.deepdive.mobilepunch.model.entities.
ProjectEntity
ProjectEntity()
- Constructor for class edu.cnm.deepdive.mobilepunch.model.entities.
ProjectEntity
ProjectFragment
- Class in
edu.cnm.deepdive.mobilepunch.view.fragments
The type Project fragment.
ProjectFragment()
- Constructor for class edu.cnm.deepdive.mobilepunch.view.fragments.
ProjectFragment
ProjectGetterTask()
- Constructor for class edu.cnm.deepdive.mobilepunch.model.dao.abstraction.
DaoHelper.ProjectGetterTask
ProjectHolder(View)
- Constructor for class edu.cnm.deepdive.mobilepunch.controller.adapters.
ProjectRecyclerViewAdapter.ProjectHolder
Instantiates a new Project holder.
ProjectRecyclerViewAdapter
- Class in
edu.cnm.deepdive.mobilepunch.controller.adapters
The type Project recycler view adapter.
ProjectRecyclerViewAdapter(Context, List<ProjectEntity>)
- Constructor for class edu.cnm.deepdive.mobilepunch.controller.adapters.
ProjectRecyclerViewAdapter
Instantiates a new Project recycler view adapter.
ProjectRecyclerViewAdapter.ProjectHolder
- Class in
edu.cnm.deepdive.mobilepunch.controller.adapters
The type Project holder.
putClients(String, List<ClientEntity>)
- Method in interface edu.cnm.deepdive.mobilepunch.service.
MobilePunchService
Put clients response.
putEquipment(String, List<EquipmentEntity>)
- Method in interface edu.cnm.deepdive.mobilepunch.service.
MobilePunchService
Put equipment response.
putProjects(String, List<ProjectEntity>)
- Method in interface edu.cnm.deepdive.mobilepunch.service.
MobilePunchService
Put projects response.
A
B
C
D
E
F
G
H
I
L
M
O
P
Q
R
S
T
U
V
Skip navigation links
Overview
Package
Class
Tree
Deprecated
Index
Help
Prev Letter
Next Letter
Frames
No Frames
All Classes


Munster and Ulster sides named ahead of tomorrow's clash
Head Coaches Johann van Graan and Dan McFarland has named his side for Satuday's Guinness PRO14 Interpro derby this Saturday at Thomand Park.
Munster
Peter O’Mahony captains Munster with eight of Munster’s Rugby World Cup contingent set to feature at Thomond Park. Andrew Conway, Chris Farrell, Niall Scannell, John Ryan, Jean Kleyn, O’Mahony and CJ Stander all start with Conor Murray among the replacements.
JJ Hanrahan, Alby Mathewson and Chris Cloete keep their places in the side after helping Munster to a bonus-point win away to Cardiff Blues last week as Munster make 12 changes. Academy winger Liam Coombes makes his second Munster start with Mike Haley and Conway completing the back three.
Mathewson and Hanrahan continue their half-back partnership with Rory Scannell and Farrell in the centres. James Cronin, Scannell and Ryan pack down in the front row with Kleyn and Billy Holland in the engine room.
O’Mahony, Cloete and Stander are named in the back row.
Team:
Mike Haley; Andrew Conway, Chris Farrell, Rory Scannell, Liam Coombes; JJ Hanrahan, Alby Mathewson; James Cronin, Niall Scannell, John Ryan; Jean Kleyn, Billy Holland; Peter O’Mahony (C), Chris Cloete, CJ Stander.
Replacements: Jeremy Loughman, Kevin O’Byrne, Stephen Archer, Fineen Wycherley, Jack O’Donoghue, Conor Murray, Tyler Bleyendaal, Arno Botha.
Ulster
In a starting team that has seven changes from the side that defeated Zebre last Friday, Irish internationals Jacob Stockdale and Jordi Murphy will make their first appearances this season.
Matt Faddes switches to the full-back position, joined by the returning Stockdale and Rob Lyttle on the left and right wings respectively. Stuart McCloskey is re-called to join last week’s Man-of-the-Match, Luke Marshall in midfield. Angus Curtis will make his first start for Ulster this season at fly-half and is joined by John Cooney at scrum-half, who made his 50th appearance last time out against Zebre.
Among the four changes in the forwards, Marty Moore returns to make his first start of the season at tighthead, joining Jack McGrath at loosehead and captain Rob Herring to make up an all-international front row. Sam Carter comes back in to join Alan O’Connor in the second row.
Joining Murphy will be Sean Reidy at blindside, and Nick Timoney switches to assume the number eight position, completing the back row.
In the replacements, Adam McBurney, Eric O’Sullivan, Tom O’Toole, Kieran Treadwell and Matthew Rea will provide forward cover. David Shanahan, Bill Johnston and Robert Baloucoune – who is also set to make his seasonal bow – make up the back-line reinforcements.
Team:
(15-9) Matt Faddes, Rob Lyttle, Luke Marshall, Stuart McCloskey, Jacob Stockdale, Angus Curtis, John Cooney.
(1-8) Jack McGrath, Rob Herring (Capt.), Marty Moore, Alan O’Connor, Sam Carter, Sean Reidy, Jordi Murphy, Nick Timoney.
Replacements: Adam McBurney, Eric O’Sullivan, Tom O’Toole, Kieran Treadwell, Matthew Rea, David Shanahan, Bill Johnston, Robert Baloucoune.
Kick off is 5:15pm.
READ MORE
Newcastle boss Bruce wants one more win ahead of hectic December


UX Designer
Born in Alaska, currently studying Human Centered Computing at the Rochester
Institute of Technology. I’m fervent about people, technology, and the gap
in between the two. My solutions and designs make sense, feel agile, and
look elegant. UX/UI, IoT, and mobile design fascinate me.
Let’s get in touch!
Coded on late nights and early mornings // Cole Johnson 2016


Welcome, so-and-so
Menu
My Profile
View My Profile
Edit My Profile
View My History
View Goals
Edit Goals
Calculator
Use calculator
Set Reminder
Set Reminder
Edit Reminder
Delete Reminder
Logout
Logout?
Are you sure you want to logout?
Logout
Cancel
hello blah blah
Back to Home
Page Footer


If two or more lines intersect then they touch or cut across each other.
Lines and figures can intersect as well.