text:
# Queue State Management

[@sivanzcw](https://github.com/sivanzcw); Oct 17, 2019

## Table of Contents

- [Queue State Management](#queue-state-management)
  * [Table of Contents](#table-of-contents)
  * [Motivation](#motivation)
  * [Function Detail](#function-detail)
    + [Data Structure](#data-structure)
    + [Queue State](#queue-state)
    + [Queue Lifecycle Management](#queue-lifecycle-management)
    + [Queue Status Refreshment](#queue-status-refreshment)
    + [Queue Placement Restriction](#queue-placement-restriction)
    + [Queue State on The Scheduling Process](#queue-state-on-the-scheduling-process)
    + [Queue State on `vcctl`](#queue-state-on--vcctl-)

## Motivation

The queue is an object of resource management in the cluster and the cornerstone of resource scheduling, which is
closely related to the allocation of resources and the scheduling of tasks. The resources under the cluster are
allocated according to the `weight` ratio of the queue. The configuration of queue guarantees the number of cluster
resources that tasks can use under the queue and limits the maximum resources that can be used. A single user or
user group is correspond to one or more queues, which is assigned and determined by the administrator. When queues
splitting cluster resources, single queue obtains the resource guarantees and quotas for using resources, so that uses
or user groups under the queue have opportunity to use cluster resources, Simultaneously due to the resource limitation
of queue, the ability of users or user groups to user cluster resources is limited to prevent cluster from being
overwhelmed by a single user to deliver a large number or tasks, thereby ensuring the `multi-tenancy` feature of
scheduling. When task is delivered, it will be placed to a specific queue and pod scheduling will by affected by queue
priority and queue resource status. It is worth mentioning that the resource allocation of queue and limitation of
queue resource can be dynamically adjusted. The queue can flexibly acquire remaining resources under cluster if there
are idle resources, when a queue is busy, and there are idle resources under the cluster, the queue may break the
original resource limit and try to occupy the remaining cluster resources.

Based on the above description, it can be found that queue is a crucial object in the process of resource scheduling.
There should have a complete guarantee mechanism to ensure the stability of queue without losing the flexibility of
queue. Firstly, the queue should not be deleted arbitrarily, since if the queue is deleted, the unscheduled tasks in
the queue will not be scheduled normally and the resources occupied by running tasks in the queue will not be normally
counted. However, considering the flexibility of resource control, queue should not be forbidden to delete. In addition,
considering the decisive role of queue in resource management, the administrator will control which user or user group
can use cluster resources by controlling queue which also requires queue to provide corresponding capabilities.

Therefore, we need to provide `State Management` capabilities for queue. Add the state configuration for queue and
adjust capabilities of queue by judging the state of queue, thereby achieving the management of queue lifecycle and
scheduling of tasks under the queue.

## Function Detail

### Data Structure

Add `state` to `properties` in `spec` of CRD `queues.scheduling.sigs.dev`. The `state` of queue controller the status
of queue.

```go
spec:
  properties:
    ...

    state:
      type: string

    ...
```

Add `state` to `properties` in `status` of CRD `queues.scheduling.sigs.dev`. The `state` of queue display the status of
current queue.

```go
status:
  properties:
    ...

    state:
      type: string

    ...
```
### Queue State

Valid queue state includes:

* `Open`, indicates that the queue is available, the queue receives new task delivery
* `Closed`, indicated that the queue is unavailable, the queue will wait for the subordinate tasks to gracefully exit,
which does not mean that the system will actively delete tasks under the queue. However, the queue does not receive new
task delivery
* `Closing`, is a intermediate state between `Open` and `Closed`. When the state of queue is `Open` and there
are tasks running or waiting to be scheduled under the queue. At this time, we try to change the state of queue to
`Closed`. The state of queue will changes to `Closing` firstly and then changes to `Closed` when all the tasks under
the queue exist.

The ability of queue corresponding to queue state as show in the following table:

| state     | default | can be set | receive delivery | can be deleted | can be scheduled | deserved resources |
| :-------: | :-----: | :--------: | :--------------: | :------------: |:---------------: | :----------------: |
| `Open`    | Y       | Y          | Y                | N              | Y                | Normal             |
| `Closed`  | N       | Y          | N                | Y              | Y                | Normal             |
| `Closing` | N       | N          | N                | N              | Y                | Normal             |

* If the state of queue is not specified during the creating of queue, the queue will use default state `Open`
* When creating a new queue, the user can only specify `Open` or `Closed` state for queue
* Only the queue with `Open` state accept new task delivery. the task will be rejected when it is posted to the queue
with `Closed` or `Closing` state
* Only the queue with `Closed` state can be deleted

### Queue Lifecycle Management

In the lifecycle management of queue, we need to guarantee the following three points:

* When creating a new queue, if the user does not specify a state for queue, we need to specify default `Open` state
for it, If the user specifies a state for queue, the specified state must be a valid value, valid values are `Open`
and `Closed`.
* When upgrading the queue, if state of queue changed, the specified state value must be valid.
* when deleting the queue, only queue with `Closed` status can be deleted successfully. The `status` here is the `state`
under the status of queue, not the `state` under the `spec` of queue.
* `default` queue can not be deleted

Add `validatingwebhookconfiguration` for queue validation during creating, updating or deleting of queue.

```yaml
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
  name: {{ .Release.Name }}-validate-queue
webhooks:
  - clientConfig:
      caBundle: ""
      service:
        name: {{ .Release.Name }}-admission-service
        namespace: {{ .Release.Namespace }}
        path: /queues
    failurePolicy: Fail
    name: validatequeue.volcano.sh
    namespaceSelector: {}
    rules:
      - apiGroups:
          - "scheduling.sigs.dev"
        apiVersions:
          - "v1alpha2"
        operations:
          - CREATE
          - UPDATE
        resources:
          - queues
```

Add implementation function `AdmitQueues`

```go
func AdmitQueues(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {
	...
	queue, err := DecodeQueue(ar.Request.Object, ar.Request.Resource)
	reviewResponse := v1beta1.AdmissionResponse{}
	validateQueue(queue, &reviewResponse)
	...
}
```

The above function will complete the following verification:

* During creating or upgrading queue, verify the validity of the queue state
* During deleting queue, check if queue can be deleted

We need another `webhook` to set default state value for queue during queue creating, add `mutatingwebhookconfiguration`
and `MutateQueues` function

```yaml
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
  name: {{ .Release.Name }}-mutate-queue
webhooks:
  - clientConfig:
      caBundle: ""
      service:
        name: {{ .Release.Name }}-admission-service
        namespace: {{ .Release.Namespace }}
        path: /mutating-queues
    failurePolicy: Fail
    name: mutatequeue.volcano.sh
    namespaceSelector: {}
    rules:
      - apiGroups:
          - "scheduling.sigs.dev"
        apiVersions:
          - "v1alpha2"
        operations:
          - CREATE
        resources:
          - queues
```

```go
func MutateQueues(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {
	...
	queue, err := DecodeQueue(ar.Request.Object, ar.Request.Resource)
	reviewResponse := v1beta1.AdmissionResponse{}
	createPatch(queue)
	...
}
```

### Queue Status Refreshment

When refreshing the status of queue, the `state` value under `spec.properties` and podgroup condition under the queue will be
considered:

* If the `state` value is empty, the status of queue will be set as `Open`
* If the `state` value is `Open`, then the status of queue will also be `Open`
* If the `state` value is `Closed`, then we need to further consider whether there is a podgroup under the queue. if
there is a podgroup under the queue, the status of the queue will be set as `Closing`, while if there is no podgroup
under the queue, the status of queue will be set as `Closed`.

### Queue Placement Restriction

When creating job, we need to verify the status of queue specified by the job:

* Allow job to be create, if the job does not specify a queue name
* If the job specifies a queue name and the status of the queue is `Open`, the job is allowed to create
* If the status of queue is not `Open`, the job creation request will be rejected.

### Queue State on The Scheduling Process

The above three states of queue have no effect on the existing scheduling process, for there is no pod under queue with
`Closed` state, while pods under queues with `Open` or `Closing` state should be scheduled normally.

### Queue State on `vcctl`

We need to add support for `queue state management` in `vcctl`, mainly including the following changes:

* Support for passing state of queue when creating queue
* When getting queue detail or queue list, we need to display the status of the queue
* Provide update function of queue, the function supports updating the `weight` or `state` of queue
* Provide delete function of queue
* Add queue operation interface, add `queue open` `queue close` `queue update` support

repository: volcano-sh/volcano

gha_language: Go

repo_name: volcano-sh/volcano


text:
---
title: HIPAA Compliance and Expo
---

## Are Apps Built with Expo HIPAA Compliant?

**They can be! You can build HIPAA compliant apps with Expo if you follow the requirements.**

Expo doesn't collect any individually identifiable health data, and you can actually see all the data that Expo collects on [our privacy explained page](https://expo.io/privacy-explained). That being said, you are ultimately in control of the data you collect from your users, so we cannot guarantee that all apps built with Expo are HIPAA compliant, as in the end it is up to you as an individual application developer. But there should be no compliance issues with using Expo.

For more information about HIPAA compliance, you can consult the [HHS website about it](https://www.hhs.gov/hipaa/for-professionals/index.html).

repository: mrexodia/expo

branch_name: refs/heads/master

extension: md

gha_license_id: NOASSERTION

license_type: permissive

repo_name: mrexodia/expo


text:
## Vanilla HTML5 UI Extension template

We prepared a vanilla HTML5 UI Extension template implementing the basic lifecycle methods to better understand the concept.

The template renders in the Contentful Web App like this:

![Screenshot of template](http://contentful.github.io/extensions/assets/uiextensions-vanilla-extension.png)

The template includes:
- the [UI Extensions SDK][extensions-sdk] library
- a Contentful look-and-feel by loading our CSS library
- basic handling of user-generated events (here: keyboard input)
- basic handling of externally generated events (here: changes introduced by other authors)
- cleanup of event listeners

[extensions-sdk]: https://github.com/contentful/ui-extensions-sdk/blob/master/docs/ui-extensions-sdk-frontend.md

license: ISC

repository: sosias/extensions

repo_name: sosias/extensions


text:
# react-likecoin

Unofficial plugin for LikeCoin on React, Nextjs or Gatsby.

Civic Liker is a movement to realign creativity and reward, by the technology of nano-payment to decouple media’s income from advertising needs. Any website can enable the LikeCoin button by installing the plugin. Each “Like” from the readers let creators to be rewarded.

[What's LikeCoin?](https://like.co/)

## Install
```bash
npm i react-likecoin
## or
yarn react-likecoin
```

## How to use
In your React component, add the following to use `react-likecoin`:
```jsx
import LikeCoin from 'react-likecoin';

// render
<LikeCoin userId="" />
```

| Props             | Required?    | Description                                                                         |
|-------------------|--------------|-------------------------------------------------------------------------------------|
| `userId` (string)   | Y            | Your LikeCoin ID.                                                                   |
| `referrer` (string) | N / Y for SSR | Referrer URL, your page current URL for LikeCoin's tracking. Only required for SSR. |
| `style` (object)    | N            | Optional styling.                                                                   |

## Author
- [Andrew Mok](https://andrewmmc.com) (@andrewmmc)

## Questions?
- Please feel free to [open an issue here](../../issues) or [contact me via email](mailto:hello@andrewmmc.com).

license: MIT

repository: andrewmmc/react-likecoin

repo_name: andrewmmc/react-likecoin


text:
# Leaf diseases
Detection of leaf diseases

The project aims at detection of plant leaf diseases at an early stages.

Steps to be followed:

1) Select the image using camera or gallery

2) Now, if the image has any blue dots, it indicates the area of diseases.

Blue dots signify that there is presence of plant diseases.


text:
# test-until

[![Build Status](https://travis-ci.org/BinaryMuse/test-until.svg?branch=master)](https://travis-ci.org/BinaryMuse/test-until)

A utility that returns a promise that resolves when the passed function returns true. It works like Jasmine's `waitsFor`, but Promise based.

## Installation

Node.js:

`npm install --save[-dev] test-until`

## Requirements

test-until requires a global variable `Promise` which needs to be a A+ compliant promise implementation (such as is available by default in [most modern browsers](http://caniuse.com/#feat=promises)). If you need to polyfill `Promise` for any reason (such as supporting IE 11), I recommend [promise-polyfill](https://github.com/taylorhakes/promise-polyfill).

## Usage

```javascript
var promise = until(checkFunc, message, timeout)
```

* `checkFunc` - A function that returns a truthy value once the promise should be resolved. `until` will call this function repeatedly until it returns `true` or the timeout elapses.
* `message` *(optional)* - A message to help identify failing cases. For example, setting this to `"value == 42"` will reject with an error of `"timed out waiting until value == 42"` if it times out. Defaults to `"something happens"`.
* `timeout` *(optional)* - The number of milliseconds to wait before timing out and rejecting the promise. Defaults to `1000`.

The three arguments can be supplied in any order depending on your preferences. For example, putting the message first can make the line read a little more like English:

```javascript
until('we know the answer to life, the universe, and everything', function () { return val === 42 }, 500)
```

## Example with Test Framework

Here's an example using the [Mocha](https://mochajs.org/) testing framework.

```javascript
var until = require('test-until')

describe('something', function () {
  it('tests things', function (done) {
    var val = 0
    setTimeout(function () { val = 42 }, 100)
    var promise = until(function () { val === 42 })
    promise.then(function() {
      // after 100ms, `val` will be set to `42`
      // and the promise returned from `until` will resolve
      done()
    })
  })
})
```

test-until reads and works even better with access to `async`/`await` in your tests, allowing you to wait for multiple async conditions with no callbacks in a manner that reads much like English:

```javascript
import until from 'test-until'

describe('something', function () {
  it('tests things', async function () {
    let val = 0
    let otherVal = 0
    setTimeout(() => val = 42, 100)
    setTimeout(() => otherVal = 2048, 200)
    // Awaiting a rejected promise will cause a synchronous `throw`,
    // which will reject the promise returned from the async function
    // and will fail the test.
    await until('val is 42', () => val === 42)
    await until('otherVal is 2048', () => otherVal === 2048)
  })
})
```

## Advanced Usage

### Setting the Default Timeout

Use `until.setDefaultTimeout(ms)` to set the default timeout. You can easily set this to different values in different parts of your test suite by setting it in a `beforeEach`

```javascript
import until from 'test-until'

// Set a global default timeout
beforeEach(function () {
  until.setDefaultTimeout(500)
})

describe('slow stuff', function () {
  beforeEach(function () {
    // Make it a bit longer for these tests
    until.setDefaultTimeout(1000)
  })
  // ...
})
```

Passing a falsy `ms` resets to the default of `1000`.

### Setting the Error Message from Inside the Check Function

The check function gets called with a special argument called `setError` which allows the check function to specify an error to return if the `until` call times out. This can be useful when integrating `until` with other test assertions; for example, here's a snippet that will wait for `val` to be `42` and will reject with an actual Chai assertion error if it fails.

```javascript
import until from 'test-until'
import {assert} from 'chai'

describe('something', function () {
  it('tests things', async function () {
    let val = 0
    setTimeout(() => val = 42, 100)
    await until(setError => {
      try {
        assert.equal(val, 42)
        return true
      } catch (err) {
        return setError(err) // explicitly set the error
      }
    })
  })
})
```

## Development

The test suite uses newer JavaScript features, so you need Node.js 6+ in order to run it. Run `npm test` to run the suite.

repository: svdaddio/microgateway

repo_name: svdaddio/microgateway


text:
# Notes for Read 28 - MVC Forms

## Views in ASP.NET Core MVC

[Microsoft Docs](https://docs.microsoft.com/en-us/aspnet/core/mvc/views/overview?view=aspnetcore-2.2)

View discover happens in this order:

+ Views/[ControllerName]/[ViewName].cshtml
+ Views/Shared/[ViewName].cshtml

Can Pass weakly typed data also

Can Annotate `[ViewData]` to reference a property to save code
It will load the property into the `ViewData` Dictionary.

`@model` at the top not required if the model instance in passed in the `return View(<instance>);`

## 4 Ways to Create Form in ASP.NET MVC

[CompleteCSharpTutorial](https://www.completecsharptutorial.com/asp-net-mvc5/4-ways-to-create-form-in-asp-net-mvc.php)

Can blend JQuery and AJAX into the page.

Using a strongly typed Form will allow Intellisense to assist

 `@Html` is a helper able to use MVC data in the element

[<--[BACK]](/README.md)


text:
---
title: "Lost in Azure cloud identity - part 3"
excerpt: "This article presents how to implement authorization in an application using Azure AD App Roles"
header:
  image: /images/devisland/article67/assets/IdentityOnAzure-part3-1.png
---

# Introduction

I have decided to create series related to identity and access management using Azure cloud services. Important note first - I will focus more on the development side and integration aspects. This series is focused on developers who would like to understand different concepts and mechanisms around identity using Azure cloud services like Azure Active Directory and Azure Active Directory B2C. It does not mean that if you are an architect or administrator, you will not find anything interesting. I think that this series can be helpful for everyone who wants to learn more about identity services in the Microsoft Azure cloud.

This is the third article from the series. In this article, we are going to talk about user authorization using Azure Active Directory App Roles. We will learn how verify user role and decide whether user should have access to specific page or not.

**Important**

*This series assumes that you already have some basic knowledge around identity concepts, application implementation, and Azure cloud services - at least Azure Active Directory.*

**Source code**

Source code of all applications and AD B2C custom policies are available on my [GitHub](https://github.com/Daniel-Krzyczkowski/Lost-In-Azure-Cloud-Identity)

**Links to additional helpful resources**

In my articles, I will focus on particular topics and I will make some assumptions. For instance, I assume that you already have access to Azure Active Directory and Azure Active Directory B2C services. If you need additional help, below I provide the links to helpful resources so you can learn more:

[Getting started with Azure Active Directory](https://docs.microsoft.com/en-us/azure/active-directory/)

[Getting started with Azure Active Directory B2C](https://docs.microsoft.com/en-us/azure/active-directory-b2c/)

[Azure AD B2C custom policy overview](https://docs.microsoft.com/en-us/azure/active-directory-b2c/custom-policy-overview)

[Microsoft identity platform documentation](https://docs.microsoft.com/en-us/azure/active-directory/develop/)

[Overview of the Microsoft identity platform for developers](https://www.youtube.com/watch?v=zjezqZPPOfc)

**Solution architecture discussed in this series**

## Authorization in the Tech Mind Factory Corporate Web App

If you have read my [previous](https://daniel-krzyczkowski.github.io/Lost-In-Azure-Cloud-Identity-Serie-Part2/) article, you remember that we created two users in the Azure Active Directory:

*<EMAIL_ADDRESS>*<EMAIL_ADDRESS>
These two above users were assigned to the Tech Mind Factory Corporate Web Application (Blazor app):

As you can see above, TMF Corporate Web App has two tabs:

* Director page
* Employee page

In this article we will see how to implement authorization so once user is authenticated and tries to access one of these pages, app will verify use role and decide to display the content, or not. First we are going to create App Roles in the Azure Active Directory and we are going to assing users to them.

## App Roles in the Azure Active Directory

App roles are usually defined on an application registration representing a service, app or API. When a user signs in to the application, Azure AD emits a roles claim for each role that the user or service principal has been assigned to. Currently there are two options to create App Roles in the Azure AD:

* App roles UI (ath the moment of writing this article, it is in preview) - using UI in the Azure portal
* App manifest editor in the Azure Active Directory Application blade (JSON format)

In this article we will create two below roles using App Roles UI:

* Employee
* Director

### Register an App Role

To add roles to the TMF Corporate Web App, open previously registered application (we did it in the [previous](https://daniel-krzyczkowski.github.io/Lost-In-Azure-Cloud-Identity-Serie-Part2/) article) in the Azure Active Directory:

#### 1. Select *App roles* from the left bar:

#### 2. Create *Employee* app role exactly as presented below:

Note that allowed member types is set to users and groups. Users with *Employee* role can display financial documents but cannot edit them in the TMF Corporate Web App.

#### 3. Create *Director* app role exactly as presented below:

Note that allowed member types is set to users and groups. Users with *Director* role can edit financial documents.

Once above App Roles are created, you should see them on the list:

### Assign users to created app roles

Once roles are created we can assign users to them. We are going to do below assignments:

*<EMAIL_ADDRESS>user will be assigned to *Employee* role
*<EMAIL_ADDRESS>user will be assigned to *Employee* and *Director* roles

#### 1. From the main blade in Azure Active Directory, open *Enterprise applications*:

#### 2. Find TMF Corporate Web Applicatin registered before:

#### 3. Select *Users and groups*, and click *Add user/group*:

#### 4. Under *Users and groups*, click on the *Non selected*:

#### 5. First we will assign *Employee* role to<EMAIL_ADDRESS>user:

#### 6. Select *Employee* from the list:

#### 7. Click *Assign* button:

Follow above steps for the second user -<EMAIL_ADDRESS>This user should have *Employee* and *Director* roles assigned:

This is how the final list should look like:

### Enable user assignment requirement

By default in the Azure Active Directory when you create application, all users in the tenant have access to it. This can be changed and only assigned users will have access to it. We are going to enable user assignment requirement for the Tech Mind Factory Corporate Web App.

To enable user assignment requrement, select *Properties* from the left bar for the TMF Corporate Web App and set *User assignment requirement* to *Yes*:

From now only below users have access to TMF Corporate Web App:

*<EMAIL_ADDRESS>*<EMAIL_ADDRESS>

## Handling authorization using Azure AD App Roles in the web app

Now it is time to discuss how to implement authorization mechanism in the Tech Mind Factory Corporate Web App (Blazor).

### Authorization policies

We handle authorization with a requirement, a requirement handler, and a pre-configured policy. These building blocks support the expression of authorization evaluations in code. An authorization policy consists of one or more requirements. It's registered as part of the authorization service configuration, in the [*Startup.ConfigureServices*](https://github.com/Daniel-Krzyczkowski/Lost-In-Azure-Cloud-Identity/blob/0a01c3d0aea0447c47c91cd5c176698c30234814/src/tmf-identity-corporate-web-app/TMF.Corporate.WebApp/Startup.cs#L38) method:

 ```csharp
            services.AddAuthorization(options =>
            {
                options.AddPolicy("Employee", configurePolicy =>
                {
                    configurePolicy.AddRequirements(new ClaimRequirement("Document.Read"));
                });

                options.AddPolicy("Director", configurePolicy =>
                {
                    configurePolicy.AddRequirements(new ClaimRequirement("Document.Edit"));
                });
            });

            services.AddSingleton<IAuthorizationHandler, ClaimAuthorizationHandler>();
```

In the above code we create two policies:

* Employee - this policy requires *Document.Read* claim to be presented in the ID Token returned from the Azure Active Directory, once user is authenticated
* Director - this policy requires *Document.Edit* claim to be presented in the ID Token returned from the Azure Active Directory, once user is authenticated

We have to also add [below two](https://github.com/Daniel-Krzyczkowski/Lost-In-Azure-Cloud-Identity/blob/0a01c3d0aea0447c47c91cd5c176698c30234814/src/tmf-identity-corporate-web-app/TMF.Corporate.WebApp/Startup.cs#L77) lines to the *Configure* method:

 ```csharp
            app.UseAuthentication();
            app.UseAuthorization();
```

#### ClaimRequirement class implementation details

As you can see, [*ClaimRequirement*](https://github.com/Daniel-Krzyczkowski/Lost-In-Azure-Cloud-Identity/blob/main/src/tmf-identity-corporate-web-app/TMF.Corporate.WebApp/AuthorizationPolicies/ClaimRequirement.cs) class implements *IAuthorizationRequirement* interface provided by ASP .NET Core framework. This class represents claim requirement so for instance the requirement for the *Document.Read* claim:

 ```csharp
    public class ClaimRequirement : IAuthorizationRequirement
    {
        public string ClaimName { get; set; }

        public ClaimRequirement(string claimName)
        {
            ClaimName = claimName;
        }
    }
```

#### ClaimAuthorizationHandler class implementation details

[*ClaimAuthorizationHandler*](https://github.com/Daniel-Krzyczkowski/Lost-In-Azure-Cloud-Identity/blob/main/src/tmf-identity-corporate-web-app/TMF.Corporate.WebApp/AuthorizationPolicies/ClaimAuthorizationHandler.cs) class is responsible for validaton and verification is specific claim is presented in the token. This class extends generic *AuthorizationHandler* class with *ClaimRequirement* as a concrete type:

 ```csharp
    public class ClaimAuthorizationHandler : AuthorizationHandler<ClaimRequirement>
    {
        protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, ClaimRequirement requirement)
        {
            var roleClaims = context
                                .User
                                .Claims
                                .Where(c => c.Type == ClaimTypes.Role);

            if (roleClaims != null)
            {
                foreach (var roleClaim in roleClaims)
                {
                    if (roleClaim != null)
                    {
                        if (roleClaim.Value.Equals(requirement.ClaimName,
                                                   StringComparison.InvariantCultureIgnoreCase))
                        {
                            context.Succeed(requirement);
                        }
                    }
                }
            }

            return Task.CompletedTask;
        }
    }
```

Inside the *HandleRequirementAsync* method we iterate through all the claims in the user token to check if required claim is presented. If it is presented, we call *context.Succeed(requirement)* method.

### Access to specific pages

In the TMF Corporate Web App there are two pages as I mentioned. One for *Employees* (they can read documents but not edit them) and one for *Directors* (they can edit documents but also read them).

#### ReadDocument.razor page

Below I present [*ReadDocument*](https://github.com/Daniel-Krzyczkowski/Lost-In-Azure-Cloud-Identity/blob/main/src/tmf-identity-corporate-web-app/TMF.Corporate.WebApp/Pages/ReadDocument.razor) page code fragment:

 ```html
<AuthorizeView Policy="Employee">
    <Authorized>
        <p>
            <b>
                The user is in the 'Employee' AAD Administrator Role
                and can read financial documents.
            </b>
            <br />
            <br />
            <button class="btn btn-primary"
                    @onclick="@(async () => await CallApiAsync())">
                Call API
            </button>
            <br />
            <br />
            <p>@ResponseFromWebApi</p>
        </p>
    </Authorized>
    <NotAuthorized>
        <p>
            <b>The user is not in the 'Employee' role and cannot see the content of this page</b>
        </p>
    </NotAuthorized>
</AuthorizeView>
```

Note that *AuthorizeView* is used together with *Policy* set to *Employee*. If user has the *Employee* role assigned and *Read.Document* claim is presented in the token, this page will be displayed. If there is no *Read.Document* claim in the token, user will see this information: *The user is not in the 'Employee' role and cannot see the content of this page*.

We use the *Employee* policy we configured in the *Startup* class described above in the article. If we sign is using<EMAIL_ADDRESS>account, we can access *Employee page* but not the *Director page*:

#### EditDocument.razor page

Below I present [*EditDocument*](https://github.com/Daniel-Krzyczkowski/Lost-In-Azure-Cloud-Identity/blob/main/src/tmf-identity-corporate-web-app/TMF.Corporate.WebApp/Pages/EditDocument.razor) page code fragment:

 ```html
<AuthorizeView Policy="Director">
    <Authorized>
        <p>
            <b>
                The user is in the 'Director' AAD Administrator Role
                and can edit financial documents.
            </b>
        </p>
    </Authorized>
    <NotAuthorized>
        <p>
            <b>The user is not in the 'Director' role and cannot see the content of this page</b>
        </p>
    </NotAuthorized>
</AuthorizeView>
```

Note that *AuthorizeView* is used together with *Policy* set to *Director*. If user has the *Director* role assigned and *Edit.Document* claim is presented in the token, this page will be displayed. If there is no *Edit.Document* claim in the token, user will see this information: *The user is not in the 'Director' role and cannot see the content of this page*.

We use the *Director* policy we configured in the *Startup* class described above in the article.

# Summary

In this article we discussed how to implement user authorization using Azure Active Directory App Roles and authorization handlers. I encourage you to check the source code on my [GitHub](https://github.com/Daniel-Krzyczkowski/Lost-In-Azure-Cloud-Identity/tree/main/src/tmf-identity-corporate-web-app) for the Tech Mind Factory Corporate Web App to learn more in detials. You can also ask if the same mechanism can be used with ASP .NET Core Web APIs. Of course it can be used and here is the sample from [my GitHub](https://github.com/Daniel-Krzyczkowski/IdentityDeveloperTemplates/tree/master/src/app-templates/IdentityDeveloperTemplates.AzureAD.Authz.API) how to achieve that. I hope this will help you.

gha_language: JavaScript

gha_license_id: MIT


text:
MIR Teleop Record
==========

The node is used to record the readings of all the frames of the robot and
to store it in a json file.

The arms are controlled using the logistic joypad. Using the Joypad the arms
are moved to the respective initial and final positions. After reaching the
respective positions the record buttions are pressed and the recordings of
the Joint angles, Joint positions are recorded in a json file. The json file
can has the current time stamp in its header.

## Recording Keys

![mir_teleop_record/ros/doc/youbot_joypad_description.pdf]
Please check the above file for key bindings.

### Recording Initial Value to File
Key(Print arm Joint States) + Key (Arm Joint 1 and 2)
### Recording Final Value to File
Key(Print arm Joint States) + Key (Arm Joint 2 and 3)

The frames used can be obtained from the following command
> rosrun tf tf_monitor

![frames ](frames.png)

The frames can be modified as per changes in the file
teleop_joypad_record_node.cpp .

```cpp
const std::string TeleOpJoypad::frame_name_[9] =
    {"arm_link_0", "arm_link_1", "arm_link_2", "arm_link_3", "arm_link_4",
     "arm_link_5", "gripper_palm_link", "gripper_finger_link_l","gripper_finger_link_r" };
```

Update the frame string list to add or delete required frames.

repository: deebuls/RecommenderSystemInRobotics

repo_name: deebuls/RecommenderSystemInRobotics


text:
# Micro Client Reactor

## Usage

```php
$request = new ClientRequest();
$request->setRoute('passport');
$request->addPayload('clientId', $clientId);

$data = $this->microClientReactor->sendAndReceive($request);

```

## License

The Soft Deletable Bundle is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

repository: micseres/micro-client-reactor

repo_name: micseres/micro-client-reactor


text:
Various code written in python serving as exercises or helping with the various server environments in this project.

* `mia_observer.py`: matplotlib-based observer. Connects as a spectator to a running MIA server, and plots the evolution of player scores in real-time.
* `mia_client<X>.py`: Various simple MIA player bots, employing different basic strategies.
* `mia_server_mock.py`: Server mock for testing the mia observer
* `trial_client.py`: Client for a trial server.
* `echo|trial_server.py`: Echo/Trial servers implemented with the low-level python socket library
* `echo|trial_socketserver.py`: Echo/Trial servers implemented with the higher-level python socketserver library


text:
# code_width

Try to limit code width to N columns. Break line if it's too long.

Possible values are 0 for no limits or integer value for some. Also another integer configuration value (like `cmt_width`) may be used.

Default configuration value is 0 (unlimited).

# Examples

## Limit 80 characters
Before
```
	int x = 10 + 10 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25;

	// The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
	std::cout << "x is " << x << '\n';
```
After
```
	int x = 10 + 10 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 +
	        23 + 24 + 25;

	// The quick brown fox jumps over the lazy dog.

# See also

* [cmt_width](cmt_width.md) - similar option but for comments
* Special line breaking cases: [ls_for_split_full](ls_for_split_full.md), [ls_func_split_full](ls_func_split_full.md) and [ls_code_width](ls_code_width.md)

license: Unlicense

repository: beardog-ukr/uncrustify-config-examples

repo_name: beardog-ukr/uncrustify-config-examples


text:
# Frequently asked questions

## How to treat word-initial or -final in a special way

Although it may seem a bit hacky, treating word-initial or -final graphemes differently is straightforward. We'll
use the common regular expression markers for start `^` and end `$`.

1. Create the orthography profile:

```python
>>> from segments.tokenizer import Profile
>>> prf = Profile(
 {'Grapheme': 'c', 'IPA': 'c'},
 {'Grapheme': '^', 'IPA': 'NULL'},
 {'Grapheme': '$', 'IPA': 'NULL'},
 {'Grapheme': 'a', 'IPA': 'b'},
 {'Grapheme': '^a', 'IPA': 'A'})
```

Note: We treat word-initial `a` differently!

2. Create the tokenizer

```python
>>> from segments.tokenizer import Tokenizer
>>> t = Tokenizer(prf)
>>> t('tha', 'IPA')
'tH b'
>>> t('ath', 'IPA')
'b tH'
>>> t('^ath', 'IPA')
'A tH'
```

3. Make sure to pass properly marked up words to the tokenizer:

```python
>>> t(' '.join('^' + s + '$' for s in 'tha ath'.split()), 'IPA')
'tH b # A tH'
```

repository: cldf/segments

gha_language: Python

repo_name: cldf/segments


text:
# Changelog

## [1.3.1] - 2020-08-10

### Fixed

- README screenshot.

## [1.3.0] - 2020-08-10

### Added

- Customizable month title style.

## [1.2.1] - 2020-04-05

### Fixed

- Bottom overflow bug.

## [1.2.0] - 2019-07-18

### Added

- Optional highlighted dates.

### Changed

- **Breaking.** Renamed color property, which is now required.

### Fixed

- Breakpoint bug.

## [1.1.0] - 2019-05-19

### Changed

- Major refactor.
- **Breaking.** Renamed properties.
- **Breaking.** Require Flutter 1.5.0.

## [1.0.0] - 2018-10-28

### Added

- Scrolling years calendar.

[1.3.1]: https://github.com/mennorenkens/flutter_scrolling_calendar/releases/tag/1.3.1
[1.2.1]: https://github.com/mennorenkens/flutter_scrolling_calendar/releases/tag/1.2.1
[1.2.0]: https://github.com/mennorenkens/flutter_scrolling_calendar/releases/tag/1.2.0
[1.1.0]: https://github.com/mennorenkens/flutter_scrolling_calendar/releases/tag/1.1.0
[1.0.0]: https://github.com/mennorenkens/flutter_scrolling_calendar/releases/tag/1.0.0


text:
---
title: Advanced guides
layout: framework_docs_overview
toc: false
order: 4
---

Fly.io makes it possible to build out high performance Postgres clusters that are accessible globally, but it does require some consideration and architecture thanks to latency imposed by the speed of light, which is approximately 204,190,477 m/s in a fiber optic cable.

repository: superfly/docs

branch_name: refs/heads/main

gha_language: HTML

repo_name: superfly/docs


text:
MIDX
====================

MIDX (Mini Index) is a simple library for full-text file search. It uses the trigram-based index implemented on Kotlin
using coroutines and flows.

To run the demo:
```console
$ git clone https://github.com/vloginova/midx.git midx
$ cd midx
$ ./gradlew jar
$ java -jar build/libs/midx-1.0-SNAPSHOT.jar [--search-ignore-case] <files separated by space>
```

repository: vloginova/midx

repo_name: vloginova/midx


text:
# canvas-course-to-pdf
Flask app to download a Canvas LMS course as a pdf file. Test it [here](http://canvas-course-to-pdf.herokuapp.com/).
## Requirements
`pip install -r requirements.txt`

repository: rjadr/canvas-course-to-pdf

repo_name: rjadr/canvas-course-to-pdf


text:
# final-course-activity-read-go

The goal of this assignment is to practice working with the ioutil and os packages in Go.

Click on "My submission" above to see specific assignment directions and to submit your response.

## Review criteria

This assignment is worth a total of 10 points:

3 points will be given if a program is written.

2 points will be given if the program compiles correctly.

5 points will be given if test execution is successful and your program: 1. Opens a named text file. 2. Prints all first name/ last name pairs.

Write a program which reads information from a file and represents it in a slice of structs. Assume that there is a text file which contains a series of names. Each line of the text file has a first name and a last name, in that order, separated by a single space on the line.

Your program will define a name struct which has two fields, fname for the first name, and lname for the last name. Each field will be a string of size 20 (characters).

Your program should prompt the user for the name of the text file. Your program will successively read each line of the text file and create a struct which contains the first and last names found in the file. Each struct created will be added to a slice, and after all lines have been read from the file, your program will have a slice containing one struct for each line in the file. After reading all lines from the file, your program should iterate through your slice of structs and print the first and last names found in each struct.

Submit your source code for the program, “read.go”.


text:
---
layout: post
title:  "pg_dump and inserts"
author: Luca Ferrari
tags:
- postgresql
- planet-postgresql-org
permalink: /:year/:month/:day/:title.html
---
pg_dump supports a few useful options to export data as a list of INSERTs

# pg_dump and inserts

`pg_dump(1)` is the default tool for doing backups of a PostgreSQL database.

I often got answers about how to produce a **more portable** output of the database dump, with *portable* meaning truly *"loadable into another PostgreSQL version or even a different database"*.

In fact, `pg_dump` defaults to use `COPY` for bulkd loading data:

```shell
% pg_dump -a  -t wa -U luca testdb
...
COPY luca.wa (pk, t) FROM stdin;
9200673 Record #1
9200674 Record #2
9200675 Record #3
9200676 Record #4
9200677 Record #5
9200678 Record #6
9200679 Record #7
9200680 Record #8
9200681 Record #9
...
```

As you can guess, `COPY` is usable only in PostgreSQL and not into other database. So, how to handle a text dump that can be used into other databases?

No need to worry: `pg_dump` has a few features to handle such need.

In particular, the following options can be useful:
- `--inserts` removes the `COPY` and substitutes it with `INSERT` statements, one per tuple;
- `--column-inserts` similar to the previous, but each `INSERT` has the list of named columns;
- `rows-per-inserts` a number of tuples a single `INSERT` statement can handle, useful for a better bulk loading (but could be less portable).

There are also some other useful options:
- `--quote-all-identifiers` force the quoting of the identifiers, and this is useful when preparing data for a different database;
- `--use-set-session-authorization` when dealing with ownership of objects, use SQL standard commands;`
- `--no-comments`, this is not a very "technical" aspect, but when you are going to load your dump into another database you probably do not want to import comments since they could be handled differently. Similarly, there are other `--no` options that are specific to PostgreSQL, like `--no-publications` to avoid replicating publications, and so on.

In the following I will use the same example table `wa` table with just two columns and a bunch of records, so that you can easily compare the output differences.

## Defaulting to `INSERT`

In order to better understand the difference between every single option, let's see a few examples:

```shell
% pg_dump -a  -t wa  --inserts -U luca testdb
...
INSERT INTO luca.wa VALUES (9200673, 'Record #1');
INSERT INTO luca.wa VALUES (9200674, 'Record #2');
INSERT INTO luca.wa VALUES (9200675, 'Record #3');
INSERT INTO luca.wa VALUES (9200676, 'Record #4');
INSERT INTO luca.wa VALUES (9200677, 'Record #5');
INSERT INTO luca.wa VALUES (9200678, 'Record #6');
INSERT INTO luca.wa VALUES (9200679, 'Record #7');
...
```

As you can see from the above, the `COPY` has been translated into a set of `INSERT`s. This of course has the drawback of having a slower buk loading.

Just to do another example, let's see how it does change the output with identifier quotiong:

```shell
% pg_dump -a  -t wa  --inserts --quote-all-identifiers -U luca testdb
...
INSERT INTO "luca"."wa" VALUES (9200673, 'Record #1');
INSERT INTO "luca"."wa" VALUES (9200674, 'Record #2');
INSERT INTO "luca"."wa" VALUES (9200675, 'Record #3');
INSERT INTO "luca"."wa" VALUES (9200676, 'Record #4');
INSERT INTO "luca"."wa" VALUES (9200677, 'Record #5');
INSERT INTO "luca"."wa" VALUES (9200678, 'Record #6');
...
```

And the table and schema name has been quoted.

What if you want also the column list on every `INSERT`? The optin ``--column-inserts` is there to explode the list of columns:`

```shell
% pg_dump -a  -t wa  --column-inserts --quote-all-identifiers -U luca testdb
...
INSERT INTO "luca"."wa" ("pk", "t") VALUES (9200673, 'Record #1');
INSERT INTO "luca"."wa" ("pk", "t") VALUES (9200674, 'Record #2');
INSERT INTO "luca"."wa" ("pk", "t") VALUES (9200675, 'Record #3');
INSERT INTO "luca"."wa" ("pk", "t") VALUES (9200676, 'Record #4');
INSERT INTO "luca"."wa" ("pk", "t") VALUES (9200677, 'Record #5');
INSERT INTO "luca"."wa" ("pk", "t") VALUES (9200678, 'Record #6');
INSERT INTO "luca"."wa" ("pk", "t") VALUES (9200679, 'Record #7');
INSERT INTO "luca"."wa" ("pk", "t") VALUES (9200680, 'Record #8');
INSERT INTO "luca"."wa" ("pk", "t") VALUES (9200681, 'Record #9');
...
```

despite the usage or not of the `--quote-all-identifiers`, each `INSERT` has the list of the columns the values are referring to.

The last case, a middle path between the `COPY` and a single `INSERT` per tuple, is the `--rows-per-insert` that allows you specify the maximum number of rows every `INSERT` will handle:

```shell
% pg_dump -a  -t wa  --rows-per-insert=3 --quote-all-identifiers -U luca testdb
...
INSERT INTO "luca"."wa" VALUES
        (9200688, 'Record #16'),
        (9200689, 'Record #17'),
        (9200690, 'Record #18');
INSERT INTO "luca"."wa" VALUES
        (9200691, 'Record #19'),
        (9200692, 'Record #20');
...
```

Note how the last `INSERT` has only two tuples instead of the specified `3`: the `pg_dump` is smart enough to let your `INSERT` to not loose a single row, so if there is not enough data left, the `INSERT` involves less rows.

## Avoid `ALTER TBALE` to set ownership

If the dump includes the table data structure, `pg_dump` will issue appropriate commands to change the ownership. For example:

```shell
% pg_dump -C  -t wa  -U luca testdb
...
CREATE TABLE luca.wa (
    pk integer NOT NULL,
    t text
);

ALTER TABLE "luca"."wraparaound_pk_seq" OWNER TO "luca";
...
```

The option `--use-set-session-authorization` produces a more portable SQL output:

```shell
% pg_dump -C  -t wa --use-set-session-authorization -U luca testdb
...
SET SESSION AUTHORIZATION 'luca';

CREATE TABLE luca.wa (
    pk integer NOT NULL,
    t text
);

...
```

As you can see, the user is *set* in the beginning, so that automatically all created objects will belong to such user.


text:
# Named Entity Recognition

I used Keras API with TensorFlow as its backend to build and train a bidirectional LSTM neural network model
to recognize named entities in text data. Named entity recognition models can be used to identify mentions of people,
locations, organizations, etc. Named entity recognition is not only a tool for information extraction,
but it also a preprocessing step for many NLP applications like machine translation, question answering,
and text summarization.

Tagged entities:\
geo = Geographical Entity\
org = Organization\
per = Person\
gpe = Geopolitical Entity\
tim = Time indicator\
art = Artifact\
eve = Event\
nat = Natural Phenomenon

Link to Dataset - https://www.kaggle.com/abhinavwalia95/entity-annotated-corpus?select=ner_dataset.csv \
Achieved 98.5% accuracy


text:
---
# Documentation: https://sourcethemes.com/academic/docs/managing-content/

title: "Learning and education in HCI: a reflection on the SIG at CHI 2019"
authors: [Viktoria Pammer-Schindler, Erik Harpstead, Benjamin Xie, Betsy DiSalvo, Ahmed Kharrufa, Petr Slovak, Amy Ogan, Joseph Jay Williams, Michael Lee]
date: 2020-09-01
doi: "10.1145/3411290"

# Schedule page publish date (NOT publication's date).
publishDate: 2021-01-09T14:27:02-08:00

# Publication type.
# Legend: 0 = Uncategorized; 1 = Conference paper; 2 = Journal article;
# 3 = Preprint / Working Paper; 4 = Report; 5 = Book; 6 = Book section;
# 7 = Thesis; 8 = Patent
publication_types: ["0"]

# Publication name and optional abbreviated publication name.
publication: "ACM Interactions Blog"
publication_short: "Interactions"

abstract: ""

# Summary. An optional shortened abstract.
summary: "Reflection article on a CHI 2019 gathering to discuss the intersection of learning sciences and HCI."

tags: []
categories: []
featured: false

# Custom links (optional).
#   Uncomment and edit lines below to show custom links.
# links:
# - name: Follow
#   url: https://twitter.com
#   icon_pack: fab
#   icon: twitter

links:
- name: full text
  url: https://interactions.acm.org/blog/view/learning-and-education-in-hci-a-reflection-on-the-sig-at-chi-2019

url_pdf:
url_code:
url_dataset:
url_poster:
url_project:
url_slides:
url_source:
url_video:

# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
image:
  caption: ""
  focal_point: ""
  preview_only: false

# Associated Projects (optional).
#   Associate this publication with one or more of your projects.
#   Simply enter your project's folder or file name without extension.
#   E.g. `internal-project` references `content/project/internal-project/index.md`.
#   Otherwise, set `projects: []`.
projects: []

# Slides (optional).
#   Associate this publication with Markdown slides.
#   Simply enter your slide deck's filename without extension.
#   E.g. `slides: "example"` references `content/slides/example/index.md`.
#   Otherwise, set `slides: ""`.
slides: ""
---

repository: bxie/bxie-academic

repo_name: bxie/bxie-academic


text:
#FizzBuzz

## Table of Contents

* [General Description](#general-description)
* [How to Run](#how-to-run)
* [Testing](#testing)
* [License](#license)

##General Description

The logic of the game of __FizzBuzz__ implemented in [Ruby](https://www.ruby-lang.org/en/)
(2.1.1) and written according to [TDD](http://en.wikipedia.org/wiki/Test-driven_development)
methodology (testing done with [Rspec](http://rspec.info/)).

In __FizzBuzz__, the players take turns counting the natural numbers, but replacing
numbers divisable by 3 with `Fizz`, numbers divisible by 5 with `Buzz`,
and numbers divisible by 15 with `FizzBuzz`.

If we run through the series of positive integers, in __Fizzbuzz__ we get:

> 1, 2, `Fizz`, 4, `Buzz`, `Fizz`, 7, 8, `Fizz`, `Buzz`, 11, `Fizz`, 13, 14,
> `FizzBuzz`, 16, 17, `Fizz`, 19, `Buzz`, `Fizz`, 22, 23, `Fizz`, `Buzz`, 26, `Fizz`,
> 28, 29, `FizzBuzz`, 31, 32, `Fizz`, 34, `Buzz`, `Fizz`, ...

For more info about the game: [Wikipedia on FizzBuzz](http://en.wikipedia.org/wiki/Fizz_buzz)

###How to Run

Clone the repo to a local folder and run:

```
$> cd fizzbuzz
$> irb
>> require './lib/fizzbuzz'

Now you can use the #fizzbuzz method with any given number
and get the relevant response, for example:

>> fizzbuzz(2)
=> 2

>> fizzbuzz(6)
=> "fizz"

>> fizzbuzz(10)
=> "buzz"

>> fizzbuzz(15)
=> "fizzbuzz"

```

##Testing

Tests were written with [Rspec](http://rspec.info/) (3.1.7).

To run the tests in terminal:

```bash
$> cd fizzbuzz
$> rspec
```

##License

Released under the MIT license.

repository: nadavmatalon/fizzbuzz

repo_name: nadavmatalon/fizzbuzz


text:
# pull-credit

credit based control flow for pull streams.

inspiration: http://250bpm.com/blog:22 http://hintjens.com/blog:15

connect two pull streams, but control the rate of flow between them.

A debtor "borrows" from a creditor's buffer.
A debtor streams binary chunks to a creditor, when they are read from
the creditor, a credit is issued to the debtor, who may stream more data.

## License

MIT

repository: dominictarr/pull-credit

repo_name: dominictarr/pull-credit


text:
Sample Channel

Summary

Demonstrates Roku Pay operations, including purchase, upgrade, and downgrade. The Subscriptions menu displays the products available for purchase on this channel. Click on the OK button on the remote to start a Roku Pay operation.

Running and Testing

Preparation:

Go to Manage My In-Channel Products on the developer dashboard, set up a product group, and add your products to the group.

How to Use:

Go to Subscriptions menu and select one product for purchase. When one product is already purchased (has a check mark), next product selected is an upgrade or downgrade.

Details

The sample channel uses the ChannelStore node doOrder command to perform an upgrade or downgrade, more information on the doOrder command is available on the developer docs [ChannelStore page](https://developer.roku.com/docs/references/scenegraph/control-nodes/channelstore.md#doorder).

Normally, requesting a doOrder command results in a new purchase. For the upgrade or downgrade, a new Action field is added to the Channel Store order to specify either an upgrade or a downgrade, e.g. the following is a code snippet of a request from function makeUpgrade() in Billing.brs:

    myOrder.action = request.action ' action is either "Upgrade" or "Downgrade"
    m.store.order = myOrder

    m.store.command = "doOrder"

repository: rokudev/samples

gha_language: Brightscript

repo_name: rokudev/samples


text:
django-tdd
==========

A Django management command to run tests every time a file is saved.

Installation
===

    pip install django-tdd

Then add django-tdd to your INSTALLED_APPS:

    INSTALLED_APPS = {
      ...
      'django_tdd',
    }

Usage
===

Use the management command in place of `runserver`. The following command will run all of the tests in your project and then start the development server.

    python manage.py tdd

When you change a file, the development server will stop, all the tests will be run again, and the development server will start again.

repository: kevinharvey/django-tdd

repo_name: kevinharvey/django-tdd


text:
# cabolabs-ehrserver-groovy
Groovy client for the CaboLabs openEHR EHRServer (https://github.com/ppazos/cabolabs-ehrserver)

## SSL Certificate configuration for HTTPS access

You need to have openssl installed: https://www.openssl.org/

On the command line / terminal

    $ openssl s_client -connect your_domain_here:443

Will return something like:

```
CONNECTED(00000003)
depth=1 /C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/CN=your_domain_here
   i:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
 1 s:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
   i:/O=Digital Signature Trust Co./CN=DST Root CA X3
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIFGzCCBAOgAwIBAgIS....
-----END CERTIFICATE-----
subject=/CN=your_domain_here
issuer=/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
---
No client certificate CA names sent
---
SSL handshake has read 3421 bytes and written 444 bytes
---
New, TLSv1/SSLv3, Cipher is DHE-RSA-AES128-SHA
Server public key is 2048 bit
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1
    Cipher    : DHE-RSA-AES128-SHA
    Session-ID: 59FB6B...
    Session-ID-ctx:
    Master-Key: AA31121...
    Key-Arg   : None
    Start Time:<PHONE_NUMBER>
    Timeout   : 300 (sec)
    Verify return code: 20 (unable to get local issuer certificate)
---
read:errno=0
```

Copy the text from -----BEGIN CERTIFICATE----- to -----END CERTIFICATE-----, including those lines.

Create a file "my_certificate.crt" and paste the content there, including the BEGIN CERTIFICATE and END CERTIFICATE lines.

From the console, use the keytool from Java:

    $ keytool -importcert -alias "server_alias" -file my_certificate.crt -keystore store.jks -storepass test1234

Write "y" when it asks if you trust the certificate.

If the alias already exists, you can delete it:

    $ keytool -delete -alias "server_alias" -keystore store.jks -storepass test1234

keytool reference:

https://www.sslshopper.com/article-most-common-java-keytool-keystore-commands.html

repository: ValleSaude/cabolabs-ehrserver-groovy

repo_name: ValleSaude/cabolabs-ehrserver-groovy


text:
---
title: Template
template: page
---

### PHP as a Template Engine

Templates must be placed in `templates/` directory (or some other place you set in your `config.php`).

They are just plain PHP script enhanced by [Plates](http://platesphp.com/) library. Thus, you can whatever you can do with PHP.

### Layouts

If you build a certain level of large Web site, you will want to divide templates to multiple files. Layout feature is helpful for such a situation.

Soushi's template system just exploits PHP and Plates library mentioned above. Thus you can build your site with layouts using a feature of Plates.

See [Layouts - Plates](http://platesphp.com/templates/layouts/) for details.

repository: kentaro/soushi

gha_language: PHP

repo_name: kentaro/soushi


text:
---
date: 2017-05-31T14:06:08.000Z
author: Dries Van Ransbeeck
title: "Open Knowledge Belgium is preparing for open Summer of code\_2017"
tags:
  - events
  - general
  - 'open belgium'
  - 'open summer of code'
  - belgium
  - 'civic labs'
  - 'open data'
  - 'open knowledge'
  - 'open summer of code'
  - osoc17
---

**In the last few months, the open community in Belgium has had the chance to gather multiple times. Open Knowledge Belgium organised a couple of events and activities which aimed to bring its passionate community together and facilitate the launch of new projects. Furthermore, as summertime is coming, it’s currently organising the seventh edition of its yearly open Summer of code. Let’s go chronologically through what’s going on at Open Knowledge Belgium.**

**Open Belgium 2017**

As the tradition goes, the first Monday after International Open Data Day, Open Knowledge Belgium organises its Open Belgium conference on open knowledge and open data in Belgium.

![](openbelgium.png)

Open Belgium was made possible by an incredible group of volunteers

This year’s community-driven gathering of open enthusiasts took place in Brussels for the first time and was a big success. More than 250 people with different backgrounds showed up to talk about the current state of and next steps towards more open knowledge and open data in Belgium.

<iframe allowfullscreen="" frameborder="0" height="356" marginheight="0" marginwidth="0" scrolling="no" src="https://www.slideshare.net/slideshow/embed_code/key/CHu5InX3faGGVW" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" width="427"> </iframe>

**[Overview Open Belgium 2017](https://www.slideshare.net/OpenKnowledgeBE/overview-open-belgium-2017 'Overview Open Belgium 2017')** from **[Open Knowledge Belgium](https://www.slideshare.net/OpenKnowledgeBE)**

All presentations, notes and visuals of Open Belgium are available on <http://2017.openbelgium.be/presentations>.

**Launch of Civic Lab Brussels**

It all started during a fruitful discussion with Open Knowledge Germany at Open Belgium. While talking about the 26 OK Labs in Germany, more specifically being intrigued by the air quality project of OK Lab Stuttgart, we got to ask ourselves: why wouldn’t we launch something similar in Brussels/Belgium?

In about the same period of time, some new open initiatives popped up from within our community and several volunteers repeatedly expressed their interest to contribute to Open Knowledge’s mission of building a world in which knowledge creates power for the many, not the few.

Eventually, after a wonderful visit to [BeCentral](http://www.becentral.org/) — the new digital hub above Brussels’ central station — all pieces of the puzzle got merged into the idea of a Civic Lab: bringing volunteers and open projects every 2 weeks together in an open space.

<iframe allowfullscreen="" frameborder="0" height="356" marginheight="0" marginwidth="0" scrolling="no" src="https://www.slideshare.net/slideshow/embed_code/key/1tZYePo9y213Ho" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" width="427"> </iframe>

**[Introduction to Civic Lab Brussels](https://www.slideshare.net/DriesVanRansbeeck/introduction-to-civic-lab-brussels 'Introduction to Civic Lab Brussels')** from **[Dries Van Ransbeeck](https://www.slideshare.net/DriesVanRansbeeck)**

The goal of Civic Labs Brussels is two-fold: on the one hand, offering volunteers opportunities to contribute to civic projects they care about. On the other hand, providing initiative-takers of open project with help and advice from fellow citizens.

Open in the case of our Civic Lab means, corresponding to the [Open Definition](http://opendefinition.org/), yet slightly shorter, that anyone can freely contribute to and benefit from the project. No strings attached.

Civic Lab meetups are not only to put open initiatives in the picture and hang out with other civic innovators. They’re also about getting things done and creating impact. Therefore, those gatherings always take place under the same format of short introductory presentations (30 min) — to both new and ongoing projects — followed by action (2 hours), whereby all attendees are totally free to contribute to the project of their choice and can come up with new projects.

**Open Summer of code 2017**

Last but not least, Open Knowledge Belgium is preparing for the seventh edition of its annual [open Summer of code](http://2017.summerofcode.be/). From 3rd until 27th July, 36 programming, design and communications students will be working under the guidance of experienced coaches on 10 different open innovation projects with real-life impact.

<iframe allowfullscreen="" frameborder="0" height="338" mozallowfullscreen="" src="https://player.vimeo.com/video/188284459" webkitallowfullscreen="" width="600"></iframe>

If you want to stay updated about open Summer of code and all other activities, please follow [Open Knowledge Belgium on Twitter](https://twitter.com/OpenKnowledgeBE) or subscribe to its [newsletter](https://www.openknowledge.be/#subform).

repository: openknowledgebe/website

repo_name: openknowledgebe/website


text:
[ludeknovy/jtl-reporter](https://github.com/ludeknovy/jtl-reporter#installation-steps)
[Generate intuitive Locust.io reports with Jtl Reporter](https://medium.com/@novyludek/generate-intuitive-locust-io-reports-with-jtl-reporter-c40c71913d64)

[Locust Monitoring with Grafana in Just 15 Minutes](https://www.blazemeter.com/blog/locust-monitoring-with-grafana-in-just-fifteen-minutes)

repository: Wimsgal/PerfBoard

repo_name: Wimsgal/PerfBoard


text:
# WAF SETUP

We shall use steps from the following article:

https://docs.microsoft.com/en-us/azure/application-gateway/create-ssl-portal

The WAF is created and prepared by our setup script in the following section:

```shell
# Create the Network and Subnets
az network vnet create --name pocVNet --resource-group AKS_POC --location westeurope --address-prefix <IP_ADDRESS>/16 --subnet-name gatewaySubnet --subnet-prefix <IP_ADDRESS>/24

az network vnet subnet create --name aksSubnet --resource-group AKS_POC --vnet-name pocVNet --address-prefix <IP_ADDRESS>/24

az network public-ip create --resource-group AKS_POC --name gatewayPublicIPAddress

az network application-gateway create --resource-group AKS_POC --name akswaf --sku WAF_Large --subnet gatewaySubnet --vnet-name pocVNet --public-ip-address gatewayPublicIPAddress

# store the network object for later (this is powershell)
$network = az network vnet subnet list --resource-group AKS_POC --vnet-name pocVnet --query [].id --output tsv | sls backend | select -exp line
```
## Certificate

To create a self-signed certificate to use for a POC or testing, use the following steps on a Windows PC.
Replace **\<angle brackets and text\>** with appropriate entries that suit you:

1. Start Powershell as Admin
2. Run the following command. If you do not have rights to a DNS namespace, use a name that you can configure in your testing machine's hosts file.

```powershell
New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname aks.<yourdomainname here>
```

3. Then export the certificate using:

```powershell
$pwd = ConvertTo-SecureString -String "<your password here>" -Force -AsPlainText
Export-PfxCertificate \
  -cert cert:\localMachine\my\<your certificate thumbprint here> \
  -FilePath c:\appgwcert.pfx \
  -Password $pwd
```

## WAF Listener

To create the HTTPS listener, which will use the certificate created above, we run the following commands (assuming that you include this in a setup script or have already run "az login"):

```shell
# register a cert for use on the App gateway / WAF
az network application-gateway ssl-cert create -g AKS_POC --gateway-name akswaf -n AksCert --cert-file \path\to\cert\file --cert-password <your password>

# create Http settings for HTTPS Frontend listener
az network application-gateway http-settings create -g AKS_POC --gateway-name akswaf -n AksWafHttpsSettings --port 443 --protocol Https --cookie-based-affinity Disabled --timeout 30

# create Http settings for HTTP Backend pool (SSL Offload)
az network application-gateway http-settings create -g AKS_POC --gateway-name akswaf -n BackendHttpSettings --port 80 --protocol Http --cookie-based-affinity Disabled --timeout 30

# create an HTTPS frontend port on the gateway to register with the listener
az network application-gateway frontend-port create -g AKS_POC --gateway-name akswaf -n HttpsPort --port 443

# create an HTTPs Listener to use the cert created above
az network application-gateway http-listener create --frontend-ip appGatewayFrontendIP --frontend-port HttpsPort --gateway-name akswaf --resource-group AKS_POC --name appGatewayHttpsListener --ssl-cert AksCert

#create a backend address pool
az network application-gateway address-pool create -g AKS_POC --gateway-name akswaf -n AksLBAddressPool --servers <IP_ADDRESS>

# create a rule to route traffic to AKS
az network application-gateway rule create -g AKS_POC --gateway-name akswaf -n RouteForAks2 --http-listener appGatewayHttpsListener --rule-type Basic --http-settings BackendHttpSettings --address-pool AksLBAddressPool
```

gha_language: Java


text:
Spoiler ahead! In this repository's `koans/koans_test.exs`, I'm storing my own solutions to the exercises found in [Programming Elixir](https://pragprog.com/book/elixir12/programming-elixir-1-2).

[![Build Status](https://travis-ci.org/thbar/elixir-playground.svg?branch=master)](https://travis-ci.org/thbar/elixir-playground)

## Common tasks

```
# install dependencies
mix deps.get

# clean dependencies
mix deps.clean --all

# check code quality
mix dogma

# run tests
elixir *_test.exs

# launch interactive session with mix setup
iex -S mix

# launch phoenix with iex session
iex -S mix phoenix.server

# visually inspect applications from iex
:observer.start()

# run one function
mix run -e "Issues.CLI.process(:help)"
```

## Creating a minimalistic phoenix app

```
mix phoenix.new web_hello_world --no-brunch
mix deps.get
```

(then truncate loads of stuff)

## Useful resources

* [Elixir CheatSheet](https://media.pragprog.com/titles/elixir/ElixirCheat.pdf)
* [Awesome Elixir](https://github.com/h4cc/awesome-elixir)

repository: thbar/elixir-playground

gha_language: Elixir

repo_name: thbar/elixir-playground


text:
# Guardian News Summary

# Introduction
This repository has been made to get more comfortable with making API requests and testing them, while also building confidence in using and manipulating the powerful Guardian API. The application is made to show the 10 most recent news articles from the Guardian.

# Technology
The technology for this project is just CSS & HTML with vanilla javascript, to keep things as simple as possible. The testing framework is Jasmine.

# See it in action:
![image of headline and news article](images/example_article.png)

Above is an example of how an article is displayed, if you'd like to see the project in your browser, it's been deployed using [surge](http://guardian-top-10-feed.surge.sh/), so feel free to have a look there.

# feature roadmap
This project is still being worked on, below is a list of the future features to be implemented:
- make an API proxy server to obfuscate the API key.
- Allow the user to select specific categories of news.
- Allow the user to search for specific keywords in articles.

repository: Edward-Phillips/news-summary-challenge

repo_name: Edward-Phillips/news-summary-challenge


text:
---
uuid: 8fcb1c0f-a438-4273-89c1-908b7e4fa218
layout: post
title: Announcing the book "Node.js design patterns - second edition"
slug: announcing-the-book-node-js-design-patterns-second-edition
subtitle: null
date: 2016-07-31T18:25:00.000Z
updated: 2016-08-01T18:45:47.000Z
author: Luciano Mammino
author_slug: luciano-mammino
header_img: ./announcing-the-book-node-js-design-patterns-second-edition.jpg
fb_img: ./announcing-the-book-node-js-design-patterns-second-edition-fb.png
tw_img: ./announcing-the-book-node-js-design-patterns-second-edition-tw.png
status: published
language: en_US
meta_title: null
meta_description: null
tags:
  - node-js
  - books
  - design-patterns
---

In this post I am going to introduce my last side-project: "Node.js design patterns — second edition", a technical book about Node.js and design patterns published by Packt.

This blog has been a very quite place in the last 8-9 months, this is because almost all my free time has been absorbed by one of my most ambitious side projects: co-writing a book about [Node.js](/tag/node-js) and [design patterns](/tag/design-patterns)!

I am finally happy to announce that "Node.js design patterns — second edition" has been published.

You can keep reading this post to find out more or have a look at the [official website](https://www.nodejsdesignpatterns.com). If all of this is convincing enough you can even decide to buy the paperback or the e-book on [Packt](https://www.packtpub.com/web-development/nodejs-design-patterns-second-edition), [Amazon](http://amzn.to/2a418Q2) or [O'Reilly](http://shop.oreilly.com/product/9781785885587.do) :P

[![Node.js design patterns second edition book cover](./book-cover-nodejs-design-patterns-second-edition-mario-casciaro-luciano-mammino.jpg)](https://www.nodejsdesignpatterns.com)

## The making of

As you might have noticed, this book is the second edition of an [existing book on the topic](http://amzn.to/2a9FgDP) — I dare to say _one of the best_ books on the topic — that [Mario Casciaro](http://www.mariocasciaro.me) put together a couple of years ago.

I was contacted by Mario in November last year because he was looking for somebody willing to help him in creating a new edition of the book. I don't know yet why he thought I might have been the right person (and I am still flattered about this) but, being his book one of my favourites, I almost immediately decided to accept the challenge and work with him and Packt on this new edition.

It took almost 9 months from the first idea to having the printed book on my desk. I have to admit it was an incredibly interesting experience for me. I learned a lot and I definitely feel I strengthened my knowledge of Node.js and design patterns, I worked with super skilled technical reviewers like [Joel Purra](http://joelpurra.com) and [Tane Piper](https://twitter.com/tanepiper) and with the amazing team at Packt. I also had chance to experiment with some new cool technologies like [React](/tag/react-js) and new ways of building websites like [Universal JavaScript](/tag/universal-javascript).

## Content of the book

The book has been heavily updated: more than the 50% of the original content from the first edition was changed. These changes were mostly about updating all the code examples to **Node v6** and **EcmaScript 2015**, upgrading all the obsolete content, introducing some new interesting examples and design patterns and a new entire chapter dedicated to **Universal Javascript**.

The final result counts **11 chapters**, more than **500 pages** and more than **100 code examples**.

The first two chapters provide basic informations about the Node.js platform and the new features introduced with EcmaScript 2015.

Chapter 3 and 4 go deep into the topic of asynchronous programming exploring different approaches (callbacks, promises, events, async/await) and design patterns to exploit all the most common scenarios.

Chapter 5 discusses one of the most important patterns in Node.js: streams. It shows you how to process data with transform streams and how to combine them into different layouts.

Chapter 6 is probably the core of this book diving deep into the most popular conventional design patterns and showing how unconventional they might look in Node.js. It also introduces the reader to some emerging design patterns that are used only with JavaScript and Node.js.

Chapter 7 analyses the different solutions for linking the modules of an application together investigating design patterns such as Dependency Injection and the service locator pattern.

Chapter 8 is an entire new chapter that explores one of the most interesting capabilities of modern JavaScript web applications: being able to share application code between the frontend and the backend. Across this chapter we learn the basic principles of Universal (a.k.a. Isomorphic) JavaScript by building a simple web application with React, Webpack, and Babel.

Chapters 9, 10 and 11 go into more advanced and enterprise topics like "Advanced Asynchronous Recipes", "Scalability and Architectural Patterns" and finally "Messaging and Integration Patterns".

You can read [a sample of the book](https://www.nodejsdesignpatterns.com/files/nodejs_design_patterns_preview_chapter1.pdf) containing the full table of contents and the first chapter for FREE on the [official website](https://www.nodejsdesignpatterns.com), don't miss it!

## Acknowledgements

Apart from Mario, Joel and Tane, which I already mentioned previously, I have to spend a special word of thank you for my dear friends [Anton Whalley](https://twitter.com/dhigit9), [Alessandro Cinelli](https://twitter.com/cirpo), [Andrea Giuliano](https://twitter.com/bit_shark) and [Andrea Mangano](https://twitter.com/andreaman87). They are amazing guys and they have been precious supporters during the creation of this new book with words of encouragement and incredibly meaningful technical advices.

Thank you once again guys :)

## What's next

Well, I don't plan to start writing a new book anytime soon in case you are wondering... :D But I surely will keep improving my knowledge and experience with Node.js and maybe I will also start to explore some new field in the amazing world of programming. I guess I will also be able to keep posting articles here more often :)

So stay tuned for the next post :)

I will go now to take a pint to celebrate the release... Cheers 🍻


text:
<% title 'Game Night Recap 02/08/2018'%>
<% date '8th February 2018' %>
<% author 'Luke DeWitt' %>

The 2018 campaign of G4N started with a game of Mission Red Planet.  The main mechanic of this game is worker placement with an action selection element.  The twist being that the workers are placed on Rockets heading off to Mars, those rockets come into play with a destination location, but that just might not be where they land if they even manage to get off the launching pad.  Turns out rocket science is hard.

  There are three phases of production on Mars through out the game, and the player with the majority of workers at those locations gets the all resources when produced.  These resources are one way for players to get victory points for the game.  There are a total of 10 rounds in a game and the production of resources happens between rounds 5 and 6, 8 and 9, and right after round 10.

  The other way to get points is by secret objective cards in the players hands, each player starts with one at the beginning of the game and can try to get another one.  Or there is an overall global objective for having the most ice collected in the game.

  We had 6 Knights trying to get the most out of Mars on this game night.  It was well played by all and I think everyone enjoyed the game.

  Final scores:

| | Knight | Score |
| :---: | --- | :---: |
| 1 | Luke | 38 |
| 2 | Garrett | 26 |
| 3 | Colten | 25 |
| 4 | Brett | 25 |
| 5 | Scott | 18 |
| 6 | Eric | 16 |

  My personal objective for this game was to have the most astronauts on the moon Phobos by the end of the game.  In those first 5 rounds of the game I tried to take 2 different rockets which were heading to Phobos from the launching pad.  However, my pieces ended up landing on the red planet instead.  Being that I didn’t get a single astronaut where I planned him to be I only managed to receive a single resource of one ice for one point in the first production phase.

  When the second production phase came around I managed a three way tie on Phobos which was producing ice (this left two ice on the moon to be taken by the player leading after round 10).  I also pick up two of the three point resources from a region on Mars.  So, I had only 7 points and was way behind the leaders on points and only tied on my objective of most astronauts on Phobos.

    Much to my surprise I got my objective completed and then a very strange occurrence happened that the area producing 3 point resources flipped to produce ice for 1 point a piece but in doing so gave me the global objective of most ice and 9 more points.  So I jumped from 7 points to 38 points.

  I really do like this game, but you are just kind of riding a bull when
playing 6 players.  You get only 1/6th of the input into the game state and
while everyone has the same pool of cards, when and how they are played can have
massive disproportionate impacts to the other players around the table.  It is
fun for sure and for a 90 minute game the amount of chaos is just fine with me.
The theme is great and it looks great on the table.

repository: ledewitt/tftgd

gha_language: Ruby

repo_name: ledewitt/tftgd


text:
**Test-driven development** is based on writing the application tests before the
main code logic, making these tests fail first, and then writing the code to
make them pass.

**WHY IS TDD GOOD FOR DEVELOPERS?**

There are many reasons why, but the most important one is that TDD forces (bắt buộc) you and the business person to think about the prerequisites (tiên quyết) in a deeper way (một cách sâu sắc hơn). This includes thinking about what the code should do under certain situations (tình huống nhất định) or use cases. It will help you clarify (làm rõ) vague (mơ hồ) prerequisites and reject invalid ones (từ chối những điều không hợp lệ).

However (tuy nhiên), there is one idea usually associated with (liên kết với) TDD that sometimes is taken to the extreme (cực đoạn): continuous refactoring (tái cấu trúc liên tục) of code in several iterations.

You should find a balance (cân bằng) — it’s not a good idea to write poor quality, unmaintainable (không thể nhầm lẫn??) code just to make the tests pass and then later refactor them.

repository: toanalien/notebook

repo_name: toanalien/notebook


text:
---
tags: [Programming Paradigms]
title: Functional Programming
created: '2020-02-24T17:27:02.198Z'
modified: '2020-03-16T11:17:42.915Z'
---

# Functional Programming

## First-Class and Higher-Order Functions

### Higher-Order Functions

[Higher-order functions](https://en.wikipedia.org/wiki/Higher-order_function) are functions that can either take other functions as arguments or return them as results. In calculus, an example of a higher-order function is the differential operator `d/dx`, which returns the derivative of a function `f`.

### First-Class Functions

A programming language is said to have [first-class functions](https://en.wikipedia.org/wiki/Functional_programming#First-class_and_higher-order_functions) if it treats functions as first-class citizens. This means the language supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning them to variables or storing them in data structures.

## Pure Functions

Pure functions (or expressions) have no side effects (memory or I/O).

## Recursion

Iteration (looping) in functional languages is usually accomplished via recursion. Recursive functions invoke themselves, letting an operation be repeated until it reaches the base case. Although some recursion requires maintaining a stack, tail recursion can be recognized and optimized by a compiler into the same code used to implement iteration in imperative languages.

## Evaluation Strategy

Functional languages can be categorized by whether they use strict (eager) or non-strict (lazy) evaluation, concepts that refer to how function arguments are processed when an expression is being evaluated. The technical difference is in the denotational semantics of expressions containing failing or divergent computations. Under strict evaluation, the evaluation of any term containing a failing subterm fails. For example, the expression:

```
print length([2+1, 3*2, 1/0, 5-4])
```

fails under strict evaluation because of the division by zero in the third element of the list. Under lazy evaluation, the length function returns the value 4 (i.e., the number of items in the list), since evaluating it does not attempt to evaluate the terms making up the list. In brief, strict evaluation always fully evaluates function arguments before invoking the function. Lazy evaluation does not evaluate function arguments unless their values are required to evaluate the function call itself.

## Referential Transparency

Functional programs do not have assignment statements, that is, the value of a variable in a functional program never changes once defined. This eliminates any chances of side effects because any variable can be replaced with its actual value at any point of execution. So, functional programs are referentially transparent.

repository: alex-c/software-engineering-notes

path: /notes/Functional Programming.md

filename: Functional Programming.md

repo_name: alex-c/software-engineering-notes


text:
---
jupytext:
  text_representation:
    extension: .md
    format_name: myst
kernelspec:
  display_name: Python 3
  language: python
  name: python3
---

# Installation Guide

+++

In Physiscs labs, we will use *Logger Pro* for video processing and data analysis. So, please make sure you have the required software. You can follow the instructions below.

---

+++

## Installation Link

You can the isntallation links to all supported OS below.

| Windows                                                 | MacOS                                                           |
|---------------------------------------------------------|-----------------------------------------------------------------|
| [Window 10](http://www.vernier.com/d/r7sek)             | [MacOS 10.15, 10.14, 10.13](http://www.vernier.com/d/2d9wf)     |
| [Windows 8.1, 7](https://www.vernier.com/d/otayn)       | [Mac OS X 10.12, 10.11, 10.10](https://www.vernier.com/d/bstnw) |
| [Windows 8](https://www.vernier.com/d/rcsq5)            | [Mac OS X 10.9](https://www.vernier.com/d/oewti)                |
| [Windows XP and Vista](https://www.vernier.com/d/7tjc0) | [Mac OS X 10.8](https://www.vernier.com/d/pdwat)                |
|                                                       | [Mac OS X 10.7](https://www.vernier.com/d/dpen3)                |

If your computer is running on an older version of the above OS, you will need a password so please visit[Canvas](https://canvas.ubc.ca/courses/69484/pages/logger-pro-installation) to get them.

```{note} Linux User
If you are using Linux distros, please let me know as soon as possible.
```

+++

## Complete Guide

For complete instructions (step by step), please follow the official guide on [Venier Website](https://www.vernier.com/til/2069/).

+++

## Sample Look

If you install Logger Pro successfully, you should see a similar window to this one.

```{figure} ../images/loggerpro.jpg
LoggerPro window
```

+++

```{caution}
Please note the UI might be different from various Operation Systems.
```

repository: tthvo/phys-web

repo_name: tthvo/phys-web


text:
## Usage

To install the latest version of Next Routes for Now CLI, run this command:

```bash
npm install -g next-routes-now
# or
yarn global add next-routes-now
```

Or install locally:
```bash
npm install next-routes-now
# or
yarn add next-routes-now
```

## Generate routes

```
generate-now-routes <routes.json> [-A <now.json>]
```

### Usage

```
Description

Usage
  $ generate-now-routes <routes_file> [options]

Options
  --help, -h          Display this message
  --version, -v       Display version
  --local-config, -A  Path to the local `now.json` file
```

### Routes config json example

Define your Now 2 rules in routes.json. To build your next-routes use the `build`
key to compose your next-routes into your now.json.

```json
[
  {
    "src": "/_next/static/(.*)",
    "dest": "/_next/static/$1",
    "headers": { "cache-control": "s-maxage=86400" },
    "continue": true
  },
  {
    "build": "routes.js"
  }
]
```

### Can also be used programatically

```
const generate = require("next-routes-now")

genaret.buildAndUpdate(pathToRoutes, pathToNow);
```

### With prefix

If you files are not located at the root of your project, say in a monorepo, you can use the `prefix` key:

```json
[
  {
    "build": "routes.js",
    "prefix": "/packages/web"
  }
]
```

repository: Freedomiza/next-routes-now

repo_name: Freedomiza/next-routes-now


text:
---
title: "🧑🏽💻 / Colophon"
order: 2
---

In other words, how the site is made.

### Tech Stack

This website is built with [Astro](https://astro.build/), [Tailwind](https://tailwindcss.com/), [Github Pages](https://pages.github.com/), and [Netlify](https://www.netlify.com/). The previous site was built using Jekyll, Sass, Bourbon, Neat, and Netlify. I wrote a short blog post about this [here](/blog/2023-05-02-website-rewrite/).

The domain is registered with [Hover](https://www.hover.com/).

### Typography

This website uses “Brother 1816”, a font by Ignacio Corbo and Fernando Díaz of [TipoType](https://tipotype.com/).

I love using Futura when I have time to go to the letterpress shop at [San Francisco Centter for the Book](https://sfcb.org/).

<!-- https://www.happyhues.co/palettes/11 -->


text:
# Exercise-1
In the space below, put your favorite quote in a block quote, and provide a link to a website that provides additional information about the quote.

Note that you can preview this Markdown in Atom to make sure it works correctly. See `complete` branch for an example.

----

"Hope" is the thing with feathers

By Emily Dickinson

> 'Hope' is the thing with feathers -
>
> That perches in the soul -
>
> And sings the tune without the words -
>
> And never stops - at all -
>
>

[Analysis of the poem](http://academic.brooklyn.cuny.edu/english/melani/cs6/hope.html)


text:
# #100DaysOfCode Challenge
## Day 26: Quick Overview
Solved 4 problems from HackerRank - Problem Solving
1. [DesignerPDFViewer.py](https://github.com/sandeep-krishna/100DaysOfCode/blob/master/Day%2026/DesignerPDFViewer.py)
2. [ClimbingTheLeaderboard.py](https://github.com/sandeep-krishna/100DaysOfCode/blob/master/Day%2026/ClimbingTheLeaderboard.py)
3. [TheHurdleRace.py](https://github.com/sandeep-krishna/100DaysOfCode/blob/master/Day%2026/TheHurdleRace.py)
4. [PickingNumbers.py](https://github.com/sandeep-krishna/100DaysOfCode/blob/master/Day%2026/PickingNumbers.py)
###
Read more about HackerRank - Problem Solving here : https://www.hackerrank.com/domains/algorithms

path: /Day 26/README.md


text:
---
layout: main
title: Head.Responsive() v2.0.0-alpha
excerpt: Getting things ready for 2.0, and looking for feedback
scripts: ["/site/assets/libs/jquery/jquery.min.js", "https://cdn.moot.it/latest/moot.min.js", "/site/assets/js/comments.min.js"]
---

#{{ page.title }} ({{ page.date | date_to_string }})

v2.0 is gearing up and getting ready for prime-time.

Currently playing with the new head.responsive() which will add a few things like

- height/width breakpoints
- hashtag handling (same as page/section handling)
- event handling (to subscribe to UI & feature detect changes)

Not everything is ready, and even, there is a need for some feedback on how certain things are done. Please have a look here, play with it, look at the souce and then come provide some feedback. Thanks !

- This way --->
  - [Test Page](/src/2.0.0/tests/responsive.html)
  - [FeedBack](https://github.com/headjs/headjs/issues/269)

P.S. The HeadJS site has been revamped to be more dynamic and more easily updateable. However i'm not a designer and as far as typographical choices etc go ..the site could use some Designer Luv !

I'd like to keep the current layout (more or less), but typo, color-scheme, ergonomics, and flat design revamps are very welcome.

If you have some Designer Luv to spread ...bring it on !

- Some designs i really like (though maybe overkill)
  - [Cassiopeia](http://themes.roussounelosweb.gr/cassiopeia)
  - [Moot](https://moot.it/)
  - Globally the bootstrap style: gray, black, white, or monochromatic with color highlights and large header/footer bars

Show Comments

repository: headjs/headjs

repo_name: headjs/headjs


text:
# ServiceNetworkManagers

```text
azure-11/Item/Other/ServiceNetworkManagers
```

```text
include('azure-11/Item/Other/ServiceNetworkManagers')
```

| Illustration | ServiceNetworkManagers | ServiceNetworkManagersCard | ServiceNetworkManagersGroup |
| :---: | :---: | :---: | :---: |
| ![illustration for Illustration](../../../azure-11/Item/Other/ServiceNetworkManagers.png) | ![illustration for ServiceNetworkManagers](../../../azure-11/Item/Other/ServiceNetworkManagers.Local.png) | ![illustration for ServiceNetworkManagersCard](../../../azure-11/Item/Other/ServiceNetworkManagersCard.Local.png) | ![illustration for ServiceNetworkManagersGroup](../../../azure-11/Item/Other/ServiceNetworkManagersGroup.Local.png) |

## Sprites
The item provides the following sriptes:

- `<$ServiceNetworkManagersXs>`
- `<$ServiceNetworkManagersSm>`
- `<$ServiceNetworkManagersMd>`
- `<$ServiceNetworkManagersLg>`

## ServiceNetworkManagers

### Load remotely
```plantuml
@startuml
' configures the library
!global $LIB_BASE_LOCATION="https://raw.githubusercontent.com/tmorin/plantuml-libs/master/distribution"

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('azure-11/bootstrap')

' loads the Item which embeds the element ServiceNetworkManagers
include('azure-11/Item/Other/ServiceNetworkManagers')

' renders the element
ServiceNetworkManagers('ServiceNetworkManagers', 'Service Network Managers', 'an optional tech label', 'an optional description')
@enduml
```

### Load locally
```plantuml
@startuml
' configures the library
!global $INCLUSION_MODE="local"
!global $LIB_BASE_LOCATION="../../.."

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('azure-11/bootstrap')

' loads the Item which embeds the element ServiceNetworkManagers
include('azure-11/Item/Other/ServiceNetworkManagers')

' renders the element
ServiceNetworkManagers('ServiceNetworkManagers', 'Service Network Managers', 'an optional tech label', 'an optional description')
@enduml
```

## ServiceNetworkManagersCard

### Load remotely
```plantuml
@startuml
' configures the library
!global $LIB_BASE_LOCATION="https://raw.githubusercontent.com/tmorin/plantuml-libs/master/distribution"

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('azure-11/bootstrap')

' loads the Item which embeds the element ServiceNetworkManagersCard
include('azure-11/Item/Other/ServiceNetworkManagers')

' renders the element
ServiceNetworkManagersCard('ServiceNetworkManagersCard', 'Service Network Managers Card', 'an optional description')
@enduml
```

### Load locally
```plantuml
@startuml
' configures the library
!global $INCLUSION_MODE="local"
!global $LIB_BASE_LOCATION="../../.."

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('azure-11/bootstrap')

' loads the Item which embeds the element ServiceNetworkManagersCard
include('azure-11/Item/Other/ServiceNetworkManagers')

' renders the element
ServiceNetworkManagersCard('ServiceNetworkManagersCard', 'Service Network Managers Card', 'an optional description')
@enduml
```

## ServiceNetworkManagersGroup

### Load remotely
```plantuml
@startuml
' configures the library
!global $LIB_BASE_LOCATION="https://raw.githubusercontent.com/tmorin/plantuml-libs/master/distribution"

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('azure-11/bootstrap')

' loads the Item which embeds the element ServiceNetworkManagersGroup
include('azure-11/Item/Other/ServiceNetworkManagers')

' renders the element
ServiceNetworkManagersGroup('ServiceNetworkManagersGroup', 'Service Network Managers Group', 'an optional tech label') {
    note as note
        the content of the group
    end note
}
@enduml
```

### Load locally
```plantuml
@startuml
' configures the library
!global $INCLUSION_MODE="local"
!global $LIB_BASE_LOCATION="../../.."

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('azure-11/bootstrap')

' loads the Item which embeds the element ServiceNetworkManagersGroup
include('azure-11/Item/Other/ServiceNetworkManagers')

' renders the element
ServiceNetworkManagersGroup('ServiceNetworkManagersGroup', 'Service Network Managers Group', 'an optional tech label') {
    note as note
        the content of the group
    end note
}
@enduml
```

repository: tmorin/plantuml-libs

gha_language: TypeScript

repo_name: tmorin/plantuml-libs