JavaScript HTML DOM Navigation
With the HTML DOM, you can navigate the node tree using node relationships.
DOM Nodes
According to the W3C HTML DOM standard, everything in an HTML document is a node:
-
The entire document is a document node
-
Every HTML element is an element node
-
The text inside HTML elements are text nodes
-
Every HTML attribute is an attribute node
-
All comments are comment nodes
With the HTML DOM, all nodes in the node tree can be accessed by JavaScript.
New nodes can be created, and all nodes can be modified or deleted.
Node Relationships
The nodes in the node tree have a hierarchical relationship to each other.
The terms parent, child, and sibling are used to describe the relationships.
-
In a node tree, the top node is called the root (or root node)
-
Every node has exactly one parent, except the root (which has no parent)
-
A node can have a number of children
-
Siblings (brothers or sisters) are nodes with the same parent

<title>DOM Tutorial</title>

DOM Lesson one

Hello world!

From the HTML above you can read:
-
 is the root node
-
 has no parents
-
 is the parent of  and
-
 is the first child of
-
 is the last child of
and:
-
 has one child: <title>
-
<title> has one child (a text node): "DOM Tutorial"
-
 has two children:
 and

-

 has one child: "DOM Lesson one"
-

 has one child: "Hello world!"
-

 and
 are siblings
Navigating Between Nodes
You can use the following node properties to navigate between nodes with JavaScript:
-
parentNode
-
childNodes[nodenumber]
-
firstChild
-
lastChild
-
nextSibling
-
previousSibling
Warning !
A common error in DOM processing is to expect an element node to contain text.
In this example: <title>DOM Tutorial</title>, the element node <title> does not contain text. It contains a text node with the value "DOM Tutorial".
The value of the text node can be accessed by the node's innerHTML property, or the nodeValue.
Child Nodes and Node Values
In addition to the innerHTML property, you can also use the childNodes and nodeValue properties to get the content of an element.
The following example collects the node value of an
 element and copies it into a
 element:
Example

My First Page

Hello!

In the example above, getElementById is a method, while childNodes and nodeValue are properties.
In this tutorial we use the innerHTML property. However, learning the method above is useful for understanding the tree structure and the navigation of the DOM.
Using the firstChild property is the same as using childNodes[0]:
Example

My First Page

Hello World!

DOM Root Nodes
There are two special properties that allow access to the full document:
-
document.body - The body of the document
-
document.documentElement - The full document
Example

Hello World!

The DOM is very useful!

This example demonstrates the document.body property.

Example

Hello World!

The DOM is very useful!

This example demonstrates the document.documentElement property.

The nodeName Property
The nodeName property specifies the name of a node.
-
nodeName is read-only
-
nodeName of an element node is the same as the tag name
-
nodeName of an attribute node is the attribute name
-
nodeName of a text node is always #text
-
nodeName of the document node is always #document
Note: nodeName always contains the uppercase tag name of an HTML element.
The nodeValue Property
The nodeValue property specifies the value of a node.
-
nodeValue for element nodes is undefined
-
nodeValue for text nodes is the text itself
-
nodeValue for attribute nodes is the attribute value
The nodeType Property
The nodeType property returns the type of node. nodeType is read only.
The most important node types are:
|
Element type |
NodeType |
|
Element |
1 |
|
Attribute |
2 |
|
Text |
3 |
|
Comment |
8 |
|
Document |
9 |


This is where you can find the lyrics of all Goddess Durga mantras or devotional hymns in English and Devanagari script. You will also find the meaning of those mantras and devotional hymns in English. These mantras are read to please Goddess Durga.
| Durga Stotra |
| Durga Chalisa |
| Durga Aarti |
| Durga Ashtottara Shatanama Stotra |
| Durga Stuti Mantra |
| Durga Stuti |
| Durga Mantra |
| Durga Dhyan Mantra |


Say "Hello!"
Hello Sir, I'm J.A.R.V.I.S.! How can I assist you?
Let's try something more interesting…
Say "Find Iron Man!"
Say "Find thermonuclear war!"
Now go wild. Say "Find…" and make your demands!
That's cool, but in the real world it's not all kittens and hello world.
No problem, say "Show TPS report"


Search nurse by name
Name of nurse:
Search nurse by ssn
SSN of nurse:
Search nurse by doctor
Name of doctor:
Search nurse by patient
Name of patient:
Search nurse by suprvising room
Room Number:
Add a nurse record
Delete a nurse record


This application will split your name by it's letters.
Type your name and then click the button "Try it".
Try it


PhD student researching programming languages at Northeastern University.
© 2021 Donald Pinckney. All rights reserved.


Firefox is a stand-alone browser based on the Mozilla codebase.
This package is known to build and work properly using an LFS-9.1 platform.
Download (HTTP): https://archive.mozilla.org/pub/firefox/releases/68.6.0esr/source/firefox-68.6.0esr.source.tar.xz
Download MD5 sum: d21112f6e2b482e3c3ce431682de5e7d
Download size: 300 MB
Estimated disk space required: 4.3 GB (166 MB installed) without tests
Estimated build time: 23 SBU (on a 4-core machine) without tests
Optional patch to allow system versions of Graphite2-1.3.13 and HarfBuzz-2.6.4: http://www.linuxfromscratch.org/patches/blfs/svn/firefox-68.6.0esr-system_graphite2_harfbuzz-1.patch
The directory name is firefox-68.6.0
Extracting the tarball will reset the permissions of the current
directory to 0755 if you have permission to do that. If you do
this in a directory where the sticky bit is set, such as
/tmp
it will end with error
messages:
tar: .: Cannot utime: Operation not permitted
tar: .: Cannot change mode to rwxr-xr-t: Operation not permitted
tar: Exiting with failure status due to previous errors
This does finish with non-zero status, but it does NOT mean there is a real problem. Do
not untar as the root
user in a
directory where the sticky bit is set - that will unset it.
As with other large packages which use C++ (or rust), the SBU times to build this vary more widely than you might expect. Also, 6GB of real memory is used during the final link and the SBUs can increase significantly if the machine has to swap.
The mach build system (Python scripts) can be somewhat unreliable: if the build fails and reports an Error, it can still return a status of success, causing a scripted build to try to install (which does not rerun the build), fail during the preparations for installing, but still exit with a status of success. Also, on occasion it may limit itself to only running one set of jobs - that will make the build take about 3 times as long as running with four sets of jobs.
Although upstream prefer to use PulseAudio, for the moment Alsa can still be used. Both may need runtime configuration to get sound working.
Autoconf-2.13, Cbindgen-0.13.2, dbus-glib-0.110, both GTK+-3.24.16 and GTK+-2.24.32, libnotify-0.7.9, nodejs-12.16.1, NSS-3.51, PulseAudio-13.0 (or alsa-lib-1.2.2 if you edit the mozconfig; now deprecated by mozilla), in either case please read the Configuration Information, rustc-1.42.0, UnZip-6.0, yasm-1.3.0, and Zip-3.0
ICU-66.1, libevent-2.1.11, libwebp-1.1.0, NASM-2.14.02, and SQLite-3.31.1
If you don't install recommended dependencies, then internal copies of those packages will be used. They might be tested to work, but they can be out of date or contain security holes.
cURL-7.69.1, Doxygen-1.8.17, FFmpeg-4.2.2 (runtime, to play mov, mp3 or mp4 files), liboauth-1.0.3, OpenJDK-12.0.2, startup-notification-0.12, Valgrind-3.15.0, Wget-1.20.3, Wireless Tools-29, libproxy, and (with the patch) Graphite2-1.3.13 and HarfBuzz-2.6.4
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/firefox
The configuration of Firefox is
accomplished by creating a mozconfig
file containing the desired configuration options. A default
mozconfig
is created below. To see
the entire list of available configuration options (and an
abbreviated description of some of them), issue ./mach configure && ./configure --help |
less. You may also wish to review the entire file
and uncomment any other desired options. Create the file by issuing
the following command:
cat > mozconfig << "EOF"
# If you have a multicore machine, all cores will be used by default.
# If you have installed (or will install) wireless-tools, and you wish
# to use geolocation web services, comment out this line
ac_add_options --disable-necko-wifi
# API Keys for geolocation APIs - necko-wifi (above) is required for MLS
# Uncomment the following line if you wish to use Mozilla Location Service
#ac_add_options --with-mozilla-api-keyfile=$PWD/mozilla-key
# Uncomment the following line if you wish to use Google's geolocaton API
# (needed for use with saved maps with Google Maps)
#ac_add_options --with-google-location-service-api-keyfile=$PWD/google-key
# Uncomment this line if you have installed startup-notification:
#ac_add_options --enable-startup-notification
# Uncomment the following option if you have not installed PulseAudio
#ac_add_options --disable-pulseaudio
# or uncomment this if you installed alsa-lib instead of PulseAudio
#ac_add_options --enable-alsa
# Comment out following options if you have not installed
# recommended dependencies:
ac_add_options --enable-system-sqlite
ac_add_options --with-system-libevent
# firefox-65 understands webp and ships with an included copy
ac_add_options --with-system-webp
ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --with-system-icu
# Do not specify the gold linker which is not the default. It will take
# longer and use more disk space when debug symbols are disabled.
# libdavid (av1 decoder) requires nasm. Uncomment this if nasm
# has not been installed.
#ac_add_options --disable-av1
# You cannot distribute the binary if you do this
ac_add_options --enable-official-branding
# If you are going to apply the patch for system graphite
# and system harfbuzz, uncomment these lines:
#ac_add_options --with-system-graphite2
#ac_add_options --with-system-harfbuzz
# Stripping is now enabled by default.
# Uncomment these lines if you need to run a debugger:
#ac_add_options --disable-strip
#ac_add_options --disable-install-strip
# Disabling debug symbols makes the build much smaller and a little
# faster. Comment this if you need to run a debugger. Note: This is
# required for compilation on i686.
ac_add_options --disable-debug-symbols
# The BLFS editors recommend not changing anything below this line:
ac_add_options --prefix=/usr
ac_add_options --enable-application=browser
# The elf-hack is reported to cause failed installs (after successful builds)
# on some machines. It is supposed to improve startup time and it shrinks
# libxul.so by a few MB - comment this if you know your machine is not affected.
ac_add_options --disable-elf-hack
ac_add_options --disable-crashreporter
ac_add_options --disable-updater
# enabling the tests will use a lot more space and significantly
# increase the build time, for no obvious benefit.
ac_add_options --disable-tests
# The default level of optimization again produces a working build with gcc.
ac_add_options --enable-optimize
# From firefox-61 system cairo is not supported
ac_add_options --enable-system-ffi
ac_add_options --enable-system-pixman
# From firefox-62 --with-pthreads is not recognized
ac_add_options --with-system-bz2
ac_add_options --with-system-jpeg
ac_add_options --with-system-png
ac_add_options --with-system-zlib
# The following option unsets Telemetry Reporting. With the Addons Fiasco,
# Mozilla was found to be collecting user's data, including saved passwords and
# web form data, without users consent. Mozilla was also found shipping updates
# to systems without the user's knowledge or permission.
# As a result of this, use the following command to permanently disable
# telemetry reporting in Firefox.
unset MOZ_TELEMETRY_REPORTING
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-build-dir
EOF
Compile Firefox by issuing the following commands:
If you have installed system versions of graphite2 and harfbuzz and
wish firefox to use those instead of its shipped versions, apply
the patch and uncomment the appropriate entries in the mozconfig
file.
patch -Np1 -i ../firefox-68.6.0esr-system_graphite2_harfbuzz-1.patch
If the geolocation APIs are needed:
The Google and Mozilla API Keys below are specific to LFS. If using these instructions for another distro, or if you intend to distribute binary copies of the software using these instructions, please obtain your own keys following the instructions located at http://www.chromium.org/developers/how-tos/api-keys and https://location.services.mozilla.com/api respectively.
echo "AIzaSyDxKL42zsPjbke5O8_rPVpVrLrJ8aeE9rQ" > google-key echo "613364a7-9418-4c86-bcee-57e32fd70c23" > mozilla-key
If you are compiling this package in chroot you must do two
things. First, as the root
user,
ensure that /dev/shm
is mounted. If
you do not do this, the Python
configury will fail with a traceback report referencing
/usr/lib/pythonN.N/multiprocessing/synchronize.py
.
Run:
mountpoint /dev/shm >/dev/null || mount -t tmpfs devshm /dev/shm
Second, either as the root
user
export the $SHELL
environment variable
using export
SHELL=/bin/sh or else prepend SHELL=/bin/sh
when running the ./mach commands.
Now invoke the Python2 script to compile the package.
export CC=gcc CXX=g++ && export MOZBUILD_STATE_PATH=${PWD}/mozbuild && ./mach build
The mozconfig
above disables the
tests because they use a lot more time and disk space for no
obvious benefit. If you have nevertheless enabled them, you can run
the tests by executing ./mach
gtest. This will require a network connection, and
to be run from within an Xorg session - there is a popup dialog
when it fails to connect to ALSA (that does not create a failed
test). One or two tests will fail. To see the details of the
failure(s) you will need to log the output from that command so
that you can review it.
Now, as the root
user:
./mach install && mkdir -pv /usr/lib/mozilla/plugins && ln -sfv ../../mozilla/plugins /usr/lib/firefox/browser/
Set environment variables back to their values:
unset CC CXX MOZBUILD_STATE_PATH
sed -e 's/checkImpl/checkFFImpl/g'
...: Although the package ships with a modified
version of ICU-63 and only tests
that the system version, if used, is at least 63, changes from
upstream 63 cause builds with the system version to fail with an
error message no void JSContext::checkImpl_63
member function
. The sed renames the local function.
Upstream ICU-64 works around this.
export CC=gcc CXX=g++ ...: Upstream now prefer clang, but gcc is a more secure compiler and now produces reasonably-sized builds.
export
MOZBUILD_STATE_PATH=${PWD}/mozbuild: The build is
now supposed to tell you that it intends to create ~/.mozbuild
, and offer you an option to press
<ENTER> to accept this, or Ctrl-C to cancel and restart the
build after specifying the directory. In practice, the message may
not appear until after <ENTER> is keyed, i.e. the build
stalls.
That directory is used for a (probably random) telemetry identifier. Creating this in the build directory, and deleting that after the installation, prevents it being used. If you wish to participate in telemetry, export MOZBUILD_STATE_PATH to point to its default directory.
./mach build: Firefox now uses this python2 script to run the build and install.
./mach build --verbose
: Use this
alternative if you need details of which files are being compiled,
together with any C or C++ flags being used.
./mach build -jN
: The build should, by
default, use all the online CPU cores. There are two reasons to
specify the number of cores, e.g. -j4 for 4 cores: First, if using
all the cores causes the build to swap because you have
insufficient memory (e.g. for 4 cores a build without system
graphite2 and harfbuzz now uses towards 8GB of RAM). In such cases,
using fewer cores can be faster. Second, on some machines the
middle part of the build can drag on as if only one core is
present. In those cases, specifying the number of cores may speed
up the build.
mkdir -pv
/usr/lib/mozilla/plugins: This ensures that
/usr/lib/mozilla/plugins/
exists.
ln -sv ...
/usr/lib/firefox/browser: This command creates a
symbolic link to /usr/lib/mozilla/plugins
. It's not really needed,
as Firefox checks /usr/lib/mozilla/plugins
by default, but the
symbolic link is made to keep all the plugins installed in one
folder.
export CC=clang CXX=clang++ AR=llvm-ar
NM=llvm-nm RANLIB=llvm-ranlib
: Use this as an alternative to
building with gcc and g++ if you wish to use the clang toolchain.
Remember to unset these variables after the build.
If you use a desktop environment like Gnome or KDE
you may like to create a firefox.desktop
file so that Firefox appears in the panel's menus. If you
didn't enable startup-notification in your mozconfig change the
StartupNotify line to false. As the root
user:
mkdir -pv /usr/share/applications &&
mkdir -pv /usr/share/pixmaps &&
cat > /usr/share/applications/firefox.desktop << "EOF" &&
[Desktop Entry]
Encoding=UTF-8
Name=Firefox Web Browser
Comment=Browse the World Wide Web
GenericName=Web Browser
Exec=firefox %u
Terminal=false
Type=Application
Icon=firefox
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=application/xhtml+xml;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
EOF
ln -sfv /usr/lib/firefox/browser/chrome/icons/default/default128.png \
/usr/share/pixmaps/firefox.png
The application settings for firefox are accessible by keying about:config in the address bar.
With this version of firefox, getting working sound can be a problem. Although upstream prefers pulseaudio, on balance using Alsa may be easier.
If you enabled Alsa for sound, you may need to alter one variable to get working sound. If you run firefox from a term and try to play something with sound you might encounter error messages like:
Sandbox: seccomp sandbox violation: pid
3941, tid 4030, syscall 16, args 48<PHONE_NUMBER><PHONE_NUMBER>84796 0
0 0.
That was on x86_64, on i686 the syscall number is 54. To allow this syscall, in about:config change security.sandbox.content.syscall_whitelist to 16 (or 54 if using i686).
If you use pulseaudio in a Desktop
Environment, it might already be started by that DE. But if it is
not, although firefox-57 managed to start it, firefox-58 did not.
If you run firefox
from a term and this problem is present, trying to play sound
will encounter error messages warning Can't
get cubeb context!
The fix for this is to close firefox, start pulseaudio to check
it does start (if not, read the information on Configuring in
PulseAudio-13.0) and restart firefox to
check it is working. If it now works, add the following to your
~/.xinitrc
: pulseaudio --verbose
--log-target=syslog&
(unfortunately, on some
systems this does not work).
You may wish to use multiple profiles within firefox. To do that, invoke firefox as firefox --ProfileManager. You can also check which profile is currently in use from about:profiles.
Last updated on 2020-03-31 20:34:37 -0500


From
Subject
Created
Show Message
×
From:
Subject:
Message:
Create Message
×
To:
Subject:
Message:
Delete Message
×


Our hometown. The vibrant and contemporary city, one of the world’s hubs of art, design and architecture.
Carrer Vigatans 11
08003 Barcelona
Our base in Asia. A city that exhales innovation, a lab of everything that is happening in the world.
上海市乾溪路151弄4号
(+86)<PHONE_NUMBER>0


The annotation interface is available at wat/annotate.
Annotator credentials to access the annotation interface are defined in the wat.conf
.
Example annotator login: "Charlie Brown" (password "Peanuts").
The administration interface is available at wat/admin.
The password to access the administration interface is defined in the wat.conf
.
For this example project, the login password is "a".
The interface currently allows to reload the server and write results (see description in the interface).
The code of WAT-SL 2.0 and all files of this example project is available at https://github.com/anonym-anno/new-WAT-SL
This page is read from /web/index.html
.
Replace it appropriately. To configure the server, you have to change the wat.conf
and component settings
You can also add curation tasks.
wat.conf
The main configuration file of WAT-SL is the wat.conf
in the server directory.
The file is used to configure the project name, which is displayed on every page, an admin password, the components and the annotator accounts.
The file uses a key = value
format with one key-value pair per line. The wat.conf
of this project contains comments that detail every setting.
WAT-SL 2.0 uses the concept of annotation components to describe jobs in the annotation interface.
The only two components in WAT-SL are a simple text box (used for comments) and segment labeling.
Components are defined and named in the wat.conf
, where a name is given to each component (here: "segment-labeling" and "comments-box").
Each component can be configured project wide (in a /project/<component-name>.conf
) and for each task (in a /tasks/<task-name>/<component-name>.conf
, which overrides settings in the project wide configuration file).
The project wirde configuration files of this project contain comments that detail every setting.
Most importantly, the /project/<component-name>.conf
defines the labels available to the annotators, but also defines a stylesheet that overrides the default segment-labeling look by assigning different colors to the labels.
The segments are read from a /tasks/<task-name>/<component-name>.txt
for each task. These files contain one segment per line, where paragraphs are separated by empty lines.
Curation is implemented by creating a new task and copying the annotation record files of the annotators.
When the annotators are finished, you can (but don't need to) disallow them to perform changes by removing the task from their tasks list in the wat.conf
.
Then copy the task directory (usually just a cp -r tasks/<task-name> tasks/curation-<task-name>
on Linux) and copy the annotation files from the task states directory into the new directory (cp -r task-states/<task-name>/* tasks/curation-<task-name>
).
After that, add the new task curation-<task-name>
to the task list of the curator.
Note that WAT does not distinguish between annotators and curators, so the curator account is defined as an annotator account in the wat.conf
.
Finally, reload the server. For an example, user "Charlie Brown" (password "Peanuts") has one curation task assigned to him.


47+ Logo 3D Bois Pictures. Comment faire pour réaliser votre logo bois en 3d ? Designevo's 3d logo maker provides abundant 3d logo templates, so you can customize them for your 3d logo design with no effort.
Whether you need a modern logo, abstract logo or any other creative logo, brandcrowd's logo maker can generate 3d logo design ideas tailored for you. 1820 volkswagen logo 3d models. Design free logo online brings you the newest, most advanced online 3d logo creator app.
Pour créer le logo, j'ai.
Upload your icon to the template of your choice and reveal it in an abstract or realistic setting. Trouvez des inspirations et idées pratiques pour tous vos projets au quotidien sur pinterest. Art 2d art art tools coins & badges interactive art math art scans & replicas sculptures signs & logos. Convert your 2d logo to 3d easily or choose from hundreds of 3d fonts.


Miss Eileen Dover
4321 Cliff Top Edge
Dover, CT9 XXX
UK
Re:Eileen Dover university application
Dear Eileen,
Thank you for your recent application to join us at the University of Awesome's science to study as part
of your PhD next year.I will answer your questions one by one,in the
following sections.
Staring dates
We are happy to accomodate you starting your study with us at any time, however it would suit us better if
you
could start at the beginning of a semester;the start dates for each one are as follows;
- First semester:9 September 2016
- Second semester:15 January 2017
- Third semester:2 May 2017
Please let me know if this is ok,and if so which start date you would prefer.
You can find more information about import university dates
Subjects of study
At the Awesome Science Faculty,we have a pretty open-minded research facility - as long as the subjects fall
somewhere in the realm of science and technology.You seem like an intelligent,dedicated researcher,and
just
the kind of person we'd like to have on our team.Saying that,of the ideas you submitted we were most
intrigued
by are as follows,in order of priority:
- Turning H20 into wine,and the health benefits of Resveratrol( C14H12O3.)
- Measuring the effect on performance of funk bassplayers at tempratures exceeding 30℃(86℉),when the
audience size exponentially increases(effect of3 x 103 >3 x 104. ) - HTML and CSS constructs for representing musical scores.
So please can you provide more information on each of these subjects,including how long you'd expect the
research to take,required staff and other resources,and anything else you think we'd need to know?Thanks.
Exotic dance moves
Yes,you are right!As part of my post-doctorate work,I did study exotic tribal dances.To answer your
question,
my favorite dances are as follows,with definitions:
Polynesian chicken dance
A little known but very influential dance dating back as far sa 300BC
,a whole village would dance around
in a circle like chickens,to encourage their livestock or be "fruitful".
Icelandic brownian shuffle
Before the Icelanders developed fire as a means of getting warm,they used to
practice this dance, which
involved huddling close together in a circle on the floor,and shuffling their bodies around in imperceptably
tiny,very rapid movements.One of my fellow students used to say that he thought this dance inspired
modem style such as Twerking.
Arctic robot dance
An interesting example of historic misinformation,English explorers in the 1960s
believed to have
discovered a new dance style characterised by "robotic",stilted movements,being practiced by inhabitants
of Northern Alaska and Canada.Later on however it was discovered that they were just moving like this
because they were really cold.
For more of my research,see my exotic dance research page.
Yours sincerely.
Dr Eleanor Gaye
University of Awesome motto:"Be excellent to each other."-- Bill S Preston, Esq


Keyfile:
Offset:
|
Autocorrect | Tolerance:
bytes
Warnings:
Made by Crashdemons with helpful input from sashah and TCN/Echoshock


Namespace: options.interaction
, the global interaction configuration is at Chart.defaults.interaction
. To configure which events trigger chart interactions, see events.
| Name | Type | Default | Description |
|---|---|---|---|
mode |
string |
'nearest' |
Sets which elements appear in the interaction. See Interaction Modes for details. |
intersect |
boolean |
true |
if true, the interaction mode only applies when the mouse position intersects an item on the chart. |
axis |
string |
'x' |
Can be set to 'x' , 'y' , or 'xy' to define which directions are used in calculating distances. Defaults to 'x' for 'index' mode and 'xy' in dataset and 'nearest' modes. |
By default, these options apply to both the hover and tooltip interactions. The same options can be set in the options.hover
namespace, in which case they will only affect the hover interaction. Similarly, the options can be set in the options.plugins.tooltip
namespace to independently configure the tooltip interactions.
The following properties define how the chart interacts with events. Namespace: options
| Name | Type | Default | Description |
|---|---|---|---|
events |
string[] |
['mousemove', 'mouseout', 'click', 'touchstart', 'touchmove'] |
The events option defines the browser events that the chart should listen to for. Each of these events trigger hover and are passed to plugins. more… |
onHover |
function |
null |
Called when any of the events fire over chartArea. Passed the event, an array of active elements (bars, points, etc), and the chart. |
onClick |
function |
null |
Called if the event is of type 'mouseup' , 'click' or ’'contextmenu' over chartArea. Passed the event, an array of active elements, and the chart. |
For example, to have the chart only respond to click events, you could do:
var chart = new Chart(ctx, {
type: "line",
data: data,
options: {
// This chart will not respond to mousemove, etc
events: ["click"],
},
});
Events for each plugin can be further limited by defining (allowed) events array in plugin options:
var chart = new Chart(ctx, {
type: "line",
data: data,
options: {
// All of these (default) events trigger a hover and are passed to all plugins,
// unless limited at plugin options
events: ["mousemove", "mouseout", "click", "touchstart", "touchmove"],
plugins: {
tooltip: {
// Tooltip will only receive click events
events: ["click"],
},
},
},
});
A common occurrence is taking an event, such as a click, and finding the data coordinates on the chart where the event occurred. Chart.js provides helpers that make this a straightforward process.
const chart = new Chart(ctx, {
type: "line",
data: data,
options: {
onClick: (e) => {
const canvasPosition = Chart.helpers.getRelativePosition(e, chart);
// Substitute the appropriate scale IDs
const dataX = chart.scales.x.getValueForPixel(canvasPosition.x);
const dataY = chart.scales.y.getValueForPixel(canvasPosition.y);
},
},
});
When configuring the interaction with the graph via interaction
, hover
or tooltips
, a number of different modes are available.
options.hover
and options.plugins.tooltip
extend from options.interaction
. So if mode
, intersect
or any other common settings are configured only in options.interaction
, both hover and tooltips obey that.
The modes are detailed below and how they behave in conjunction with the intersect
setting.
Finds all of the items that intersect the point.
var chart = new Chart(ctx, {
type: "line",
data: data,
options: {
interaction: {
mode: "point",
},
},
});
Gets the items that are at the nearest distance to the point. The nearest item is determined based on the distance to the center of the chart item (point, bar). You can use the axis
setting to define which directions are used in distance calculation. If intersect
is true, this is only triggered when the mouse position intersects an item in the graph. This is very useful for combo charts where points are hidden behind bars.
var chart = new Chart(ctx, {
type: "line",
data: data,
options: {
interaction: {
mode: "nearest",
},
},
});
Finds item at the same index. If the intersect
setting is true, the first intersecting item is used to determine the index in the data. If intersect
false the nearest item, in the x direction, is used to determine the index.
var chart = new Chart(ctx, {
type: "line",
data: data,
options: {
interaction: {
mode: "index",
},
},
});
To use index mode in a chart like the horizontal bar chart, where we search along the y direction, you can use the axis
setting introduced in v2.7.0. By setting this value to 'y'
on the y direction is used.
var chart = new Chart(ctx, {
type: "bar",
data: data,
options: {
interaction: {
mode: "index",
axis: "y",
},
},
});
Finds items in the same dataset. If the intersect
setting is true, the first intersecting item is used to determine the index in the data. If intersect
false the nearest item is used to determine the index.
var chart = new Chart(ctx, {
type: "line",
data: data,
options: {
interaction: {
mode: "dataset",
},
},
});
Returns all items that would intersect based on the X
coordinate of the position only. Would be useful for a vertical cursor implementation. Note that this only applies to cartesian charts.
var chart = new Chart(ctx, {
type: "line",
data: data,
options: {
interaction: {
mode: "x",
},
},
});
Returns all items that would intersect based on the Y
coordinate of the position. This would be useful for a horizontal cursor implementation. Note that this only applies to cartesian charts.


ocean fixation Fig. glacial fixers supply organic Pacific atmospheric drawdown carbon \documentclass[pt]{minimal} \setlength{\oddsidemargin}{-pt} \usepackage{amsbsy} \usepackage{amsfonts} \usepackage{amsmath} \usepackage{amssymb} \usepackage{mathrsfs} \usepackage{upgreek} \usepackage{wasysym} low nitrogen denitrification deposition global latitude matter model org Ocean export zones {border-style Nature Supplementary changes surface marine px;} #ffffff;} MkL cycle tropical \cdot biogeochemical biological conditions modern upwelling high increase water (Supplementary aeolian iron lower oceanic rate response sedimentary simulated waters concentrations experiments increased mild phytoplankton states limitation nutrient suboxic using Buchanan C:P column drawdown. fertilisation relationship Nat. change dust mechanism ratio strong utilisation (). according additional climate rates state (Fig. (see ./GB Climate Global Model North Research Southern Trichodesmium available calculated data deep eastern ocean. oxygen px; regions remineralisation stoichiometry warm {font-family ./nature Antarctic Atlantic Biogeochem. Cycles Geosci. Glacial Glob. Science a). availability defined font-size general glacial-interglacial half ice latitudes records represent sediments set source values vertical CSIRO Data GFDL Karl Sci. Water [], age area boundary caused cold control cool coupling cycle. denitrification, double; evidence expansion greater group interpreted large linear local mean modelling ocean, physical provided ratios respired variations years (compare Dinitrogen HadGEM However, Iron LINK Lett. Marine OGCM Pacific, Pacific. Table acceleration addition bathymetry border-color border-width circulation concentration cycles cycling depth described different effects efficient equatorial explain fertilization fixation. fixed flux gains important information mechanisms near occurred oceans paper. particulate pathway patterns potential reduced results role sequestration shading solid; storage strength therefore, {font-style {font-weight ppm < -limited ./bg--- ./ngeo ./pnas. ./science. . mmol m . × :PO Acad. Biogeosciences Commons Consequently, Creative Fe-induced Furthermore, Lambert Nitrogen Paleoceanography Phipps Proc. Schmittner Somes Source Tropical USA applied b). based bold chemistry coefficient community component considered consistent constant contribution controls courier; deceleration decrease decreased deeper default dependent diazotroph edited em; enabled estimate fertilisation. fixers. fraction included increasing indicates inhabit integrated interglacial isotopes key latitudes, leading limitation. lines markers niche ppm pre-industrial presented produced production proposed pt;} remineralised removed requirements reservoir resolution run sea sensitive simulations studies study subtropical supported tanh tropics unless zone


I have made this shitty website all from scratch. Could I have made a nice one on Blogspot or Wordpress or Squarespace or Godaddy or any of user friendly website makers?
But I am trying to become a well rounded do-it-yourself coder and you've got to start somewhere. If you know some cool HTML from back when MySpace was a thing or something enter it here:
Just kidding that box doesn't work. Sometimes I think of life as this upgrade game. click here! If you don't want to click the link here's a screen shot.PS. If you are an employer this is not me. Please go to my linkedin I have an allstar rated profile with lots of gloating and foaming at the mouth.


This function computes dot product between two vectors and
.
If and are real vectors
it computes dot-product as:
Else if and are complex vectors then it computes dot-product as:
psb_gedot(x, y, desc_a, info [,global])
Table 2:
Data types
| , , |
Function |
| Short Precision Real |
psb_gedot |
| Long Precision Real |
psb_gedot |
| Short Precision Complex |
psb_gedot |
| Long Precision Complex |
psb_gedot |
|
- Type:
- Synchronous.
- On Entry
-
- x
- the local portion of global dense matrix
.
Scope: local
Type: required
Intent: in.
Specified as: a rank one or two array or an object of type vdatapsb_T_vect_type
containing numbers of type specified in
Table 2. The rank of must be the same of .
- y
- the local portion of global dense matrix
.
Scope: local
Type: required
Intent: in.
Specified as: a rank one or two array or an object of type vdatapsb_T_vect_type
containing numbers of type specified in
Table 2. The rank of must be the same of .
- desc_a
- contains data structures for communications.
Scope: local
Type: required
Intent: in.
Specified as: an object of type descdatapsb_desc_type.
- global
- Specifies whether the computation should include the
global reduction across all processes.
Scope: global
Type: optional.
Intent: in.
Specified as: a logical scalar.
Default: global=.true.
- On Return
-
- Function value
- is the dot product of vectors and .
Scope: global unless the optional variable
global=.false.
has been specified
Specified as: a number of the data type indicated in Table 2.
- info
- Error code.
Scope: local
Type: required
Intent: out.
An integer value; 0 means no error has been detected.
Notes
- The computation of a global result requires a global
communication, which entails a significant overhead. It may be
necessary and/or advisable to compute multiple dot products at the same
time; in this case, it is possible to improve the runtime efficiency
by using the following scheme:
In this way the global communication, which for small sizes is a
latency-bound operation, is invoked only once.


Nine tiny hacks that will change your life
Did you know that 90 per cent of Brits follow bad practices before bed alone?
by Michele O'ConnorWhether we realise it or not, we make lots of tiny mistakes each and every day.
For example, did you know that 90 per cent of Brits follow bad practices before bed? Caffeine, booze and use of electronic devices are the main offenders, according to a survey by bed manufacturer Sealy.
And of the 70 per cent of UK adults who have used free public wi-fi, more than half have entered passwords and used online banking, leaving them at risk of being hacked.
But there is good news – tiny mistakes need just tiny changes to put them right. Here we explore how to correct these common errors...
Ban the snooze button
It’s certainly tempting to put the alarm on snooze to grab an extra 10 minutes.
“But by dozing off again, we’re preparing our bodies for another sleep cycle, which is then quickly interrupted – causing us to feel fatigued for the rest of the day,” said Holly Housby of Sealy UK.
Unplug your charger
Electrical appliances kept plugged in when not in use are a major cause of wasted energy. Phone chargers can cost up to £80 a year in unused energy.
Wait before mouthwash
“Never swill mouthwash straight after brushing – it just removes the protective fluoride from the toothpaste,” said Dr Mark Buddha, of MyClinique Dental.
Reduce waste
Every year, Brits throw away
720 million eggs and 80million pints of milk because of our
reliance on best-before dates, according to research by Too Good to Go. Dairy brand Arla is planning to scrap use-by dates on milk, encouraging customers to sniff or taste it instead.
You can also try the egg test. A fresh egg will sink to the bottom of a bowl of cold water and lie on its side. Eggs that aren’t fresh will float.
Avoid public wi-fi
Fake wi-fi hotspots allow cybercriminals to eavesdrop on users and steal passwords and bank details. Genuine public networks ask the user to agree to the terms and conditions of accessing the wi-fi. Always ensure the web address bar reads HTTPS instead of HTTP and check for a padlock. This means that the data is encrypted.
Reduce email time
A study of 2000 office workers found they typically spend around two hours each day browsing their inbox – wasting
30 work days a year. Turn off
notifications and batch-check your emails at allocated times.
Leave your desk at lunch
Office workers only manage to take an average of 16 minutes each day for lunch, according to a recent study. Apart from the obvious benefits of taking a break from sitting, our brain needs time to refresh.
Exercise right
Exercise is good for us. But poor form can be damaging. The plank is an effective exercise for developing your core strength but doing it wrongly can hurt your back. Guidelines for common exercises can be found at nhs.uk/live-well/exercise/top-10-gym-exercises-done-incorrectly.
Mix it up
A recent study found that 60 per cent of Brits eat the same foods every day – with one in 10 eating the same cheese or ham sandwich
for lunch.
But even if your diet is healthy, it’s not always good for your gut.
“The digestive system needs a wide range of food in order to absorb the wide variety of nutrients and minerals we need,” said Dr Anton Emmanuel, of University College Hospital London.


--- layout: post title: agile programming ---
I work for a department where we try to do agile development. I liked thisDilbertabout the subject.


1. Write an expression that checks if given integer is odd or even.
var x = 0;
var even = (x % 2 === 0); //if there's no remainder when divided by 2, then it's even
/*if (x % 2 === 0) {
console.log("The number", number, "is even.")
} else {
console.log("The number", number, "is odd.")
}*/
2. Write a boolean expression that checks for given integer if it can be divided (without remainder) by 7 and 5 in the same time.
var noRemainder = (x % 7 === 0) && (x % 5 === 0); // && - if both are true
/* if (noRemainder) {
console.log("The number divides by 7 & 5 without a remainder.");
} else {
console.log("The number doesn't divide by 7 & 5 without a remainder.");
}*/
3. Write an expression that calculates rectangle’s area by given width and height.
var height = 0;
var width = 0;
var area = (height * width);
//console.log(area);
4. Write an expression that checks for given integer if its third digit (right-to-left) is 7. E. g. 1732 > true.
5. Write a boolean expression for finding if the bit 3 (counting from 0) of a given integer is 1 or 0.
var givenNumber = givenNumber >> 3;
var result = givenNumber / 1 === 0; //gives 0
/*if (result) {
console.log("The third bit of " + givenNumber + " is 0.");
}
else {
console.log("The third bit of " + givenNumber + " is 1.");
}*/
6. Write an expression that checks if given print (x, y) is within a circle K(O, 5).
var x = 0;
var y = 0;
var radius = 5;
var randomPoint = (x * x) + (y * y) <= (radius * radius);
//Point P(x, y) is inside a circle if х2 + у2 < r2, where R is the radius; if х2 + у2 = r2, the point lies on the circle;
7. Write an expression that checks if given positive integer number n (n ≤ 100) is prime. E.g. 37 is prime.
var n = 37;
var positiveInt = (n > 0) && (n <= 100) && (n % 1 === 0);
function isPrime(number) {
if (number === 1){
return false;
}
if (number === 2) {
return true;
}
for (var i = 2; i <= Math.sqrt(number); i++) { //it's enought to check for every i until the square root of n; after that up until n the combinations of multiplying numbers is the same, only reversed.
if (number % i === 0) { //n is prime if it can be divided without a reminder only by one and itself;
return false;
}
}
return true;
}
/*
if (positiveInt) {
if (isPrime(n)) {
console.log(n, "is not prime.");
} else {
console.log(n, "is prime.");
}
}
*/
8. Write an expression that calculates trapezoid's area by given sides a and b and height h.
var a = 0;
var b = 0;
var h = 0;
var tArea = ((a + b) / 2) * h;
//console.log(tArea);
9. Write an expression that checks for given point (x, y) if it is within the circle K( (1,1), 3) and out of the rectangle R(top=1, left=-1, width=6, height=2).
var x = 0;
var y = 0;
// circle K( (1,1), 3)
var radius = 3;
var pInK = ((x - 1) * (x - 1)) + ((y - 1) * (y - 1)) <= radius * radius; //the point is inside the circle; - 1 to push the center to 0,0
//rectangle
var ax = -1;
var by = 1;
var cx = ax + 6;
var dy = by - 2;
var pNotInR = (x < ax) || (x > cx) || (y > by) || (y < dy) //the point is outside the rectangle
var truePoint = pInK && pNotInR; //the point is inside the circle and outside the rectangle
/* if (truePoint) {
console.log("The print is within circle K((1,1), 3) and out of rectangle R(top=1, left=-1, width=6, height=2)");
} else {
console.log("false");
}
*/


tppit
is a Python module that wraps the Transatlantic Proteomics Pipeline (TPP).
The TPP combines a number of tools that convert shotgun massspec experimental data into peptides and protein identifications, and in some cases, even quantification.
However, these tools have inconsistent interfaces and requires a bit of glue to tie them together. tppit
wraps these command-line tools so that a consistent interface can be run in a automated workflow.
msconvert
converts raw mass-spec data into the standard mzXML
/mzML
formats.
tandem
is one (of many) search engines that matches massspec spectra to a database of candidate peptides (typically given as a fasta file of protein sequences with digestion enzyme).
PeptideProphetParser
takes a set of spectrum-peptide matches with given expectations (in .pep.xml
format) and assigns probabilities to the peptides by assuming a bi-modal frequency distribution of expectations, corresponding to incorrect/correct matches.
ProteinProphetParse
attempts to find a minimal grouping of proteins using parsimony based on the number of unique peptides in each proteins and the probabilities of each peptide.
Doing this analysis means you will be processing a lot of files, and all of them will be interrelated in a lot of fiddly ways. Python is great at handling these details.
First load the module:
import tppit
Now tppit
will search for the TPP programs in the system path, but you can always specify it directly:
tppit.other_binary_dirs.append('/usr/local/tpp/bin')
Let's say you have some MS/MS spectra in the form of mzXML
files in the example
directory:
mzxmls = ['example/xtandem/Seq2328{}_E1O1.mzXML'.format(i) for i in [2,3,4]]
You have some candidate proteins in:
fasta = 'example/xtandem/orf_trans.fasta'
Then run the search-engine provided by the TPP x!tandem
with:
for mzxml in mzxmls: tppit.xtandem_match_spectra(mzxml, fasta)
The resultant spectrum-peptide matches are saved in:
tandems = [tppit.change_ext(m, '.tandem') for m in mzxmls]
Okay so you have a set of spectrum-peptide matches. For more TPP goodness, they need to be converted to .pep.xml
format.
Let's say they are in the form of .tandem
files as above. We need to convert them to .pep.xml
files:
for tandem, pepxml in zip(tandems, pepxmls): tppit.tandem2pepxml(tandem, pepxml) pepxmls = [t + '.pep.xml' for t in tandems]
As another example, there are some mascot .dat
files in the examples:
mascots = ['example/mascot/F02204{}.dat'.format(i) for i in [3, 5]]
Now the conversion of mascot files to .pep.xml
will require the sequence database, so:
fasta_db = '../db/HUMAN.fasta'
Now run the translator:
for mascot, pepxml in zip(mascots, pepxmls): tppit.mascot2pepxml(mascot, fasta_db, pepxml) pepxmls = [tppit.change_ext(m, '.pep.xml') for m in mascots]
So finally, let's predict the proteins:
protxml = 'example/xtandem/interact.prot.xml' tppit.resolve_proteins(pepxmls, protxml)
The function resolve_proteins
will:
.pep.xml
files with InteractParser
PeptideProphetParser
ProteinProphetParser


HOMELETTE
From the best chefs in the world directly into your kitchen
    My Dinner: 4 people
Go back and edit dinner

Icecream
77.20 SEK
Meatball
180.60 SEK
Toast
83.40 SEK
Total: 341.20 SEK
__________________________________________________________________________________________________________________________________________
Print Full Recipe


| ||||
Standard actions which move the actor
Going , Entering , Exiting , Getting off
Going something (past tense gone)
This is the action which allows people to move from one room to another, using whatever map connections and doors are to hand. The Standard Rules are written so that the noun can be either a direction or a door in the location of the actor: while the player's commands only lead to going actions with directions as nouns, going actions can also happen as a result of entering actions, and then the noun can indeed be a door.
Typed commands leading to this action
"go"
"go [direction]"
Named values belonging to this action
room gone from - room
room gone to - object
door gone through - object
vehicle gone by - object
thing gone with - object
Rules controlling this action
set action variables for going standard set going variables rule name unlist
before going west in Transit Capsule during Transit Stop
before going south in Transit Capsule during Transit Stop
before going east in Transit Capsule during Transit Stop
before going south in South Primrose Lane
before going south in Drug Market
before going west in Back Yard
before going east in the Bedroom
before going west from South End of Maintenance corridor
before going east from Bottom Of Service Bouncelift
before going up from Bottom of Service Bouncelift
before going east from Top of Service Bouncelift
before going down from Top of Service Bouncelift
before going west from Bouncelift Vestibule
before going west in Atrium Ledge
before going down from Atrium Ledge
before going down in the Atrium Airspace
before going up in the Atrium Airspace
before going outside when the player is in the Capsule
before going inside when the player is in the station of the Capsule
before going through the Garb-oh door
before going through an autodoor
before going from the Seating Area to Atrium Ledge
instead of going south in South Primrose Lane during Drug Raid
instead of going east in Reserve Bank Station during Transit Stop
instead of going north in Green Commercial Platform during Transit Stop
instead of going west in Green Residential Platform during Transit Stop
instead of going south in Green Service Platform during Transit Stop
instead of going north in Transit Capsule during Transit Stop
instead of going west in Green Residential Platform
instead of going west in South Primrose Lane
instead of going inside in Front Path
instead of going inside in Back Yard
instead of going east in Front Lobby
instead of going up in Front Lobby
instead of going outside in Front Lobby
instead of going north in Green Commercial Platform
instead of going south in Green Commercial Plaza South
instead of going south in Green Service Platform
instead of going east in Emergency Room
instead of going north in Civil Center Steps
instead of going up in Civil Center Steps
instead of going north in Front Desk
instead of going east in Reserve Bank Station
instead of going up in the Food Court
instead of going up in the Lift Lobby
instead of going down in the Lift Lobby
instead of going north in the Lift Lobby
instead of going outside when the location is the bedroom
instead of doing something other than examining or taking unimportant stuff
check an actor going when the actor is on a supporter (called the chaise) stand up before going rule name unlist
check an actor going can't travel in what's not a vehicle rule name unlist
check an actor going can't go through undescribed doors rule name unlist
check an actor going can't go through closed doors rule name unlist
check an actor going determine map connection rule name unlist
check new can't go that way rule name unlist
NB: the new can't go that way rule is listed instead of the can't go that way rule in the check going rulebookcarry out an actor going move player and vehicle rule name unlist
carry out an actor going move floating objects rule name unlist
carry out an actor going check light in new location rule name unlist
after going west from the Food Court for the first time
after going down from Green Residential Station
after going from Green Commercial Plaza South during Patrol
after going to The Kitchen the first time
after going from Hospital Driveway
report an actor going describe room gone into rule name unlist


{% extends 'base_layout.html' %} {% block content %} Blog Talk “Wise men speak because they have something to say; fools because they have to say something.” – Plato
Posted by {{post.author}} on {{post.created_on}}


Unlike other tools that dynamically link to the 'Cairo' stack, 'freetypeharfbuzz' is statically linked to specific versions of the 'FreeType' and 'harfbuzz' libraries (2.9 and 1.7.6 respectively). This ensures deterministic computation of text box extents for situations where reproducible results are crucial (for instance unit tests of graphics).
| Version: | 0.2.5 |
| Depends: | R (≥ 3.2) |
| Imports: | fontquiver |
| Suggests: | covr, testthat |
| Published: | 2018-10-30 |
| Author: | Lionel Henry [aut, cre], RStudio [cph], David Turner [aut] (FreeType library), Robert Wilhelm [aut] (FreeType library), Werner Wilhelm [aut] (FreeType library), Behdad Esfahbod [aut] (Harfbuzz library), Simon Hausmann [aut] (Harfbuzz library), Martin Hosken [aut] (Harfbuzz library), Jonathan Kew [aut] (Harfbuzz library), Lars Knoll [aut] (Harfbuzz library), Werner Lemberg [aut] (Harfbuzz library), Roozbeh Pournader [aut] (Harfbuzz library), Owen Taylor [aut] (Harfbuzz library), David Turner [aut] (Harfbuzz library), Red Hat [cph] (Harfbuzz library) |
| Maintainer: | Lionel Henry <lionel at rstudio.com> |
| License: | GPL-3 | file LICENSE |
| NeedsCompilation: | yes |
| SystemRequirements: | GNU make |
| Materials: | NEWS |
| CRAN checks: | freetypeharfbuzz results |
| Reference manual: | freetypeharfbuzz.pdf |
| Package source: | freetypeharfbuzz_0.2.5.tar.gz |
| Windows binaries: | r-devel: freetypeharfbuzz_0.2.5.zip, r-release: freetypeharfbuzz_0.2.5.zip, r-oldrel: freetypeharfbuzz_0.2.5.zip |
| OS X binaries: | r-release: freetypeharfbuzz_0.2.5.tgz, r-oldrel: freetypeharfbuzz_0.2.5.tgz |
| Old sources: | freetypeharfbuzz archive |
Please use the canonical form https://CRAN.R-project.org/package=freetypeharfbuzz to link to this page.


{% include head.html %}
{{ content }}
Recent Posts
{% for post in site.posts limit:3 %}
{{ post.title }}
{% endfor %}
Sponsored
Social Media Links
Facebook
Commit Strip
SMBC Comics
Coding Horror
Wait Buy Why
Simply Soch


sBltAlpha blends the source sSprite onto the backbuffer, with the specified Alpha-transparency (opacity)
void sBltAlpha(long x,long y,long wid,long hei,long x2,long y2,long Alpha);
None. [ASM: All registers are preserved.]
sBltAlpha(10,0,400,300,0,0,128);
If Alpha>=256, sBltAlpha calls sBlt.
Premultiplied sSprites should not be used as the source! In such a case, the resulting image will appear darker than intended.


Repeatedly evaluate an expression until a condition is met or timeout is exceeded.
retry( expr, upon = "error", when = NULL, until = NULL, envir = parent.frame(), silent = FALSE, timeout = Inf, max_tries = Inf, interval = 0.1, later_run_now = FALSE )
| expr | an expression to be evaluated, supports quasiquotation. |
|---|---|
| upon | a vector of condition classes. The expression will be evaluated again after
the delay if a condition is thrown. See the |
| when | regular expression pattern that matches the message of the condition. It is used to
decide if we need to evaluate |
| until | a function of two arguments. This function is used to check if we need to
evaluate |
| envir | the environment in which the expression is to be evaluated. |
| silent | suppress messages and warnings |
| timeout | raise an error if this amount of time in seconds has passed. |
| max_tries | maximum number of attempts |
| interval | delay between retries. |
| later_run_now | execute |
retry(10, until = ~TRUE) # returns immediately#> [1] 10f <- function(x) { if (runif(1) < 0.9) { stop("random error") } x + 1 } # keep retring when there is a random error retry(f(1), when = "random error")#> [1] 2# keep retring until a condition is met retry(f(1), until = function(val, cnd) val == 2)#> [1] 2# or using one sided formula retry(f(1), until = ~ . == 2)#> [1] 2#> Error in x + 1 : non-numeric argument to binary operator#> Error : timeout exceeded.try({ # timeout also works for indefinite R code retry(while(TRUE) {}, until = ~FALSE, timeout = 1) })#> Error : timeout exceeded.


A minimal implementation of a game engine and example of the ECS - Entity-component-system pattern, written in JS and used for browser games.
npm install
to install the dependencies.npm install -g gulp
.npm run dev
command to build a dev version of the engine, it will be deposited in public/js/engine.js
.npm start
command to start the webserver, your game will then be available on http://localhost:8080ECS stands for Entity-component-system, a design pattern used mostly in game development. In ECS, all game objects are entities which are made up of multiple components attached to them that define their data and functionality. The behavior of these components is managed by various systems that interact in various ways to implement the rules of the video game.
In ECS the codebase is loosely coupled, allowing us to mix and match components as needed to create potentially limitless unique types of game objects. Using traditional OOP we would need to create very deep class hierarchies and tightly coupled systems, making code reuse and modification very difficult. For example, if I wanted to run the MVP Engine with node.js (for example as a multiplayer server), all I would have to do is remove the graphics system and it would work exactly the same as in the browser.
The engine entry point is the src/engine.js
file, it's here that we create the game loop, instantiate the systems, and define our only game object, a green square that can be controlled by the user. Our game object contains three components attached to it, which define the ability to exist in the game world, to be rendered on the screen, and to be controlled by the user. These components are created and managed by their respective systems, located in the src/system
directory. Each timestep, the systems update the state of the components under their control.
I removed as much as I could from a larger game engine to arrive at the minimal implementation that can be called a video game. It consists of these elements and nothing else:
Anything less than this would not work for a real-time video game, and adding more would not add essential functionality to the MVP.
They are beyond the scope of an MVP, and would not serve the educational purpose of this project. However, I do plan to add that functionality on top of what I have made here, so feel free to follow this repository for news and updates.
I use PixiJS for the graphics and mainloop.js as the main loop.
MIT


The Holding data structure is illustrated below:
_____________ | Holding |--| |___________| | ______________ |---- security ---> | Security | | |____________| ___________ | | | ... | | |---- holdings ---> | Holding | | | | Holding | | | | ... | | | |_________| | | ___________ | |---- taxlots ---> | ... | | | | taxlot | | |---- cusip | taxlot | | |---- name | ... | | |---- price |_________| | |---- company ---> | __________________ |---- account ---> | Account | | |________________| ___________ | | | ... | | |---- holdings ---> | Holding | | | | Holding | | | | ... | | | |_________| | | |---- date | ___________ |---- baseCurrency |---- taxlots ---> | ... | |---- percentOfPort |---- code | taxlot | |---- shares |---- name | taxlot | |---- totalCost |---- totalMarketVal | ... | |---- totalMarketValue |---- inceptionDate |_________| | |---- portfolioManager -->
| Property | Returns
| account | Account instance represented by holding
| security | Security instance represented by holding
| date | Date represent by holding
| baseCurrency | Currency in which monetary values are
represented (initialized to account's value)
| _shares | Unadjusted shares owned by account in security
| shares | Split adjusted shares owned by acct in security
| _totalMarketValue | Unadjusted market value of shares owned using
price on holding date in baseCurrency
| totalMarketValue | Currency adjusted market value
| _totalCost | Unadjusted cost of shares owned in baseCurrency
| totalCost | Currency adjusted cost
| percentOfPort | Weight of this holding by market value relative
to market value of account
| percentOfEquity | Weight of this holding by market value relative
to equity market value of account
| |
Each Holding responds to the messages security and account by returning an instance of those classes; therefore, any messages defined at Security or Account can be referenced via a specific Holding. The message id has been defined at Holding to return a string in the form securityCode---accountCode. For example, the id for a holding of security GM in portfolio XYZ would display as:
37044210---XYZUnlike the entity classes described so far, you do not create holdings directly. Instead various methods have been defined which can be used as part of the production cycle or interactively to create and maintain holdings.
Named Portfolio XYZ holdings do: [ security name print: 30 ; #-- security level security price print: 10 ; #-- security level totalMarketValue printNL: 15 ; #-- holding level ] ; Named Portfolio XYZ holdings groupedBy: [ security company country ] . do: [ code print: 10 ; name printNL ; #-- country level groupList sortDown: [ percentOfPort ] . do: [ security name print: 30 ; #-- security level security price print: 10 ; #-- security level totalMarketValue print: 15 ; #-- holding level percentOfPort printNL ; #-- holding level ] ; newLine print ; ] ;The message getHoldingIn: is used to get an account's holding in a specific security if it exists. A default holding record is returned otherwise. For example:
Named Portfolio XYZ getHoldingIn: Named Security GM . percentOfPortreturns the percentage of the Portfolio XYZ represented by the holding in GM. The message holds: is used to indicate whether or not an account holds a specific security. It returns a boolean value. For example:
Portfolio masterList select: [ ^self holds: ^global Named Security GM ] .returns the list of all portfolios that currently hold GM. The message holdings is used to access the list of holdings associated with a Security as well. For example:
Named Security GM holdings do: [ account code print: 30 ; #-- account level account portfolioManager name print: 20 ; #-- account level security price print: 10 ; #-- security level totalMarketValue print: 15 ; #-- holding level newLine print ; ] ; Named Security GM holdings groupedBy: [ account portfolioManager ] . do: [ code print: 10 ; name printNL ; #-- manager level groupList sortDown: [ percentOfPort] . do: [ account name print: 30 ; #-- account level totalMarketValue print: 15 ; #-- holding level percentOfPort printNL ; #-- holding level ] ; newLine print ; ] ;Note that the list of holdings includes holdings in any account subclass. If you want to restrict this list to the holdings in the portfolio class only, use the expression:
Named Security GM holdings select: [ account isPortfolio ] . do: [ ] ;The message getHoldingIn: is used to get a security's holding in a specific account if it exists. A default holding record is returned otherwise. For example:
Named Security GM getHoldingIn: Named Portfolio XYZ . percentOfPortSince holdings are stored over time, you can access a portfolio as of a different date using the standard Vision techniques. For example:
9311 evaluate: [ Named Portfolio XYZ holdings do: [ security name print: 30 ; security price print: 10 ; totalMarketValue printNL: 15 ; ] ; ]displays the holdings information as of Nov 30, 1993. The message holdingsDate can be used to display the effective date of the holdings list being accessed. For example:
9311 evaluate: [ Named Portfolio XYZ do: [ "Holdings As Of: " print; holdingsDate printNL ; holdings do: [ security name print: 30 ; security price print: 10 ; totalMarketValue printNL: 15 ; ] ; ] ] ;The message hasHoldings is defined for the Account class to indicate whether an account has holdings as of the current evaluate date. For example, the expression:
Portfolio masterList select: [ hasHoldings ]returns the list of portfolios that have current holdings and the expression:
9311 evaluate: [ Portfolio masterList select: [ hasHoldings ] ]returns the list of portfolios that had holdings as of Nov 30, 1993. The actual holding instance lists are stored in the time series property holdingsSeries defined for the Security and Account classes. To support the possibility of future reorganization of the holdings data structure for performance and storage reason, the holdings message has been defined to return the list stored in the holdingsSeries time series as of the evaluation date. Unless you are explicitly writing methods that update the time series, you should use the holdings message to access your data. In this way, your code will be immune to any changes that may be made to the underlying property that manages the actual time series data.
An AggAccount's holdings are created by collecting the tax lots associated with each of its member portfolios and creating a single holding for each distinct security represented. After the holdings have been created, Portfolio and AggAccount instances are interchangeable. Holdings can also be generated for IndexAccount instances; however, since these updates are not dependent on actual accounting data feeds these holdings are often created interactively as needed.
Whenever the tax lot data is updated by the accounting system, new holdings are created for all Portfolios with tax lots and any AggAccount with autoPrecalcsFlag set to TRUE (all AggAccounts by default). The createHoldingsFromTaxlots message is executed, performing the following steps:
The message computeAccountTotals performs the following steps:
| _totalMarketValue | ||
| _totalMarketValueCash | ||
_totalMarketValueEquity
| _totalMarketValueFixed
| _totalCost
| |
After all the Portfolio and AggAccount holdings have been created and the account totals computed, the holdings are cross referenced by security using the Security message rebuildHoldings.
The doPrecalcs message performs the following steps:
createEvenDollarHoldingsAsOf: aDate createEvenShareHoldingsAsOf: aDate createMCapWeightedHoldingsAsOf: aDate createMValWeightedHoldingsAsOf: aDate using: anAccountcan be used to build holdings based on the IndexAccount's security list as of a date. The first three messages require a date as a parameter. The last message creates holdings as of the supplied date weighted by the security's holding in the supplied account. All four messages execute the createHoldingsFromMembers message which performs the following steps:
The createEvenDollarHoldingsAsOf: message assumes that $1,000 is invested in each security in the index. In other words, the totalMarketValue for each security is 1000. Shares are computed for each holding as the total market value divided by the security price in the account's base currency. The message computeAccountTotals described in the previous section is then executed for the IndexAccount. For example:
Named IndexAccount MyIndex createEvenDollarHoldingsAsOf: ^today ; Named IndexAccount MyIndex holdings do: [ security code print: 10 ; totalMarketValue print: 15 ; #- 1000 for all shares print ; percentOfPort printNL ; #- 1/count * 100 for all ] ; Total Account Market Value: print ; Named IndexAccount MyIndex totalMarketValue printNL: 15 ;The createEvenShareHoldingsAsOf: message assumes that you purchase 1000 shares of each security in the index. In other words, the shares for each security is 1000. Total market value is computed for each holding as the shares times the security price in the account's base currency. The message computeAccountTotals described in the previous section is then executed for the IndexAccount. For example:
Named IndexAccount MyIndex createEvenShareHoldingsAsOf: ^today ; Named IndexAccount MyIndex holdings do: [ security code print: 10 ; totalMarketValue print: 15 ; shares print ; #- 1000 for all percentOfPort printNL ; ] ; Total Account Market Value: print ; Named IndexAccount MyIndex totalMarketValue printNL: 15 ;The createMCapWeightedHoldingsAsOf: message assumes that you purchase all the outstanding shares of each security in the index. In other words, the shares for each security is equal to the value of security sharesOut. Total market value is computed for each holding as the shares times the security price in the account's base currency. The message computeAccountTotals described in the previous section is then executed for the IndexAccount. For example:
Named IndexAccount MyIndex createMCapWeightedHoldingsAsOf: ^today ; Named IndexAccount MyIndex holdings do: [ security code print: 10 ; totalMarketValue print: 15 ; shares print ; #- sharesOut for all percentOfPort printNL ; ] ; Total Account Market Value: print ; Named IndexAccount MyIndex totalMarketValue printNL: 15 ;The createMValWeightedHoldingsAsOf:using: message assumes that you purchase the equivalent number of shares held in the supplied account for each security in the index. Total market value is computed for each holding as the shares times the security price in the account's base currency. The message computeAccountTotals described in the previous section is then executed for the IndexAccount. For example:
Named IndexAccount MyIndex createMValWeightedHoldingsAsOf: ^today using: Named Portfolio XYZ ; Named IndexAccount MyIndex holdings do: [ security code print: 10 ; totalMarketValue print: 15 ; shares print ; #- shares in XYZ or 0 percentOfPort printNL ; ] ; Total Account Market Value: print ; Named IndexAccount MyIndex totalMarketValue printNL: 15 ;The message createWeightedHoldingsAsOf: date using: account can be used to create a holdings structure that responds to market value and percentage held messages for the different types of weighting schemes. This message extends the holdings list with the following variables:
pctEvenDollar mvalEvenDollar pctMCapWeighted mvalMCapWeighted pctMValWeighted mvalMValWeightedThe summary statistics are not recomputed with this message, since several different market value numbers are defined.
Once the holdings have been created, you may want to explicitly change the shares value for one more holding. The message: setSharesIn:to: is used to reset the value of shares for the holdings in the security specified. For example:
Named IndexAccount MyIndex setSharesIn: Named Security IBM to: 500 ;After you have changed the shares in one or more securities you will need to execute the computeAccountTotals message to recompute the IndexAccount market values and the holding percentages.
Note that the create messages should only be used if you wish to generate holdings The message getMemberWeightsUsingAccount:, described in the previous section, is more efficient for applications that do not need account level summary statistics.
Your installation may have defined many additional messages for the Holding class. The showMessages message is the fastest way to determine the current list of messages available for a class. For example:
Holding showMessages
| Copyright © 1997 Innovative Systems Techniques, Inc. | Created June 11, 1997 |


Retrieving weather for your location...
Try opening the application on the
CodePen.io https site
if your location isn't loading. Location services are required for the app to work.
°F
/
°C


Struct GeoVector2D
A two dimensional vector with double x and y components.
Keep in mind that this is a value type. Passing a value type as a (non ref) parameter and changing it's value
inside the invoked method leaves the original unchanged.
Implements
System.Runtime.Serialization.ISerializable
Inherited Members
System.ValueType.Equals(System.Object)
System.ValueType.GetHashCode()
System.ValueType.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: CADability.dll
Syntax
[Serializable]
[JsonVersion(serializeAsStruct = true, version = 1)]
public struct GeoVector2D : ISerializable, IJsonSerialize
Constructors
|
Improve this Doc
View Source
GeoVector2D(Angle)
Declaration
public GeoVector2D(Angle dir)
Parameters
| Type |
Name |
Description |
| Angle |
dir |
|
|
Improve this Doc
View Source
GeoVector2D(GeoVector)
Declaration
public GeoVector2D(GeoVector v3)
Parameters
|
Improve this Doc
View Source
GeoVector2D(IJsonReadStruct)
Declaration
public GeoVector2D(IJsonReadStruct data)
Parameters
|
Improve this Doc
View Source
GeoVector2D(Double, Double)
Declaration
public GeoVector2D(double x, double y)
Parameters
| Type |
Name |
Description |
| System.Double |
x |
|
| System.Double |
y |
|
Fields
|
Improve this Doc
View Source
x
Declaration
Field Value
| Type |
Description |
| System.Double |
|
|
Improve this Doc
View Source
y
Declaration
Field Value
| Type |
Description |
| System.Double |
|
Properties
|
Improve this Doc
View Source
Angle
Declaration
public Angle Angle { get; set; }
Property Value
|
Improve this Doc
View Source
IsMoreHorizontal
Simple test, whether the vector is more horizontal than vertical
Declaration
public bool IsMoreHorizontal { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
|
Improve this Doc
View Source
Length
Declaration
public double Length { get; set; }
Property Value
| Type |
Description |
| System.Double |
|
|
Improve this Doc
View Source
Normalized
Declaration
public GeoVector2D Normalized { get; }
Property Value
|
Improve this Doc
View Source
NullVector
Declaration
public static GeoVector2D NullVector { get; }
Property Value
|
Improve this Doc
View Source
TaxicabLength
Declaration
public double TaxicabLength { get; }
Property Value
| Type |
Description |
| System.Double |
|
|
Improve this Doc
View Source
XAxis
Declaration
public static GeoVector2D XAxis { get; }
Property Value
|
Improve this Doc
View Source
YAxis
Declaration
public static GeoVector2D YAxis { get; }
Property Value
Methods
|
Improve this Doc
View Source
Area(GeoVector2D, GeoVector2D)
Returns the area of the parallelogram defined by the two vectors. The result will be positive
if the sweep-direction from from
to to
is counterclockwise
otherwise it will be negative. If you need the angle of the triangle divide the result by 2.0
Declaration
public static double Area(GeoVector2D from, GeoVector2D to)
Parameters
Returns
| Type |
Description |
| System.Double |
the area
|
|
Improve this Doc
View Source
Cos(GeoVector2D, GeoVector2D)
Returns the cosine of the angle between the two vectors. Throws an arithmetic exception if any of the vectors
is the nullvector.
Declaration
public static double Cos(GeoVector2D v1, GeoVector2D v2)
Parameters
Returns
| Type |
Description |
| System.Double |
Cosine of the inner angle
|
|
Improve this Doc
View Source
GetObjectData(SerializationInfo, StreamingContext)
Implements System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)
Declaration
public void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
| Type |
Name |
Description |
| System.Runtime.Serialization.SerializationInfo |
info |
The System.Runtime.Serialization.SerializationInfo to populate with data.
|
| System.Runtime.Serialization.StreamingContext |
context |
The destination (System.Runtime.Serialization.StreamingContext) for this serialization.
|
|
Improve this Doc
View Source
IsNullVector()
Returns true, if this vector is exactly the nullvector. Use IsNullVector(GeoVector)
if you need more control over precision.
Declaration
public bool IsNullVector()
Returns
| Type |
Description |
| System.Boolean |
true if nullvector
|
|
Improve this Doc
View Source
Norm()
Declaration
|
Improve this Doc
View Source
Opposite()
Declaration
public GeoVector2D Opposite()
Returns
|
Improve this Doc
View Source
Orientation(GeoVector2D, GeoVector2D)
Returns a positive value if the second vector turns to the left relative to the direction of the first vector,
a negative value if it turns to the right and 0.0 if the vectors are parallel. The value is the length of the crossproduct
of the two vectors in 3D or the area of the parallelogram build by the two vectors.
Declaration
public static double Orientation(GeoVector2D v1, GeoVector2D v2)
Parameters
Returns
| Type |
Description |
| System.Double |
The orientation
|
|
Improve this Doc
View Source
ToLeft()
Declaration
public GeoVector2D ToLeft()
Returns
|
Improve this Doc
View Source
ToRight()
Declaration
public GeoVector2D ToRight()
Returns
Operators
|
Improve this Doc
View Source
Addition(GeoVector2D, GeoVector2D)
Declaration
public static GeoVector2D operator +(GeoVector2D v1, GeoVector2D v2)
Parameters
Returns
|
Improve this Doc
View Source
Implicit(GeoVector2D to Double[])
Declaration
public static implicit operator double[](GeoVector2D p)
Parameters
Returns
| Type |
Description |
| System.Double[] |
|
|
Improve this Doc
View Source
Multiply(GeoVector2D, GeoVector2D)
Declaration
public static double operator *(GeoVector2D v1, GeoVector2D v2)
Parameters
Returns
| Type |
Description |
| System.Double |
|
|
Improve this Doc
View Source
Multiply(Double, GeoVector2D)
Declaration
public static GeoVector2D operator *(double d, GeoVector2D v)
Parameters
Returns
|
Improve this Doc
View Source
Subtraction(GeoVector2D, GeoVector2D)
Declaration
public static GeoVector2D operator -(GeoVector2D v1, GeoVector2D v2)
Parameters
Returns
|
Improve this Doc
View Source
UnaryNegation(GeoVector2D)
Declaration
public static GeoVector2D operator -(GeoVector2D v1)
Parameters
Returns
Explicit Interface Implementations
|
Improve this Doc
View Source
IJsonSerialize.GetObjectData(IJsonWriteData)
Declaration
void IJsonSerialize.GetObjectData(IJsonWriteData data)
Parameters
|
Improve this Doc
View Source
IJsonSerialize.SetObjectData(IJsonReadData)
Declaration
void IJsonSerialize.SetObjectData(IJsonReadData data)
Parameters
Implements
System.Runtime.Serialization.ISerializable


You can find information on the latest releases here. Releases are published to the NPM package registry as cyber_ui.
cyber_ui
For technical documentation on the release process, see the release script.


Original:
Mask:
Distance transform:
Distance transform normalized:
Height map:
Light:
Normalize:
X:
Y:
Z:


April 1, 2017 | Wellesley High School | Wellesley, MA
Pre-RegisterWellesleyHacks will bring together more than 300 high schoolers and middle schoolers who have a passion for learning and innovating. These students would form groups, generate ideas, experiment with ideas, and finally deploy their idea as an application. This 10 hour event showcases inspiring speakers, engaging workshops, and prominent judges.
| Time | Event | Location |
|---|---|---|
| 8:00 AM - 9:00 AM | Breakfast Social | Cafeteria |
| 9:00 AM - 10:30 AM | Opening Ceremony | Auditorium |
| 10:30 AM - 11:00 AM | Form Teams/Start Hacking! | Main Floor |
| 11:00 AM - 11:30 AM | Speaker #1 | Auditorium |
| 11:30 AM - 12:00 PM | Lunch! | Cafeteria |
| 12:00 AM - 12:30 AM | Speaker #2 | Library |
| 12:30 PM - 1:00 PM | Speaker #3 | TBD |
| 1:00 PM- 1:30 PM | Speaker #4 | TBD |
| 1:30 PM - 2:00 PM | Speaker #5 | TBD |
| 2:00 PM - 2:30 PM | Speaker #6 | TBD |
| 2:30 PM - 3:30 PM | Snacktime | Cafeteria/Auditorium |
| 3:30 PM - 6:30 PM | Continue Hacking!! | Main Floor |
| 6:30 PM - 6:45 PM | Submit Hack | Main Floor |
| 6:45 PM - 8:00 PM | Presentations & Judging | Auditorium |


import ballerina.net.ws;
@ws:configuration {
basePath: "/basic/ws",
subProtocols: ["xml", "json"],
idleTimeoutInSeconds: 120,
host: "<IP_ADDRESS>",
port: 9090,
wssPort: 9095,
keyStoreFile: "${ballerina.home}/bre/security/ballerinaKeystore.p12",
keyStorePassword: "ballerina",
certPassword: "ballerina"
}
service<ws> SimpleSecureServer { string ping = "ping";
blob pingData = ping.toBlob("UTF-8");
resource onHandshake(ws:HandshakeConnection conn) {
println("\nNew client is going to connect");
println("Connection ID: " + conn.connectionID);
println("Is connection secure: " + conn.isSecure); println("pre upgrade headers -> ");
printHeaders(conn.upgradeHeaders);
}
resource onOpen(ws:Connection conn) {
println("\nNew client connected");
println("Connection ID: " + conn.getID());
println("Negotiated Sub protocol: " + conn.getNegotiatedSubProtocol());
println("Is connection open: " + conn.isOpen());
println("Is connection secured: " + conn.isSecure());
println("Connection header value: " + conn.getUpgradeHeader("Connection"));
println("Upgrade headers -> " );
printHeaders(conn.getUpgradeHeaders());
}
resource onTextMessage (ws:Connection conn, ws:TextFrame frame) {
println("\ntext message: " + frame.text + " & is final fragment: " + frame.isFinalFragment);
string text = frame.text; if (text == "ping") {
println("Pinging...");
conn.ping(pingData);
} else if (text == "closeMe") {
conn.closeConnection(1001, "You asked me to close connection");
} else {
conn.pushText("You said: " + frame.text);
}
}
resource onBinaryMessage(ws:Connection conn, ws:BinaryFrame frame) {
println("\nNew binary message received");
blob b = frame.data;
println("UTF-8 decoded binary message: " + b.toString("UTF-8"));
conn.pushBinary(b);
}
resource onPing(ws:Connection conn, ws:PingFrame frame) {
conn.pong(frame.data);
}
resource onPong(ws:Connection conn, ws:PongFrame frame) {
println("Pong received");
}
resource onIdleTimeout(ws:Connection conn) {
println("\nReached idle timeout");
println("Closing connection " + conn.getID());
conn.closeConnection(1001, "Connection timeout");
}
resource onClose(ws:Connection conn, ws:CloseFrame closeFrame) {
println("\nClient left with status code " + closeFrame.statusCode + " because " + closeFrame.reason);
}
}function printHeaders(map headers) {
string [] headerKeys = headers.keys();
int len = lengthof headerKeys;
int i = 0;
while (i < len) {
string key = headerKeys[i];
var value, _ = (string) headers[key];
println(key + ": " + value);
i = i + 1;
}
}
|
This program explains the basic functions of WebSocket server endpoint |
import ballerina.net.ws;
|
|
This example gives you the basic idea of WebSocket endpoint. |
@ws:configuration {
basePath: "/basic/ws",
subProtocols: ["xml", "json"],
idleTimeoutInSeconds: 120,
host: "<IP_ADDRESS>",
port: 9090,
wssPort: 9095,
keyStoreFile: "${ballerina.home}/bre/security/ballerinaKeystore.p12",
keyStorePassword: "ballerina",
certPassword: "ballerina"
}
service<ws> SimpleSecureServer {
|
string ping = "ping";
blob pingData = ping.toBlob("UTF-8");
|
|
|
This resource is responsible for handling user logic on handshake time. Note that the connection is not yet established while this code is running. |
resource onHandshake(ws:HandshakeConnection conn) {
println("\nNew client is going to connect");
println("Connection ID: " + conn.connectionID);
println("Is connection secure: " + conn.isSecure);
|
println("pre upgrade headers -> ");
printHeaders(conn.upgradeHeaders);
}
|
|
|
This resource is triggered after a successful client connection. |
resource onOpen(ws:Connection conn) {
println("\nNew client connected");
println("Connection ID: " + conn.getID());
println("Negotiated Sub protocol: " + conn.getNegotiatedSubProtocol());
println("Is connection open: " + conn.isOpen());
println("Is connection secured: " + conn.isSecure());
println("Connection header value: " + conn.getUpgradeHeader("Connection"));
println("Upgrade headers -> " );
printHeaders(conn.getUpgradeHeaders());
}
|
|
This resource is triggered when a new text frame is received from a client. |
resource onTextMessage (ws:Connection conn, ws:TextFrame frame) {
println("\ntext message: " + frame.text + " & is final fragment: " + frame.isFinalFragment);
string text = frame.text;
|
if (text == "ping") {
println("Pinging...");
conn.ping(pingData);
} else if (text == "closeMe") {
conn.closeConnection(1001, "You asked me to close connection");
} else {
conn.pushText("You said: " + frame.text);
}
}
|
|
|
This resource is triggered when a new binary frame is received from a client. |
resource onBinaryMessage(ws:Connection conn, ws:BinaryFrame frame) {
println("\nNew binary message received");
blob b = frame.data;
println("UTF-8 decoded binary message: " + b.toString("UTF-8"));
conn.pushBinary(b);
}
|
|
This resource is triggered when a ping message is received from the client. If this resource is not implemented then pong message will be sent automatically to the connected endpoint when a ping is received. |
resource onPing(ws:Connection conn, ws:PingFrame frame) {
conn.pong(frame.data);
}
|
|
This resource is triggered when a pong message is received |
resource onPong(ws:Connection conn, ws:PongFrame frame) {
println("Pong received");
}
|
|
This resource is triggered when a particular client reaches it’s idle timeout defined in the ws:configuration annotation. |
resource onIdleTimeout(ws:Connection conn) {
|
|
This resource will be triggered after 180 seconds if there is no activity in a given channel. |
println("\nReached idle timeout");
println("Closing connection " + conn.getID());
conn.closeConnection(1001, "Connection timeout");
}
|
|
This resource is triggered when a client connection is closed from the client side. |
resource onClose(ws:Connection conn, ws:CloseFrame closeFrame) {
println("\nClient left with status code " + closeFrame.statusCode + " because " + closeFrame.reason);
}
}
|
function printHeaders(map headers) {
string [] headerKeys = headers.keys();
int len = lengthof headerKeys;
int i = 0;
while (i < len) {
string key = headerKeys[i];
var value, _ = (string) headers[key];
println(key + ": " + value);
i = i + 1;
}
}
|
|
To run the program, put the code in |
$ ballerina run websocket-basic-sample.bal
|
|
To check the sample,use Chrome or Firefox javascript console and run the below commands |
$ var ws = new WebSocket("ws://localhost:9090/basic/ws", "xml", "my-protocol");
|
$ ws.onmessage = function(frame) {console.log(frame.data)};
$ ws.onclose = function(frame) {console.log(frame)};
|
|
|
To send messages |
$ ws.send("hello world");
|
|
Use more advance client to check the ping pong since browser client does not have capability to send pings. But to check the the behavior when server sends a ping message to the browser client use the following command |
$ ws.send("ping");
|
|
To close the connection |
$ ws.close(1000, "I want to go");
|
|
To close connection from server side |
$ ws.send("closeMe");
|
|
To check the connection closure due to connection timeout wait for 120 seconds or change the timeout in configuration annotation |
Next example: WebSocket Chat Application.


Two Black Men Charged in Case of ‘Irate’ Man Who Reportedly Refused to Leave a Waffle House but Instead Spewed N-Word and Fought, Ending in His Death
by Lauren FloydWhen an “irate” Georgia man reportedly used a racial slur during an alleged fight with two Black men at a Waffle House, he ended up shot and killed and the other men charged in his death.
Robert Lewis Henderson Jr. and Antonio DeMarty Evans turned themselves in to the Butts County Sheriff’s Office Wednesday at about 9 a.m., according to the Georgia Bureau of Investigation.
Henderson was charged with murder and aggravated assault in the death of Nicholas Bryan, and Evans was charged with tampering with evidence, the GBI said in its news release.
The incident that led to the arrests unfolded late on Halloween at the Waffle House on Ga. 36 in Butts County, which is about 50 miles southeast of Atlanta.
Bryan, 27, was directing racial slurs at Henderson Jr., 36, and Evans, 39, when Waffle House staff members asked him to leave, according to another GBI news release.
Instead of leaving, Bryan got into “a physical altercation” with Evans, and Henderson fired one round at Bryan, hitting him, the GBI said.
The incident led to three separate calls within minutes of each other just before 11 p.m. about “disturbances” at the restaurant, according to the GBI.
The first call was about an “irate customer,” the second about a fight and the third about shots fired, the GBI said.
When deputies arrived at the restaurant, they found Bryan with a gunshot wound, authorities said.
Bryan was taken to the Monroe County Hospital about 15 miles away in Forsyth, and he died at about 3 a.m. Friday, the GBI said.
The agency was called to investigate the shooting at about 12:35 a.m. Nov. 1.


Erica Mena And Safaree Celebrate Their Baby Girl With A Met Gala-Themed Baby Shower
by Alexis StoneErica Mena and Safaree are living their best lives since she got pregnant, and they found out that they will be having a baby girl. Erica could not be happier, and she also looks more beautiful than ever.
Here are the clips from the baby shower.
‘#Safaree and #EricaMena are celebrating their baby girl tonight with a Met Gala themed baby shower with their close family and friends!! (📸: @chinee_chow)’ The Shade Room captioned the post, which includes more videos.
Someone said: ‘Baby showers ain’t what they used to be.
A follower posted: ‘Lol it’s Met Gala themed, but Met Gala is a Gala of themes. 😭’ and one other commenter wrote: ‘This must be what they would wear if they were invited to the actual Met Gala 😭’
Someone else said: ‘They are doing too much. The knock off Wanna be A-list celebrities.’
A commenter posted this: ‘somebody said she’s the first woman to get pregnant for no reason and I haven’t stopped thinking about it since 🤣🤣’
Another Instagrammer posted this: ‘The next time I get pregnant I’m not telling anybody ima just show up at the family dinner with my husband pregnant af🤰🏽😩🤣’
Other than this, Erica shared a family photo on her social media account, featuring herself, Safaree, and their puppy. She looks stunning as always.


In its broadest terms, recursion is any process that repeats in a self-similar way. Many examples appear in nature, from plants to shells to snowflakes. Fractals are examples of recursion, as is what you see when you face two mirrors directly at one another. While recursive processes in the analog world are just curiosities to most of us, in mathematics and computer science, they are fundamental concepts allowing us to elegantly perform a wide range of functions and operations.
The primary attraction of recursion in programming is that it allows us to take a big problem and break it down into smaller and smaller pieces. Think of it like a tree, and when each of the problems at the tiniest branches are solved, those answers feed into the calculation one level up, which in turn feeds the calculation above it, all the way back to the very first branch.
It's important to mention that any problem that can be solved recursively can also be solved with standard Ruby iterators, like a while loop. It just might not be an elegant a solution. But recursion can also be dangerous, because all the branching and recrusive method calls require additional memory space, which can quickly overflow the memory stack if you're not careful. If a problem requires breaking down into too many pieces, it might not be a good candidate for recursion due to the memory limitations. (As an aside, there is also a computer science technique called tail call optimization which can reduce or eliminate the memory overflow problems caused by recursion, but this is not supported in Ruby by default).
The favorite example of recursion in programming seems to be the Fibonacci sequence, which begins 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... to Infinity. Each number is the sum of the two numbers preceeding it. What if we wanted to write a program in Ruby that told us what the 15th Fibonacci number was? An easy approach to this, and one which avoids the need for iterative loops, is employing a recursive method that calls upon itself each time upon executing. Let's see it in code:
def fibonacci(n)
n <= 1 ? n : fibonacci( n - 1 ) + fibonacci( n - 2 )
end
puts fibonacci(15)
=> 610
What's happening here? In the first part of the conditional statement we check whether the input number is less than or equal to 1, and if so, just return that number. That covers our beginning cases, because an input of '0' or '1' would fail if we applied the typical Fibonacci logic to them. However if the number is greater than 1, we can run the loop, and recursively call on the
In practice however, recursion is not the best way to calculate Fibonacci numbers in Ruby due to the memory overflow issues described above. My system gets hung processing any number greater than 35.
Let's look at one more popular example of recursion:
def fact(n)
n = 0 ? 1 : n * fact(n-1)
end
puts fact(8)
=> 40320
Here we calculate the Factorial of a number by calling on the
def fact(n)
(1..n).inject {|result, n| result*n}
end
puts fact(8)
=> 40320