text:
---
layout: post
title: The Science Of Screaming
category: General
---
#### WHY WE SCREAM FROM THE MOMENT WE’RE BORN (AND WHY IT FEELS SO GOOD).

![]( http://katieball.me/assets/images/babyscream.jpeg)

There’s a high chance that the first thing you ever did was scream. Thrust new and pink into a cold, strange world, what else is there to do other than take your first breath and let it out as a big WAAAAAH? It was probably the happiest moment of your parents’ lives.

>>Screaming is an essential survival mechanism when you’re too young to be able to ask nicely for a feed or a nappy change.

It’s also something humans do in a bafflingly broad array of contexts, ranging from terror to joy to surprise and almost everything in between. It’s a versatile, attention-grabbing vocalisation.No wonder it’s so popular.

##### But what even is a scream?
In an everyday context you don’t really need to know the answer to that question, because you know a scream when you come across one. Rarely will you hear someone ask, “Hey, was that a scream I just heard, or just a coo of delight?”

Screams have a very particular quality, one that a team of scientists led by researcher David Poeppel believe is defined by audible ‘roughness’ rather than pitch. A rough sound changes volume, going up and down in individually imperceptible shifts many times per second. Overall, this creates an impression of ‘raggedness’ that registers at a deep level in the human brain.

##### This is evolutionarily advantageous
Being able to recognise a scream quickly means being alert to danger.

Screams of terror or pain aren’t the only kind, although it seems like those are the main game from which all other types are derived.
Researcher Sascha Frühholz found that there are at least six flavours of screaming (yum!), including sadness, joy, surprise, and sensual pleasure, as well as the old faithful fear/alarm scream.

Rather than being a single-situation thing, it’s more accurate to say that there is a menu of screams to choose from, depending on the circumstances in which you find yourself. Imagine the amygdala, a brain structure involved in screaming and emotions, as a sort of scream sommelier.
Would madam prefer a short, terrified scream today? A bright, joyful scream? Or perhaps a middle-toned scream of frustration and anger with a lingering, grumbling tail end?

>>When we hear a scream,
it cuts through our
consciousness and straight
into the fear centres
of the brain.
We immediately want
to do something –
gather information,
run away,
take action,
anything!

This is why babies’ neat trick of screaming is so handy; it’s a way to hijack their parents’ brains.

Researcher Sean M. Smith identified the pathway that causes your brain to go psycho when you hear the mewling cries of an infant: it’s called the hypothalamic-pituitary-adrenal axis, or HPA for short. When you hear screaming, a hormone called corticotropin-releasing factor is secreted from a section of the hypothalamus.

This causes a cascade of complex interactions that culminates in the release of cortisol, the ‘stress hormone’, from the adrenal gland, which causes the subjective experience we know as ’stress’,

Interestingly, despite the variety of different screams humans can produce, we aren’t tip top at distinguishing between screams of happiness and screams of fear without other contextual clues.

Researchers led by Jonathan Engelberg, a psychologist at Emory University, played 30 different screams from movies to 182 participants and asked them to guess what emotion was being conveyed. Generally, the subjects were pretty good amateur screamologists, guessing correctly much of the time, but they consistently rated happy screaming as being more fearful than it actually was.

The study theorises that this might be because of the high cost of hearing a fear scream and misinterpreting it as happy – you don’t want to bust out the noisemakers and applause if what you’re actually hearing is someone screaming because they’ve touched a live wire, or been bitten by a snake.

Because of its universality, screaming is a widely explored theme in art and culture. Think of Edvard Munch’s famous 1893 painting, The Scream, which shows an eerie, genderless, neotenous figure clutching the sides of their face and letting out a scream or shriek of sorrow.

>>Munch was a very early
practitioner of Expressionism,
an art movement that rejected
strict photorealism in favour
of more abstract, distorted
aesthetics, so that the main
purpose of the work is evoking
emotions rather than
representing reality.

Horror movies work on a similar principle: rather than telling a realistic story, they use intense atmospheric techniques in order to make you feel afraid. Actors screaming triggers the same stress pathway as babies screaming, which is why horror movies are so scary.

There is also a cathartic element to screaming, which you can see in music that incorporates screams like screamo or aggressive genres of metal.

Screaming is powerful, and there’s undeniably situations in which we seek it out on purpose to feel good; even going on a rollercoaster is just a disguised opportunity to get in a big, cathartic scream. Amusement park screams show how blurry the line can be between joy screaming and fear screaming – if you’re having your birthday at Uncle Shriek’s Fun Shack of Terror, you’re doing that on purpose, seeking out the pleasing thrill of danger under controlled circumstances. But your body doesn’t know that, which is why the rollercoaster drop still makes you scream like you’ve just fallen out of a dirigible with no parachute on.

Back in the 1970s, psychologist Arthur Janov wrote The Primal Scream, a book that advocated screaming as a way to discharge neurosis generated by childhood trauma. There’s little evidence that this actually works to make you feel better in the long term, but that’s not really the point.

![]( http://katieball.me/assets/images/scream.JPG)

Screaming seems to have evolved as a quick and dirty way of communicating extremely heightened emotions, so that everyone around you will immediately recognise that something is happening that’s worth looking up from the newspaper for. Seen that way, it’s not so surprising that a vocal alarm meaning, “We’re all gonna die!!!” can also mean, “Wow, I have unexpectedly received a puppy as a present and am overjoyed and grateful.”

The thing that all these scream types have in common is honesty! Compared to the plodding, unclear vagaries of actual language, screaming is a shortcut to authenticity.
I’ll scream to that.


text:
# cucumber_wire

[![Pub Version](https://img.shields.io/pub/v/cucumber_wire.svg)](https://pub.dartlang.org/packages/cucumber_wire)
[![Build Status](https://travis-ci.org/eredo/cucumber_wire.svg?branch=master)](https://travis-ci.org/eredo/cucumber_wire)
[![Coverage Status](https://coveralls.io/repos/github/eredo/cucumber_wire/badge.svg)](https://coveralls.io/github/eredo/cucumber_wire)

An implementation of cucumber using the [cucumber wire protocol](https://github.com/cucumber/cucumber/wiki/Wire-Protocol).

## Usage

There are several ways to use this package. For a regular use setup a dart project and add this package as a dependency:

```yaml
name: my_cucumber_features

dependency:
  cucumber_wire: any
```

Then setup your features folder containing a `.feature` file and a `step_definitions` folder, in which you add a
`dart_server.wire` file including the following content:

```yaml
host: localhost
port: 9090
```

Add a step definition dart file which registers the scenarios (ex: `features/step_definitions/definitions.dart`).
The `cucumber_wire` package exports the `package:matcher/matcher.dart` so matcher are directly available as well as a
simple `expect` function.

```dart
// You may import further tests
import 'package:cucumber_wire/cucumber_wire.dart';

void main(_, SendPort port) {
  // The port is provided by the runner when this step definition dart file is loaded and is used to communicate
  // between this dart file and the server.
  registerStepDefinitions(sendPort, [
    TestScenario,
  ]);
}

class TestScenario {
  @Given("we're all wired")
  void allWired() {}

  @Then(r'I see the download button with text "([A-Za-z\s+]+)"')
  void openTheBrowser(String text) {
    expect(button.text, text);
  }

  @Then('I want to do something')
  void wantToDoSomething() {
    // ...
  }
}
```

Start the `cucumber_wire` server using `pub run` pointing to your entry point file.

```
pub run cucumber_wire features/step_definitions/definitions.dart
```

Afterwards start your cucumber runner:

```
cucumber -f pretty
```

## Setting up scenarios

Scenario classes contain methods which define steps. These steps are annotated with `@Then`, `@And`, `@Given` and `@When`.
The name of the method is not relevant. Within the step annotations a regular expression string is defined, which will
be extended by the scenario loader when the scenario is added to `registerStepDefinitions`, meaning the original
expression string: `It's a ([a-z]+)` will be turned into `^It's a ([a-z]+)`, to make it a valid expression and save some
overhead.

The matches of the regular expression are than passed to the method as parameters when the step is executed, meaning
there need to be at least the same number of parameters for a method than potential matches within the pattern. If the
parameter type is not of type string, the runner will try to convert the passed value from cucumber into the proper dart
type, which is currently only supported for `bool` (string == "true"), `int`, `double` and `num`.

The scenario needs to have at least one default named constructor (or no constructor at all) in order for the runner to
initiate an instance of the scenario.

```dart
void main(_, SendPort port) {
  // The port is provided by the runner when this step definition dart file is loaded and is used to communicate
  // between this dart file and the server.
  registerStepDefinitions(sendPort, [
    TestScenario,
  ]);
}

class TestScenario {
  @Given("we're all wired")
  void allWired() {}

  @Then(r'I see the download button with text "([A-Za-z\s+]+)"')
  void openTheBrowser(String text) {
    expect(button.text, text);
  }

  @Then('I want to do something')
  void wantToDoSomething() {
    // ...
  }
}
```

## Parameter types

It's not necessary to always write matchers as regular expression. The built-in parameter types of cucumber are supported
as well:

| Parameter type | Description | Regular expression |
| -------------- | ----------- | ------------------ |
| `{int}` | Matches integers, for example `71` or `-19`. | `([\-\+0-9]+)` |
| `{float}` | Matches floats, for example `3.6`, `.8` or `-9.2`. | `([\+\-0-9\.]+)` |
| `{word}` | Matches words without whitespace, for example `banana` (but not `banana split`) | `([A-Za-z0-9\_\-]+)` |
| `{string} ` | Matches single-quoted or double-quoted strings, for example `"banana split"` or `'banana split'` (but not `banana split`). Only the text between the quotes will be extracted. The quotes themselves are discarded. | `"([A-Za-z0-9.\s]+)"` |
| `{}` | Matches anything. | `(.*)` |

## Current implementation of worlds

Currently worlds should be defined as `abstract class` and shared across scenarios using inheritance. If variables of
a world should be initiated only once use getters which refer to a static property of the world.

```dart
// Example scenario with multiple worlds.
class MyScenario1 extends DriverWorld with MagicWorld {
  @When('I open the browser at (.*)')
  void openTheBrowser(String url) => driver.get(url);

  @And('I activate magic')
  void activateMagic() => isActive = true;

  @Then('all is good')
  void allIsGood() => expect(allGood, isTrue);
}
class MyScenario2 extends DriverWorld {}

// A world
abstract class DriverWorld {
  // Static property so each instance of DriverWorld shares the driver.
  static WebDriver _driver;
  // This getter checks whether _driver is not null, if it is null the initiation expression is executed.
  WebDriver get driver => _driver ??= createDriver();

  @afterAll
  void closeDriver() {
    _driver?.close();
    _driver = null;
  }
}

abstract class MagicWorld {
  // Example of getter and setter usage.
  static bool _isActive = false;

  bool get isActive => _isActive;

  set isActive(bool active) {
    assert(_isActive != active, 'Active cannot be set to the same value twice, something went wrong.');
    _isActive = active;
  }

  // Static variable can also be used instantly
  static bool allGood = true;
}
```

### Proposal for worlds

> **Note: This is a proposal and not yet implemented.**

Worlds should be provided by dependency injection.

```dart
void main(_, port) {
  registerStepDefinitions(port, [
    TestScenario,
  ], providers: [
    TestWorld,
  ]);
}

class TestScenario {
  final TestWorld world;
  TestScenario(this.world);
}

class TestWorld {}
```

## Plugins

Plugins help to provide further details to a step definition method and do steps before executing the method. Plugins
are imported within the step definition and as such can be defined outside of this package. A possible first implementation
of a plugin could be `cucumber_wire_webdriver` which is currently available in `features/step_definitions/driver.dart`.

A plugin contains a method `apply` which is called for each step parameter which is not defined by the expression before
the method is called.

```dart
@When('I open the browser at (.*)')
void openTheBrowserAt(String url, String thisParameterIsForPlugin) {}
```

The first plugin in the list of registered plugins within `registerStepDefinitions` which returns an other value than
`null` in it's `apply` method is used. The `apply` method receives a [ParameterMirror](https://api.dartlang.org/stable/2.1.0/dart-mirrors/ParameterMirror-class.html)
which is used to gather the information of the parameter and as a second argument the instance of the scennario class which
contains the method. Therefore the instance of the scenario can be used to gather further information or execute
additional steps (which at this point may only be synchronous).

An example for a plugin can be seen below, which enables an annotation for parameters to use the `WebDriver` to fetch
a `WebElement` using a CSS selector, where the instance of the scenario needs to inherit the `Driver` world.

```dart
/// Example plugin to support build in annotations for CssSelectors.
class ByCssSelectorPlugin extends SuitePlugin<Driver, WebElement> {
  final _by = reflectClass(By);

  @override
  WebElement apply(ParameterMirror mirr, Driver instance) {
    final selector = _selector(mirr);
    if (selector != null) {
      return instance.driver.findElement(selector);
    }

    return null;
  }

  By _selector(ParameterMirror mirr) {
    for (final meta in mirr.metadata) {
      if (meta.type.isAssignableTo(_by)) {
        return meta.reflectee;
      }
    }

    return null;
  }
}
```

After registering the plugin to the `registerStepDefinitions` function, it's available to all scenarios registered within
the same function as well.

```dart
void main(_, SendPort sendPort) {
  registerStepDefinitions(sendPort, [
    TestScenario
  ], plugins: [
    ByCssSelectorPlugin(),
  ]);
}

class TestScenario extends Driver {
  @Then(r'I see the download button with text "([A-Za-z\s+]+)"')
  void openTheBrowser(
      String text, @By.cssSelector('.install-download') WebElement button) {
    expect(button.text, text);
  }
}
```

## Tools

### Add definition

This tool generates the step definition method code based on a provided sentence.

```
Usage: pub run cucumber_wire:add_definition [options] "<sentence>" [target_file] [target_line]

Where <sentence> needs to start with either Given, And, Then or When.

-a, --[no-]async    Defines that the step definition should be asynchronous
-h, --[no-]help     Shows this usage message.
```

Define it as an [external tool within intellij](https://www.jetbrains.com/help/idea/settings-tools-external-tools.html)
to enable a smooth experience directly in the IDE.

![settings tool](doc/assets/screen_tool.png?raw=true)

![settings tool async](doc/assets/screen_tool_async.png?raw=true)

![usage tool](doc/assets/screen_usage.gif?raw=true)

## How it works

This package is using the [cucumber wire protocol](https://github.com/cucumber/cucumber/wiki/Wire-Protocol) to support
a dart implementation of cucumber. Therefore a TCP server is started which listens for instructions provided by cucumber
when it's started using a `.wire` configuration file within the `step_definitions` folder. The dart process which starts
the TCP server also spawns an isolate with the given path to the step definitions dart implementation.

The isolate uses reflection to detect all step definitions (`@Given`, `@Then`, `@When`, `@And`, `@after`, ...) which are
defined within scenarios passed to `registerStepDefinitions` within the `main` function. Because the step definition dart
file is spawned using an isolate it receives a `SendPort` as the second argument to the `main` function, which is passed
to `registerStepDefinitions` which is responsible for the communication between the isolate and parent dart isolate
which spawned the TCP server.

When the TCP server receives instructions from the `cucumber` client it forwards them to the isolate which either:
- Looks up if the definition exists, which arguments are provided and returns a proper identifier for the method
- Executes a definition by it's previously provided identifier and the given arguments
- Executes a hook (`@afterAll`, `@beforeAll`, `@before`, `@after`)

The implementation which spawns the isolate comes with some features, like change detection and reloading of the isolate.

## Known issues

- `@afterAll`, `@beforeAll` methods on worlds might be executed multiple times, therefore add a bool check whether the
  method was already executed otherwise skip function. Null operators help in this case `_driver ??= createDriver()`.
  `_driver?.close(); _driver = null;`.

## Roadmap

- Support configuration with configuration file parameters which are then either passed as environment variables or
  available for access by injection.
- Integration with `package:test`.
- Support for multiple entry point files.
- Examples for Intellij live code templates for ease of use.
- Support asynchronous plugins
- Dependency injection of scenarios and worlds.
- Debugging story including running `pub run cucumber` and providing a debug port.
- Applying new mixin patterns to worlds and plugins.
- Add analyzer plugin to validate scenarios, potential analyzer warnings/lints:
  - Number of parameters doesn't match the amount of pattern matches.
  - Step definition already exists in a different scenario.
- Provide optional arguments and named arguments (`@Then('Button label :label should :equal')`)

license: MIT

branch_name: refs/heads/master

extension: md

gha_language: Dart

gha_license_id: MIT

license_type: permissive


text:
# osu.Framework.Flexbox
A flexbox container for osu-framework.

Includes features such as:
* flex-basis, flex-grow and flex-shrink
* flex-direction
* flex-spacing
* flex-wrap
* min-width, max-width and width
* min-height, max-height and height
* align-items and align-self
* align-content
* avaiable in `px` and `%` units if applicable

The `Flexbox` container is included in `osu.Framework.Graphics.Containers`.

For a guide how flexboxes work [click here](https://css-tricks.com/snippets/css/a-guide-to-flexbox/).

## Not implemented yet
* order

## Sample code
```cs
// Side menu with a body that fills the rest of the space:
var menu = new Flexbox {
    Width = 500,
    RelativeSizeAxes = Axes.Y,
    Children = new FlexboxItem[] {
        new() {
            Basis = 50.Pixels(),
            Drawable = new Box() {
                Colour = Colour4.Gray
            }
        },
        new() {
            Grow = 1,
            Drawable = new Box() {
                Colour = Color4.DarkGray
            }
        }
    }
};

// A flexbox child animating its flex properties:
this.TransformBindableTo( this.GetFlexboxProperties().BasisBindable, 100.Pixels(), 400, Easing.Out );
```

repository: Flutterish/osu-framework-flexbox

branch_name: refs/heads/main

repo_name: Flutterish/osu-framework-flexbox


text:
# AngularJS

The `xlsx.core.min.js` and `xlsx.full.min.js` scripts are designed to be dropped
into web pages with script tags:

```html
<script src="xlsx.full.min.js"></script>
```

Strictly speaking, there should be no need for an Angular demo!  You can proceed
as you would with any other browser-friendly library.

## Array of Objects

A common data table is often stored as an array of objects:

```js
$scope.data = [
  { Name: "Bill Clinton", Index: 42 },
  { Name: "GeorgeW Bush", Index: 43 },
  { Name: "Barack Obama", Index: 44 },
  { Name: "Donald Trump", Index: 45 }
];
```

This neatly maps to a table with `ng-repeat`:

```html
<table id="sjs-table">
  <tr><th>Name</th><th>Index</th></tr>
  <tr ng-repeat="row in data">
    <td>{{row.Name}}</td>
    <td>{{row.Index}}</td>
  </tr>
</table>
```

The `$http` service can request binary data using the `"arraybuffer"` response
type coupled with `XLSX.read` with type `"array"`:

```js
  $http({
    method:'GET',
    url:'https://sheetjs.com/pres.xlsx',
    responseType:'arraybuffer'
  }).then(function(data) {
    var wb = XLSX.read(data.data, {type:"array"});
    var d = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);
    $scope.data = d;
  }, function(err) { console.log(err); });
```

The HTML table can be directly exported with `XLSX.utils.table_to_book`:

```js
var wb = XLSX.utils.table_to_book(document.getElementById('sjs-table'));
XLSX.writeFile(wb, "export.xlsx");
```

## Import Directive

A general import directive is fairly straightforward:

- Define the `importSheetJs` directive in the app:

```js
app.directive("importSheetJs", [SheetJSImportDirective]);
```

- Add the attribute `import-sheet-js=""` to the file input element:

```html
<input type="file" import-sheet-js="" multiple="false"  />
```

- Define the directive:

```js
function SheetJSImportDirective() {
  return {
    scope: { opts: '=' },
    link: function ($scope, $elm) {
      $elm.on('change', function (changeEvent) {
        var reader = new FileReader();

        reader.onload = function (e) {
          /* read workbook */
          var bstr = e.target.result;
          var workbook = XLSX.read(bstr, {type:'binary'});

          /* DO SOMETHING WITH workbook HERE */
        };

        reader.readAsBinaryString(changeEvent.target.files[0]);
      });
    }
  };
}
```

## Export Service

An export can be triggered at any point!  Depending on how data is represented,
a workbook object can be built using the utility functions.  For example, using
an array of objects:

```js
/* starting from this data */
var data = [
  { name: "Barack Obama", pres: 44 },
  { name: "Donald Trump", pres: 45 }
];

/* generate a worksheet */
var ws = XLSX.utils.json_to_sheet(data);

/* add to workbook */
var wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, "Presidents");

/* write workbook and force a download */
XLSX.writeFile(wb, "sheetjs.xlsx");
```

## Demo

`grid.html` uses `angular-ui-grid` to display a table.  The library does not
provide any way to modify the import button, so the demo includes a simple
directive for a HTML File Input control.  It also includes a sample service for
export which adds an item to the export menu.

The demo `SheetJSImportDirective` follows the prescription from the README for
File input controls using `readAsBinaryString`, converting to a suitable
representation and updating the scope.

`SheetJSExportService` exposes export functions for `XLSB` and `XLSX`.  Other
formats are easily supported by changing the `bookType` variable.  It grabs
values from the grid, builds an array of arrays, generates a workbook and forces
a download.  By setting the `filename` and `sheetname` options in the `ui-grid`
options, the output can be controlled.

[![Analytics](https://ga-beacon.appspot.com/UA-36810333-1/SheetJS/js-xlsx?pixel)](https://github.com/SheetJS/js-xlsx)

repository: michaelmeganet/testphhsystem

gha_language: PHP

repo_name: michaelmeganet/testphhsystem


text:
# Visual Studio Code Extension for mCRL2
Extension to allow working with [mCRL2](https://mcrl2.org/) in [Visual Studio Code](https://code.visualstudio.com/).

## Features
- Syntax highlighting for `.mcrl2` and `.mcf` files.
- Run options
  - Parse code
  - Show LTS Graph
  - Simulate LTS Graph
  - Verify mu-calculus properties.

## Links
[Download](https://marketplace.visualstudio.com/items?itemName=CptWesley.mcrl2)
[Source Code/Git](https://github.com/CptWesley/vscode-mcrl2)
[Bug Reports/Feature Requests](https://github.com/CptWesley/vscode-mcrl2/issues)

## Usage
First, install the extension into your VS Code instance and make sure it's enabled.
Make sure the `/bin/` folder of your mCRL2 installation is either available from your `PATH` or configured in the extension settings.
Open the directory that contains your `.mcrl2` files and optionally your properties (in subdirectories).
Use any of the provided run-options at the top right of the editor window, or alternatively, use the keybindings described below.

## Keybindings
__F4__: Parses the specification.
__F5__: Shows the LTS Graph.
__F6__: Simulates the LTS.
__F7__: Verifies all found properties.


text:
# NSDesign for iOS

NSDesign is animation library that contains ready to use of animation classes. Check out the animations below and Enjoy!

---
## Table of Contents
* [Animations](#app-design)
  * [Circular Transition](#objective)
  * [Loading Animation](#objective)

---
### How to use it

#### Circular Transition
Goal: create A circle transition from one view into another
* Drag and drop ```CircularTransition.swift``` into your project.

* Use ```UIViewControllerTransitioningDelegate``` in your initial ViewController

* Make an object of CircularTransition

* add these functions to conform the protocol
``` swift
    func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {

        transition.transitionMode = .present
        transition.startingPoint = (buttonSender?.center)!
        transition.circleColor = (buttonSender?.backgroundColor)!

        return transition
    }

    func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {

        transition.transitionMode = .dismiss
        transition.startingPoint = (buttonSender?.center)!
        transition.circleColor = (buttonSender?.backgroundColor)!

        return transition
    }
```
* Go to prepare for segue to set delegate to self:
```swift
     override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
     if segue.identifier == "segueID" {
         let destinationViewController: DestinationViewController = segue.destination as! DestinationViewController
         destinationViewController.transitioningDelegate = self
         destinationViewController.modalPresentationStyle = .custom
     }
 }
```
* For any reference, your can checkout the sample project: ```ViewController.swift``` and ```DestinationViewController.swift```

#### Loading animation
* Drag and drop ```SkillLoaderView.swift```
* Subclass your view with SkillLoaderView
* Modify the animation as you wish from the storyboard

[Back to top ^](#)

---

## Contributing or Feature Request

Contributors are more than welcome. NSDesign accepts any kind of great animation in Swift. Just upload a pull request and add a description on your changes you made.

Feel free to add any issue and feature request to make NSDesign better in the future.


text:
+++
title = "Tips and Tricks With Mongodb"
date = "2019-01-12T16:46:47-05:00"

math = false
highlight = true
tags = ["nosql", "mongodb"]

summary = """
A list of Tips and Tricks with MongoDB
"""
+++

In this blog post I go over some tips and tricks with MongoDB and focus on using the mongodbshell.

# What is MongoDB

MongoDB is a document database with the scalability and flexibility that you want with the querying and indexing that you need.

## Installing MongoDB

MongoDB is released as two editions: Community and Enterprise.

Community is the open source release of MongoDB.

Enterprise provides additional administration, authentication, and monitoring features.

Installation steps vary depending on the edition; both procedures are outlined in this section.

Follow the [Instructions to Download MongoDB per Platform](https://docs.mongodb.com/manual/installation/)

#### Starting interactive mongodb session

Once you have installed mongodb you need to make sure that is running and then you can simply type:

```sh
> mongo
```

and then get into an interactive mongo shell session:

{{< figure src="/media/mongo-interactive-shell.png" >}}

#### Pretty Print trick for mongodb

You can set global settings in mongodb interactive shell in the *$SHELL/.mongorc.js* configuration file.

In mongodb shell if you want to pretty print collections you need to use the pretty() function like this:

```sh
> db.heroes.find({}).pretty()
```

If we set the following values in our *~/.mongorc.js*:

{{< figure src="/media/mongo-pretty-print.png" >}}

Now with this new setting we can simply query for documents and get pretty printing by default:

{{< figure src="/media/pretty-print-by-default.png" >}}

Notice here that we did not specify the `.pretty()` function and got pretty print behavior by default.

{{< figure src="/media/using-unpretty-function.png" >}}

#### Setting default number of documents printed to standard output

You can set the number of documents to show at a time with the following setting in *$HOME/.mongorc.js:

```js
DBQuery.shellBatchSize = 25
```

#### Set the settings for a mongodb server with the following command:

You can see the setting for the mongodb server with this command in the interactive shell:

{{< figure src="/media/mongodb-admin-server-settings.png">}}

#### Using interactive mongodb session full javascript console

Remember that the mongodb interactive shell is full blown javascript repl:

{{< figure src="/media/mongodb-interactive-repl.png" >}}

{{< figure src="/media/mongodb-interactive-repl2.png" >}}

*Notice here that we were able to use the map javascript function in the mongodb shell session.*

#### Extending prototype functions in JavaScript available in mongo shell

You can easily extend the available functions in mongo shell by adding them on *~/.mongorc.js* configuration file:

{{< figure src="/media/adding-prototype-functions-mongoshell.png" >}}

Now you can easily use this new function in a new mongo shell session like this:

{{< figure src="/media/list-proto-length.png" >}}

#### Using mongostat

[mongostat docs](https://docs.mongodb.com/manual/reference/program/mongostat/)

The mongostat utility provides a quick overview of the status of a currently running mongod or mongos instance.

mongostat is functionally similar to the UNIX/Linux file system utility vmstat, but provides data regarding mongod and mongos instances.

#### Finding the timestamp for when a particular document was added

You can run the `ObjectId("").getTimestamp()` to get the timestamp for the added mongo document

{{< figure src="/media/mongo-shell-timestamp-function.png" >}}

#### Using ESNext features in mongo shell session

You can use all the esnext features in JavaScript in the MongoShell session like this:

{{< figure src="/media/mongo-shell-esnext-js.png" >}}

repository: jbelmont/marcels-blog

repo_name: jbelmont/marcels-blog


text:
# Product Recommendation
Use Hadoop and Spark MapReduce jobs to analyze e-commerce web log files to provide product recommendation.

### Project Structure
- hadoop folder contains the hadoop MapReduce Job Implementation.
- spark folder contains the spark MapReduce Job Implementation.

### Recommendation Model
- One customer could visit multiple products during a visit session.
- Product co-occurrence measures the frequency with which two products appear close to each other in a customer’s visit session.
- It provides results for “people who is interested in this, also interested that”.

### MapReduce Jobs:

![MapReduce Jobs](mapreduce.png?raw=true “MapReduce Jobs“)
- The first MapReduce Job generates a History matrix which contains the interactions between user visit session and products. The input is web log files. The output key is a visit session ID, and the value is a list of product IDs visited during the visit session. Note: The product list contains the unique products.

- The second MapReduce Job transforms the history matrix into an product-by-product matrix which stores product pairs co-occur or appear together in multiple users visit session. The input is the output of the previous MapReduce Job output. The output key is a pair of product IDs, and the value is the co-occur number of the pair of products appear together in multiple user’s visit sessions.

- The third MapReduce Job generate the indicator matrix which retains only the anomalous (interesting) co-occurrences. The indicator matrix will serve as clues for recommendation. The input is the output of the previous MapReduce Job output. The output key is a product IDs, and the value is a list of products whick can be used as recommendation. The production list are ranked by the co-occur number.

### Hadoop Implementation:

#### How to create your MapReduce Job recommendation jar file:
* Create your LogFileLineParser java class which implements the parser.LogFileLineParser interface. Your LogFileLineParser should provide parse session ID and parse product ID methods. Those methods will be used by map-reduce job to parse each line of log files. You can refer to SampleLogFileLineParser.java file.
* Use maven to build and create the recommendation-1.0-SNAPSHOT.jar file
```sh
mvn package
```

#### How to run the haoop map-reduce jobs:

Step 1 - Run User session Product job with your LogFileLineParser class and your logfiles HDFS path.
```sh
hadoop jar recommendation-1.0-SNAPSHOT.jar hadoop.mapreduce.UserProductDriver -DlogFileLineParserClass="<your LogFileLineParser class name>" <your logfiles HDFS path> out/step1
```

Step 2 - Run Product CoOccur job
```sh
hadoop jar recommendation-1.0-SNAPSHOT.jar hadoop.mapreduce.ProductCoOccurDriver out/step1 out/step2
```

Step 3 - Run Product Indicator job
```sh
hadoop jar recommendation-1.0-SNAPSHOT.jar hadoop.mapreduce.ProductIndicatorDriver out/step2 out/step3
```

Check the final result:
```sh
hadoop fs -cat out/step3/part-r-00000 | less
```

### Spark Implementation:

#### How to create your MapReduce Job recommendation jar file:
- Implements the LogFileLineParser. The LogFileLineParser should provide parse session ID and parse product ID methods. Those methods will be used by map-reduce job to parse each line of log files. You can refer to SampleLogLineParser.scala file.
- Use sbt to build and create the recommendation jar file
```sh
sbt package
```

#### How to run the spark map-reduce jobs:

Submit the recommendation jar file to spark cluster with input/output locations. The final result will be stored in the output location.
```sh
spark-submit --class "RecommendationApp" --master <master-url> product-recommendation_2.11-1.0.jar <input_log_files_location> <output_location>
```

License
----

MIT


text:
# unrow
Display tab-separated data file with one field per line, for easier readability

Useful for tabular data which is unreadable in a console window.

repository: lucasgonze/unrow

repo_name: lucasgonze/unrow


text:
Struct (de)serialization
========================

This crate provides very simple way of (de)serializing structs. The main purpose is to aid working with packets.

Maintenance status
------------------

As you can see from the history of the repository, there wasn't much activity in a while. The main reason for it is that the crate satisfies my needs well and nobody approached me with feature requests, bug repports or pull requests, so I had no way of knowing if people are missing something.

However, in the meantime @xoac created [his own fork of this crate](https://crates.io/crates/endian_codec), which may be more interesting to you. Please go check it first. It's likely that he has more time to maintain his fork than me, so approach him with feature requests first. If he happens to become unresponsive, you may try your luck pinging me. I should have enough time to merge good PRs at least once per week.

Features
--------

* derive(StructDeser)
* handling of endianess
* associated consts
* `no_std`

Usage
-----

```rust
extern crate struct_deser;
#[macro_use]
extern crate struct_deser_derive;

// derive traits
#[derive(StructDeser, Debug, Eq, PartialEq)]
struct Packet {
    // mark as big endian
    // this is mandatory because u16 has multiple bytes
    #[be]
    version: u16,
    // u8 goes without endianess attribute
    ttl: u8,
    // mark as little endian
    #[le]
    chksum: u32,
}

fn main() {
    use struct_deser::{SerializedByteLen,FromBytes,IntoBytes};

    let packet0 = Packet {
        version: 1,
        ttl: 42,
        chksum: 47,
    };

    let mut bytes = [0; Packet::BYTE_LEN];
    packet0.into_bytes(&mut bytes);
    let packet1 = Packet::from_bytes(&bytes);

    assert_eq!(packet0, packet1);
}
```

License
-------
MITNFA

license: MITNFA

gha_language: Rust


text:
# jsoncols

## USAGE

    jsoncols [OPTIONS] [EXPRESSION] [INPUT_FILENAME] [OUTPUT_FILENAME]

## SYSNOPSIS

jsoncols provides for both interactive exploration of JSON structures like jid
and command line scripting flexibility for data extraction into delimited
columns. This is helpful in flattening content extracted from JSON blobs.
The default delimiter for each value extracted is a comma. This can be
overridden with an option.

+ EXPRESSION can be an empty stirng or dot notation for an object's path
+ INPUT_FILENAME is the filename to read or a dash "-" if you want to
  explicity read from stdin
	+ if not provided then jsoncols reads from stdin
+ OUTPUT_FILENAME is the filename to write or a dash "-" if you want to
  explicity write to stdout
	+ if not provided then jsoncols write to stdout

## OPTIONS

```
	-d	set the delimiter for multi-field output
	-h	display help
	-i	read JSON from a file
	-input	read JSON from a file
	-l	display license
	-m	display output in monochrome
	-r	run interactively
	-repl	run interactively
	-v	display version
```

## EXAMPLES

If myblob.json contained

```
    {"name": "Doe, Jane"<EMAIL_ADDRESS>"age": 42}
```

Getting just the name could be done with

```
    jsoncols .name myblob.json
```

This would yeild

```
    "Doe, Jane"
```

Flipping .name and .age into pipe delimited columns is as
easy as listing each field in the expression inside a
space delimited string.

```
    jsoncols -d\|  ".name .age" myblob.json
```

This would yeild

```
    "Doe, Jane"|42
```

repository: tmorrell/datatools

repo_name: tmorrell/datatools


text:
---
id: xxx
title: "Alumna’s Gift Extends Legacy to Support Future Slugs"
subtitle: "Linda Peterson aims to share the positive experience she had as one of UCSC's pioneer alumni."
date: 2022-09-23
layout: post
author:
  - Paula Hermann
author_email:
  -<EMAIL_ADDRESS>excerpt: "Linda Peterson aims to share the positive experience she had as one of UCSC's pioneer alumni."
pull_quote: false
hero:
  use: false
thumbnail_image: linda-peterson.jpg
thumbnail_alt_text: Linda Peterson
category: "Donor Profiles"
---

<figure class="inline-image right">
  {% asset linda-peterson.jpg  magick:resize=400 alt='Linda Peterson' %}
  <figcaption></figcaption>
</figure>

Linda Peterson’s (Stevenson ‘70, history) distinguished corporate law career took her to many locales around the country, but her passion for UC Santa Cruz has kept her close to campus and eternally tied to the university.

Among the university’s first graduates, Peterson was a trailblazer, forging a path for women in law in the 70s and 80s. Her willingness to push boundaries and ask thought-provoking questions–skills she honed at UCSC–helped catapult her success in a male-dominated profession.

While Peterson was making transformative change within her industry, she was also providing financial support and leadership expertise to her alma mater. She has served in a variety of roles including more than two decades as a Foundation Board Trustee. These experiences informed a strong commitment to philanthropy as well as an appreciation for the critical role of planned giving in strengthening the fabric of the university.

“Planned gifts enable the university to feel confident that financial support will be there in future years for programs, scholarships, research and other things that are not covered entirely by tuition or state funding,” said Peterson.

With no family members for whom she would need to provide, Peterson is extending her legacy of giving by establishing a planned gift to support two areas of the university which were instrumental in her personal and professional development–the History Department and Stevenson College.

“My undergraduate education was very important in shaping the person I am today and for preparing me academically for law school and my working life,” Peterson said. “I want my gift to help others have a similar positive experience.”

She believes wholeheartedly in the college system, particularly the core course, which she feels is integral to the Banana Slug experience.

“The colleges provide community in the midst of a large institution,” she said. “The core course establishes cohesion. It lets students approach a shared curriculum with faculty and students from different academic disciplines and learn to appreciate the value different perspectives bring to any issue.”

Nathanial Deutsch, faculty director of The Humanities Institute, describes Peterson’s legacy and the lasting impact of her gifts.

“Linda is one of the heroes of this campus,” said Deutsch. “She has retained a deep and abiding interest in the Humanities since she was a student in the program, and her commitment to the university hasn’t waned.  She is a great example for current students and for all of us.”

The influence of Peterson’s voluminous and unwavering support has permeated the UCSC campus for nearly a half century. Her planned gift ensures that future generations of history majors and Banana Slugs affiliated with Stevenson will have an extraordinary academic experience that will prepare them to blaze their own trail on campus and in the world.

_Learn more about naming UC Santa Cruz as a life insurance beneficiary at the [UC Santa Cruz Planned Gifts site.](https://plannedgifts.ucsc.edu/) _

repository: ucsc/site-giving

gha_language: HTML

repo_name: ucsc/site-giving


text:
# Dave's MySQL Basics

This is an introductory series for those wishing to learn how to use the MySQL database.

Episodes:
#1 Mysqlsh - https://youtu.be/IBn8zLTsP4o

Before you can use the database server, you need to know a little about how to use a client program to talk to that server. This is a quick introduction on using the MySQL Shell or *mysqlsh*.

#2 Load the example data - https://youtu.be/WtrpW90Zotc

You need practice data in order to learn Structured Query Language (SQL) and the world database has been used for decades by MySQL.  You will learn how to load the data.

Wrtten directions are available at https://dev.mysql.com/doc/world-setup/en/ and the database can be download at https://dev.mysql.com/doc/index-other.html

#3 First queries using SELECT - https://youtu.be/8KHt4eeDRLw

Novices need to write queries but those first few times can be frightening. In this episode we start with some very simple queries on which we will build on later.

#4 Data Types - https://youtu.be/Cq8YHTWgVGg

What can you store in a database? Anything!  This is an overview of your options on how you store your data

#5 Create a simmple table and load some data  -- https://youtu.be/Cg7cdqzl8-k

Creating a table from scratch is easy and you will soo how to do just that, add in some data, and then query that data.

#6 Auto Increment Introduction -- https://youtu.be/2g2Nkwlbk4w

The MySQL can automatically increment an integer or real column for use as a unique index number and this episode shows you what you need to make that happen.

#7 Automatic date or time stamp - https://youtu.be/x-rsUTr6qZ4

This is how you have the MySQL server automatically record the time a record is created or updated.

#8 Databases: Creating, dropping, and altering -- https://youtu.be/xiJPCogAlV4

MySQL uses the terms schema and databases interchangeably but which ever you want to call it you need to know how to create them and alter them.

#9 Default values - https://youtu.be/3Gh3e3lFpJo

You can specify default values for columns and this episode shows you the basics.

#10 JOINing tables - https://youtu.be/kri_IwnsrpI

This episode shows to to join two tables on a common column with the MySQL World database

#11 JOINing more than two tables -- https://youtu.be/24ZxY9cRkaA

Three tables joined together in able to retreive more data. Plus a peek at GROUP_CONCAT()

#12 SELECT -- https://youtu.be/uEGugVYrx9g

SELECT is the command used to query data from the database and we start looking at how to use it in this episode

#13  GROUP BY and ORDER BY -- https://youtu.be/Vqm02nnApZo

Arranging the output can be confusing as there are so many options.  And we start with this look at using ORDER by and GROUP BY

repository: davidmstokes/MySQLBasics

repo_name: davidmstokes/MySQLBasics


text:
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]

Spring Hibernate Query Utils

    No more N+1 queries in your Spring applications

    Spring Hibernate Query Utils: an easy way of detecting N+1 queries and counting queries in a Spring/Hibernate application

    Report Bug
    ·
    Request Feature

## Table of Contents

* [About the Project](#about-the-project)
* [Getting Started](#getting-started)
  * [Prerequisites](#prerequisites)
  * [Installation](#installation)
* [Usage](#usage)
  * [N+1 Query Detection](#n1-query-detection)
    * [Detection](#detection)
    * [Configuration](#configuration)
  * [Query Count](#query-count)
* [License](#license)
* [Contact](#contact)

## About The Project

While investigating the performance problems in my SpringBoot application, I discovered the infamous N+1 queries problem (more details on this problem [here](https://medium.com/@mansoor_ali/hibernate-n-1-queries-problem-8a926b69f618)) that was killing the performance of my services.

After managing to fix this problem, I had to find a way to detect it and raise the alarm to avoid any developer to introduce new ones.

That is why I created Spring Hibernate Query Utils to provide an easy way of detecting N+1 queries and counting the queries generated in a Spring application using Hibernate.

If you develop Spring applications using Hibernate, you have probably also encountered performance issues caused by N+1 queries.

This library provides several benefits:

* Kill the N+1 queries problem by throwing an exception when detecting it in your tests
* Count the exact number of queries generated for each service or resource
* Improve the onboarding of new developers by making them understand the impact of the N+1 queries problem
* Improve the debugging by seeing which query is executed and when

## Getting Started

### Prerequisites

* JDK 8 or more.

### Installation
##### Maven

Add the dependency to your project inside your `pom.xml` file
```xml
<dependency>
    <groupId>com.yannbriancon</groupId>
    <artifactId>spring-hibernate-query-utils</artifactId>
    <version>1.0.1</version>
</dependency>
```

## Usage

### N+1 Query Detection

#### Detection

The N+1 query detection is enabled by default so no configuration is needed.

Each time a N+1 query is detected in a transaction, a log of level error will be sent.

Here is an example catching the error log:

```java
@RunWith(MockitoJUnitRunner.class)
@SpringBootTest
@Transactional
class NPlusOneQueryLoggingTest {

    @Autowired
    private MessageRepository messageRepository;

    @Mock
    private Appender mockedAppender;

    @Captor
    private ArgumentCaptor<LoggingEvent> loggingEventCaptor;

    @BeforeEach
    public void setup() {
        Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
        root.addAppender(mockedAppender);
    }

    @Test
    void nPlusOneQueryDetection_isLoggingWhenDetectingNPlusOneQuery() {
        // Fetch the 2 messages without the authors
        List<Message> messages = messageRepository.findAll();

        // Trigger N+1 query
        List<String> names = messages.stream()
                .map(message -> message.getAuthor().getName())
                .collect(Collectors.toList());

        verify(mockedAppender, times(2)).doAppend(loggingEventCaptor.capture());

        LoggingEvent loggingEvent = loggingEventCaptor.getAllValues().get(0);
        assertThat("N+1 query detected for entity: com.yannbriancon.utils.entity.User")
                .isEqualTo(loggingEvent.getMessage());
        assertThat(Level.ERROR).isEqualTo(loggingEvent.getLevel());
    }
}
```

#### Configuration

By default the detection of a N+1 query logs an error to avoid breaking your code.

However, my advise is to override the default error level to throw exceptions for your test profile.

Now you will easily detect which tests are failing and be able to flag them and set the error level to error logs only on
those tests while you are fixing them.

To do this, you can configure the error level when a N+1 query is detected using the property `hibernate.query.interceptor.error-level`.

4 levels are available to handle the detection of N+1 queries:

* **INFO**: Log a message of level info
* **WARN**: Log a message of level warn
* **ERROR** (default): Log a message of level error
* **EXCEPTION**: Throw a NPlusOneQueryException

Here are two examples on how to use it globally or for a specific test:

* In application.properties:
```yaml
hibernate.query.interceptor.error-level=INFO
```

* In tests:
```java
@SpringBootTest("hibernate.query.interceptor.error-level=INFO")
@Transactional
class NPlusOneQueryLoggingTest {
    ...
}
```

### Query Count

To start counting the generated queries, you need to instantiate a **HibernateQueryInterceptor**.

Three methods are available:
* startQueryCount: Initializes the query count to 0 and allows the queries to increment the count.
* getQueryCount: Returns the current query count for the Thread concerned as a Long.

The count is local to a Thread. This choice was made to have a consistent count for a running application and avoid other threads to alter the count.

Example in a test:

```java
...
import com.yannbriancon.interceptor.HibernateQueryInterceptor;

@RunWith(SpringRunner.class)
@SpringBootTest
@Transactional
public class NotificationResourceIntTest {
    @Autowired
    private HibernateQueryInterceptor hibernateQueryInterceptor;

    @Test
    public void saveFile_isOk() throws Exception {
        // Initialize the query to 0 and allow the counting
        hibernateQueryInterceptor.startQueryCount();

        // Call the resource that we want to test
        MvcResult result = mvc.perform(get("/rest/notifications"))
                .andExpect(status().isOk())
                .andReturn();

        // Get the query count for this thread and check that it is equal to the number of query you expect, let's say 4.
        // The count is checked and we detect potential n+1 queries.
        Assertions.assertThat(hibernateQueryInterceptor.getQueryCount()).isEqualTo(4);
    }
}
```

## License

Distributed under the MIT License. See [`LICENSE`][license-url] for more information.

## Contact

[@YBriancon](https://twitter.com/YBriancon) -<EMAIL_ADDRESS>
Project Link: [https://github.com/yannbriancon/spring-hibernate-query-count](https://github.com/yannbriancon/spring-hibernate-query-count)

[contributors-shield]: https://img.shields.io/github/contributors/yannbriancon/spring-hibernate-query-count.svg?style=flat-square
[contributors-url]: https://github.com/yannbriancon/spring-hibernate-query-count/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/yannbriancon/spring-hibernate-query-count.svg?style=flat-square
[forks-url]: https://github.com/yannbriancon/spring-hibernate-query-count/network/members
[stars-shield]: https://img.shields.io/github/stars/yannbriancon/spring-hibernate-query-count.svg?style=flat-square
[stars-url]: https://github.com/yannbriancon/spring-hibernate-query-count/stargazers
[issues-shield]: https://img.shields.io/github/issues/yannbriancon/spring-hibernate-query-count.svg?style=flat-square
[issues-url]: https://github.com/yannbriancon/spring-hibernate-query-count/issues
[license-shield]: https://img.shields.io/github/license/yannbriancon/spring-hibernate-query-count.svg?style=flat-square
[license-url]: https://github.com/yannbriancon/spring-hibernate-query-count/blob/master/LICENSE

repository: andyglick/spring-hibernate-query-utils

repo_name: andyglick/spring-hibernate-query-utils


text:
---
title: "Language Matters"
---

Because it does, and my dear friend [Isabelle Pride]() says so. Jokes.

But it does. Most fundamentally. Language is how we construct reality and our self-concept. Using it well, in full recognition of its expressive limitations, is one of our highest exercises of agency. Better words are better block to (re)constructing our reality reality.

I don't have a coherent theory of cognition and language, and there is plenty of crazy dense philosophical and psychological work on this topic. I am have experience. I cajole you to take a leap of faith and try.

Find a word/phrase/metaphor you often use, interrogate it, and then find something better. Then challenge yourself to use the new phrase/word instead of the old. Notice when you do how you feel. Note down the situations

Whether it is a predisposition to apologize when it isn't your fault, or a category you use to counterproductively and limits your understanding of yourself, take a moment to find a better word or phrase. One that closely aligns with who you want to be and how you want to construct reality. Language is the location of the agency. Let's pay attention to what words and metaphors we use. If language is the "limits" of my world, better words can literally mean, vaster life. I hope you give it a try. Here is a running list of my language interventions for some inspiration. Personally shifting my metaphors from [Rhythm-Not-Momentum](digital-garden/Rhythm-Not-Momentum.md)

Finding the language to understand and communicate part of ourselves to the world is transformative.I've also seen the oppressive weight of undirected rage, channel itself into pointed prose so many times in the writing center.  Seeing our words on a page capturing our experience, communicating it to other, we cannot help but feel powerful. That we've done something worth doing with the day, something that will last.

Thoughts on Words:

> "Community" and "spam" are \[...] outstanding examples of words as places rather than fixed objects, that is zones where we can meet and negotiate about meaning. These words act as an open space for the movements of great powers and agendas, as well as small roving groups of actors.  "Community" enables conversation about its meaning.
> — Finn Brunton [[SPAM - A Shadow History of the Internet]] Chapter 1 *Ready for the Next Messsage* pg.7

- Kind of like the word "American." Its a place where discourse can happen. A conceptual point in space which people can approach and move given their unique experiences and identity.

Fun World Expanding Words:
- fingerspitzengefühl

branch_name: refs/heads/hugo


text:
---
severity: Important
pillar: Security
category: Identity and access management
resource: Cosmos DB
online version: https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.Cosmos.DisableMetadataWrite/
---

# Restrict user access to data operations in Azure Cosmos DB

## SYNOPSIS

Use Azure AD identities for management place operations in Azure Cosmos DB.

## DESCRIPTION

Cosmos DB provides two authorization options for interacting with the database:

- Azure Active Directory identity (Azure AD).
  Can be used to authorize account and resource management operations.
- Keys and resource tokens.
  Can be used to authorize resource management and data operations.

Resource management operations include management of databases, indexes, and containers.
By default, keys are permitted to perform resource management operations.
You can restrict these operations to Azure Resource Manager (ARM) calls only.

## RECOMMENDATION

Consider limiting key and resource tokens to data plane operations only.
Use Azure AD identities for authorizing account and resource management operations.

## EXAMPLES

### Configure with Azure template

To deploy Cosmos DB accounts that pass this rule:

- Set the `Properties.disableKeyBasedMetadataWriteAccess` property to `true`.

For example:

```json
{
    "type": "Microsoft.DocumentDB/databaseAccounts",
    "apiVersion": "2021-06-15",
    "name": "[parameters('dbAccountName')]",
    "location": "[parameters('location')]",
    "properties": {
        "consistencyPolicy": {
            "defaultConsistencyLevel": "Session"
        },
        "databaseAccountOfferType": "Standard",
        "locations": [
            {
                "locationName": "[parameters('location')]",
                "failoverPriority": 0,
                "isZoneRedundant": false
            }
        ],
        "disableKeyBasedMetadataWriteAccess": true
    }
}
```

### Configure with Bicep

To deploy Cosmos DB accounts that pass this rule:

- Set the `Properties.disableKeyBasedMetadataWriteAccess` property to `true`.

For example:

```bicep
resource dbAccount 'Microsoft.DocumentDB/databaseAccounts@2021-06-15' = {
  name: dbAccountName
  location: location
  properties: {
    consistencyPolicy: {
      defaultConsistencyLevel: 'Session'
    }
    databaseAccountOfferType: 'Standard'
    locations: [
      {
        locationName: location
        failoverPriority: 0
        isZoneRedundant: false
      }
    ]
    disableKeyBasedMetadataWriteAccess: true
  }
}
```

## LINKS

- [Use identity-based authentication](https://learn.microsoft.com/azure/architecture/framework/security/design-identity-authentication#use-identity-based-authentication)
- [Restrict user access to data operations in Azure Cosmos DB](https://docs.microsoft.com/azure/cosmos-db/how-to-restrict-user-data)
- [Secure access to data in Azure Cosmos DB](https://docs.microsoft.com/azure/cosmos-db/secure-access-to-data)
- [How does Azure Cosmos DB secure my database?](https://docs.microsoft.com/azure/cosmos-db/database-security#how-does-azure-cosmos-db-secure-my-database)
- [Access control in the Azure Cosmos DB SQL API](https://docs.microsoft.com/rest/api/cosmos-db/access-control-on-cosmosdb-resources)
- [Azure resource template](https://docs.microsoft.com/azure/templates/microsoft.documentdb/databaseaccounts#databaseaccountcreateupdateproperties-object)

gha_language: PowerShell


text:
## 目錄架構

在 RanvierMUD 中，套件（bundle）由一個或多個下述的目錄和文件所組成：

- `areas/`: Area definitions and their items, rooms, NPCs, and quests along with the scripts for those entities
- `behaviors/`: Scripts that are shared between entities of the same type, e.g., a behavior to have an NPC wander around an area
- `commands/`: What it says on the tin, commands to add to the game
- `effects/`: Effects that can be applied to characters (NPCs/Players)
- `help/`: Helpfiles for commands
- `skills/`: Player skills (Spells are included, they're just skills with the SPELL type)
- `input-events/`: Scripts attached to a connected socket, this involves things like handling login and parsing incoming data for commands
- `server-events/`: Scripts attached to the startup of Ranvier itself such as starting a telnet server
- `quest-goals/`: Quest goal definitions that can be used by builders when writing quests
- `quest-rewards/`: Quest reward definitions that can be used by builders when writing quests
- `channels.js`: Communication channels
- `player-events.js`: Scripts attached to the player such being hit, gaining experience, leveling, etc.
- `attributes.js`: Definitions of available attributes to assign to NPCs or players

## 授權許可

Licensed under the MIT License, Copyright © 2021-present MUD-TW (Multi-User Dungeon Taiwan).

repository: MUDTW/bundle-chaos

repo_name: MUDTW/bundle-chaos


text:
# Alva Website
The landing page for [Alva](https://github.com/meetalva/alva), a radically new design tool that enables cross-functional teams to create contextual digital experiences and code-based ecosystems.

## Install

This project uses [node](http://nodejs.org) and [npm](https://npmjs.com). Go check them out if you don't have them locally installed.

```sh
$ git clone https://github.com/meetalva/website.git
cd website
npm install
```

## Usage

To develop frontend sources you start the local development
setup like this:

```sh
npm start # starts a server at http://localhost:8080
```

## Contribute

Feel free to dive in! [Open an issue](https://github.com/meetalva/website/issues/new) or submit a [Pull Request](https://github.com/meetalva/website/pull/new/master). :heart:

repository: colmtuite/website

repo_name: colmtuite/website


text:
# README #

Summary and steps that are necessary to get this application up and running.

### What is this repository for? ###

* Quick summary: These scripts were created to teach Structured-Query-Language-for-Data-Management course.
* Version: 1.0
* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)

### How do I get set up? ###

* Summary: To set up the CIA FactBook database used in this course you can download a sample database script from section one.
* Configuration: Please see movies in section one
* Dependencies: All the required scripts to setup environment are included.
* Database configuration: Please watch section one movies.
* How to run tests: You can create your own unit test script.
* Deployment instructions: Please watch section one movies.

### Contribution guidelines ###

* To fix errors or add additional matterials to this please pull request to contribute.

### Who do I talk to? ###

* Biz Nigatu can be reached at<EMAIL_ADDRESS>* Other community or team contact


text:
#Jiro

[Documentation](./Documentation/API/Overview.md) · [Reference](./Documentation/API/Reference)

> Jiro is a Leap Motion type hand-gesture framework that enables developers to use smart phones as leap motion-like devices in their web projects.

####Developers
> Hunter John Larco - Frontend / Backend Web Developer

> James Harnett - iOS Developer

> Ankitha Gangarapu - Graphic Design

repository: HunterLarco/Jiro

repo_name: HunterLarco/Jiro


text:
---
layout: default
title: 发布 v0.15.0
---

JHipster release 0.15.0
==================

*JHipster为您提供集Yeoman + Maven + Spring + AngularJS于一体的应用生成器.*

更新日志
----------

JHipster 0.15.0 comes with two important updates:

- A new "registration" page, that was one of our most requested features: [#309](https://github.com/jhipster/generator-jhipster/pull/309)
- Corrected a database error that was occuring in production mode: [#305](https://github.com/jhipster/generator-jhipster/issues/305)

And of course several minor bugfixes and improvements, which are listed [here](https://github.com/jhipster/generator-jhipster/issues?milestone=4&page=1&state=closed)

更新指引
------------

使用以下命令更新Jhipster:

```
npm update -g generator-jhipster
```

使用以下命令更新你的项目

```
yo jhipster
```

帮助和缺陷
--------------

如果您发现这个版本的任何问题, 请随时联系我们:

- 在推特上联系[@jhipster](https://twitter.com/jhipster)
- 在我们的[bug tracker](https://github.com/jhipster/generator-jhipster/issues?state=open)添加一个缺陷报告
- 在[Stack Overflow](http://stackoverflow.com/tags/jhipster/info)提交问题

repository: jhipster/cn

gha_language: JavaScript

gha_license_id: NOASSERTION

repo_name: jhipster/cn


text:
This profile defines a representation of a Personal Health Summary document for a patient in an Australian healthcare context.

##### **Usage Scenarios**
The following are the usage scenarios expected:
* An individual or their authorised representative authors a personal health summary document to be exchanged with the My Health Record system

##### **Each Composition SHALL have**
* a profile assertion to this profile
* one or more sections
* exactly one section for allergies, with
    * a title
    * a code
    * a text
    * at least one entry or an emptyReason
* exactly one section for medications, with
    * a title
    * a code
    * a text
    * at least one entry or an emptyReason

#####  **Must Support**
In the context of this profile [Must Support](http://hl7.org/fhir/STU3/conformance-rules.html#mustSupport) SHALL be interpreted as follows.
* The system SHALL be able to store and retrieve the following elements:
    * type
    * title
    * section(allergies)
    * section(allergies).title
    * section(allergies).code
    * section(allergies).text
    * section(allergies).entry(allergyIntolerance)
    * section(allergies).emptyReason
    * section(medications)
    * section(medications).title
    * section(medications).code
    * section(medications).text
    * section(medications).entry(medication)
    * section(medications).entry(noRelevantFindingMedication)
    * section(medications).emptyReason

##### **Profile-specific implementation guidance**
* For the usage scenarios for this profile it is required that the composition include only the specified top-level sections; additional sections to handle local content not covered by the primary design can be included as a child section if necessary.
* Where additional content beyond that flagged with must support is provided it:
    * shall not qualify or negate content described by this profile as must support
    * shall be clinically safe for receivers of the document to ignore the non-narrative additions when interpreting the existing content
* For each section included in the composition it is important to differentiate between affirmatively stating a patient has no relevant findings (e.g. no history of immunisation) versus a finding that a patient does not have a specific condition (e.g. no latex allergy) versus not including findings in the record (e.g. not applicable or unknown).
* In Allergies section:
    * Where a sending system does not have any clinical data to provide in that section it is expected that section.emptyReason is used
    * Where a sending system can state that a patient does not have an allergy or category of allergies it is expected that an AllergyIntolerance resource is sent with the appropriate negation code (e.g. 160244002 |No Known Allergies|) is sent as the code
* In Medications section:
    * Where a sending system does not have any clinical data to provide in that section it is expected that section.emptyReason is used
    * Where a sending system can state that a patient is known not to have current medications  (relevant to Medications) it is expected an observation of assertion of no relevant finding is sent with the appropriate code (e.g.<PHONE_NUMBER>168109 |No current medications|)

##### **Examples**

[Personal Health Summary example 1](Composition-426e957a-3c4c-4780-98f3-8339cc1e6f7c.html)

[Personal Health Summary example 2](Composition-dc32838b-faf3-4102-9c78-27186ac32e20.html)

[Personal Health Summary example 3](Composition-fb584f29-e4cc-4f55-ba2e-7bdf03c7a5ee.html)

[Personal Health Summary example 4](Composition-340fcbec-f501-4582-9be1-4627618119e3.html)

[Personal Health Summary example 5](Composition-28d02fcf-6b64-49c1-8870-6533059b8129.html)


text:
# Video Doorbell, Lab 7

*A lab report by Konstantinos Karras Kallidromitis*

### In This Report

1. Upload a video of your version of the camera lab to your lab Github repository
1. As usual, update your class Hub repository to add your [forked IDD-Fa18-Lab7](/FAR-Lab/IDD-Fa18-Lab7) repository.
1. Answer the questions in-line below on your README.md.

## Part A. HelloYou from the Raspberry Pi

**a. Link to a video of your HelloYou sketch running.** [Video](https://www.youtube.com/watch?v=QEEFubCHCh4)

## Part B. Web Camera

**a. Compare `helloYou/server.js` and `IDD-Fa18-Lab7/pictureServer.js`. What elements had to be added or changed to enable the web camera? (Hint: It might be good to know that there is a UNIX command called `diff` that compares files.)**
To add a webcam functionality the file also includes the webcam variable "var NodeWebcam" as well as the deafualt parameters and fucntion "'takePicture', function()".

**b. Include a video of your working video doorbell** [Video](https://www.youtube.com/watch?v=oabhYpd3rR8)

I added the socket.emit('takePicture') in the case "light":
```js
socket.on('server-msg', function(msg) {
  msg = msg.toString();
  console.log('msg:', msg);
  switch (msg) {
    case "light":
      socket.emit('takePicture')
      document.body.style.backgroundColor = "black";
      console.log("white")
      break;
    case "dark":
      document.body.style.backgroundColor = "rgb(255,0,0)";
      console.log("black");
      break;
    default:
      //console.log("something else");
      break;
  }
});
```

## Part C. Make it your own

**a. Find, install, and try out a node-based library and try to incorporate into your lab. Document your successes and failures (totally okay!) for your writeup. This will help others in class figure out cool new tools and capabilities.**
I decided to go a doorbell related to elon musk memes. I changed the html file. I also used the fswebcam library and changed brightness (fswebcam −−set brightness=50%) and other settings to improve the resolution.

**b. Upload a video of your working modified project** [Video](https://www.youtube.com/watch?v=Xn53MSCFeng)


text:
This is an exercise app.

To run:

```
npm install
npm start
```

Now browse to the app at `http://localhost:8000/index.html`.

repository: ishener/exercise-fibi

repo_name: ishener/exercise-fibi


text:
# SALARY PREDICTION
This is an Experience V/S Salary prediction model made using Streamlit and Deployed using HeroKu
# D E M O
 [ CLICK_HERE](https://experience-vs-salary.herokuapp.com/)

## Steps
<!--- If your README is long or you have some specific process or steps you want contributors to follow, consider creating a separate CONTRIBUTING.md file--->
To use  <Salary-Prediction->, follow these steps:

1. Fork this repository.
2. Give me a star.
3. Follow me.
4. Sign up for [HeroKu](https://www.heroku.com/)
5. Repeat the Steps [Here](https://github.com/itzanuragsinghania/Sketchencil/blob/main/README.md)

Alternatively see the GitHub documentation on [creating a pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request).

## Contributors

* [itzanuragsinghania](https://github.com/itzanuragsinghania) 📖 🐛

You might want to consider using something like the [All Contributors](https://github.com/all-contributors/all-contributors) specification and its [emoji key](https://allcontributors.org/docs/en/emoji-key).

## Contact

If you want to contact me you can reach me at<EMAIL_ADDRESS>
## License
<!--- If you're not sure which open license to use see https://choosealicense.com/--->

This project uses the following license: [LISCENSE](https://github.com/itzanuragsinghania/Salary-Prediction-/blob/main/LICENSE).


text:
Jetson Nano Docker with Gstreamer v2
====================================

Refering to [v1](https://github.com/VeCAD/jetson-gstreamer-docker), after fiddling around trying to
restart the nvargus-daemon inside the container, I felt this wasn't really a clean solution, so I decided
to look around for other options of running the nvargus-daemon isolated from the host system.

I came across this repo https://github.com/zrzka/nanny-bot that copies and installs the necessary L4T files
into the container, installs them and runs the container without the `nvidia-runtime` needed to share CUDA
ecosystem of the host.

Following the guide in the Readme, I managed to get the following files installed in the container using
Jetpack 4.4.1 (L4T 32.4.4). In my case, this was the L4T files required as I was using a later version 32.4.4.

```
nvidia/
├── deb
│   ├── cuda-repo-l4t-10-2-local-10.2.89_1.0-1_arm64.deb
│   ├── graphsurgeon-tf_7.1.3-1+cuda10.2_arm64.deb
│   ├── libcudnn8_<IP_ADDRESS>-1+cuda10.2_arm64.deb
│   ├── libcudnn8-dev_<IP_ADDRESS>-1+cuda10.2_arm64.deb
│   ├── libcudnn8-doc_<IP_ADDRESS>-1+cuda10.2_arm64.deb
│   ├── libnvinfer7_7.1.3-1+cuda10.2_arm64.deb
│   ├── libnvinfer-bin_7.1.3-1+cuda10.2_arm64.deb
│   ├── libnvinfer-dev_7.1.3-1+cuda10.2_arm64.deb
│   ├── libnvinfer-doc_7.1.3-1+cuda10.2_all.deb
│   ├── libnvinfer-plugin7_7.1.3-1+cuda10.2_arm64.deb
│   ├── libnvinfer-plugin-dev_7.1.3-1+cuda10.2_arm64.deb
│   ├── libnvinfer-samples_7.1.3-1+cuda10.2_all.deb
│   ├── libnvonnxparsers7_7.1.3-1+cuda10.2_arm64.deb
│   ├── libnvonnxparsers-dev_7.1.3-1+cuda10.2_arm64.deb
│   ├── libnvparsers7_7.1.3-1+cuda10.2_arm64.deb
│   ├── libnvparsers-dev_7.1.3-1+cuda10.2_arm64.deb
│   ├── libvisionworks-repo_<IP_ADDRESS>1_arm64.deb
│   ├── libvisionworks-sfm-repo_<IP_ADDRESS>1_arm64.deb
│   ├── libvisionworks-tracking-repo_<IP_ADDRESS>1_arm64.deb
│   ├── OpenCV-4.1.1-2-gd5a58aa75-aarch64-dev.deb
│   ├── OpenCV-4.1.1-2-gd5a58aa75-aarch64-libs.deb
│   ├── OpenCV-4.1.1-2-gd5a58aa75-aarch64-licenses.deb
│   ├── OpenCV-4.1.1-2-gd5a58aa75-aarch64-python.deb
│   ├── OpenCV-4.1.1-2-gd5a58aa75-aarch64-samples.deb
│   ├── python3-libnvinfer_7.1.3-1+cuda10.2_arm64.deb
│   ├── python3-libnvinfer-dev_7.1.3-1+cuda10.2_arm64.deb
│   ├── tensorrt_<IP_ADDRESS>-1+cuda10.2_arm64.deb
│   ├── uff-converter-tf_7.1.3-1+cuda10.2_arm64.deb
├── nvgstapps.tbz2
└── nvidia_drivers.tbz2
├── config.tbz2
```
Instead of using the original Dockerfile balena image, using here arm64v8/ubuntu:18.04 one.

The camera requires `nvargus-daemon &` to be started inside the container per the
original repo container startup script. Moved it here to inside capture.py

To run this container
```
docker-compose build
docker-compose run nano bash
```

Run the capture.py
```
python3 capture.py
```

In case cv display fails, type this in host
```
xhost +local:docker
```
Camera stability test

Sending the camera feed to a Darknet Yolo inference engine. 640x480 image size,
had to drop the framerate to 15, otherwise results in buffer overflow issues
```
 def gstreamer_pipeline(self,
        capture_width=640,
        capture_height=480,
        display_width=640,
        display_height=480,
        framerate=15,
        flip_method=0
        ):
        return (
        "nvarguscamerasrc ! "
        "video/x-raw(memory:NVMM), "
        "width=(int)%d, height=(int)%d, "
        "format=(string)NV12, framerate=(fraction)%d/1 ! "
        "nvvidconv flip-method=%d ! "
        "video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! "
        "videoconvert ! "
        "video/x-raw, format=(string)BGR ! appsink drop=True "
        % (
            capture_width,
            capture_height,
            framerate,
            flip_method,
            display_width,
            display_height
        )
        )
```

Tegrastats
```
RAM 2927/3963MB (lfb 14x4MB) SWAP 1006/1981MB (cached 36MB) CPU [92%@1479,96%@1479,95%@1479,96%@1479] EMC_FREQ 0%
GR3D_FREQ 99%<EMAIL_ADDRESS><EMAIL_ADDRESS>iwlwifi@57C PMIC@100C <EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>POM_5V_IN 8055/7870
POM_5V_GPU 2424/2206 POM_5V_CPU 3084/3110
```

Htop
>8 hrs without camera disconnecting or nvargus crashing
![htop](htop.PNG)

Notes on up host distro upgrade \
I noticed that stability got worse after upgrading the host distro.
Suspect either the Docker or L4T package updates is breaking something.
```
sudo apt update
sudo apt upgrade -y
```
Had to reflash to original L4T image to regain the stability


text:
---
layout: text/textblock
---
A URL is the actual web address of each page on your site. Use words in the URL to help users find your content and search engines understand what your page is about.

**Guidelines for writing URLs:**
- Use keywords in your URL.
- Keep URLs short but clear.
- Make sure you use a consistent, clear format across all URLs.
- Avoid special characters such as & or %.
- Use verbs where possible (for example, use -apply instead of -applying
- Use hyphens (-) to separate words, not spaces.
- Use keywords in your URL structures (folder names).

URL structure may be dependent on how your [information architecture](/content-strategy/information-architecture/) has been set up.

### [3]Google and HTTPS
Make sure your CMS will provide secure protocol URLs (HTTPS). Google may lower the search result position of URLs that use HTTP. [Secure your site with HTTPS](https://support.google.com/webmasters/answer/6073543?hl=en) from Google support has more on best practice HTTPS.

repository: govau/service-manual

repo_name: govau/service-manual


text:
# favorite-episode-picker

This project uses React and Typescript. Choose your favorite episodes from The Office and save them to your favorites list.

To run this project:

1. Install dependencies with `npm install`
2. Start the server with `npm start`

repository: crystalbohacek/favorite-episode-picker

gha_language: TypeScript

repo_name: crystalbohacek/favorite-episode-picker


text:
# The Binding Status

The Binding Status is a show about [Crossplane](https://github.com/crossplaneio/crossplane), Kubernetes, and building an open multicloud future!

You can find all episodes on the [official YouTube channel](https://www.youtube.com/playlist?list=PL510POnNVaaYFuK-B_SIUrpIonCtLVOzT).

## Logistics

The Binding Status airs live every other Thursday at 9:00 AM PT (Pacific Time). It alternates weeks with the Crossplane [community meeting](https://github.com/crossplaneio/crossplane#community-meeting).

Episodes generally follow a similar format:

* Host introduction
* What is happening in the Crossplane community?
* Relevant Kubernetes news
* Deep-dive into episode topic of interest

## Episodes

* [TBS(0): Welcome to Crossplane](episodes/0)
* [TBS(1): Crossplane-Runtime](episodes/1)
* [TBS(2): Stack-GCP](episodes/2)
* [TBS(3): Yet Another Live Stack](episodes/3)
* [TBS(4): BYO Cluster](episodes/4)
* [TBS(5): Crossplane v0.4.0](episodes/5)
* [TBS(6): Crossplane Turns One](episodes/6)
* [TBS(7): Lost in Translation](episodes/7)
* [TBS(8): All Things GKE](episodes/8)
* [TBS(9): Would you like some k3sup on that?](episodes/9)
* [TBS(10): Local K8s Development with Crossplane + Okteto](episodes/10)
* [TBS(11): Cluster API](episodes/11)
* [TBS(12): Linkerd](episodes/12)
* [TBS(13): OpenFaaS](episodes/13)
* [TBS(14): Open Policy Agent](episodes/14)
* [TBS(15): Knative](episodes/15)
* [TBS(16): Velero](episodes/16)
* [TBS(17): NATS](episodes/17)
* [TBS(18): Adding Cloud Pub/Sub Support to provider-gcp](episodes/18)
* [TBS(19): Falco](episodes/19)
* [TBS(20): Packet](episodes/20)

## Requesting a Topic

Anyone is welcome to open an issue in this repository with a [topic recommendation](https://github.com/crossplaneio/tbs/issues/new/choose). We will try to cater episodes to topics that are suggested by the community.

## Inspiration

The Binding Status was inspired by the awesome work done by the people who make [TGIK](https://github.com/heptio/tgik). We highly recommend you check out their show!

repository: juniorz/tbs

repo_name: juniorz/tbs