text:
# tweet-matches
Check if a tweet matches a twitter filter. Since the Twitter API allows you only
one or a couple connections from on IP at a time, tracking multiple queries to
the streaming API at once requires some processing on your end.

This module implements the key part of that post-processing: checking whether a
tweet matches a given value for the `track` parameter of the Twitter streaming
API. Twitter's documentation for this parameter is [here](https://dev.twitter.com/streaming/overview/request-parameters#track), and I've backed it up [here](official_docs.md).

## Usage
```js
var tweetMatches = require('tweet-matches');

var track = 'foo,bar bAZ , what is ';
var compiled = tweetMatches.compile(track);
tweetMatches({ text: 'foo' }, compiled); // true
tweetMatches({ text: 'some bAZ and some barrrr' }, compiled); // true
tweetMatches({ text: 'something else what' }, compiled); // false
tweetMatches({
  text: 'bAZ',
  quoted_status: {
    entities: {
      media: [ { display_url: 'bar.com' } ]
    }
  }
}, compiled); // true
```

## With Twit
This module is best used to consume tweet objects from [twit](https://github.com/ttezel/twit).
```js
var track = 'anything, as usual';
var stream = T.stream('statuses/filter', { track: track }
var compiled = tweetMatches.compile(track);
stream.on('tweet', function(tweet) {
  tweetMatches(tweet, compiled); // true
});
```

## Testing
Use `test.js` to test against the live twitter API. This module intends to
implement exactly the logic that Twitter uses to decide which tweets to send to
`statuses/filter`, so this test just compares our output to theirs.
```sh
$ node test.js 'value,for the,track parameter'
Connected
Matched 1 tweets
Matched 2 tweets
Matched 3 tweets
...
```
Of course if `tweetMatches` decides it's a match when it shouldn't, this won't
tell you.

## Related projects
* [twitter-stream-channels](https://github.com/topheman/twitter-stream-channels)
  is intended to solve the same problem
* [twitter-search-terms](https://github.com/SpiderStrategies/twitter-search-terms)

repository: pgarrison/tweet-matches

repo_name: pgarrison/tweet-matches


text:
<!---
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
-->

# com.estimote.sdk

Estimote Beacon is a super small device. It has a powerful 32-bit ARM® Cortex M0 CPU with 256kB flash memory, accelerometer, temperature sensor and most importantly – a 2.4 GHz Bluetooth 4.0 Smart (also known as BLE or Bluetooth low energy) bidirectional radio.

You can think of the beacon as a small lighthouse tower that's installed in a fixed location and broadcasts its presence to all the ships (smartphones) around. They could be as close as 2 inches and as far as 230 feet (approx. 70 metres) away.

The plugin is implemented on top of the Estimote native SDKs that lets you track beacon devices around you. It defines a global `estimote` object, which defines various operations that are used for tracking a beacon device.

Although the object is in the global scope, it is not available until after the `deviceready` event.

    document.addEventListener("deviceready", onDeviceReady, false);
    function onDeviceReady() {
        console.log(device.cordova);
    }

## Installation

Once you have your Estimote beacons in place and configured, you can install the plugin in the folloiwng way:

    cordova plugin add plugin_url

## Methods

- estimote.startRanging
- estimote.stopRanging

# estimote.startRanging

The method initalizes the native beacon manager for a region.

    estimote.startRanging("Telerik");

Optionally you can pass in a UUID like "B9407F30-F5F8-466E-AFF9-25556B57FE6D" which is the default and is used to detect regular Estimote beacons.

    estimote.startRanging({
        region: "Telerik",
        uuid: "B9407F30-F5F8-466E-AFF9-25556B57FE6D" // default
    });

Once done you can subscribe to the document event as shown below and as I have devices nearby it will send me list and other information that will let me identify an Estimote beacon and do various cool things with my app:

    document.addEventListener('beaconsReceived', this.onBeaconsReceived, false);

    onBeaconsReceived: function(e){
        for(var index = 0; index< e.beacons.length; index++){
          // TODO: You app specific logic.
        }
    }

# estimote.stopRanging

The method stops the tracking of any further beacons send by estimote devices.

## Example

    estimote.stopRanging();

## Supported Platforms

- iOS
- Android

## Resources

In order to get an understanding of how the Estimote beacons work, please refer to the Estimote [Getting Started Documentation](http://estimote.com/api/getting-started/intro-to-beacons.html).

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
# LAB-07

# Project Name

City Explorer backend app

**Author**: Peter Tynan, David Marchante
**Version**: 1.0.0 (increment the patch/fix version number if you make more commits past your first submission)

## Overview
This is a class project to return data with user input. The data to be returned is location info, latitude, longitude, and weather, and events info based on user input.

## Getting Started

### Installation:
From the terminal, run one of the following to make a local copy:
* ssh: `git clone git@github.com:dmarchante/lab-07-repository`
* https: `git clone https://github.com/dmarchante/lab-07-repository`

### Usage:
* Change directory into the project directory and load `index.html` in your favorite browser.
* Or go to: [TBD](TBD)

## Architecture
  Node.js, dotenv, cors, express, Heroku

## Change Log

04-30-2019 11:00 - Application now has a fully-functional Google Maps API call
04-30-2019 12:00 - Application now has a fully-functional Dark Sky API call
04-30-2019 13:00 - Application now has a fully-functional Eventbrite API call

## Credits and Collaborations
* David Marchante dmarchante](https://github.com/dmarchante)
* Peter Tynan, [pettynan](https://github.com/pettynan)

## Time Estimation

  Number and name of feature: API and Event Constructor

  Estimate of time needed to complete: 4 hours

  Start time: 0900

  Finish time: 1200

  Actual time needed to complete: 4 hours

## Installation:
From the terminal, run one of the following to make a local copy:
* ssh: `git clone git@github.com:stephenchu530/lab-06-back-end.git`
* https: `git clone https://github.com/stephenchu530/lab-06-back-end.git`

## License:
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/stephenchu530/lab-06-back-end/blob/master/LICENSE)

license: MIT

gha_language: JavaScript

gha_license_id: MIT


text:
# Authorization For Phone Book

At this point, anyone can enter phone book page since no authorization
defined. We will define two permission:

- A permission to **enter phone book page**.
- A permission to **create new person** (which is a child permission
  of first one, as naturally).

## Permission for Entering Phone Book Page

### Define the permission

Go to **AppAuthorizationProvider** class in the server side and add a new permission as shown below (you can add just below the dashboard permission):

```csharp
pages.CreateChildPermission(AppPermissions.Pages_Tenant_PhoneBook, L("PhoneBook"), multiTenancySides: MultiTenancySides.Tenant);
```

A permission should have a unique name. We define permission names as constant strings in **AppPermissions** class. It's a simple constant string:

```csharp
public const string Pages_Tenant_PhoneBook = "Pages.Tenant.PhoneBook";
```

Unique name of this permission is "**Pages.Tenant.PhoneBook**". While you can set any string (as long as it's unique), it's suggested to use that convention. A permission can have a localizable display name: "**PhoneBook**" here. (See "Adding a New Page" section for more about localization, since it's very similar). Lastly, we set this as a **tenant** level permission.

### Add AbpAuthorize attribute

**AbpAuthorize** attribute can be used as **class level** or **method level** to protect an application service or service method from unauthorized users. Since all server side code is located in `PersonAppService` class, we can declare a class level attribute as shown below:

```csharp
[AbpAuthorize(AppPermissions.Pages_Tenant_PhoneBook)]
public class PersonAppService : PhoneBookAppServiceBase, IPersonAppService
{
    //...
}
```

Admin role has every static permission by default but those permissions can be reversible on user interface for this role. Go to Roles page, edit role named "admin", go to Permissions tab and revoke "Phone Book" permission and save.

Now, let's try to enter Phone Book page by clicking the menu item without required permission:

We get an error message. This exception is thrown when any method of `PersonAppService` is called without required permission.

### Guard Angular Route

We got an exception about permission. Server did not send the data but we can still enter the page. To prevent it, open **main-routing.module.ts** and change the route definition like that:

```json
{
	path: 'phonebook',
	loadChildren: () => import('./phonebook/phonebook.module').then(m => m.PhonebookModule),
	data: { permission: 'Pages.Tenant.PhoneBook' }
}
```

**AuthRouteGuard** class automatically checks route permission data and prevents entering to the view if specified permission is not granted. Try to click Phone Book menu!

### Hide Unauthorized Menu Item

While user can not enter to the page, the menu item still there! We should also **hide** the Phone book **menu item**. It's easy, open **app-navigation-service.ts** and add change PhoneBook menu definition as shown below:

```typescript
new AppMenuItem("PhoneBook", 'Pages.Tenant.PhoneBook', "flaticon-book", "/app/main/phonebook")
```

### Grant permission

So, how we can enter the page now? Simple, go to **Role Management** page and edit **admin** role:

We see that a **new permission** named "**Phone book**" added to **permissions** tab. So, we can check it and save the role. After saving, we need to **refresh** the whole page to refresh permissions for the current user. We could also grant this permission to a specific user. Now, we can enter the Phone book page again.

## Permission for Create New Person

While a permission for a page is useful and probably always needed, we may want to define additional permissions to perform some **specific actions** on a page, like creating a new person.

### Define the Permission

Defining a permission is similar (in the `AppAuthorizationProvider` class):

```csharp
var phoneBook = pages.CreateChildPermission(AppPermissions.Pages_Tenant_PhoneBook, L("PhoneBook"), multiTenancySides: MultiTenancySides.Tenant);
phoneBook.CreateChildPermission(AppPermissions.Pages_Tenant_PhoneBook_CreatePerson, L("CreateNewPerson"), multiTenancySides: MultiTenancySides.Tenant);
```

First permission was defined before. In the second line, we are creating a child permission of first one. Remember to create a constant in `AppPermissions` class:

```csharp
public const string Pages_Tenant_PhoneBook_CreatePerson = "Pages.Tenant.PhoneBook.CreatePerson";
```

### Add AbpAuthorize Attribute

This time, we're declaring **AbpAuthorize** attribute just for **CreatePerson** method:

```csharp
[AbpAuthorize(AppPermissions.Pages_Tenant_PhoneBook_CreatePerson)]
public async Task CreatePerson(CreatePersonInput input)
{
    //...
}
```

### Hide Unauthorized Button

If we run the application and try to create a person, we get an authorization error after clicking the save button. But, it's good to **completely hide Create New Person button** if we don't have the permission. It's very simple:

Open the **phonebook.component.html** view and add the permission **Pages.Tenant.PhoneBook.CreatePerson** condition as shown below:

```html
<button *ngIf="'Pages.Tenant.PhoneBook.CreatePerson' | permission" class="btn btn-primary" (click)="createPersonModal.show()"><i class="fa fa-plus"></i> {{"CreateNewPerson" | localize}}</button>
```

In this way, the "Create New Person" button is not rendered in server and user can not see this button.

### Grant permission

To see the button again, we can go to role or user manager and grant related permission as shown below:

As shown above, **Create new person** permission is a child permission of the **Phone book**. Remember to refresh page to get permissions updated.

## Next

- [Deleting a Person](Developing-Step-By-Step-Angular-Deleting-Person)

repository: aspnetzero/documents

gha_language: HTML

repo_name: aspnetzero/documents


text:
<!--title={Bigrams, Trigrams, and Ngrams}-->

### Bigrams, trigrams, ngrams

Bigrams, trigrams, and ngrams are simply groups of tokens. Before we were working with a single token, but lets say we wanted to have a pair of tokens. This is called a Bigram and can be done with:

``` python
from nltk import bigrams, trigrams, ngrams
```

Let's create a string

```python
string = "AI programs can absorb new modifications by putting highly independent pieces of information together. Hence you can modify even a minute piece of information of program without affecting its structure.""
```

First lets tokenize our string like so:

```python
quotes_tokens = nltk.word_tokenize(string)
```

Now we will use the functions we imported.

For a bigram we can use

```Python
quotes_bigrams = list(nltk.bigrams(quotes_tokens))
```

Trigram:

```python
quotes_trigrams = list(nltk.trigrams(quotes_tokens))
```

Ngrams:

```python
quotes_ngrams = list(nltk.ngrams(quotes_token,#length here
                                ))
```

`Ngrams` takes in to two parameters. The first is the token list and the second is how many tokens you want in your group. If we inserted 2, we would have a bigram.

repository: ShayanRiyaz/curriculum

repo_name: ShayanRiyaz/curriculum


text:
---
layout: post
title: "Developmental neuronal networks as models to study the evolution of biological intelligence"
date: 2020-07-13
---

Arend Hintze, P. Robin Hiesinger, Jory Schossau

[pdf](/devonn/files/2020/hintze_final.pdf)

Abstract: Artificial neural networks (ANNs) learn through iterative ad-
justment of synaptic weights, most commonly by backprop-
agation or similar training methods. By contrast, learning in
the neuro-evolution approach of ANNs as well as in biolog-
ical neural networks can also be achieved through iterative
adjustment of synaptic weights based on mutational changes
of a genome. Evolutionary learning of ANNs is typically
based on changes in the genome that directly affect synap-
tic weights, while the biological genome affects changes to
synaptic weights through indirect and developmental encod-
ing of the molecular composition of synapses. Methods for
indirect and developmental encoding in ANNs are compara-
bly scarce and their constraints and advantages remain in-
completely explored. Here, we identify robustness to en-
vironmental challenges as a key feature associated with in-
direct and developmental encoding using a neuro-evolution
approach. In biological systems, the developmental process
’unfolds’ synaptic connectivity information in a time- and
energy-consuming process that is sensitive to environmental
conditions like temperature. Our tests for robustness to devel-
opmental temperature reveal successful adaptation for indi-
rect encoding followed by a developmental process compared
to lower performance of developmental or indirect encoding
alone. These findings set the stage for a more comprehensive
neuro-evo-devo approach that acknowledges the necessity of
neural network development for biological intelligence.

<iframe width="560" height="315" src="https://www.youtube.com/embed/CmYg4N8ZkQ8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

Part of the [2020 Workshop](/devonn/2020/07/13/alife.html) on Developmental Neural Networks

extension: markdown


text:
title: Migrating from 2.x to 3.0
permalink: /docs/v3/migrating-from-2-x-to-3-0/
alias: /docs/migrating-from-2-x-to-3-0/
release: v3
type: docs
order: 501
---

This release should fix most of the inconsistencies of the Socket.IO library and provide a more intuitive behavior for
the end users. It is the result of the feedback of the community over the years. A big thanks to everyone involved!

**TL;DR:** ~~due to several breaking changes, a v2 client will not be able to connect to a v3 server (and vice versa)~~

Update: As of [Socket.IO 3.1.0](/blog/socket-io-3-1-0/), the v3 server is now able to communicate with v2 clients. More information [below](#How-to-upgrade-an-existing-production-deployment). A v3 client is still not be able to connect to a v2 server though.

For the low-level details, please see:

- [Engine.IO protocol v4](https://github.com/socketio/engine.io-protocol#difference-between-v3-and-v4)
- [Socket.IO protocol v5](https://github.com/socketio/socket.io-protocol#difference-between-v5-and-v4)

Here is the complete list of changes:

- [Configuration](#Configuration)
  - [Saner default values](#Saner-default-values)
  - [CORS handling](#CORS-handling)
  - [No more cookie by default](#No-more-cookie-by-default)
- [API change](#API-change)
  - [io.set() is removed](#io-set-is-removed)
  - [No more implicit connection to the default namespace](#No-more-implicit-connection-to-the-default-namespace)
  - [Namespace.connected is renamed to Namespace.sockets and is now a Map](#Namespace-connected-is-renamed-to-Namespace-sockets-and-is-now-a-Map)
  - [Socket.rooms is now a Set](#Socket-rooms-is-now-a-Set)
  - [Socket.binary() is removed](#Socket-binary-is-removed)
  - [Socket.join() and Socket.leave() are now synchronous](#Socket-join-and-Socket-leave-are-now-synchronous)
  - [Socket.use() is removed](#Socket-use-is-removed)
  - [A middleware error will now emit an Error object](#A-middleware-error-will-now-emit-an-Error-object)
  - [Add a clear distinction between the Manager query option and the Socket query option](#Add-a-clear-distinction-between-the-Manager-query-option-and-the-Socket-query-option)
  - [The Socket instance will no longer forward the events emitted by its Manager](#The-Socket-instance-will-no-longer-forward-the-events-emitted-by-its-Manager)
  - [Namespace.clients() is renamed to Namespace.allSockets() and now returns a Promise](#Namespace-clients-is-renamed-to-Namespace-allSockets-and-now-returns-a-Promise)
  - [Client bundles](#Client-bundles)
  - [No more "pong" event for retrieving latency](#No-more-“pong”-event-for-retrieving-latency)
  - [ES modules syntax](#ES-modules-syntax)
  - [`emit()` chains are not possible anymore](#emit-chains-are-not-possible-anymore)
  - [Room names are not coerced to string anymore](#Room-names-are-not-coerced-to-string-anymore)
- [New features](#New-features)
  - [Catch-all listeners](#Catch-all-listeners)
  - [Volatile events (client)](#Volatile-events-client)
  - [Official bundle with the msgpack parser](#Official-bundle-with-the-msgpack-parser)
- [Miscellaneous](#miscellaneous)
  - [The Socket.IO codebase has been rewritten to TypeScript](#The-Socket-IO-codebase-has-been-rewritten-to-TypeScript)
  - [Support for IE8 and Node.js 8 is officially dropped](#Support-for-IE8-and-Node-js-8-is-officially-dropped)

- [How to upgrade an existing production deployment](#How-to-upgrade-an-existing-production-deployment)
- [Known migration issues](#Known-migration-issues)

## Configuration

### Saner default values

- the default value of `maxHttpBufferSize` was decreased from `100MB` to `1MB`.
- the WebSocket [permessage-deflate extension](https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression-19) is now disabled by default
- you must now explicitly list the domains that are allowed (for CORS, see [below](#CORS-handling))

### CORS handling

In v2, the Socket.IO server automatically added the necessary headers to allow [Cross-Origin Resource Sharing](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) (CORS).

This behavior, while convenient, was not great in terms of security, because it meant that all domains were allowed to reach your Socket.IO server, unless otherwise specified with the `origins` option.

That's why, as of Socket.IO v3:

- CORS is now disabled by default
- the `origins` option (used to provide a list of authorized domains) and the `handlePreflightRequest` option (used to edit the `Access-Control-Allow-xxx` headers) are replaced by the `cors` option, which will be forwarded to the [cors](https://www.npmjs.com/package/cors) package.

The complete list of options can be found [here](https://github.com/expressjs/cors#configuration-options).

Before:

```js
const io = require("socket.io")(httpServer, {
  origins: ["https://example.com"],

  // optional, useful for custom headers
  handlePreflightRequest: (req, res) => {
    res.writeHead(200, {
      "Access-Control-Allow-Origin": "https://example.com",
      "Access-Control-Allow-Methods": "GET,POST",
      "Access-Control-Allow-Headers": "my-custom-header",
      "Access-Control-Allow-Credentials": true
    });
    res.end();
  }
});
```

After:

```js
const io = require("socket.io")(httpServer, {
  cors: {
    origin: "https://example.com",
    methods: ["GET", "POST"],
    allowedHeaders: ["my-custom-header"],
    credentials: true
  }
});
```

### No more cookie by default

In previous versions, an `io` cookie was sent by default. This cookie can be used to enable sticky-session, which is still required when you have several servers and HTTP long-polling enabled (more information [here](/docs/v3/using-multiple-nodes/)).

However, this cookie is not needed in some cases (i.e. single server deployment, sticky-session based on IP) so it must now be explicitly enabled.

Before:

```js
const io = require("socket.io")(httpServer, {
  cookieName: "io",
  cookieHttpOnly: false,
  cookiePath: "/custom"
});
```

After:

```js
const io = require("socket.io")(httpServer, {
  cookie: {
    name: "test",
    httpOnly: false,
    path: "/custom"
  }
});
```

All other options (domain, maxAge, sameSite, ...) are now supported. Please see [here](https://github.com/jshttp/cookie/) for the complete list of options.

## API change

Below are listed the non backward-compatible changes.

### io.set() is removed

This method was deprecated in the 1.0 release and kept for backward-compatibility. It is now removed.

It was replaced by middlewares.

Before:

```js
io.set("authorization", (handshakeData, callback) => {
  // make sure the handshake data looks good
  callback(null, true); // error first, "authorized" boolean second
});
```

After:

```js
io.use((socket, next) => {
  var handshakeData = socket.request;
  // make sure the handshake data looks good as before
  // if error do this:
    // next(new Error("not authorized"));
  // else just call next
  next();
});
```

### No more implicit connection to the default namespace

This change impacts the users of the multiplexing feature (what we call Namespace in Socket.IO).

In previous versions, a client would always connect to the default namespace (`/`), even if it requested access to another namespace. This meant that the middlewares registered for the default namespace were triggered, which may be quite surprising.

```js
// client-side
const socket = io("/admin");

// server-side
io.use((socket, next) => {
  // not triggered anymore
});

io.on("connection", socket => {
  // not triggered anymore
})

io.of("/admin").use((socket, next) => {
  // triggered
});
```

Besides, we will now refer to the "main" namespace instead of the "default" namespace.

### Namespace.connected is renamed to Namespace.sockets and is now a Map

The `connected` object (used to store all the Socket connected to the given Namespace) could be used to retrieve a Socket object from its id. It is now an ES6 [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map).

Before:

```js
// get a socket by ID in the main namespace
const socket = io.of("/").connected[socketId];

// get a socket by ID in the "admin" namespace
const socket = io.of("/admin").connected[socketId];

// loop through all sockets
const sockets = io.of("/").connected;
for (const id in sockets) {
  if (sockets.hasOwnProperty(id)) {
    const socket = sockets[id];
    // ...
  }
}

// get the number of connected sockets
const count = Object.keys(io.of("/").connected).length;
```

After:

```js
// get a socket by ID in the main namespace
const socket = io.of("/").sockets.get(socketId);

// get a socket by ID in the "admin" namespace
const socket = io.of("/admin").sockets.get(socketId);

// loop through all sockets
for (const [_, socket] of io.of("/").sockets) {
  // ...
}

// get the number of connected sockets
const count = io.of("/").sockets.size;
```

### Socket.rooms is now a Set

The `rooms` property contains the list of rooms the Socket is currently in. It was an object, it is now an ES6 [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set).

Before:

```js
io.on("connection", (socket) => {

  console.log(Object.keys(socket.rooms)); // [ <socket.id> ]

  socket.join("room1");

  console.log(Object.keys(socket.rooms)); // [ <socket.id>, "room1" ]

});
```

After:

```js
io.on("connection", (socket) => {

  console.log(socket.rooms); // Set { <socket.id> }

  socket.join("room1");

  console.log(socket.rooms); // Set { <socket.id>, "room1" }

});
```

### Socket.binary() is removed

The `binary`  method could be used to indicate that a given event did not contain any binary data (in order to skip the lookup done by the library and improve performance in certain conditions).

It was replaced by the ability to provide your own parser, which was added in Socket.IO 2.0.

Before:

```js
socket.binary(false).emit("hello", "no binary");
```

After:

```js
const io = require("socket.io")(httpServer, {
  parser: myCustomParser
});
```

Please see [socket.io-msgpack-parser](https://github.com/darrachequesne/socket.io-msgpack-parser) for example.

### Socket.join() and Socket.leave() are now synchronous

The asynchronicity was needed for the first versions of the Redis adapter, but this is not the case anymore.

For reference, an Adapter is an object that stores the relationships between Sockets and [Rooms](/docs/v3/rooms/). There are two official adapters: the in-memory adapter (built-in) and the [Redis adapter](https://github.com/socketio/socket.io-redis) based on Redis [pub-sub mechanism](https://redis.io/topics/pubsub).

Before:

```js
socket.join("room1", () => {
 io.to("room1").emit("hello");
});

socket.leave("room2", () => {
  io.to("room2").emit("bye");
});
```

After:

```js
socket.join("room1");
io.to("room1").emit("hello");

socket.leave("room2");
io.to("room2").emit("bye");
```

Note: custom adapters may return a Promise, so the previous example becomes:

```js
await socket.join("room1");
io.to("room1").emit("hello");
```

### ~~Socket.use() is removed~~

`socket.use()` could be used as a catch-all listener. But its API was not really intuitive. It is replaced by [socket.onAny()](#Catch-all-listeners).

**UPDATE**: the `Socket.use()` method was restored in [`socket.io@3.0.5`](https://github.com/socketio/socket.io/releases/3.0.5).

Before:

```js
socket.use((packet, next) => {
  console.log(packet.data);
  next();
});
```

After:

```js
socket.onAny((event, ...args) => {
  console.log(event);
});
```

### A middleware error will now emit an Error object

The `error` event is renamed to `connect_error` and the object emitted is now an actual Error:

Before:

```js
// server-side
io.use((socket, next) => {
  next(new Error("not authorized"));
});

// client-side
socket.on("error", err => {
  console.log(err); // not authorized
});

// or with an object
// server-side
io.use((socket, next) => {
  const err = new Error("not authorized");
  err.data = { content: "Please retry later" }; // additional details
  next(err);
});

// client-side
socket.on("error", err => {
  console.log(err); // { content: "Please retry later" }
});
```

After:

```js
// server-side
io.use((socket, next) => {
  const err = new Error("not authorized");
  err.data = { content: "Please retry later" }; // additional details
  next(err);
});

// client-side
socket.on("connect_error", err => {
  console.log(err instanceof Error); // true
  console.log(err.message); // not authorized
  console.log(err.data); // { content: "Please retry later" }
});
```

### Add a clear distinction between the Manager query option and the Socket query option

In previous versions, the `query` option was used in two distinct places:

- in the query parameters of the HTTP requests (`GET /socket.io/?EIO=3&abc=def`)
- in the `CONNECT` packet

Let's take the following example:

```js
const socket = io({
  query: {
    token: "abc"
  }
});
```

Under the hood, here's what happened in the `io()` method:

```js
const { Manager } = require("socket.io-client");

// a new Manager is created (which will manage the low-level connection)
const manager = new Manager({
  query: { // sent in the query parameters
    token: "abc"
  }
});

// and then a Socket instance is created for the namespace (here, the main namespace, "/")
const socket = manager.socket("/", {
  query: { // sent in the CONNECT packet
    token: "abc"
  }
});
```

This behavior could lead to weird behaviors, for example when the Manager was reused for another namespace (multiplexing):

```js
// client-side
const socket1 = io({
  query: {
    token: "abc"
  }
});

const socket2 = io("/my-namespace", {
  query: {
    token: "def"
  }
});

// server-side
io.on("connection", (socket) => {
  console.log(socket.handshake.query.token); // abc (ok!)
});

io.of("/my-namespace").on("connection", (socket) => {
  console.log(socket.handshake.query.token); // abc (what?)
});
```

That's why the `query` option of the Socket instance is renamed to ̀`auth` in Socket.IO v3:

```js
// plain object
const socket = io({
  auth: {
    token: "abc"
  }
});

// or with a function
const socket = io({
  auth: (cb) => {
    cb({
      token: "abc"
    });
  }
});

// server-side
io.on("connection", (socket) => {
  console.log(socket.handshake.auth.token); // abc
});
```

Note: the `query` option of the Manager can still be used in order to add a specific query parameter to the HTTP requests.

### The Socket instance will no longer forward the events emitted by its Manager

In previous versions, the Socket instance emitted the events related to the state of the underlying connection. This will not be the case anymore.

You can still have access to those events on the Manager instance (the `io` property of the socket) :

Before:

```js
socket.on("reconnect_attempt", () => {});
```

After:

```js
socket.io.on("reconnect_attempt", () => {});
```

Here is the updated list of events emitted by the Manager:

| Name | Description | Previously (if different) |
| ---- | ----------- | ------------------------- |
| open | successful (re)connection | - |
| error | (re)connection failure or error after a successful connection | connect_error |
| close | disconnection | - |
| ping | ping packet | - |
| packet | data packet | - |
| reconnect_attempt | reconnection attempt | reconnect_attempt & reconnecting | - |
| reconnect | successful reconnection | - |
| reconnect_error | reconnection failure | - |
| reconnect_failed | reconnection failure after all attempts | - |

Here is the updated list of events emitted by the Socket:

| Name | Description | Previously (if different) |
| ---- | ----------- | ------------------------- |
| connect | successful connection to a Namespace | - |
| connect_error | connection failure | error |
| disconnect | disconnection | - |

And finally, here's the updated list of reserved events that you cannot use in your application:

- `connect` (used on the client-side)
- `connect_error` (used on the client-side)
- `disconnect` (used on both sides)
- `disconnecting` (used on the server-side)
- `newListener` and `removeListener` (EventEmitter [reserved events](https://nodejs.org/api/events.html#events_event_newlistener))

```js
socket.emit("connect_error"); // will now throw an Error
```

### Namespace.clients() is renamed to Namespace.allSockets() and now returns a Promise

This function returns the list of socket IDs that are connected to this namespace.

Before:

```js
// all sockets in default namespace
io.clients((error, clients) => {
  console.log(clients); // => [6em3d4TJP8Et9EMNAAAA, G5p55dHhGgUnLUctAAAB]
});

// all sockets in the "chat" namespace
io.of("/chat").clients((error, clients) => {
  console.log(clients); // => [PZDoMHjiu8PYfRiKAAAF, Anw2LatarvGVVXEIAAAD]
});

// all sockets in the "chat" namespace and in the "general" room
io.of("/chat").in("general").clients((error, clients) => {
  console.log(clients); // => [Anw2LatarvGVVXEIAAAD]
});
```

After:

```js
// all sockets in default namespace
const ids = await io.allSockets();

// all sockets in the "chat" namespace
const ids = await io.of("/chat").allSockets();

// all sockets in the "chat" namespace and in the "general" room
const ids = await io.of("/chat").in("general").allSockets();
```

Note: this function was (and still is) supported by the Redis adapter, which means that it will return the list of socket IDs across all the Socket.IO servers.

### Client bundles

There are now 3 distinct bundles:

| Name              | Size             | Description |
|:------------------|:-----------------|:------------|
| socket.io.js               | 34.7 kB gzip     | Unminified version, with [debug](https://www.npmjs.com/package/debug)    |
| socket.io.min.js           | 14.7 kB min+gzip | Production version, without [debug](https://www.npmjs.com/package/debug) |
| socket.io.msgpack.min.js   | 15.3 kB min+gzip | Production version, without [debug](https://www.npmjs.com/package/debug) and with the [msgpack parser](https://github.com/darrachequesne/socket.io-msgpack-parser)    |

By default, all of them are served by the server, at `/socket.io/<name>`.

Before:

```html
<!-- note: this bundle was actually minified but included the debug package -->
<script src="/socket.io/socket.io.js"></script>
```

After:

```html
<!-- during development -->
<script src="/socket.io/socket.io.js"></script>
<!-- for production -->
<script src="/socket.io/socket.io.min.js"></script>
```

### No more "pong" event for retrieving latency

In Socket.IO v2, you could listen to the `pong` event on the client-side, which included the duration of the last health check round-trip.

Due to the reversal of the heartbeat mechanism (more information [here](/blog/engine-io-4-release/#Heartbeat-mechanism-reversal)), this event has been removed.

Before:

```js
socket.on("pong", (latency) => {
  console.log(latency);
});
```

After:

```js
// server-side
io.on("connection", (socket) => {
  socket.on("ping", (cb) => {
    if (typeof cb === "function")
      cb();
  });
});

// client-side
setInterval(() => {
  const start = Date.now();

  // volatile, so the packet will be discarded if the socket is not connected
  socket.volatile.emit("ping", () => {
    const latency = Date.now() - start;
    // ...
  });
}, 5000);
```

### ES modules syntax

The ECMAScript modules syntax is now similar to the Typescript one (see [below](#The-Socket-IO-codebase-has-been-rewritten-to-TypeScript)).

Before (using default import):

```js
// server-side
import Server from "socket.io";

const io = new Server(8080);

// client-side
import io from 'socket.io-client';

const socket = io();
```

After (with named import):

```js
// server-side
import { Server } from "socket.io";

const io = new Server(8080);

// client-side
import { io } from 'socket.io-client';

const socket = io();
```

### `emit()` chains are not possible anymore

The `emit()` method now matches the [`EventEmitter.emit()`](https://nodejs.org/dist/latest/docs/api/events.html#events_emitter_emit_eventname_args) method signature, and returns `true` instead of the current object.

Before:

```js
socket.emit("event1").emit("event2");
```

After:

```js
socket.emit("event1");
socket.emit("event2");
```

### Room names are not coerced to string anymore

We are now using Maps and Sets internally instead of plain objects, so the room names are not implicitly coerced to string anymore.

Before:

```js
// mixed types were possible
socket.join(42);
io.to("42").emit("hello");
// also worked
socket.join("42");
io.to(42).emit("hello");
```

After:

```js
// one way
socket.join("42");
io.to("42").emit("hello");
// or another
socket.join(42);
io.to(42).emit("hello");
```

## New features

Some of those new features may be backported to the `2.4.x` branch, depending on the feedback of the users.

### Catch-all listeners

This feature is inspired from the [EventEmitter2](https://github.com/EventEmitter2/EventEmitter2) library (which is not used directly in order not to increase the browser bundle size).

It is available for both the server and the client sides:

```js
// server
io.on("connection", (socket) => {
  socket.onAny((event, ...args) => {});
  socket.prependAny((event, ...args) => {});
  socket.offAny(); // remove all listeners
  socket.offAny(listener);
  const listeners = socket.listenersAny();
});

// client
const socket = io();
socket.onAny((event, ...args) => {});
socket.prependAny((event, ...args) => {});
socket.offAny(); // remove all listeners
socket.offAny(listener);
const listeners = socket.listenersAny();
```

### Volatile events (client)

A volatile event is an event that is allowed to be dropped if the low-level transport is not ready yet (for example when an HTTP POST request is already pending).

This feature was already available on the server-side. It might be useful on the client-side as well, for example when the socket is not connected (by default, packets are buffered until reconnection).

```js
socket.volatile.emit("volatile event", "might or might not be sent");
```

### Official bundle with the msgpack parser

A bundle with the [socket.io-msgpack-parser](https://github.com/darrachequesne/socket.io-msgpack-parser) will now be provided (either on the CDN or served by the server at `/socket.io/socket.io.msgpack.min.js`).

Pros:

- events with binary content are sent as 1 WebSocket frame (instead of 2+ with the default parser)
- payloads with lots of numbers should be smaller

Cons:

- no IE9 support (https://caniuse.com/mdn-javascript_builtins_arraybuffer)
- a slightly bigger bundle size

```js
// server-side
const io = require("socket.io")(httpServer, {
  parser: require("socket.io-msgpack-parser")
});
```

No additional configuration is needed on the client-side.

## Miscellaneous

### The Socket.IO codebase has been rewritten to TypeScript

Which means `npm i -D @types/socket.io` should not be needed anymore.

Server:

```ts
import { Server, Socket } from "socket.io";

const io = new Server(8080);

io.on("connection", (socket: Socket) => {
    console.log(`connect ${socket.id}`);

    socket.on("disconnect", () => {
        console.log(`disconnect ${socket.id}`);
    });
});
```

Client:

```ts
import { io } from "socket.io-client";

const socket = io("/");

socket.on("connect", () => {
    console.log(`connect ${socket.id}`);
});
```

Plain javascript is obviously still fully supported.

### Support for IE8 and Node.js 8 is officially dropped

IE8 is no longer testable on the Sauce Labs platform, and requires a lot of efforts for very few users (if any?), so we are dropping support for it.

Besides, Node.js 8 is now [EOL](https://github.com/nodejs/Release). Please upgrade as soon as possible!

## How to upgrade an existing production deployment

- first, update the servers with `allowEIO3` set to `true` (added in<EMAIL_ADDRESS>
```js
const io = require("socket.io")({
  allowEIO3: true // false by default
});
```

Note: If you are using the Redis adapter to [broadcast packets between nodes](/docs/v3/broadcasting-events/#With-multiple-Socket-IO-servers), you must use `socket.io-redis@5` with `socket.io@2` and `socket.io-redis@6` with `socket.io@3`. Please note that both versions are compatible, so you can update each server one by one (no big bang is needed).

- then, update the clients

This step may actually take some time, as some clients may still have a v2 client in cache.

You can check the version of the connection with:

```js
io.on("connection", (socket) => {
  const version = socket.conn.protocol; // either 3 or 4
});
```

This matches the value of the `EIO` query parameter in the HTTP requests.

- and finally, once every client was updated, set `allowEIO3` to `false` (which is the default value)

```js
const io = require("socket.io")({
  allowEIO3: false
});
```

With `allowEIO3` set to `false`, v2 clients will now receive an HTTP 400 error (`Unsupported protocol version`) when connecting.

## Known migration issues

- `stream_1.pipeline is not a function`

```
TypeError: stream_1.pipeline is not a function
    at Function.sendFile (.../node_modules/socket.io/dist/index.js:249:26)
    at Server.serve (.../node_modules/socket.io/dist/index.js:225:16)
    at Server.srv.on (.../node_modules/socket.io/dist/index.js:186:22)
    at emitTwo (events.js:126:13)
    at Server.emit (events.js:214:7)
    at parserOnIncoming (_http_server.js:602:12)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23)
```

This error is probably due to your version of Node.js. The [pipeline](https://nodejs.org/api/stream.html#stream_stream_pipeline_source_transforms_destination_callback) method was introduced in Node.js 10.0.0.

- `error TS2416: Property 'emit' in type 'Namespace' is not assignable to the same property in base type 'EventEmitter'.`

```
node_modules/socket.io/dist/namespace.d.ts(89,5): error TS2416: Property 'emit' in type 'Namespace' is not assignable to the same property in base type 'EventEmitter'.
  Type '(ev: string, ...args: any[]) => Namespace' is not assignable to type '(event: string | symbol, ...args: any[]) => boolean'.
    Type 'Namespace' is not assignable to type 'boolean'.
node_modules/socket.io/dist/socket.d.ts(84,5): error TS2416: Property 'emit' in type 'Socket' is not assignable to the same property in base type 'EventEmitter'.
  Type '(ev: string, ...args: any[]) => this' is not assignable to type '(event: string | symbol, ...args: any[]) => boolean'.
    Type 'this' is not assignable to type 'boolean'.
      Type 'Socket' is not assignable to type 'boolean'.
```

The signature of the `emit()` method was fixed in version `3.0.1` ([commit](https://github.com/socketio/socket.io/commit/50671d984a81535a6a15c704546ca7465e2ea295)).

- the client is disconnected when sending a big payload (> 1MB)

This is probably due to the fact that the default value of `maxHttpBufferSize` is now `1MB`. When receiving a packet that is larger than this, the server disconnects the client, in order to prevent malicious clients from overloading the server.

You can adjust the value when creating the server:

```js
const io = require("socket.io")(httpServer, {
  maxHttpBufferSize: 1e8
});
```

- `Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at xxx/socket.io/?EIO=4&transport=polling&t=NMnp2WI. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).`

Since Socket.IO v3, you need to explicitly enable [Cross-Origin Resource Sharing](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) (CORS). The documentation can be found [here](/docs/v3/handling-cors/).

- `Uncaught TypeError: packet.data is undefined`

It seems that you are using a v3 client to connect to a v2 server, which is not possible. Please see the [following section](#How-to-upgrade-an-existing-production-deployment).

- `Object literal may only specify known properties, and 'extraHeaders' does not exist in type 'ConnectOpts'`

Since the codebase has been rewritten to TypeScript (more information [here](#the-socketio-codebase-has-been-rewritten-to-typescript<EMAIL_ADDRESS>is no longer needed and will actually conflict with the typings coming from the `socket.io-client` package.


text:
---
layout:     post
title:      "HTML Emails :("
subtitle:   "It's 2017 and email is still horrible"
date:       2017-03-29 10:00:00
author:     "Christian Droulers"
header-img: "img/post-bg-reflection-pattern.jpg"
---

Apparently, wanting technology that was drafted in 1997 and finalised in 2011 to work
properly in 2017 is asking too much. Pretty emails that work consistently across different
clients are *very* hard to build. If your application sends transactional emails, this
post is probably relevant to you!

Plain text will (unfortunately) get you only so far. Users expect a little more from email
than simple text. But once you start getting involved in *overly* complicated things like
background colours or even making text centered, you're opening Pandora's box. There is a
plethora of
[different clients that all handle things differently](https://www.campaignmonitor.com/css/).
Some will respect CSS in the `<head>`, others won't. Some will simply ignore all CSS. The only reliable way is to use basic HTML elements and attributes like it's 1997 all over again.
Also, table for layout is back in action for this wonderful task.

Obviously, writing markup manually for tables and repetitive styles like font-style, weight,
size, family and so on would be way too tedious for anyone. If only someone had done
all this work already...

[Someone did!](http://foundation.zurb.com/emails.html) We're saved!

![Zurb Foundation for Email](/img/posts/zurb-foundation-emails.png)

Zurb's Foundation for Email requires [NodeJS](https://nodejs.org/), which you probably
already have installed if you do frontend development work. There's a
[handy guide](https://foundation.zurb.com/emails/docs/sass-guide.html) available for
starting a new project. The framework uses
[Inky](https://foundation.zurb.com/emails/docs/inky.html) to write HTML like code
that will then be transformed into actual HTML. Then, for a production build, it will
also inline your CSS and minify your HTML. That means you can develop using regular
CSS (event SASS in the default project's configuration) with IDs and classes and whatnot
so you don't repeat everything at development time. Then for production, you get a
cross-client compatible output.

 The project template already supports
[BrowserSync](https://www.npmjs.com/package/browser-sync) which makes it even easier
to write and see as you code.

The basic CSS template can be modified at will or used as is. You can then customise
all your emails as you wish. Simply add a new `html` file and write away. I added
a step in the `gulpfile` to copy my templates' output from the Zurb project to my
actual backend code. As I write the templates, they are automatically updated in my
backend and I can test them out with my unit tests or by using the UI to actually
send them!

Here's the gulp function.

```javascript
function copyToParents(done) {
  return rimraf("../DotNetCoreBackend/Emails/*.cshtml", () => {
    return gulp
      .src("dist/emails/*.html")
      .pipe(
        $.rename({
          extname: ".cshtml"
        })
      )
      .pipe($.replace("@media", "@@media"))
      .pipe(gulp.dest("../DotNetCoreBackend/Emails/Emails"))
      .on("end", done);
  });
}
```

I use [`RazorLight`](https://github.com/toddams/RazorLight) to fill out data in the
templates, so I change the extension while copying them. It's also why I replace
`@media` with the Razor safe `@@media`.

In the end, I end up with good looking HTML emails that are filled with Razor and
can be sent to any user with any email client!

**EDIT:** [Reddit discussion](https://www.reddit.com/r/programming/comments/627egf/html_emails_its_2017_and_email_is_still_horrible/)


text:
# Midterm Review
## README Contents
Nice README. Great to have clear links to everyone in the team
so prominently. Nice summary in the overiew. Thanks for listing
the expected properties for the .env file.

Here's one tip.  If you include this
in the repo then people can copy it and start using your app
super easily.

## Server
You've got this utility line commented out in your server. You
could modify your package.json to have a custom `seed` command
that runs your `seedDb` file.

Nice overall main server file. It's clean and well-organized.
It's easy to see a high-level summary of all the routes.

## Routes
You have slightly inconsistent file names between your routes.
`removeSong.js` doesn't match the pattern of `add-song.js`,
`signgin-route.js` and the others. JavaScript files tend to
use `kebab-case` but consistency is the most important thing.
As projects get larger small inconsistencies like this can
really drive you nuts.

It's strange to have all CRUD methods for the song split out
across different files. Most applications have just one file
that handles all the create, read, update and delete routes for
one resource.

Nice work handling updating songs with all the optional
properties.

## MongoDB
You only need to make one connection to your database. Do that
connection in your main server file. There's a second connection
being made in the `update.js` file that's unnecessary.

Good job using the pre-save hook in the User model to save the
hashed password instead of plain text.

Good job establishing the relationship between users and songs.

## Testing
Your Sign-In test depends on someone having created an account
with username/password "signin/signin" manually. Improve the
test by running a sign-up within the test and using that new
account to sign in.

Your sign-in test has strange indentation. The series of
`.then()` functions after `User.findOne` cascades further
and further in.

Return `Song.find()` from the first `.then()` so then it's
passed as a parameter to your second `.then()`, then your
then functions will flatten out.

Compare the two code snippets below.

```js
User.findOne({
  username: username
})
  .then((results) => {
    Song.find( {
      userId: results._id
    })
      .then((results) => {
        let payload = { userId: user._id };
        let token = jwt.sign(payload, process.env.SECRET);
        res.status(200).send({ auth: true, token: token , results});
      })
      .catch(err => res.send(err.message));
```

```js
User.findOne({
  username: username
})
.then((results) => {
  return Song.find( {
    userId: results._id
  })
})
.then((results) => {
  let payload = { userId: user._id };
  let token = jwt.sign(payload, process.env.SECRET);
  res.status(200).send({ auth: true, token: token , results});
})
.catch(err => res.send(err.message));
```

## Frontend

Oh the horror. String-inlined HTML. D: Happy we're using React
now?

Seriously good use of jQuery and handlebars. Way to jump in and
flex your front-end muscles again.

Very clean code on the front-end. Nice work.

```js
let markup = `
<div id="song-div">
  <ul class="songListItems">
    <li id="artist">Artist: {{artist}}</li>
    <li id="album">Album: {{album}}</li>
    <li id="song">Title: {{title}}</li>
    <a id="audio" onclick="this.firstChild.play()"> <audio controls
    controlsList="nodownload" src="{{url}}"></audio></a>
  </ul>
</div>
`;

```

# Oberall
Excellent work!

repository: moondump/soundwave

repo_name: moondump/soundwave


text:
.

 -- {mctc 1}

  .

 -- {mctc 1}

  **Mt. Carmel**
--------------

**Training Center**
-------------------

CATALOG-SYLLABUS

AND

RULES MANUAL

 “By Knowledge Shall the Chamber Be Filled.”

### CONTENTS

**MT. CARMEL TRAINING CENTER**

####  Page

Location........................................ 5

Purpose ........................................5

Mould ........................................... 6

Atmosphere .................................. 7

Persons Accepted......................... 7

School Plant ..................................7

Ministerial Correspondence

 Course ........................................ 8

Pre-Ministerial Course ................. 8

Attendance.................................... 8

Deportment .................................. 9

#### **MINISTERIAL** **CURRICULUM**

Vocational .................................. 10

Spirit of Prophecy ...................... 11

Prophetic Eschatology ................ 11

Revealed Philosophy ................. 11

Revealed Psychophysics............. 12

Revealed Sociology ................... 12

Revealed History ....................... 13

Sacred Poetry and Song ............. 13

Homiletics .................................... 13

Christian English .......................... 14

The Student’s Pledge.................... 14

 	 **GENERAL RULES AND REGULATIONS GOVERNING TEACHERS (DEPARTMENT HEADS), STUDENTS (WORKERS), AND ALL RESIDENTS**

Visitors and Newcomers ........... 16

Rooms .........................................17

Fire.............................................. 17

Services.......................................18

Money......................................... 18

Culinary....................................... 19

Mercantile.................................... 19

Laundry ...................................... 20

Sewing ....................................... 20

General Office ........................... 21

Transportation ............................ 21

Academy .................................... 21

Miscellaneous ............................ 22

Dress .......................................... 24

Health ..........................................25

Medical ...................................... 25

Employment................................ 26

Tools and Building Material ....... .27

Department Heads

 and Workers .............................. 27

Time Slips and Bonus Time ....... 28

Checking Out or Leaving Camp ..28

Whatever You Do Do It

 in a Business Like Way ............ 29

 -- {mctc 2}

  **MT. CARMEL**
--------------

TRAINING CENTER
---------------

**\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_**

### **CATALOG-SYLLABUS**

### **AND**

### **RULES MANUAL**

**\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_**

 -- {mctc 3}

  ### **LIFE’S OBJECT**

 “ **‘Eye hath not seen, nor ear heard, neither have entered into the heart of man, the things which God hath prepared for them that love him.’ 1 Cor. 2:9.**

 “To dwell forever in this home of the blest, to bear in soul, body and spirit, not the dark traces of sin and the curse, but the perfect likeness of our Creator, and through ceaseless ages to advance in wisdom, in knowledge, and in holiness, ever exploring new fields of thought, ever finding new wonders and new glories, ever increasing in capacity to know and to enjoy and to love, and knowing that there is still beyond us joy and love and wisdom infinite, – such is the object to which the Christian’s hope is pointing, for which Christian’s education is preparing. To secure this education, and to aid others to secure it, should be the object of the Christian’s life.” – _Counsels to Teachers_, p. 55.

 -- {mctc 4}

  Mt. Carmel Training Center
--------------------------

 [PICTURE]

### Location

 Mt. Carmel Training Center was established in 1935, and is located six miles northwest of Waco, Texas. Its 375 acres a sylvan sanctuary, and its western and northern prominences commanding unexcelled views of beautiful Lake Waco some three hundred feet below, and the picturesque vistas beyond, it is happy indeed for situation solitarily in the woods.

### Purpose

 In such propitious setting, it was raised up at this late hour (the “eleventh” – Matt. 20:6) in the history of the gospel, as proving grounds for that Christian army (Joel 2:2-11; Mic. 5:7, 8) which is to restore the soon-coming and everlasting Kingdom. Hence, upon all who come within the compass of its influence its fundamental injunction is that prime principle enunciated by the greatest Teacher the world has ever known: “Seek ye first the kingdom of God, and His righteousness.” Matt. 6:33.

 -- {mctc 5}

   Thus it is called forth to implement the divine task of gathering, educating, and disciplining men and women for a place in the long-hoped-for Kingdom and, consequently, for the joy of a glorious service now in the “harvest” at the end of this world, and the subsequent higher joy of an ever more glorious service in the world to come.

 Its educational processes therefore having to do with the whole man for time and for eternity, Mt. Carmel’s constant aim is to educate hand, mind, and heart in a harmonious development of the physical, the mental, and the spiritual powers. By this threefold education it seeks to restore in man the image of his Maker – to promote the development of body, mind, and soul, that the immortal perfection divinely purposed in his creation might be realized.

### Mould

 As prerequisite to its accomplishing this divine task, the school has from its inception been cast in the divine mould of the ancient schools of the prophets. Struck from this divine pattern, its entire educational structure has for its foundation the Word of God; and for its study, the grand object of all study: to learn the will of God, the sole knowledge that fits for citizenship in the “kingdom prepared...from the foundation of the world.” Matt. 25:34.

 -- {mctc 6}

  ### Atmosphere

 Possessed of this heritage of divine purpose and mould, the institution is invested with an atmosphere of supreme purposiveness. Teacher and student breathing deeply of this inspiration are impelled to supreme effort to achieve to the supreme heights where, among the elect, at the feet of the Teacher of teachers, in the Classroom of classrooms, he shall learn the Science of sciences – the Key of knowledge which shall unlock unto him the Kingdom of God.

### Persons Accepted

 Consistent with this divine design, Mt. Carmel matriculates only such persons as are known to subscribe in full to its beliefs, its purposes, and its principles, and who aspire to a place in the final work of the gospel – the restoration of every divine institution, and the ushering in of enduring peace on earth and good will toward men.

 Right is reserved to refuse admission to anyone who appears for entrance without having previously filled out and returned an application form provided by the college, and without having received notification of acceptance.

School Plant

 In keeping with its belief in both the imminent end of all things mundane, and the principles of simplicity and modesty, the institution is building unpretentiously.

 -- {mctc 7}

  Its plant to date is composed of six main structures and a number of subsidiary ones. All save one (which is of tile) are of frame and stone construction. These at present provide an administration center, a chapel, classrooms, dormitories and other living quarters, kitchen, dining room, laundry, dispensary, nursery, material and storage shed, pump-house, water storage tank, water-works control house, and produce depot.

### Ministerial Correspondence Course

 Students who prior to their coming here have done satisfactory work in the school’s correspondence course are allowed ministerial credit.

### Pre-Ministerial Course

 As an integral part of its structure, its educational system provides cumulative pre-ministerial preparation in a sustained twelve-grade course, embracing the fundamental branches of learning, for students of elementary, intermediate, and secondary school age.

### Attendance

1. Punctual and regular attendance at all classes, special meetings, and religious services is required of students.

 “Of all the features of an education to be given...the religious exercises are the most important.” – _Testimonies_, Vol. 6, p. 174.

 -- {mctc 8}

  1. Absence and tardy lists will be posted once a week.
2. _Only_ such absences, other than for illness, as have been arranged for by the institution are excusable.
3. Reasons for an absence or tardiness must be filed within twenty-four hours of the return of the student to his classes.
4. A student having in any one class absences amounting to more than 15 percent of the total sessions of that class will receive an “F” in that subject.
5. A second unexcused absence in a year whether in the same or another class, carries a fine of 50¢. (Additional unexcused absences become a matter of more drastic discipline.)
6. Two unexcused tardinesses are equal to one unexcused absence.
7. A leave of absence does not excuse from classes. Reason for absence from each class must be submitted.
8. Any student withdrawing from a class in any other than the proper manner, or dropping out because of unsatisfactory work, will receive an “F” in that subject.

### Deportment

 A student whose conduct, spirit, or influence is out of harmony with the standards and principles of the institution, may be dismissed at any time even through he may not have violated any specific regulations.

 -- {mctc 9}

   “One student with careless ideas may do more to let down the standard, than ten men with all their effort can do to counteract the demoralizing influence.

 “Failure or success will be read in the course the students pursue. If they stand ready to question rules and regulations and order, if they indulge self, and by their example encourage a spirit of rebellion, give them no place. The institution might better close its doors than suffer this spirit to leaven the helpers and break down the barriers that it has cost thought, effort, and prayer to establish.” – _Counsels to Teachers_, p. 482.

Ministerial Curriculum
----------------------

### Vocational

 The manual phase of the student’s training. It is gained through daily pursuit of one or more of the institution’s various employments. Both in theory and in practice, right methods and procedures are constantly inculcated for right results. Efficiency is stressed as the result of energetic application and concentration, carefulness, thoroughness, speed, and proficiency. The irrepressible desire for some greater good, the indomitable will to success, the strenuous exertion, the untiring perseverance are cultivated as the elements of character which make a man successful and honored among men, and which will win for him the highest of all promotions and commendations,

 -- {mctc 10}

  “_Well done_, thou good and faithful servant: thou hast been faithful over a few things, I will make thee ruler over many things: enter thou into the joy of thy Lord.” Matt. 25:21. Work is thus dignified and restored to its original primacy in the redemptive processes.

 Therefore the basic and most potent factor of discipline and growth in the student’s training experience (as well as the means of his livelihood), it is accordingly exploited as the most productive source and means of symmetrical character development.

### _Spirit of Prophecy_

 A perspective study of the prophetic gift, its vital place and purpose in the church, past, present, and future. Special attention is directed to its climactic manifestation, work, and fruits.

### _Prophetic Eschatology_

 An intensive study of end-conditions and end-events as revealed in correlative and convergent lines of prophetic testimony, parable, ceremony, and number. Predominant emphasis is upon their pragmatic integration in the believer’s credenda.

### _Revealed Philosophy_

 A strictly non-speculative inquiry into the divine scheme of things, into the Absolute and Its unities. Approach is made objectively in the light of revealed knowledge. The aim is progressive elevation and

 -- {mctc 11}

  enlargement of the soul’s horizons, and its consequent activation on the divine plane of living, as the only truly good and more abundant life – that which is measured by the life of God. Accordingly, its primary foci of exploration are the immensity and diversity of the love of God.

### _Revealed Psychophysics_

 A Scriptural study of the great psychophysical laws governing the physical, mental, and moral balance of true Christian growth. This threefold development and integration of the personality is carefully viewed in its consummate embodiment in the man, Jesus. The ideal of the Christ poise and power is assiduously inculcated and pursued. Animated application is keynoted.

### _Revealed Sociology_

 An examination of the true social structure (the Edenic man, in his Edenic home in the Edenic school, in the Edenic state – the kingdom of the first dominion), the causes of its fall, and the conditions of its restoration. Most intensive study is devoted to the third phase of the course – to the social reforms involved in the regeneration, and in the transformation into the Kingdom of God, of the individual, the family, the school, and the church among those elements of society which elect to identify themselves with the divine purpose.

 -- {mctc 12}

  ### _Revealed History_

 A survey of history from the divine point of view. Causes underlying the rise and fall of empires and nations from creation to the present are incisively traced. Types and cycles are especially noticed. Main attention is fixed on the agencies of the all-merciful Providence silently, patiently working out the counsels of His own will behind, above, and through all the vast play and counterplay of human interests and power and passions. Final focus is upon the climactic scene in the drama – the restoration of the Kingdom of God in the light of the great lessons brought to view.

### _Sacred Poetry and Song_

 An excavation into the poetic veins of revealed truth. The course includes a brief non-technical study of the form and the kinds of poetry in the Bible, while chief concern is with the spiritual esthetic of the sacred poems and songs.

### _Homiletics_

 A study of the art and science of effective composition and delivery of Scriptural discourses. Ministerial ideals are woven in throughout the course. The spiritual element is held aloft as the most important in all stages of the discourse. Varied opportunity is given for delivery.

 -- {mctc 13}

  ### _Christian English_

 Remedial drill in the fundamentals of grammar, sentence and paragraph structure, punctuation, and oral and written composition. Constant emphasis is upon language study from the higher point of view, that it “be always with grace, seasoned with salt,” “the outward expression of an inward grace.”

### _The Student’s Pledge_

 As Christian students in American, devoted to God, and consequently loyal to the just principles of this free “government under God,” we pledge our hearts, our minds, our hands, our all, first to the

**[flag]**

of God’s eternal kingdom, and to the Theocracy for which it stands, one people made up of all nations, and bound by

 -- {mctc 14}

  the cords of everlasting love, liberty, purity justice, peace, happiness, light and life for all, and second “to the

 [flag]

of the United States of America, and to the republic for which it stands, one nation, indivisible with liberty and justice for all.”

 -- {mctc 15}

  RULES GOVERNING TEACHERS (DEPARTMENT HEADS),
--------------------------------------------

STUDENTS (WORKERS), AND ALL RESIDENTS
-------------------------------------

### Visitors and Newcomers

1. Newcomers are, upon arrival, to be directed to register at the General Office, state their purpose in coming here, and make known what they expect of this institution.
2. All are to go to the General Office for information.
3. Smoking is positively prohibited on the grounds.
4. Carrying on conversation with those at work is condemned as a species of theft, for it steals time and effort from the job.
5. Visitors wishing to help in the work, are to report to the Employment Department, and if placed, they are to hand in their time slips. They are not, however (save under special provisions), to be entered on the payroll.
6. Only such as have read and accepted all that is contained in the entire series of The Shepherd’s Rod books and tracts are eligible for permanent residence.

 -- {mctc 16}

  ### Rooms

1. Keep rooms and premises clean and orderly at all times. Be a particular, self-respecting housekeeper.
2. Cooking and eating in rooms built and equipped only for sleeping quarters create unhealthful conditions for the occupants, and menace the health of the institution. In such quarters, therefore, preparing and eating food is to be done only when there is no other way of obtaining meals. And at such times, take precaution to leave food covered and no crumbs about. Save when impossible patronize the dining room, and help make it what it ought to be.

### Fire

1. Before leaving your room at any time, see to it that you carefully (a) extinguish all lamps; (b) tightly close all stove dampers, (c) turn off all electrical appliances; (d) make certain that all clothing, wood, and inflammable articles are an amply safe distance from lamps or heating appliances.
2. Throw burnt matches nowhere but in their proper place, and there only after making certain that the flame is completely extinguished. And keep unused matches in a proper place.

 -- {mctc 17}

  3\. Vigilantly guard against firing stoves red-hot.

4\. In event of fire, immediately notify the General Office; call all hands by ringing the fire bell fast and long; then hasten with a container of water to the scene of fire.

### Services

Shun laughing, talking, common whispering, and unnecessary moving about before, during, or after meetings. Such deportment profanes the house of God. Remember that God is in His sanctuary and that only an irreverent soul will engage in such deportment.

### Money

1. All departments are to sell on a strict cash basis only.
2. Save in authorized exceptions, trade currency is not exchangeable for national money for purchases from elsewhere.
3. National money is exchangeable for Mt. Carmel trade currency at the General Office only.
4. Only under special provision may visitors exchange trade currency for national money.
5. Anyone depositing coins is to seal them before placing them in the deposit box.

 -- {mctc 18}

  ### Culinary

1. All dishes, silverware, and utensils in the Culinary Department are to be used and kept solely therein. Violation will result in fine.
2. Meals are served at regular times. Do not expect early or late servings.
3. Only authorized persons are to open refrigerators.
4. Only Culinary Department employees on duty or when specially authorized are to be in the kitchen or bakery.

### Mercantile

1. Orders to be filled from stock other than that on hand are to be in before 3:00 P.M. preceding the regular Mercantile purchasing days.
2. Personal purchases at the Mercantile may be made only during regular buying hours.
3. Only authorized buyers are to do purchasing in the name of the Mercantile.
4. Making unauthorized business inquiries, appointments, or contracts either by person or by letter in the name of the Mercantile Association, will subject the offender to dismissal from the institution.
5. Anyone making personal purchases in town and requesting the institution’s purchaser to deliver them, will be charged a service fee.

 -- {mctc 19}

   6. Academy-student buying is to be done by requisition signed by parent or guardian and countersigned by the school.

 7. All purchasing should be done through the Mercantile, for through the institution the Lord provides our “daily bread.” All, therefore, should seek for its prosperity as for hidden treasure.

### Laundry

1. Washing will be received only on the first day of the week up to 10:00 A.M.
2. Washing will be accepted only with a laundry slip properly made out.
3. All ironing is to be done at the laundry. Other buildings are not wired for this purpose, and hence become fire hazards when high wattage heating appliances are used.
4. Individuals doing their own ironing will be charged by the hour.

### **Sewing**

1. Anyone desiring to use sewing room equipment must first make arrangements with the department head.
2. Patterns, pattern books, etc., are to be taken from the sewing room only with permission from the department head. (The Mercantile the Laundry, the Culinary, and the Sewing departments

 -- {mctc 20}

  are for the purpose of serving Mt. Carmel’s residents. It is therefore the obligation of all here, visitors and residents alike, to maintain these services by patronizing them.)

### _General Office_

1. Permission to converse with those at work in the office is to be secured at the Information desk.
2. Typing, mimeographing, or any other kind of work to be done by the Office, is first to be submitted to the Office manager.

### _Transportation_

Those wishing transportation to town, are to make arrangement with the Transportation Department, and to purchase a ticket there. Renting private cars or paying individuals for transportation is permissible only under special provision by the management.

### _Academy_

1. Academy students wishing to leave the School Campus proper may do so only if accompanied by an adult. Mixed groups are not permitted.
2. Bank loans are issued only to those students whose deportment, scholarship, and work are meritorious. Requisitions for such loans are to be

 -- {mctc 21}

  signed by the school and by parent or guardian, and countersigned by the Credit Manager.

1. Lending money to students and borrowing money from them is permissible only under special provision.
2. Academy student’s mail, both incoming and out going, is to pass through the Academy office.
3. Each one is to sleep only in his own room and in his own bed.
4. Radios or phonographs are not permitted in student dormitories.

Miscellaneous

1. Lost and found articles are to be turned in at the Information desk.
2. Property damage is to be reported immediately to the Office.
3. All breakage is to be reported immediately and is to be settled for by the one responsible.
4. Cutting or hacking trees, destroying plants picking flowers, or throwing rubbish on the campus, etc., is subject to fine.
5. Failing to close any farm, garden, orchard, or dairy gate is likewise subject to fine.
6. Conserve water and electricity by using no more than absolutely necessary.

 -- {mctc 22}

   7. Keep out of dam and watershed areas. They supply water for human consumption and must therefore be maintained absolutely clean.

 8. Place ashes only in ash containers and keep them free of glass. Place cans and glass in separate containers.

 9. Idling in cars, hanging upon them, and riding on the outside, are prohibited.

 10. Loitering about the premises before or after nightfall will subject the offender to discipline.

 11. The unrestricted association of unmarried men and women is not permitted. Neither is corresponding, open or clandestine strolling, idling, or otherwise companioning together on the campus or elsewhere. or sitting together in public gatherings. Such violations subject the offenders to expulsion.

A man student whose conduct, scholarship, and maturity warrant the privilege, may, at such times as the institution deems wise, gain permission to call upon a woman student in like standing.

 12. Complaints and suggestions for improvements are to be taken only to those who are responsible for the matter involved. Communicating them one

 -- {mctc 23}

   to another can only foment trouble and lead to sorrow.

 13. Any authorized person or persons will hear charges or complaints against anyone (including youth and children) only if they are made in writing.

 14. All doctrinal questions as well as others requiring a formal answer are to be placed in the question box at the General Office, to be answered at the proper time, at the proper place.

 15. Speak no evil; hear no evil; think well of and be kind and courteous to everyone.

 16. Gambling of any kind, drinking, smoking, profane language, obscene or questionable literature, are strictly prohibited.

### Dress

1. Dress sleeves are to hang below the elbow.
2. Girls under twelve years of age are to have their skirts one third the distance between the bend of the knee and the floor. All women, and girls over twelve, are to have theirs half way between the bend of the knee and the floor.
3. Low necklines are condemned.
4. Crisping-pins and artificial embellishments are forbidden.

 -- {mctc 24}

  5\. Unless going barefooted, women and girls are to wear long stockings.

6\. Sheer silk stockings, rolled down stockings, perfume, rouge, lipstick, mascara, etc., are absolutely taboo.

7\. Wrist watches, tie pins, display watch chains, display handkerchiefs, display wear of any kind, and any other such vanities, are discountenanced.

8\. High-heeled shoes are unhealthful and are therefore discountenanced.

9\. Head coverings are to be worn by the women on religious occasions.

### Health

1. Retire on time to bed, and preserve quietness thereafter.
2. Guard against all unhealthful living. Health once lost, may never be regained. “Be ye temperate in all things.”

### Medical

1. At the first signs of contracting a contagious malady (including colds, whooping cough, etc.,) report to the dispensary.
2. Expenses for dispensary treatments for minor cuts, wounds, etc. to institutional employees and students, are to be defrayed by a weekly fee from each one.

 -- {mctc 25}

  3\. Faithful employees incurring expenses for care at the Mt. Carmel Dispensary, may receive aid from the Benevolent department.

4\. Hospital expense and doctors’ charges are either to be paid by, or charged to, the individual.

5\. Anyone desiring appointment with a doctor is to make it through the General Office, and at the same time make arrangements there for payment of the fees.

6\. Academy students reporting to the Mt. Carmel Dispensary for care, or wishing to see a doctor in town, must present a requisition signed by parent or guardian and countersigned by the Academy Office.

### Employment

1. To work in any department, either a visitor or a regular worker must first receive placement from the Employment Department.
2. Department heads requiring help are to report each evening to the Employment Office their needs for the following day. Each is to secure his help, get his tools, etc., and be in readiness for the job in the morning. Remember that bonus time is for this work.
3. Departments may interchange help only with permission from the Employment Department.

 -- {mctc 26}

  4\. Private enterprises of any kind is barred from the institution’s grounds.

5\. “Let all things be done decently and in order.” 1 Cor. 14:40.

### Tools and Building Material

1. Building material may lawfully be had only by requisition.
2. Individual or departmental lending or borrowing of material or tools is condemned. If you need something, place your order with the Mercantile.
3. Each worker is responsible for all the tools checked out to him. Upon finishing a job, he is to return them to their regular depository.

### Department Heads and Workers

1. A newly-appointed department head shall first report to the Office for instructions before taking up his duties. The outgoing department head shall leave the department in fit order to turn over to his successor, and shall return to the General Office all materials, books, cash box, etc.
2. Any employee, head of department or otherwise desiring information, is to go to his immediate superior.
3. Each worker is to attend strictly to the work to which he is assigned, and is not to encroach upon or drift over to another’s job.

 -- {mctc 27}

  4\. Working only to put in time, is a disloyalty to the institution and thus to God.

5\. Engage only in necessary conversation on the job.

6\. No over-time is allowed for routine work.

7\. If you cannot keep up with your work, seek to discover the trouble. If you need more help, apply for it Keep your work from dragging.

8\. Vigilantly prevent waste.

### Time Slips and Bonus Time

1. Time slips are to be made out correctly and turned in at the Office each evening.
2. Time slips overdue one day up to nightfall will have their time reduced one hour, if in later than this, they will not be honored at all.
3. On the back of each Sunday’s time slip, make a record of attendance at religious services for the preceding week, and give the reason for any tardiness or absence.
4. Only those who are faithful and regular in their work, are to receive bonus time.

### Checking Out or Leaving Camp

1. Anyone upon deciding to sever his

 -- {mctc 28}

  connection with Mt. Carmel, is to hand in his resignation, and check out one day ahead of his departure. If he has children who are to remain here, he is to make arrangements with the Academy Office.

2\. Adults desiring to leave the camp during work hours, are to secure release from their department. Academy students must first secure release from their department, then from the School.

3\. Outside work hours, Academy students are to gain permission from the school.

\_\_\_\_\_\_0\_\_\_\_\_\_

 Any violation of these rules shall be dealt with as an enemy act.

\_\_\_\_\_\_0\_\_\_\_\_\_

### Whatsoever You Do, Do It in a

### Business-like Way

 “...seek ye first the kingdom of God, and his righteousness; and all these things shall be added unto you. Take therefore no thought for the morrow: for the morrow shall take thought for the things of itself. Sufficient unto the day _is_ the evil thereof.” Matt. 6:33, 34. “Therefore all things whatsoever ye would that men should do to you, do ye even so to them: for this is the law and the prophets.” Matt. 7:12.

 -- {mctc 29}

repository: GADSDA/shepherd-rod-english

repo_name: GADSDA/shepherd-rod-english


text:
# GOST filtering

Samples of supported filtering requests

## Logical Operators

- Equals

```
$ curl http://localhost:8080/v1.0/Datastreams?$filter=name eq 'test1'
```

- Not Equals

```
$ curl http://localhost:8080/v1.0/Datastreams?$filter=name ne 'test1'
```

- Lower than

```
$ curl http://localhost:8080/v1.0/Observations?$filter=result lt 5
```

- Lower or equals than

```
$ http://localhost:8080/v1.0/Observations?$filter=result le 5
```

- Greater than

```
$ curl http://localhost:8080/v1.0/Observations?$filter=result gt 5
```

- Greater or equals than

```
$ curl http://localhost:8080/v1.0/Observations?$filter=result ge 5
```

- And

```
$ curl http://localhost:8080/v1.0/Observations?$filter=result ge 5 and result le 15
```

- Or

```
$ curl http://localhost:8080/v1.0/Observations?$filter=result lt 5 or result gt 15
```

- Not

```
$ curl http://localhost:8080/v1.0/Datastream?$filter=not endswith(Description,'milk')
```

## Arithmetic Operators

- Add

select observations where result equals 10 + 5 = 15

```
$ curl http://localhost:8080/v1.0/Observations?$filter=result eq 10 add 5
```

- Sub

select observations where result equals 10 - 3 = 7

```
$ curl http://localhost:8080/v1.0/Observations?$filter=result eq 10 sub 3
```

- Mul

select observations where result equals 10 * 3 = 30

```
$ curl http://localhost:8080/v1.0/Observations?$filter=result eq 10 mul 3
```

- Div

select observations where result equals 21 / 3 = 7

```
$ curl http://localhost:8080/v1.0/Observations?$filter=result eq 21 div 3
```

- Mod

select observations where result modulo 2 == 0

```
$ curl http://localhost:8080/v1.0/Observations?$filter=result mod 2 eq 0
```

## grouping Operators

```
$ curl http://localhost:8080/v1.0/Observations?$filter=(result sub 5) eq 45
```

## String functions

- contains

```
$ curl http://localhost:8080/v1.0/Sensors?$filter=contains(name,'temperature')
```

- startswith

```
$ curl http://localhost:8080/v1.0/Sensors?$filter=startswith(name,'temp')
```

- endswith

```
$ curl http://localhost:8080/v1.0/Sensors?$filter=endswith(name,'sensor')
```

- length

```
$ curl http://localhost:8080/v1.0/Sensors?$filter=length(name) eq 18
```

- indexof

```
$ curl http://localhost:8080/v1.0/Sensors?$filter=indexof(name, 'sensor') eq 0
```

- substringof

```
$ curl http://localhost:8080/v1.0/Sensors?$filter=substringof('sensor', name) eq true
```

- trim

```
$ curl http://localhost:8080/v1.0/Sensors?$filter=trim(name) eq 'My Sensor'
```

- toupper

```
$ curl http://localhost:8080/v1.0/Sensors?$filter=toupper(name) eq 'SENSOR NAME 1'
```

- tolower

```
$ curl http://localhost:8080/v1.0/Sensors?$filter=tolower(name) eq 'sensor name 1'
```

- concat

```
$ curl http://localhost:8080/v1.0/Sensors?$filter=concat(name,'!') eq 'sensor name 1!'
```

## Geospatial functions

- geo.distance

```
$ curl http://localhost:8080/v1.0/Locations?$filter=geo.distance(location, geography'POINT(-122 43)') gt 1
```

- geo.length

```
$ curl http://localhost:8080/v1.0/Locations?$filter=geo.length(location) gt 0
```

- geo.intersects

```
$ curl http://localhost:8080/v1.0/Locations?$filter=geo.intersects(location, geography'POLYGON ((30 10, 10 20, 20 40, 40 40, 30 10))')
```

## Spatial Relationship Functions

- st_within

```
$ curl http://localhost:8080/v1.0/Locations?$filter=st_within(location,geography'POLYGON((-180 -90, -180 90, 180 90, 180 -90, -180 -90))')
```

- st_intersects

```
$ curl http://localhost:8080/v1.0/Locations?$filter=st_intersects(location, geography'POLYGON ((-180 -90, -180 90, 180 90, 180 -90, -180 -90))')
```

- st_equals

```
$ curl http://localhost:8080/v1.0/Locations?$filter=st_equals(location, geography'POINT (-117.123 54.123)')
```

- st_disjoint

```
$ curl http://localhost:8080/v1.0/Locations?$filter=st_disjoint(location, geography'POLYGON ((-180 -90, -180 90, 180 90, 180 -90, -180 -90))')
```

- st_touches

```
$ curl http://localhost:8080/v1.0/Locations?$filter=st_touches(location, geography'POLYGON ((-180 -90, -180 90, 180 90, 180 -90, -180 -90))')
```

- st_overlaps

```
$ curl http://localhost:8080/v1.0/Locations?$filter=st_overlaps(location, geography'POLYGON ((-180 -90, -180 90, 180 90, 180 -90, -180 -90))')
```

- st_crosses

```
$ curl http://localhost:8080/v1.0/Locations?$filter=st_crosses(location, geography'POLYGON ((-180 -90, -180 90, 180 90, 180 -90, -180 -90))')
```

- st_contains

```
$ curl http://localhost:8080/v1.0/Locations?$filter=st_contains(location, geography'POLYGON ((-180 -90, -180 90, 180 90, 180 -90, -180 -90))')
```

- st_relate

Relates two geometry, more info about the format see https://en.wikipedia.org/wiki/DE-9IM

```
$ curl http://localhost:8080/v1.0/Locations?$filter=st_relate(location, geography'POLYGON ((30 10, 10 20, 20 40, 40 40, 30 10))', 'T********')
```

## Date functions

- day

```
$ curl http://localhost:8080/v1.0/Observations?$filter=day(phenomenonTime) eq 4
```

- hour

```
$ curl http://localhost:8080/v1.0/Observations?$filter=hour(phenomenonTime) eq 8
```

- minute

```
$ curl http://localhost:8080/v1.0/Observations?$filter=minute(phenomenonTime) eq 8
```

- second

```
$ curl http://localhost:8080/v1.0/Observations?$filter=second(phenomenonTime) eq 8.234
```

- month

```
$ curl http://localhost:8080/v1.0/Observations?$filter=month(phenomenonTime) eq 8
```

- month

```
$ curl http://localhost:8080/v1.0/Observations?$filter=year(phenomenonTime) eq 2017
```

- fractional seconds

```
$ curl http://localhost:8080/v1.0/Observations?$filter=fractionalseconds(phenomenonTime) eq 733
```

- now

```
$ curl http://localhost:8080/v1.0/Observations?$filter=phenomenonTime gt now()
```

- mindatetime

```
$ curl http://localhost:8080/v1.0/Observations?$filter=phenomenonTime gt mindatetime()
```

- maxdatetime

```
$ curl http://localhost:8080/v1.0/Observations?$filter=phenomenonTime lt maxdatetime()
```

- totaloffsetminutes

```
$ curl http://localhost:8080/v1.0/Observations?$filter=totaloffsetminutes(phenomenonTime) eq 0
```

- date

```
$ curl http://localhost:8080/v1.0/Observations?$filter=date(phenomenonTime) eq date('2017-07-04')
```

- time

```
$ curl http://localhost:8080/v1.0/Observations?$filter=time(phenomenonTime) eq time('14:31:24.733Z')
```

## Math functions

- round

```
$ curl http://localhost:8080/v1.0/Observations?$filter=round(result) eq 10
```

- floor

```
$ curl http://localhost:8080/v1.0/Observations?$filter=floor(result) eq 10
```

- floor

```
$ curl http://localhost:8080/v1.0/Observations?$filter=ceiling(result) eq 10
```

## Filter on related entities

```
$ curl http://localhost:8080/v1.0/Observations?$filter=Datastream/id eq ‘1’
```

Status: not implemented

## Type functions

isOf

status: not implemented

repository: janniswarnat/docs

repo_name: janniswarnat/docs


text:
# mirnn
MiRNN is a Neural Network library implemented with the [Groovy programming language](http://www.groovy-lang.org/)

This library implements the algorithm described in the following paper:

[D. Monner and J.A. Reggia (2012). A generalized LSTM-like training algorithm for second-order recurrent neural networks](http://www.overcomplete.net/papers/nn2012.pdf)

while the implementation is based on the [Synaptic](https://github.com/cazala/synaptic) javascript library.

The library is bundled with [MirComp](https://github.com/mcolletta/mircomp), the framework for algorithmic and assisted music composition.

Copyright (c) 2016-2017 Mirco Colletta

This library is released under the MIT License, see the LICENSE file for details.

repository: mcolletta/mirnn

repo_name: mcolletta/mirnn


text:
# Build Your Own Toast

The file `build-your-own-context-free.zip` contains dialog without context. During the workshop we show how to work with context in order to control the intent activation.

> To view the conversation tree click [here](https://bit.ly/2IR3GVh)

repository: davinci-school/DialogFlowToastBar

branch_name: refs/heads/main

repo_name: davinci-school/DialogFlowToastBar


text:
# Slim Launcher [![CircleCI](https://circleci.com/gh/subbramanil/slim-launcher.svg?style=svg)](https://circleci.com/gh/subbramanil/slim-launcher)

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=subbramanil_slim-launcher&metric=alert_status)](https://sonarcloud.io/dashboard?id=subbramanil_slim-launcher)

Android minimalistic launcher

The project got inspired by [Slim Launcher](https://github.com/sduduzog/slim-launcher)

## New Features

- List View with icons
![Apps In List](https://s3-us-west-2.amazonaws.com/my-blogresources/screenshots/apps_in_list.png)

- Grid view
![Apps In Grid](https://s3-us-west-2.amazonaws.com/my-blogresources/screenshots/apps_in_grid.png)

## Contribute

- PRs are more than welcome.

repository: subbramanil/slim-launcher

repo_name: subbramanil/slim-launcher


text:
---
layout: default
---

# 1996-05-02 - Re: [Fwd: Cylink can export 128-bit DH?]

## Header Data

From: Derek Atkins<EMAIL_ADDRESS>To: peng-chiew low<EMAIL_ADDRESS>Message Hash: 399e7061911002fa2dea6c400b8d2ee8bbc59460335ead031eb548ac9bf552b4

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1996-05-02 02:04:18 UTC

Raw Date: Thu, 2 May 1996 10:04:18 +0800

## Raw message

```
{% raw  %}From: Derek Atkins<EMAIL_ADDRESS>Date: Thu, 2 May 1996 10:04:18 +0800
To: peng-chiew low<EMAIL_ADDRESS>Subject: Re: [Fwd: Cylink can export 128-bit DH?]
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

It is legal to export full DES, in binary form, to banks outside the
US.  In other words, a company in the US can create a financial
package that uses DES, even for encryption, and sell it to a bank
outside the US.  THe caveat is that DES can only be used to encrypt
the financial transactions, not arbitrary data.

I hope this helps.

-derek

{% endraw %}
```

## Thread

+ Return to [May 1996](/archive/1996/05)

+ Return to "[Derek Atkins <warlord@MIT.EDU>](/authors/derek_atkins_warlord_at_mit_edu_)"
+ Return to<EMAIL_ADDRESS>(Daniel R. Oelke)](/authors/droelke_at_rdxsunhost_aud_alcatel_com_daniel_r_oelke_)"
+ Return to "[peng-chiew low <pclow@pc.jaring.my>](/authors/pengchiew_low_pclow_at_pc_jaring_my_)"

+ 1996-05-01 (Thu, 2 May 1996 06:03:33 +0800) - [Re: [Fwd: Cylink can export 128-bit DH?]](/archive/1996/05/70d78717ffbdf77967c5c0b0dd487fc23cf6ed443beec79dfe873090f0dac395) -<EMAIL_ADDRESS>(Daniel R. Oelke)_
  + 1996-05-02 (Thu, 2 May 1996 08:50:52 +0800) - [Re: [Fwd: Cylink can export 128-bit DH?]](/archive/1996/05/2b5c12147025588d93896c0f46778d5d53c2f8e57977c8e0981639368c519b3d) - _peng-chiew low<EMAIL_ADDRESS>    + 1996-05-02 (Thu, 2 May 1996 10:04:18 +0800) - Re: [Fwd: Cylink can export 128-bit DH?] - _Derek Atkins<EMAIL_ADDRESS>


text:
# Asus Strix Raid DLX-Linux-Workaround
Asus Strix Raid DLX Soundcard reverse engineering for using the included control box under linux

## 1. Introduction

I own a Asus Soundcard named Strix Raid DLX which comes with a control box. Thix box is intended to be placed on the desk and you can plug in your headphones easily.
With a button you can switch between headphones (connected to the box) and speaker (directly connected to the soundcard). You can change also the volume with a rotation of the button.

Since the box doesn't work under linux and changing the output is not that easy I tried to reverse engineer the hole process. This was my first time to do so and there might be
some better methods for it but I was successful so I want to share my knowledge.

The soundcard uses a Asmedia USB controller chip where the soundchip and the control box are internally connected.
On button press a microcontroller inside the box starts an interrupt on the usb bus with a special request. The controller on the soundcard analyses the request and sends a response back.

## 2. USB request to change led states on control box

The control box itself can only change the state of the leds and cannot switch the relais between headphone and speaker.

There exist 13 leds for the volume which results in 14 different states: all off (volume 0% / volume off) and 1-13 leds on for increased volume.
Also there are 2 leds which show if headphone or speaker are active. That results in 2 different states: (on / off or off / on)

To control the LEDs on the box the following USB request is used:

```bash
bmRequestType :0x21
bRequest: 0x09
wValue: 0x0200
wIndex: 0x0004
wLength: 16
```

The data block consists of 16 bytes and looks like this:
```bash
09 c5 27 00 04 03 02 ff 1f 00 00 00 00 00 00 00
```

Byte 7 changes the state for the status LED (headphone or speaker). 02 represents headphones, 08 represents speaker

Bytes 3, 8 and 9 represent the state of the volume control (how many leds are on)

- state of status led remains on headphones, volume led change from zero two 13

```bash

09 c5 09 00 04 03 02 00 00 00 00 00 00 00 00 00		- headphone led on, zero volume leds
09 c5 0a 00 04 03 02 01 00 00 00 00 00 00 00 00
09 c5 0c 00 04 03 02 03 00 00 00 00 00 00 00 00
09 c5 10 00 04 03 02 07 00 00 00 00 00 00 00 00
09 c5 18 00 04 03 02 0f 00 00 00 00 00 00 00 00
09 c5 28 00 04 03 02 1f 00 00 00 00 00 00 00 00
09 c5 48 00 04 03 02 3f 00 00 00 00 00 00 00 00
09 c5 88 00 04 03 02 7f 00 00 00 00 00 00 00 00
09 c5 08 00 04 03 02 ff 00 00 00 00 00 00 00 00
09 c5 09 00 04 03 02 ff 01 00 00 00 00 00 00 00
09 c5 0b 00 04 03 02 ff 03 00 00 00 00 00 00 00
09 c5 0f 00 04 03 02 ff 07 00 00 00 00 00 00 00
09 c5 17 00 04 03 02 ff 0f 00 00 00 00 00 00 00
09 c5 27 00 04 03 02 ff 1f 00 00 00 00 00 00 00		- headphone led on, all 13 volume leds on
```
- state of status led remains on speaker, volume led change from zero two 13

```bash
09 c5 0f 00 04 03 08 00 00 00 00 00 00 00 00 00		- speaker led on, zero volume leds
09 c5 10 00 04 03 08 01 00 00 00 00 00 00 00 00
09 c5 12 00 04 03 08 03 00 00 00 00 00 00 00 00
09 c5 16 00 04 03 08 07 00 00 00 00 00 00 00 00
09 c5 1e 00 04 03 08 0f 00 00 00 00 00 00 00 00
09 c5 2e 00 04 03 08 1f 00 00 00 00 00 00 00 00
09 c5 4e 00 04 03 08 3f 00 00 00 00 00 00 00 00
09 c5 8e 00 04 03 08 7f 00 00 00 00 00 00 00 00
09 c5 0e 00 04 03 08 ff 00 00 00 00 00 00 00 00
09 c5 0f 00 04 03 08 ff 01 00 00 00 00 00 00 00
09 c5 11 00 04 03 08 ff 03 00 00 00 00 00 00 00
09 c5 15 00 04 03 08 ff 07 00 00 00 00 00 00 00
09 c5 1d 00 04 03 08 ff 0f 00 00 00 00 00 00 00
09 c5 2d 00 04 03 08 ff 1f 00 00 00 00 00 00 00		- speaker led on, all 13 volume leds on
```
## 3. USB Reuqest to change sound output

To change the sound output the following USB request is used:
```bash
bmRequestType :0x21
bRequest: 0x01
wValue: 0x0800
wIndex: 0x0700
wLength: 2
```
The data block consists of 2 bytes and looks like this:

switching relais from headphone to speaker:
```bash
01 03
```
switching relais from speaker to headphone
```bash
02 03
```

## 4. Generated USB interrupts from control box

If the button is pressed or the volume is changed the box sends some data and waits for an answer. This data will be resend
until an answer with a new state is received (see part #2).

Pressing middle button for switching relais:
```bash
5 5 0 3 1 1 3 0 1 1 1 1 1 0 0 0
```
Rotating button increasing volume:
```bash
5 5 0 1 1 3 3 0 1 1 1 1 1 0 0 0
```
Rotating button decreasing volume:
```bash
5 6 0 1 1 4 3 0 1 1 1 1 1 0 0 0
```
button press on raid mode button:
```bash
5 2 0 1 1 0 4 0 1 1 1 1 1 0 0 0
```

## 5. Prerequisites

I don't have any experience in programming a kernel driver so I decided to go the easiest way for me and write a python script with
the help of the pyusb library.

Because the control box is attached to the Asmedia USB Hub and is not correctly recognized through linux the kernel module usbhid is
automatically loaded. You have to unbind it to send commands to the control box itself or you will get a "resource busy" error code.

The script is tested with python3.7, i cannot say if it works with other versions too.
To change the volume I use the pyalsaaudio library.

```bash
pip3.7 install pyusb
pip3.7 install pyalsaaudio

```

## 6. Usage

Actual the python script must be run under root. It should be possible to get it working without root using udev rules but I don't have
the time to check this out.

Changing the output requires to send a command to a usb interface which is in use by the usb audio driver module. In my script I deattach
it from the kernel, send my message and reattach it. Don't know if there is a better way.

## 7. Todo:

My time is limited but I want to:

usage without root
systemd service for startup
RaidMode Button does nothing
Save last state of the box and read it out at startup

## 8. Contribution:

Please feel free to use all of the informations above