text:
#Constitutions and canons ecclesiasticall; treated upon by the Archbishops of Canterbury and York, presidents of the convocations for the respective provinces of Canterbury and York, and the rest of the bishops and clergie of those provinces; and agreed upon with the Kings Majesties licence in their severall synods begun at London and York. 1640  ... Constitutions and canons ecclesiastical#

##Church of England.##
Constitutions and canons ecclesiasticall; treated upon by the Archbishops of Canterbury and York, presidents of the convocations for the respective provinces of Canterbury and York, and the rest of the bishops and clergie of those provinces; and agreed upon with the Kings Majesties licence in their severall synods begun at London and York. 1640  ...
Constitutions and canons ecclesiastical
Church of England.

##General Summary##

**Links**

[TCP catalogue](http://www.ota.ox.ac.uk/tcp/)  •
[HTML](http://tei.it.ox.ac.uk/tcp/Texts-HTML/free/A00/A00089.html)  •
[EPUB](http://tei.it.ox.ac.uk/tcp/Texts-EPUB/free/A00/A00089.epub) •
[Page images (Historical Texts)](https://data.historicaltexts.jisc.ac.uk/view?pubId=eebo-99835843e&pageId=eebo-99835843e-69-1)

**Availability**

This keyboarded and encoded edition of the
	       work described above is co-owned by the institutions
	       providing financial support to the Early English Books
	       Online Text Creation Partnership. This Phase I text is
	       available for reuse, according to the terms of Creative
	       Commons 0 1.0 Universal. The text can be copied,
	       modified, distributed and performed, even for
	       commercial purposes, all without asking permission.

**Major revisions**

1. __2002-03__ __TCP__ *Assigned for keying and markup*
1. __2002-03__ __SPi Global__ *Keyed and coded from ProQuest page images*
1. __2002-04__ __TCP Staff (Michigan)__ *Sampled and proofread*
1. __2002-04__ __Olivia Bottum__ *Text and markup reviewed and edited*
1. __2002-05__ __pfs__ *Batch review (QC) and XML conversion*

##Content Summary##

#####Front#####
CHARLES, By the grace of GOD, King of England, Scotland, France, and Ireland, Defender of the Faith,
#####Body#####

1. Constitutions and Canons Ecclesiasticall, treated upon by the Archbishops of Canterbury and York, Presidents of the Convocations for the respective Provinces of Canterbury and York, and the rest of the Bishops and Clergie of those Provinces: And agreed upon with the Kings Majesties Licence in their severall Synods begun at London and York 1640.

    _ I. Concerning the Regall power.

    _ II. For the better keeping of the day of his Majesties most happy Inauguration.

    _ III. For suppressing of the growth of Popery.

    _ IV. Against Socinianisme.

    _ V. Against Sectaries.

    _ VI. An Oath injoyn'd for the preventing of all Innovations in Doctrine and Government.

      * The Oath is:

    _ VII. A Declaration concerning some Rites and Ceremonies.

    _ VIII. Of Preaching for Conformity.

    _ IX. One Book of Articles of inquiry to be used at all Parochiall Visitations.

    _ X. Concerning the Conversation of the Clergie.

    _ XI. Chancellours Patents.

    _ XII. Chancellours alone not to Censure any of the Clergie in sundry Cases.

    _ XIII. Excommunication and absolution not to be pronounced but by a Priest.

    _ XIIII. Concerning Commutations, and the disposing of them.

    _ XV. Touching concurrent Iurisdictions.

    _ XVI. Concerning Licences to Marrie.

    _ XVII. Against vexatious Citations.
WEE of Our Princely inclination and Royall care for the maintenance of the present Estate and govern
#####Back#####

1. THE TABLE.

**Types of content**

  * Oh, Mr. Jourdain, there is **prose** in there!

There are 151 **ommitted** fragments!
 @__reason__ (151) : illegible (151)  •  @__resp__ (151) : #PDCC (151)  •  @__extent__ (151) : 1 letter (145), 1 word (1), 2 letters (5)

**Character listing**

|Text|string(s)|codepoint(s)|
|---|---|---|
|General Punctuation|•|8226|
|Superscripts             and Subscripts|⁴|8308|
|Geometric Shapes|◊|9674|
|CJKSymbolsandPunctuation|〈〉|12296 12297|

##Tag Usage Summary##

###Header Tag Usage###

|No|element name|occ|attributes|
|---|---|---|---|
|1.|__author__|2||
|2.|__availability__|1||
|3.|__biblFull__|1||
|4.|__change__|5||
|5.|__date__|8| @__when__ (1) : 2003-01 (1)|
|6.|__edition__|2||
|7.|__editionStmt__|2||
|8.|__editorialDecl__|1||
|9.|__extent__|2||
|10.|__idno__|6| @__type__ (6) : DLPS (1), STC (2), EEBO-CITATION (1), PROQUEST (1), VID (1)|
|11.|__keywords__|1| @__scheme__ (1) : http://authorities.loc.gov/ (1)|
|12.|__label__|5||
|13.|__langUsage__|1||
|14.|__language__|1| @__ident__ (1) : eng (1)|
|15.|__listPrefixDef__|1||
|16.|__note__|7||
|17.|__notesStmt__|2||
|18.|__p__|11||
|19.|__prefixDef__|2| @__ident__ (2) : tcp (1), char (1)  •  @__matchPattern__ (2) : ([0-9\-]+):([0-9IVX]+) (1), (.+) (1)  •  @__replacementPattern__ (2) : http://eebo.chadwyck.com/downloadtiff?vid=$1&page=$2 (1), https://raw.githubusercontent.com/textcreationpartnership/Texts/master/tcpchars.xml#$1 (1)|
|20.|__projectDesc__|1||
|21.|__pubPlace__|2||
|22.|__publicationStmt__|2||
|23.|__publisher__|2||
|24.|__ref__|2| @__target__ (2) : https://creativecommons.org/publicdomain/zero/1.0/ (1), http://www.textcreationpartnership.org/docs/. (1)|
|25.|__seriesStmt__|1||
|26.|__sourceDesc__|1||
|27.|__term__|2||
|28.|__textClass__|1||
|29.|__title__|5||
|30.|__titleStmt__|2||

###Text Tag Usage###

|No|element name|occ|attributes|
|---|---|---|---|
|1.|__desc__|151||
|2.|__div__|23| @__type__ (23) : title_page (1), document (1), canons (1), part (17), oath (1), assent (1), table (1)  •  @__n__ (17) : 1 (1), 2 (1), 3 (1), 4 (1), 5 (1), 6 (1), 7 (1), 8 (1), 9 (1), 10 (1), 11 (1), 12 (1), 13 (1), 14 (1), 15 (1), 16 (1), 17 (1)|
|3.|__g__|323| @__ref__ (323) : char:EOLhyphen (322), char:EOLunhyphen (1)|
|4.|__gap__|151| @__reason__ (151) : illegible (151)  •  @__resp__ (151) : #PDCC (151)  •  @__extent__ (151) : 1 letter (145), 1 word (1), 2 letters (5)|
|5.|__head__|21| @__type__ (1) : sub (1)|
|6.|__hi__|131| @__rend__ (3) : sup (3)|
|7.|__item__|17||
|8.|__list__|1||
|9.|__p__|65||
|10.|__pb__|54| @__facs__ (54) : tcp:69:1 (2), tcp:69:2 (2), tcp:69:3 (2), tcp:69:4 (2), tcp:69:5 (2), tcp:69:6 (2), tcp:69:7 (2), tcp:69:8 (2), tcp:69:9 (2), tcp:69:10 (2), tcp:69:11 (2), tcp:69:12 (2), tcp:69:13 (2), tcp:69:14 (2), tcp:69:15 (2), tcp:69:16 (2), tcp:69:17 (2), tcp:69:18 (2), tcp:69:19 (2), tcp:69:20 (2), tcp:69:21 (2), tcp:69:22 (2), tcp:69:23 (2), tcp:69:24 (2), tcp:69:25 (2), tcp:69:26 (2), tcp:69:27 (2)  •  @__rendition__ (3) : simple:additions (3)  •  @__n__ (10) : 1 (1), 2 (1), 3 (1), 4 (1), 5 (1), 6 (1), 7 (1), 8 (1), 9 (1), 10 (1)|
|11.|__seg__|20| @__rend__ (20) : decorInit (20)|
|12.|__trailer__|1||
|13.|__unclear__|1||


text:
#** Welcome **#

###** This is the CloudMS WIKI **###
In this wiki you will see:

* [Table Structure](DATABASE_STRUCTURE.md)
* [TODO](TODO.md)
* [Changelog](CHANGELOG.md)
* Classes document
* [Walktrought - HowTo Documentation](Walktrought.md)

###** Learn about the project. **###
This project is an CMS, Content Management System, based in the PHP framework Symfony (version 2.3.0), the objective of this is to put together,admin, content and development in only one place.

The structure of the project was based in the WordPress structure, for the user friendly GUI so easy as possible.

###** About the developer. **###
My name is Victor Freitas ( vfreitas.com ).
email<EMAIL_ADDRESS>cel: +55 021 9671 6112
skype: victor_fcm

###** About the project **###

###** Requirements **###
 * PHP 5.3.3+
	- tested on php 5.4.17
 * PHP Composer
    - $ curl -s https://getcomposer.org/installer | php

###** Framework **###
[Symfony2](http://symfony.com/) - version 2.3.0

###** External Bundles **###
 * [FOSUserBundle](https://github.com/FriendsOfSymfony/FOSUserBundle)
 * [KNPMenuBundle](https://github.com/KnpLabs/KnpMenuBundle)
 * [StFalconTinyMCEBundle](https://github.com/stfalcon/TinymceBundle)
 * [KNPPaginatorBundle](https://github.com/KnpLabs/KnpPaginatorBundle)
 * [DMSFilterBundle](http://knpbundles.com/rdohms/DMSFilterBundle)
 * [LexikFormFilterBundle](https://github.com/lexik/LexikFormFilterBundle)

###** Internal Bundles **###
 1. CMS
    - StoreBundle: Bundle of all the database models and Back-end Admin controllers.
    - AdminBundle: Bundle of Front-end CMS Admin controllers.

###** The Idea **###
An powered CMS with the core no-hosted on the client, with a administrator area that you can administer how many sites as you want.

license: MIT

repository: victorfcm/cloudms

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: victorfcm/cloudms


text:
# git_cheatsheet

List branches on machine:
$ git branch

Create and checkout branch
$ git checkout -b {newbranch}

List where all the branches have come from
$ git remote show origin

Rename local branch$ git branch -m {newname}

Preview GIT committed changes:
$ git log --graph --abbrev-commit --pretty=oneline --decorate

To see the difference between two branches in a readable format
*Do exercise to fully understand*
 git diff --stat <branch1> <branch2>

To see which files have been created an which deleted
Git diff --summary <branch1> <branch2>

To show what is about to be pushed after committing
git diff --stat --cached origin/master

From <http://stackoverflow.com/questions/3636914/how-can-i-see-what-i-am-about-to-push-with-git>


text:
# Recover data to the master instance through a temporary instance {#concept_en3_pfn_ydb .concept}

**Note:** This article is not applicable to MySQL instances. To recover data for a MySQL instance, see [Recover data from a clone instance to a master instance](intl.en-US/User Guide/Backup and recovery/Recover MySQL data/Recover data from a clone instance to a master instance.md) \(recommended\) or [Recover data directly to the master instance](intl.en-US/User Guide/Backup and recovery/Recover MySQL data/Recover data directly to the master instance.md).

The data recovery function minimizes the damage caused by database misoperations. We recommend that you recover data to the master instance through a temporary instance. That is to say, recover data to a temporary instance, verify the data, and then migrate the data to the master instance. This avoids the impact of data recovery on the master instance.

## Note: {#section_qn5_l2n_ydb .section}

-   Creating a temporary instance does not affect the master instance.

-   The temporary instance inherits the account and password of the backup file.

-   The network type of the temporary instance is classic network.

-   A master instance can have only one temporary instance at a time. Before creating a temporary instance, delete any existing temporary instance of the master instance.

-   The temporary instance is free of charge, but will be released automatically 48 hours after being created.

## Create a temporary instance {#section_vbm_n2n_ydb .section}

1.  Log on to the [RDS console](https://rds.console.aliyun.com/) and select the region where the target instance is located.
2.  Click the ID of the target instance to go to the Basic information page.
3.  Select **Backup and Recovery** in the left-side navigation pane.
4.  Select the **Temporary Instance** tab.
5.  Select a point in time for recovery and click **Create Temporary Instance**.
6.  In the displayed dialog box, click **OK**.
7.  Go back to the **Instances** page.

## Recover data from the temporary instance to the master instance {#section_xm5_phv_l2b .section}

1.  After the temporary instance is created successfully, click the ID of the master instance to go to the Basic information page.
2.  Click **Create Data Migration Task** in the upper right corner to go to the [Data Transmission Service console](http://dts.console.aliyun.com/).
3.  Select **Data migration** in the left-side navigation pane.
4.  Click **Create migration task**.
5.  Set the parameters.
    -   Task name: A default task name is generated. You can modify it so that you will identify it more easily later.

    -   Source database information:

        -   Instance type: Select **RDS instance**.

        -   Instance region: Select the region where the master instance is located.

        -   RDS instance ID: Select the ID of the temporary instance.

        -   Database account: Same as the account name of the master instance. Make sure that this account has read/write permissions on the data to be migrated.

        -   Database password: Same as the account password of the master instance.

    -   Target database information:

        -   Instance type: Select **RDS instance**.

        -   Instance region: Select the region where the master instance is located.

        -   RDS instance ID: Select the master instance that has the temporary instance.

        -   Database account: Enter the account name of the master instance. Make sure that this account has read/write permissions on the data to be migrated.

        -   Database password: Enter the account password of the master instance.

6.  Click **Authorization whitelist and enter into next step**.
7.  Select the migration types.
8.  In the left pane, select the objects to be migrated and click **\>** to add them to the right. If you want to modify the name of a migrated object in the target database, you can hover the mouse over the database that needs to be modified in the Selected objects pane and click the displayed **Edit** button.
9.  Click **Pre-check and start**.
10. If the pre-check fails, click **!** next to the failed check item to view detailed failure information, and perform troubleshooting accordingly. After the troubleshooting, find the migration task in the **Migration task list** page and start the pre-check again.
11. After the pre-check is passed, click **OK** to start the migration task.

url: https://raw.githubusercontent.com/BoobooWei/mysql/ab57fd707a304fef514c395afe35966a34c9b8b9/intl.en-US/User Guide/Backup and recovery/Recover SQL Server/PPAS/PostgreSQL data/Recover data to the master instance through a temporary instance.md

repository: BoobooWei/mysql

gha_license_id: MIT

repo_name: BoobooWei/mysql


text:
---
title: PHP Chat using WebSocket
author: PipisCrew
date: 2017-04-17
categories: [js,php]
toc: true
---

HTML5 - Introducing WebSockets
https://www.html5rocks.com/en/tutorials/websockets/basics/

PHP Implementation
http://phppot.com/php/simple-php-chat-using-websocket/
or
https://github.com/ratchetphp/Ratchet/
or
https://www.sanwebe.com/2013/05/chat-using-websocket-php-socket/

warning
1-you have to enable the sockets extension - http://www.php.net/manual/en/sockets.installation.php to php.ini aka

```js
extension=php_sockets.dll
```

2-of course run the server from command line.

origin - http://www.pipiscrew.com/2017/04/php-chat-using-websocket/ php-chat-using-websocket


text:
---
layout: article
title: "Now it is easy enough! Make your Smart Home by yourself"
categories: articles
author: plinio_seniore
excerpt: "Souliss is the enabler for your DIY home hacks"
tags: [arduino, souliss, diy, hack]
modified: 2014-04-02
image:
  feature:
  teaser:
ads: false
redirect_from: "2014/04/now-it-is-easy-enough-make-your-smart.html"
---

Personally I don't have any automation and I don't think that I will have some, but I was looking for something to do with some Arduino wireless boards when Souliss has started. At that time and still now I can see a lot of demands in DIY automations and few reliable solution.

I've coded for a couple of months before releasing the first code, no user interface and poor reliability, but almost working. It was a bit more than two years ago and now I can say: "It's easy enough!".

Almost all the people that join our community are able to control devices in their homes in few hours, getting them on Android or in the cloud. And that's not a single shot, is something that scale and can cover a whole home.
You will have your hands dirty and the end, but you don't need to be a professional coder or even an electrician or an engineer. Get your Smart Home is easy as code an Arduino, you just have to read and get information over the web.

Souliss is the first project that I've build not for myself but as starting point for a community, and just now is turning in that way. Many of the most interesting features (like the openHAB interface or the cloud ZozOT) are coming from the community as the deep test of such people has turned Souliss into a reliable code.

Often while diving into the forum I get impressed, people starts to do amazing things that never can be done with a commercial product.
Is almost one year ago when Lorenzo has started to share its idea and result, he used a 7'' inch Android tablet as media server and installed SoulissApp over it, then he put a set of multicolor LED strip lights and get them synched with the movies or music played in his tavern.

Christian build the cheapest and simpler remote control for its electrical devices, mixing Souliss with an Arduino library for RF (radio controlled) sockets (20 euros for three sockets), controlling them from the smartphone and the internet.

What about Marco that kick its home gate using the GPS location or Fulvio that is buiding a complete automated home with more than 20 boards? The amazing Antonino is pushing its data consumption to the cloud using Android as home server.
Is nice see that the community is building up a reliable, cheap and scalable automation system that fits many needs. Actually there are almost a thousand of people that use Souliss for simple and complex automation that hopefully will continue to growth in the near future.

So, what's next? Actually the main features are there, but the project will need more people deeply involved because is becoming too large for the small team behind it. People that knows HTML5, Android and JAVA coding can really improve Souliss, is time to spread Souliss around and get more geeks involved.

gha_language: SCSS


text:
---
title: "Set up our JFrog Pipelines Integrations"
chapter: false
weight: 54
pre: "<b>5.4 </b>"
---

Our CI/CD pipeline requires access to GitHub to pull our code, access to JFrog Artifactory to deploy our Docker image and access to AWS to deploy to EKS. We will set up JFrog Pipelines integrations to enable these.

![Pipelines Integration](/images/pipeline-integrations-diagram.png)

{{% notice info %}}
An Integration connects Pipelines to an external service/tool. Each integration type defines the endpoint, credentials and any other configuration detail required for Pipelines to exchange information with the service. All credential information is encrypted and held in secure storage, in conformance with best security practices.
{{% /notice %}}

{{% notice warning %}}
You may have already created these integrations in previous steps. If so, you can reuse them and do not need to recreate them. JFrog Pipelines allows you to share integrations and resources across pipelines.
{{% /notice %}}

1. In your JFrog Platform instance, go to **Administration** > **Pipelines** > **Integrations**.

2. Click **Add an Integration**.

3. For the **Name**, enter _artifactory\_integration_.

4. For **Integration Type**, select **Artifactory**.

5. Click **Get API Key** to generate an API key.

6. Click **Test connection** to validate.

7. Click **Create** to create the integration.
   ![Artifactory Integration](/images/artifactory-integration.png)

8. Click **Add an Integration** again.

9. For the **Name**, enter _github\_integration_.

10. For **Integration Type**, select **GitHub**.

11. Copy and paste your GitHub personal access token. Ensure it has these minimum GitHub permissions:

    - repo (all)
    - admin:repo_hook (read, write)
    - admin:public_key (read, write)

12. Click **Test connection** to validate.

13. Click **Create** to create the integration.
   ![GitHub Integration](/images/github-integration.png)

14. In your Cloud9 terminal, execute the following commands to create a AWS user and access key ID and secret access key.

```
aws iam create-user --user-name workshopuser
aws iam attach-user-policy --user-name workshopuser --policy-arn arn:aws:iam::aws:policy/AdministratorAccess
aws iam create-access-key --user-name workshopuser
```

15. Copy the output of these commands.
   ![AWS Access Key](/images/aws-access-key.png)

16. Go back to your JFrog Platform instance and go to **Administration** > **Pipelines** > **Integrations**.

17. Click **Add an Integration** again.

18. For the **Name**, enter _aws\_integration_.

19. For **Integration Type**, select **AWS**.

20. For the **Access Key Id** and the **Secret Access Key**, enter the values from above.

21. Click **Create** to create the integration.
   ![AWS Integration](/images/aws-integration.png)
22. Click **Add an Integration** again.
23. For the **Name**, enter _eks\_integration_.
24. For **Integration Type**, select **Kubernetes**.
25. Paste in the Kubeconfig output from the steps where you created your EKS cluster.
26. Click **Create** to create the integration.
   ![EKS Integration](/images/eks-integration.png)
27. Click **Add an Integration** again.
28. For the **Name**, enter _pagerduty\_integration_.
29. For **Integration Type**, select **PagerDuty Events**.
30. Enter the PagerDuty Pipelines Integration Key created in the prior steps for **Service Integration/routing key**.
    ![PagerDuty Integration](/images/addpagerdutyintegration.png)
31. Click **Create**.
32. Go to **Administration** > **Xray** > **Settings**.
33. Click on **Webhooks** in the **General** tile.
34. Create a **New Webhook**.
35. Enter _Xray PagerDuty_ for the **Webhook Name**
36. Enter the PagerDuty Xray Integration URL for the **URL**.  _ex: https://events.pagerduty.com/integration/< integration id >/enqueue_
37. Click **Create**.
    ![PagerDuty Xray Webhook](/images/pdxraywebhook.png)
38. Go to **Administration** > **Xray** > **Watches & Policies**.
39. Click on the **High-Severity** policy that you created earlier.
40. Then click on the edit icon for the **High-Severity** rule that you created earlier.
    ![PagerDuty Edit Xray Rule](/images/pdeditxrayrule.png)
41. Scroll down and enable **Trigger Webhook** and select **Xray Pagerduty**, the webhook that you created in the previous steps.
42. Click **Save** to save the rule.
    ![PagerDuty Xray Webhook](/images/pdxraywebhookrule.png)
43. Click **Save** to save the policy.

Congratulations! We have created the integrations that are required for our CI/CD pipeline.

repository: jfrog/aws-modernization-with-jfrog

branch_name: refs/heads/main

repo_name: jfrog/aws-modernization-with-jfrog


text:
# Edouardia Corr.Mello GENUS

#### Status
ACCEPTED

#### According to
International Plant Names Index

#### Published in
Fauna Brit. Ind. , Moll. , 2, 280.

#### Original name
Conulinus Martens, 1895

### Remarks
null

repository: mdoering/backbone

repo_name: mdoering/backbone


text:
# bpmn-visualization examples

This repository contains examples showing how to use [bpmn-visualization](https://github.com/process-analytics/bpmn-visualization-js).

## Demo

This example let you load a BPMN file to see how the lib renders it. Various versions of the lib are available.

- online: [bpmn-visualization-examples demo](https://cdn.statically.io/gh/process-analytics/bpmn-visualization-examples/master/demo/index.html)
thanks to the [statically.io](https://statically.io/) service
- local: [demo](./demo)

If you need BPMN examples, you can use resources
- from the [BPMN Model Interchange Working Group (BPMN MIWG)](http://www.omgwiki.org/bpmn-miwg)
  - https://github.com/bpmn-miwg/bpmn-miwg-test-suite
  - https://github.com/bpmn-miwg/bpmn-miwg-demos
- [files used to test](./bpmn-files/README.md) how the lib renders BPMN elements

## Examples

All examples are available live, see [index.html](https://cdn.statically.io/gh/process-analytics/bpmn-visualization-examples/master/examples/index.html)

### Usage

- [load remote BPMN diagrams](examples/load-remote-bpmn-diagrams/README.md)

### Extensibility

**DISCLAIMER: extension points are currently very experimental and are subject to changes**

- [custom user task icon](./examples/custom-user-task-icon/README.md) use your own icon
- [custom colors](examples/custom-colors/README.md):
  - change default fill and stroke colors
  - change default font color
  - use specific colors depending on the BPMN element types
- [custom fonts](examples/custom-fonts/README.md):
  - change default font
  - use specific fonts depending on the BPMN element types

# Powered by

[![statically.io logo](https://statically.io/icons/icon-96x96.png "statically.io")](https://statically.io)

**[statically.io](https://statically.io)** (demo environment and live examples)


text:
## VcImageryProviderWms

Loading a tiled imagery provider that provides tiled imagery hosted by a Web Map Service (WMS) server. It is equivalent to initializing a `Cesium.WebMapServiceImageryProvider` instance.

**Note**: It needs to be a subcomponent of `vc-layer-imagery` to load normally.

### Basic usage

Basic usage of the `vc-imagery-provider-wms` component.

:::demo Use the `vc-layer-imagery` tag to add the imagery layer with WebMapServiceImageryProvider to the viewer.

```html
<el-row ref="viewerContainer" class="demo-viewer">
  <vc-viewer @ready="onViewerReady">
    <vc-layer-imagery :alpha="alpha" :brightness="brightness" :contrast="contrast">
      <vc-imagery-provider-wms
        ref="provider"
        url="https://nationalmap.gov.au/proxy/http://geoserver.nationalmap.nicta.com.au/geotopo_250k/ows"
        layers="Hydrography:bores"
        :parameters="{transparent: true, format: 'image/png'}"
      ></vc-imagery-provider-wms>
    </vc-layer-imagery>
  </vc-viewer>
  <div class="demo-toolbar">
    <el-row>
      <el-button type="danger" round @click="unload">Unload</el-button>
      <el-button type="danger" round @click="load">Load</el-button>
      <el-button type="danger" round @click="reload">Reload</el-button>
    </el-row>
    <el-row>
      <el-col>
        <div class="block">
          <span class="demonstration">Alpha</span>
          <el-slider v-model="alpha" :min="0" :max="1" :step="0.01"></el-slider>
          <span class="demonstration">Brightness</span>
          <el-slider v-model="brightness" :min="0" :max="5" :step="0.01"></el-slider>
          <span class="demonstration">Contrast</span>
          <el-slider v-model="contrast" :min="0" :max="5" :step="0.01"></el-slider>
        </div>
      </el-col>
    </el-row>
  </div>
</el-row>

<script>
  import { ref, getCurrentInstance } from 'vue'
  export default {
    setup() {
      // state
      const instance = getCurrentInstance()
      const provider = ref(null)
      const alpha = ref(1)
      const brightness = ref(1)
      const contrast = ref(1)
      let viewer = undefined
      // methods
      const unload = () => {
        provider.value.unload()
      }
      const reload = () => {
        provider.value.reload()
      }
      const load = () => {
        provider.value.load()
      }
      const onViewerReady = cesiumInstance => {
        cesiumInstance.viewer.camera.setView({
          destination: Cesium.Rectangle.fromDegrees(114.591, -45.837, 148.97, -5.73)
        })
      }
      return {
        provider,
        unload,
        reload,
        load,
        alpha,
        brightness,
        contrast,
        onViewerReady
      }
    }
  }
</script>
```

:::

### Props

<!-- prettier-ignore -->
| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| url | string\|Cesium.Resource | | `required` The URL of the WMS service. The URL supports the same keywords as the UrlTemplateImageryProvider. |
| layers | string | | `required` The layers to include, separated by commas. |
| parameters | any | | `optional` Additional parameters to pass to the WMS server in the GetMap URL. |
| getFeatureInfoParameters | any | | `optional` Additional parameters to pass to the WMS server in the GetFeatureInfo URL. |
| enablePickFeatures | boolean | `true` | `optional` If true, WebMapServiceImageryProvider#pickFeatures will invoke the GetFeatureInfo operation on the WMS server and return the features included in the response. If false, WebMapServiceImageryProvider#pickFeatures will immediately return undefined (indicating no pickable features) without communicating with the server. Set this property to false if you know your WMS server does not support GetFeatureInfo or if you don't want this provider's features to be pickable. Note that this can be dynamically overridden by modifying the WebMapServiceImageryProvider#enablePickFeatures property. |
| getFeatureInfoFormats | Array | | `optional` The formats in which to try WMS GetFeatureInfo requests. |
| rectangle | VcRectangle\|Array | | `optional` The rectangle of the layer. |
| tilingScheme | Cesium.GeographicTilingScheme \| Cesium.WebMercatorTilingScheme | | `optional` The tiling scheme to use to divide the world into tiles. |
| ellipsoid      | Cesium.Ellipsoid | | `optional` The ellipsoid. If the tilingScheme is specified, this parameter is ignored and the tiling scheme's ellipsoid is used instead. If neither parameter is specified, the WGS84 ellipsoid is used. |
| tileWidth | number | `256` | `optional` The width of each tile in pixels. |
| tileHeight | number | `256` | `optional` The height of each tile in pixels. |
| minimumLevel | number | `0` | `optional` The minimum level-of-detail supported by the imagery provider. Take care when specifying this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely to result in rendering problems. |
| maximumLevel | number | | `optional` The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. If not specified, there is no limit. |
| crs | string | | `optional` CRS specification, for use with WMS specification >= 1.3.0. |
| srs | string | | `optional` SRS specification, for use with WMS specification 1.1.0 or 1.1.1 |
| credit | Credit\| string | | `optional` A credit for the data source, which is displayed on the canvas. |
| subdomains | string\| Array | `'abc'` | `optional` The subdomains to use for the {s} placeholder in the URL template. If this parameter is a single string, each character in the string is a subdomain. If it is an array, each element in the array is a subdomain. |
| clock | Cesium.Clock | | `optional` A Clock instance that is used when determining the value for the time dimension. Required when options.times is specified. |
| times | Cesium.TimeIntervalCollection | | `optional` TimeIntervalCollection with its data property being an object containing time dynamic dimension and their values. |

### Events

| Name         | Parameters                              | Description                                                          |
| ------------ | --------------------------------------- | -------------------------------------------------------------------- |
| beforeLoad   | (instance: VcComponentInternalInstance) | Triggers before the cesiumObject is loaded.                          |
| ready        | (readyObj: VcReadyObject)               | Triggers when the cesiumObject is successfully loaded.               |
| destroyed    | (instance: VcComponentInternalInstance) | Triggers when the cesiumObject is destroyed.                         |
| errorEvent   | TileProviderError                       | Triggers when the imagery provider encounters an asynchronous error. |
| readyPromise | ImageryProvider                         | Triggers when the provider is ready for use.                         |

### Reference

- Refer to the official documentation: **[WebMapServiceImageryProvider](https://cesium.com/docs/cesiumjs-ref-doc/WebMapServiceImageryProvider.html)**

repository: zouyaoji/vue-cesium

branch_name: refs/heads/dev

gha_language: JavaScript

repo_name: zouyaoji/vue-cesium


text:
# Damascus

[![Greenkeeper badge](https://badges.greenkeeper.io/hadabo/damascus.svg)](https://greenkeeper.io/)
[![Build Status][build-badge]][build]
[![MIT License][license-badge]][LICENSE]
[![Semantic release][semantic-release]][semantic]
[![Damascus package][npm-dm]][damascus]
[![Coverage Status][coveralls-badge]][coveralls]

Get random districts names of Damascus.

## Installation

This package is distributed via npm:
```bash
npm install damascus
```

## Usage
```javascript
var damascus = require('damascus');
var allNames = damascus.all;
var randomName = damascus.random();
var threeRandomNames = damascus.random(3);
```

## Other
This library was developed by [Abdul-hadi Hawari](https://twitter.com/@hadabo) as a PoC to learn [semantic-release](https://www.npmjs.com/package/semantic-release).

[build-badge]: https://img.shields.io/travis/hadabo/damascus.svg?style=flat-square
[build]: https://travis-ci.org/hadabo/damascus
[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
[license]: https://github.com/hadabo/damascus/blob/master/LICENSE
[semantic-release]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square
[semantic]: https://www.npmjs.com/package/semantic-release
[npm-dm]: https://img.shields.io/npm/dm/damascus.svg?style=flat-square
[damascus]: https://www.npmjs.com/package/damascus
[coveralls]: https://coveralls.io/github/hadabo/damascus?branch=master
[coveralls-badge]: https://coveralls.io/repos/github/hadabo/damascus/badge.svg?branch=master

repository: hadabo/damascus

repo_name: hadabo/damascus


text:
# Contributing to Nalu-Wind

Thank you for considering contributing to Nalu-Wind project. Please follow these
guidelines for contributing to the Nalu-Wind project.

## Reporting bugs

This section guides you through the process of [submitting a bug
report](https://github.com/exawind/nalu-wind/issues/new) for the Nalu-Wind project.
Following these guidelines will help maintainers understand your issue,
reproduce the behavior, and develop a fix in an expedient fashion. Before
submitting your bug report, please perform a [cursory
search](https://github.com/search?q=is%3Aissue+repo%3Aexawind%2Fnalu-wind) to
see if the problem has been already reported. If it has been reported, and the
issue is still open, add a comment to the existing issue instead of opening a
new issue.

### Tips for effective bug reporting

- Use a clear descriptive title for the issue

- Describe the steps to reproduce the problem, the behavior you observed after
  following the steps, and the expected behavior

- Provide the SHA ID of the git commit Nalu-Wind code that you are using, as
  well as the SHA ID of the Trilinos build

- Provide as much detail as possible about the operating system, compiler
  versions, and third-party libraries used to build Nalu-Wind

- Include output of the CMake configuration step

- For build errors, include the complete output when executing `make`

- For runtime errors, provide a stack trace of the error output

## Contributing code and documentation changes

Contributions can take the form of bug fixes, feature enhancements,
documentation updates. All updates to the repository are managed via [pull
requests](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/proposing-changes-to-your-work-with-pull-requests).
One of the easiest ways to get started is by looking at [open
issues](https://github.com/Exawind/nalu-wind/issues) and contributing fixes,
enhancements that address those issues. If your code contribution involves large
changes or additions to the codebase, we recommend opening an issue first and
discussing your proposed changes with the core development team to ensure that
your efforts are well directed, and so that your submission can be reviewed and
merged seamlessly by the maintenance team.

Nalu-Wind can be developed locally. For instructions please consult the
[developer
manual](https://nalu-wind.readthedocs.io/en/latest/source/developer/index.html).

### Guidelines for preparing and submitting pull-requests

- Use a clear descriptive title for your pull-requests

- Describe if your submission is a bugfix, documentation update, or a feature
  enhancement. Provide a concise description of your proposed changes.

- Provide references to open issues, if applicable, to provide the necessary
  context to understand your pull request

- Make sure that your pull-request merges cleanly with the `master` branch of
  Nalu-Wind. When working on a feature, always create your feature branch off of
  the latest `master` commit

- Ensure that the code compiles without warnings, the unit tests and regression
  tests all pass without errors, and the documentation builds properly with your
  modifications

- New physics models and code enhancements should be accompanied with relevant
  updates to the documentation, supported by necessary verification and
  validation, as well as unit tests and regression tests

- Where appropriate please use [Clang
  format](https://clang.llvm.org/docs/ClangFormat.html) to format your code to
  match the rest of Nalu-Wind. Only do that for sections you edit/add. Don't run
  `clang-format` on the entire file if it is not a new file created by you.

Once a pull-request is submitted you will iterate with Nalu-Wind maintainers
until your changes are in an acceptable state and can be merged in. You can push
addditional commits to the branch used to create the pull-request to reflect the
feedback from maintainers and users of the code.

repository: Exawind/nalu-wind

gha_language: C

gha_license_id: NOASSERTION

repo_name: Exawind/nalu-wind


text:
# P2F

A react web app with a list of user tweet feeds(embed) that coders should follow on twitter

## About

**P2F**(People to Follow) is a website that contains a list
a list of people on Twitter who can fill your timeline with productive
tweets. They are open to discussions and questions.
These people can impact your tech and maker life really positively.

### Why?

People such as @chrisooncode and @alligator, have improved my software development
life by a mile. So I made this website to help others who are devs just like me.

### Thanks

It would have taken me a while to get this list but thanks to
[@hacksultan](https://twitter.com/hacksultan)
who made an [article](https://scotch.io/bar-talk/the-top-tech-people-to-follow-on-twitter-for-your-stack)
containing a list of people.

## Contribute

I know I don't have everyone here but great news **P2F** is open-source so you can add your maker on existing data or you can add new people.

> **Note**: Before you start contributing ensure you read the `CONTRIBUTING.md`.

## Getting Started

### Prerequisites

- Have `Node`, `npm`/`yarn` installed on your computer, but `yarn` is prefered
- Should have basic knowledge `Typescript` and `React`

### Standard Installation

- Fork this repo `https://github.com/tesh254/p2f.git`
- Clone your forked repository `git clone https://github.com/<your-username>/p2f.git`
- Type `yarn start` to run the application.

### Add to an existing

- If you want to add on a person locate `src/data/<datafile e.g react.ts>`.
- Inside the file you should see an array with multiple objects containing users' info
- To add someone just add anywhere in the array with an object like this:
  ```js
  {
      name: "<The person's Twitter name>",
      username: "<The person's Twitter username>",
      profileLink: "<Link to profile>",
      avatar: "<The person's current avatar>"
  }
  ```
- Push your code, raise your pull request.

### Add a new stack/category

- Locate `src/data` folder
- Create a new **file**, name it according to the **category/stack** in **lowercase**
- When adding data ensure you adhere to the template below
  ```js
      export default [
          {
            name: "<The person's Twitter name>",
            username: "<The person's Twitter username>",
            profileLink: "<Link to profile>",
            avatar: "<The person's current avatar>"
          },
          {...},
          {...}
      ]
  ```

* Locate `src/Components/People`
* Create a new folder with the name of the **stack/category**, first letter **uppercase**
* Inside the folder create an `index.ts` file
* Inside your template should adhere to the template below

  ```typescript
      import React from "react";
      import { PeopleState } from "../../types/interface";
      import People from "../../../data/<your data file in the src/data folder>";
      import PeopleComponent from "../../Commons/people";

      // If stack the class should be <Stack>People e.g. VuePeople
      // If category then it should be <Category name> e.g. Influencers
      class <Stack/Category name> extends React.Component<{}, PeopleState> {
          state = {
              people: People
          }

          render() {
              return (
                  <PeopleComponent {...this.state} />
              )
          }
      }

      export default <Stack/Category name>;
  ```

* Locate the `src/Components/Commons/StackTabs.tsx`
* Ensure you import your `<Stack/Category>` Component
* Open it and add your tab
  - Each tab is enclosed with the `<TabPane>` antd component.
  - The `tab` props is the name of the tab, emoji **must** be there so get creative.
  - The `key` is numeric number that helps in toggling the tabs
  - Ensure you is the last one and the `key` props should be a number **greater** than the **second last** tab by **one**.

gha_language: TypeScript


text:
## structure of blockchain's chunks

###### head
- height (this chunk's unique ID in its blockchain)
- head_hash (generated by `prev_chunk.head`'s hash, `prev_chunk.data`'s hash and `rand`)
- father_hash (inherit `prev_chunk.head_hash`)
- merkle_root (**no idea about what it is**)
- timestamp
- hard_level (adjusted by the whole system atuomaticly)
- Nonce (proof of workload `How many times did miner hashcalc?`)

###### body
- record of the trades during a period of time, which is so called account


text:
# reduxdb

Redux with MongoDB-like API.

Notice that NOT all the features of MongoDB are implemented here, such as multi-index and query operators.

The purpose of _reduxdb_ is to avoid writing almost the same actions and stores again and again in different projects.

A database is generally used for storing related, structured data, with well defined data formats, in an efficient manner for
insert, update and/or retrieval (depending on application).

On the other hand, a file system is a more unstructured data store for storing arbitrary, probably unrelated data.
The file system is more general, and databases are built on top of the general data storage services provided by file systems.

### Installation

```shell
npm install --save reduxdb
```

### Usage

```javascript
var reduxdb = require("reduxdatabase")

var db = reduxdb.use("test")
db.createCollection("users", {index: "id"})
db.createCollection("teams", {index: "id"})
db.createCollection("books")    // using default index `_id`

db.subscribe(function() {
    console.log(db.stats())
    console.log(db.users.stats())
    console.log(db.teams.stats())
    console.log(db.books.stats())
})

db.users.insert({id: "1234", name: "wizawu"})
db.users.findOne({name: "wizawu"}).id    // 1234
```

### API

#### reduxdb

+ use(name)

A database is generally used for storing related, structured data, with well defined data formats, in an efficient manner for insert, update and/or retrieval (depending on application).

On the other hand, a file system is a more unstructured data store for storing arbitrary, probably unrelated data. The file system is more general, and databases are built on top of the general data storage services provided by file systems

#### reduxdb.DB

ReduxDB:

A database is generally used for storing related, structured data, with well defined data formats, in an efficient manner for
insert, update and/or retrieval (depending on application).

On the other hand, a file system is a more unstructured data store for storing arbitrary, probably unrelated data.
The file system is more general, and databases are built on top of the general data storage services provided by file systems.

1. Parallel First Design Pattern

2. Symntic query: like google/fb

3. normilze, schema, redux, reselect

4. GraphQL: Solves REST problesm for limited fields and offset etc

5. migration for mongo and mysql

6. ES6 from scratch

7. Deserializing on browser: localstorage or redux form. Eg: info related to session user

8. Integrate features one by one

9. Joins/Aggregation between tables/JSON objects

10. lodash

11. Version controlled

12. No separate service in background

13. Speed Test on large record

14. ML data

15. jest testing DB, snapshot testing?

repository: priyanshuchauhan/reduxdatabase

repo_name: priyanshuchauhan/reduxdatabase


text:
# Creating a ServicePrincipal for scripting scenarios in 3 different ways
One does not want to login interactively all the time. Azure provides service principal authentication as a secure way for silent login.

## 1. via Portal
[This article](https://azure.microsoft.com/en-us/documentation/articles/resource-group-create-service-principal-portal/) provides detailed steps on creating a service principal via portal.

## 2. via XplatCLI in 3 simple steps
Pre-requisite:
- Install the latest version of cli from the [latest github release](https://github.com/Azure/azure-xplat-cli/releases) or from [npm](https://npmjs.com/package/azure-cli).

```bash
npm uninstall azure-cli -g
npm cache clear -g
npm install azure-cli -g
```
- Login to the azure-cli via azure login command to create a service principal for future use.
  - For 2FA enabled user accounts  `azure login`
  - For non 2FA enabled user accounts `azure login -u<EMAIL_ADDRESS>
After successful login, please follow the steps mentioned below to create a serviceprincipal:
#### Step 0. Please make sure you have selected the correct subscription. The service principal will have access to your current subscription.
- To list all your subscriptions: `azure account list`
- To set the subscription of your choice: `azure account set "your subscription name"`

#### Step 1. Create a service principal

Let us create a serviceprincipal with a password. The default start-date will be the day of application creation and the default end-date will be 1 year from the day of creation.

> ###### NOTE: The AppId a.k.a the serviceprincipal name in **GUID** format that gets created in this command is also known as clientId. It is the id given by ADAL for itself to identify your application. You can use this as the clientId during user authentication (creating UserTokenCredentials object).

```
D:\sdk>azure ad sp create -n testap908 -p P@ssw0rd
info:    Executing command ad sp create
+ Creating application testap674
+ Creating service principal for application 56894bd4-0fde-41d8-a0d7-5bsslccety2
data:    Object Id:               weewrerer-e329-4e9b-98c6-7878787
data:    Display Name:            testap674
data:    Service Principal Names:
data:                             56894bd4-0fde-41d8-a0d7-5bsslccety2   <<<<<<<<<<<<<<<<<<<<< also known as clientId
data:                             https://testap908
info:    ad sp create command OK
```

#### Step 2. Assigning a role to a ServicePrincipal by using the spn

- You can get a list of available roles by ```azure role list```
- In this example we are creating the serviceprincipal as a Contributor at the subscription level.
  - Definition of a Contributor
```
data:    Name             : Contributor
data:    Actions          : 0=*
data:    NotActions       : 0=Microsoft.Authorization/*/Delete, 1=Microsoft.Authorization/*/Write
data:    IsCustom         : false
```
This will associate the serviceprincipal to your current subscription
```
D:\sdk>azure role assignment create --spn 56894bd4-0fde-41d8-a0d7-5bsslccety2 -o Contributor
info:    Executing command role assignment create
+ Finding role with specified name
data:    RoleAssignmentId     : /subscriptions/abcdefgh-1234-4cc9-89b5-12345678/providers/Microsoft.Authorization/roleAssignments/987654-ea85-40a5-80c2-abcdferghtt
data:    RoleDefinitionName   : Contributor
data:    RoleDefinitionId     : jhfskjf-6180-42a0-ab88-5656eiu677e23e
data:    Scope                : /subscriptions/abcdefgh-1234-4cc9-89b5-12345678
data:    Display Name         : testap674
data:    SignInName           :
data:    ObjectId             : weewrerer-e329-4e9b-98c6-7878787
data:    ObjectType           : ServicePrincipal
data:
+
info:    role assignment create command OK
```

#### Step 3. Login as a serviceprincipal
```
D:\sdk>azure login -u 56894bd4-0fde-41d8-a0d7-5bsslccety2 -p P@ssw0rd --tenant <a guid OR your domain(contosocorp.com) --service-principal
info:    Executing command login
info:    Added subscription TestSubscription
+
info:    login command OK
```
## 3. via running a simple node.js script
You can run a script to create an SP programmaticaly in node.js. Please see the link over [here](./ServicePrincipal) for more info.

## Using authentication in your node.js script

- **Interactive Login** is the simplest and the best way to authenticate.
It provides a url and code that needs to be copied and pasted in a browser and authenticated over there. If successful,
the user will get a DeviceTokenCredentials object.
```javascript
 var someAzureServiceClient = require('azure-arm-someService');
 msRestAzure.interactiveLogin(function(err, credentials) {
   if (err) {
     console.log(err);
     return;
   }
   var client = new someAzureServiceClient(credentials, 'your-subscriptionId');
   client.someOperationGroup.method(param1, param2, function(err, result) {
     if (err) console.log(err);
     console.log(result);
   });
 });
```

> NOTE: Please provide the domain i.e. the tenantID, if you are going to authenticate with a LiveID(your outlook, yahoo, gmail, etc. account). This will give you the credential object pertaining to the specified tenant. This credential object can then be used for creating the client. Please refer to this [issue for detailed explanation](https://github.com/Azure/azure-sdk-for-node/issues/1821#issuecomment-237419366).

- **Service Principal Authentication**
This is useful in automation scenarios. The experience for loginWithServicePrincipalSecret is the same as the one described above for [azure-cli in step 4](https://github.com/Azure/azure-sdk-for-node/blob/master/Documentation/Authentication.md#step-4-login-as-a-serviceprincipal).
```javascript
 var someAzureServiceClient = require('azure-arm-someService');
 msRestAzure.loginWithServicePrincipalSecret(clientId, secret, domain, function(err, credentials) {
   if (err) {
    console.log(err);
    return;
   }
   var client = new someAzureServiceClient(credentials, 'your-subscriptionId');
   client.someOperationGroup.method(param1, param2, function(err, result) {
     if (err) console.log(err);
     console.log(result);
   });
 });
```

- **Login with username and password**
This mechanism will only work for non 2FA enabled organizational ids.
Otherwise it is better to use the above mechanism (interactive login).
```javascript
 var someAzureServiceClient = require('azure-arm-someService');
 msRestAzure.loginWithUsernamePassword(username, password, function(err, credentials) {
   if (err) {
     console.log(err);
     return;
   }
   var client = new someAzureServiceClient(credentials, 'your-subscriptionId');
   client.someOperationGroup.method(param1, param2, function(err, result) {
     if (err) console.log(err);
     console.log(result);
   });
 });
```

repository: nmors/azure-sdk-for-node

repo_name: nmors/azure-sdk-for-node


text:
# Macros Examples

The example Cloudformation macros have moved to their own repository:

<https://github.com/aws-cloudformation/aws-cloudformation-macros>

repository: stilvoid/aws-cloudformation-templates

repo_name: stilvoid/aws-cloudformation-templates


text:
---
layout: post
title: Java类型检查
categories: [Java]
---
Java类型转换前一般有三种方式进行类型检查

- isAssignableFrom
- isInstance
- instanceof

## isAssignableFrom
X.class.isAssignableFrom(Y.class)

> If X and Y are the same class, or X is Y's super class or super interface, return true, otherwise, false

## isInstance
X.class.isInstance(y)

> Say y is an instance of class Y, if X and Y are the same class, or X is Y's super class or super interface, return true, otherwise, false.

## instanceof
x instanceof X

> For instanceof you need to know the exact class X at compile time.


text:
# shipshape
An open-source program to check quality of new public data.

## Notes
This tool gauges variances between a base and newly updated data set using basic statistics and Gradient Boosted Trees. ShipShape was developed and tested using the 2013 and 2014 household records of the New York Public Use Microdata Sample (PUMS), available from the Census here -> https://www.census.gov/programs-surveys/acs/data/pums.html.

To use, update runner with local file path for both base and new data before executing.

repository: julms/shipshape

repo_name: julms/shipshape


text:
# new-relic

Installs and configures New Relic monitoring and adds git-crypt config.

## Usage

Run generator from root of the project that needs New Relic setup.

```
$ yo springworks:new-relic
```

## Result

- `newrelic.js` in root of project without the license key. Must be added manually.
- `.gitattributes` in root of project with config for encrypting `newrelic.js`. Remember to initiate git-crypt and commit `.gitattributes` before committing `newrelic.js` for the encryption to happen.

repository: Springworks/generator-springworks

repo_name: Springworks/generator-springworks


text:
# AI Programming with Python Project

Project code for Udacity's AI Programming with Python Nanodegree program. In this project, students first develop code for an image classifier built with PyTorch, then convert it into a command line application.

## Requirements
This project requires a working Python3 environment with numpy and pytorch intalled. Image data is not part of this repository.

## Training
To train the network, run

```
python train.y <data_dir>
```

For futher options see the console output. The training result will be saved to a checkpoint file.

## Predictions
To predict the category of an image use
```
python predict.py <image_file> <checkpoint>
```

For further options see the console output.

gha_language: HTML


text:
---
title: "Camel Designer's new mapping system"
date: 2022-07-01
authors: [brunoNetId]
categories: ["Tooling"]
preview: "Camel Designer's new mapping system"
---

\

A new input mapping system has been added to *Camel Designer*. But what that even means ?!?

Well, better to be seen, but if explained, it's an effort to provide a more intuitive configuration system for *Camel* route steps. On one hand, it simplifies the view of a route by compacting route steps, and on the other hand, it provides an easy drag-and-drop mapping ability to map process variables to activity inputs.

For example, to configure an endpoint, such as an HTTP activity, the mapping view allows the developer to configure a full HTTP invocation by mapping component options, headers and payload.

## Detailed blog article

To really understand how this new configuration system works, head to the following blog post that deep dives into it:

- [**Gearing up _Camel Designer_**](https://brunonetid.github.io/2022/06/28/camel-designer-configuration.html)

In the blog above, this new functionality is covered in great detail. Furthermore, it showcases how combining *Camel Designer* and [***Camel JBang***](/manual/camel-jbang.html) empowers the developer to code with super fast trial-and-error cycles. The combo shines when used for exploratory work and prototyping.

## Quick video demonstration

If you're not that interested in the nitty-gritty details, here's a video recording showcasing *Camel Designer* and *Camel JBang*, walking you through the process of building and running one of the examples included in the blog article.

{{< youtube id="JP2fslD704w" class="video" >}}

<br>

## Related resources

\

- In-detail blog post about [*Camel Designer*'s](https://brunonetid.github.io/2022/06/28/camel-designer-configuration.html) configuration system.
- Official [*Camel JBang*'s](/manual/camel-jbang.html) documentation.
- Find [*Camel Designer*](https://marketplace.visualstudio.com/items?itemName=brunoNetId.camel-designer) in *VS Code*'s marketplace.

repository: apache/camel-website

gha_language: CSS

repo_name: apache/camel-website


text:
---
title: "ICorDebugType2::GetTypeID Method | Microsoft Docs"
ms.custom: ""
ms.date: "03/30/2017"
ms.prod: ".net-framework"
ms.reviewer: ""
ms.suite: ""
ms.technology:
  - "dotnet-clr"
ms.tgt_pltfrm: ""
ms.topic: "article"
api_name:
  - "ICorDebugType2.GetTypeID"
api_location:
  - "mscordbi.dll"
api_type:
  - "COM"
f1_keywords:
  - "ICorDebugType::GetTypeID"
helpviewer_keywords:
  - "GetTypeID method, ICorDebugType2 interface [.NET Framework debugging]"
  - "ICorDebugType2.GetTypeID method [.NET Framework debugging]"
ms.assetid: 0b933686-226e-4373-92b7-fac579ee7b1a
topic_type:
  - "apiref"
caps.latest.revision: 4
author: "rpetrusha"
ms.author: "ronpet"
manager: "wpickett"
---
# ICorDebugType2::GetTypeID Method
Gets a [COR_TYPEID](../../../../docs/framework/unmanaged-api/debugging/cor-typeid-structure.md) for this type.

## Syntax

```

HRESULT GetTypeID(
    ([out] COR_TYPEID *id
);

```

#### Parameters
 `id`
 [out] A pointer to the [COR_TYPEID](../../../../docs/framework/unmanaged-api/debugging/cor-typeid-structure.md) for this ICorDebugType.

## Return Value
 The return value is `S_OK` on success, or a failure `HRESULT` code on failure. The `HRESULT` codes include the following:

|Return code|Description|
|-----------------|-----------------|
|`S_OK`|Method succeeded. The method has retrieved a valid [COR_TYPEID](../../../../docs/framework/unmanaged-api/debugging/cor-typeid-structure.md).|
|`CORDBG_E_CLASS_NOT_LOADED`|The type has not been loaded.|
|`CORDBG_E_UNSUPPORTED`|The type is not supported.|

## Remarks
 This method provides a mapping from the ICorDebugType, which represents a type that may or may not have been loaded into the runtime, to a [COR_TYPEID](../../../../docs/framework/unmanaged-api/debugging/cor-typeid-structure.md), which serves as an opaque handle that identifies a type loaded into the runtime.

 When the type that the ICorDebugType represents has not yet been loaded, this method returns `CORDBG_E_CLASS_NOT_LOADED`.  If the type is not supported, it returns `CORDBG_E_UNSUPPORTED`.

## Requirements
 **Platforms:** See [System Requirements](../../../../docs/framework/get-started/system-requirements.md).

 **Header:** CorDebug.idl, CorDebug.h

 **Library:** CorGuids.lib

 **.NET Framework Versions:** [!INCLUDE[net_current_v462plus](../../../../includes/net-current-v462plus-md.md)]

## See Also
 [ICorDebugType2 Interface](../../../../docs/framework/unmanaged-api/debugging/icordebugtype2-interface.md)


text:
# Best-first feature selection for classifications with cross-validation

Script to select the `n` best features for modeling a given dataset,
using a greedy algorithm:

- Initialize the set `S` of selected features to the empty set
- For `i` in `1 ... n`:
  - For each feature `f` not in `S`, model and evaluate (with cross-validation)
    with feature set `S + f`
  - Greedily select the feature `f'` with the best performance and add
    it to `S`

If last features have not improved the performance of the model during a
certain number of iterations, it will stop the execution.

The script takes as inputs

- the dataset to use
- the number of features (that is, dataset fields) to return
- the objective field (target)
- the configuration options for the models
- the number of k-folds to use in the cross-validation
- the subset of pre-selected features that will be used to append any other
  available feature
- an early-stop-performance improvement value (in %) used as a threshold
  to consider good performance of a feature
- the maximum number of iterations with bad performance allowed (as
  percentage of the initial number of features)

and yields as output a
list of the `n` (or lower if the algorithm stops due to bad performance)
selected features, as field identifiers plus their names and the subsets
and evaluations for each iteration step.

To select the best performance, the script uses the metric
`average_phi` in the evaluations it performs, which is only available
for classification problems.  Therefore, the script is only valid for
categorical objective fields.

In cross-validation, the standard deviation is substracted to the average
of all `average_phi` to use the *worst case* as metric of
performance.

You can set the configuration for the model to be used in the analysis in the
`options` variable. For instance, if you set {"number_of_models": 2} an
ensemble will be used.


text:
example how to use:

```python
sshkey_palmkey:

#no need to specify a sshkey, because there is only 1 will use that one
host.littlepc.palm_host1:
  rack: 'ourtable'
  addr: '<IP_ADDRESS>:22'
```

no need to specify an entry in blueprint about sshkey
this will automatically find the key if the following was in scheme of host.littlepc.palm

```python
sshkeys                        = type:str list consume:sshkey:1
```

this tells that a consumption of an sshkey is a requirement

if key does not exist yet then will generate one

repository: Incubaid/playenv

gha_language: Python

repo_name: Incubaid/playenv


text:
# mygamebacklogcolelction
Game bgacklog colelction maade in Rails

## Installation and usage

To use this app, just clone, run rake db:migrate and then run rails s. Typically, hosted on  http://<IP_ADDRESS>:3000/. If you want, you can run rake db:seed to preload some users and their posts.

## Contributing

Bug reports and pull requests are welcome on GitHub at https://https://github.com/RSigmaSG/mygamebacklogcollection. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

## Code of Conduct

Everyone interacting in the EdenEvents project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/RSigmaSG/portfolio_maker/blob/main/CODE_OF_CONDUCT.md).

repository: RSigmaSG/mygamebacklogcollection

repo_name: RSigmaSG/mygamebacklogcollection


text:
### Materials
- [__lecture slides__](https://drive.google.com/file/d/1wQ8VRiKLxfqAndLh3Djr1jIMixacznQF/view?usp=sharing)
* Our videos (russian) - [lecture](https://yadi.sk/i/xONJD2llbRbwlA), [seminar](https://yadi.sk/i/UXa6vq2FZ5IASg)
* Stanford nlp videos: [N-gram language models](https://archive.org/details/41IntroductionToNGramsStanfordNLPProfessorDanJurafskyChrisManning/), [neural language models](https://www.youtube.com/watch?v=Keqep_PKrY8)

### Practice
Seminar: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/yandexdataschool/nlp_course/blob/2020/week03_lm/seminar.ipynb)

As usual, `./seminar.ipynb` and `./homework_*.ipynb` awaits you :)

### Lecture-blog, research thinking exercises, related papers and fun:
#### ![logo](../resources/course_logo.png) [NLP Course For You](https://lena-voita.github.io/nlp_course.html#preview_lang_models)
![lecture_preview](../resources/nlp2020_gifs/language_modeling.gif)

### Play with softmax temperature:
#### ![logo](../resources/course_logo.png) [NLP Course For You](https://lena-voita.github.io/nlp_course/language_modeling.html#generation_strategies_temperature)
![softmax_temperature_demo](../resources/nlp2020_gifs/softmax_temperature.gif)

### More materials
* CS231 lecture on RNNs - [video](https://www.youtube.com/watch?v=iX5V1WpxxkY) (english)
* A more detailed lecture by Y. Bengio - [video](https://www.youtube.com/watch?v=xK-bzjIQkmM)
* Great reading by A. Karpathy - http://karpathy.github.io/2015/05/21/rnn-effectiveness/
* LSTM explained in detail by colah - http://colah.github.io/posts/2015-08-Understanding-LSTMs/
* "Awesome rnn" entry point - https://github.com/kjw0612/awesome-rnn


text:
# Leucostoma niveum (Hoffm.) Höhn., 1928 SPECIES

#### Status
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Mitt. bot. Inst. tech. Hochsch. Wien 5: 58 (1928)

#### Original name
Sphaeria nivea Sowerby

### Remarks
null

path: /life/Fungi/Ascomycota/Sordariomycetes/Diaporthales/Valsaceae/Valsa/Valsa nivea/ Syn. Leucostoma niveum/README.md


text:
---
title: "Companion to BER 670: Rasch Techniques for Constructing and Evaluating Measurement Instruments"
author: "Cheng Hua & Dr. Stefanie Wind"
date: "2020-11-02T02:37:01Z"
tags: [Course, Statistics]
link: "https://bookdown.org/chua/new_rasch_demo2/"
length_weight: "100%"
pinned: false
---

This is the Rasch R book. [...] This book is still in progress !!! This is a draft. Several sections are still incomplete or unedited. This book is written to help students enrolled in the University of Alabama, Rasch Measurement Theory (BER 670) course led by Professor Stefanie Wind. We hope that the book will be a useful resource to help you learn both R and statistics. If you have any suggestions for improvements, please get in touch with your lovely TA: Cheng Hua, at<EMAIL_ADDRESS>The course schedule proceeds as follows: Part I includes an introduction to the course, an overview of ...


text:
Decorators
==========
Login and permission decorators.

login_required
---------
*``aegis.decorators.login_required``*

If unauthorized user tries to reach to a `login_required` end-point returns
`UNAUTHORIZED` response.

```python
# server
from aegis import login_required

@login_required
async def protected(request):
    return web.json_response({'hello': 'user'})

app.router.add_get('/protected', protected)

# client
response = await session.get("http://<IP_ADDRESS>:8080/protected")
assert response.status == 401

error = await response.json()
assert error == {
    "type": "https://mgurdal.github.io/aegis/api.html#AuthRequiredException",
    "title": "Authentication Required",
    "detail": "You did not specify the required token in headers or you provided it incorrectly.",
    "instance": "http://<IP_ADDRESS>:8080/protected",
    "status": "401"
}
```

permissions
---------
*``aegis.decorators.permissions``*
Opens the end-point for any user who has the permission to access.

**Matching Algorithms**:

- `algorithm='any'` - The default algorithm which opens the end-point for any user who has any of the required permissons.
- `algorithm='all'` - Opens the end-point to users who has all of the required permissons.
In this case end-point is also open for users who has a superset of required permissions.
- `algorithm='exact'` - Opens the end-point for the users who has exactly the same permissions with required permissions.

You can also implement your own matching algorithm and use with permissions.

```python
from aegis import permissions
from aegis.matching_algorithms import match_any

def match_any_and_admin(required_permissions, user_permissions) -> bool:
    # ignore the matching algorithm if user is admin
    has_permission = (
        "admin" in user_permissions
        or match_any(required_permissions, user_permissions)
    )
    return has_permission

@permissions("user", algorithm=match_any_and_admin)
async def protected(request):
    return web.json_response({'hello': 'user'})
```

- If user has no permission to access to scoped end-point, returns `FORBIDDEN` response.

```python
response = await session.get("http://<IP_ADDRESS>:8080/protected")
assert response.status == 401

error = await response.json()
assert error == {
    "type": "https://mgurdal.github.io/aegis/api.html#ForbiddenException",
    "title": "Forbidden Access",
    "detail": "User permissions does not meet access requests for http://<IP_ADDRESS>:8080/protected",
    "instance": "http://<IP_ADDRESS>:8080/protected",
    "status": "403"
}
```

repository: mgurdal/aegis

repo_name: mgurdal/aegis


text:
---
title: Code Reviews
link: http://raganwald.posterous.com/a-conjecture-about-code-reviews
date: 2012-10-05T00:20Z
---
> Imagine if we didn’t judge the author of the code by how few “WTFs” it generated, but instead by how fertile it was
> for discussion? Or, imagine if every programmer was being judged by what they learned from the discussion. How would
> that change things? better still, imagine if the “manager's” job was to facilitate the learning and get the
> discussion back on track when it strayed into fixing-the-code territory instead of to judge people by how much they
> "contribute." That would be a breath of fresh air to most teams.

An excellent point. Code reviews are valuable for getting eyes on the code, but I agree with Raganwald here that the
more valuable outcome is that everyone shares in the learning. I've thought of that as learning *about* the work that
others are doing, but Raganwald makes a good point that you learn from the *discussion* about the work that others are
doing.


text:
# Intermediate Representation Suitable for INT8 Inference {#openvino_docs_MO_DG_prepare_model_convert_model_IR_suitable_for_INT8_inference}

## Introduction

OpenVINO Runtime CPU and GPU devices can infer models in low precision.
For more details, refer to the [Model Optimization Guide](@ref openvino_docs_model_optimization_guide).

Intermediate Representation should be specifically formed to be suitable for low precision inference.
Such a model is called a Low Precision IR and can be generated in two ways:
- By [quantizing regular IR with the Post-Training Optimization tool](@ref pot_introduction)
- Using Model Optimizer for a model pre-trained for Low Precision inference: TensorFlow pre-TFLite models (`.pb` model file with `FakeQuantize*` operations) and ONNX quantized models.
Both TensorFlow and ONNX quantized models can be prepared by [Neural Network Compression Framework](https://github.com/openvinotoolkit/nncf/blob/develop/README.md).

For an operation to be executed in INT8, it must have `FakeQuantize` operations as inputs.
For more details, see the [specification of `FakeQuantize` operation](../../../ops/quantization/FakeQuantize_1.md).

To execute the `Convolution` operation in INT8 on CPU, both data and weight inputs should have `FakeQuantize` as an input operation:
![](../../img/expanded_int8_Convolution_weights.png)

Low precision IR is also suitable for FP32 and FP16 inference if a chosen plugin supports all operations of the IR. The only difference between a Low Precision IR and FP16 or FP32 IR is the existence of `FakeQuantize` in the Low Precision IR.
Plugins that support Low Precision Inference recognize these sub-graphs and quantize them during inference.
The ones that do not, execute all operations, including `FakeQuantize`, as is in the FP32 or FP16 precision.

Consequently, when `FakeQuantize` operations are present in an OpenVINO IR, it suggests to the inference device how to quantize particular operations in the model.
If the device is capable, it accepts the suggestion and performs Low Precision Inference. If not, it executes the model in the floating-point precision.

## Compressed Low Precision Weights

Weighted operations, such as `Convolution` and `MatMul`, store weights as the floating-point `Constant` in the graph followed by the `FakeQuantize` operation.
The `Constant` followed by the `FakeQuantize` operation could be optimized memory-wise due to the `FakeQuantize` operation semantics.
The resulting weights sub-graph stores weights in Low Precision `Constant`, which gets unpacked back to floating point with the `Convert` operation.
Weights compression replaces `FakeQuantize` with optional `Subtract` and `Multiply` operation leaving output arithmetically the same and weights storing takes four times less memory.

See the visualization of `Convolution` with the compressed weights:
![](../../img/compressed_int8_Convolution_weights.png)

Both Model Optimizer and Post-Training Optimization tool generate a compressed IR by default.

repository: novakale/openvino

repo_name: novakale/openvino


text:
# dockerdns
Uses RFC2136 and container labels to update DNS records.
It's not fully tested, probably leaves a lot of mess if stopped unplanned and probably overwrites everything in its path.

Configuration is done via environment variables as shown below. Also uses docker connection settings from environment variable. TTL hardcoded to 300, could easily be a variable. TSIG key algorithm is hardcoded to HMAC-SHA512.

    DOCKERDNS_ZONE="example.com." # have not tested without trailing dot
    DOCKERDNS_NS="<IP_ADDRESS>"  #  must be IP-address, could add resolving myself but haven't done it
    DOCKERDNS_TSIGKEY="key.name"  # name of key
    DOCKERDNS_TSIGSECRET="b64 secret==" # secret

Add these labels to the containers

    org.nuxis.dockerdns.enable=true
    org.nuxis.dockerdns.hostname=www
    org.nuxis.dockerdns.target=<IP_ADDRESS>
    org.nuxis.dockerdns.rtype=A

repository: mboehn/dockerdns

repo_name: mboehn/dockerdns


text:
# Embedded Web Server - Frontend
## Application Overview
This project is bootstrapped by [Create-React-App](https://github.com/facebook/create-react-app). It contains the frontend React assets for the Embedded Web Server. This project provides a developement server which only serves the user interfaces at localhost:3000. To enable the backend APIs, you need to run EWSNodeJS-server separately at localhost:5000.

## Application Installation
1. You need to install [Node.js](https://nodejs.org/en/) and [NPM](https://www.npmjs.com/) on your system to run this app. Please refer to their official websites for detailed installation steps on different operating systems
2. Clone or download this project
3. ```cd``` into the project folder and run ```npm install```
4. Run ```npm run start``` to start the React development server
5. Open your browser (Chrome preferred) and navigate to [http://localhost:3000/](http://localhost:3000/)

## Build this application
Notice that running this application using ```npm run start``` is only for development. To create an optimized production build, run ```npm run build```, which will generate a production build in the ```build``` folder. Copy the ```build``` folder into EWSNodeJS-server.

## Major Dependencies
#### Please refer to the following documentations for the major packages that are used in this project:
*  [React](https://reactjs.org/)
*  [material-ui](https://material-ui.com/) for UI styles
*  [react-router](https://github.com/ReactTraining/react-router) for broswer routing
*  [axios](https://github.com/axios/axios) for API calls

repository: packeted/OpenSpeechPlatform-UCSD

repo_name: packeted/OpenSpeechPlatform-UCSD


text:
# pycidrtools
Do fun stuff with DIY tools regarding CIDR Blocks

## pre-requisites

To work, you have to install `ipaddr` python module, which can be done using pip:

`pip install ipaddr`

## usage

Open the `pieces.py` file and insert your subnets in the array, save the file and run the application.

repository: deploytoprod/pycidrtools

repo_name: deploytoprod/pycidrtools


text:
# Lesson 03

In Lesson 3, we made our game respond to keyboard input and created a simple interaction between our player character and another element in the game. We didn't learn any new programming concepts in this lesson, but we did re-use what we learned in previous lessons about variables, functions, and if-statements.

Here's what we learned to do:
* Make our alien character move when the player presses the up and down arrow keys.
* Add an asteroid to the game, using a sprite we designed ourselves.
* Detect collisions between the alien and the asteroid.
* Change the appearance of the alien.
* Play sounds.
* Make something happen after a specified amount of time.

Some notes on these topics follow.

# Keyboard Input

At the end of our last lesson, we had implemented code that moves the alien across the screen, over and over. This movement was automatic; the player had no control over it. In real games, while you might have some elements or characters that move automatically, usually the player will be able to control at least one character. In our game, we'll write the code that will allow the player move the alien using their keyboard's arrow keys.

At the end of the last lesson, the game code looked like this:

```
WIDTH = 500
HEIGHT = 300

alien = Actor("alien")
alien.pos = 100, 56

def draw():
    screen.fill((0, 102, 255))
    alien.draw()

def update():
    alien.left += 2
    if alien.left > WIDTH:
        alien.left = 0
```

The `update()` function, Pygame Zero calls before it draws each frame, changes the position of the alien. This is how we implemented movement. To start this lesson, make a copy of this code in a new file, and then delete the `update()` function entirely. We'll eventually bring a different form of `update()` back, but for now we want to remove it. The starting code for this lesson should look like this:

```
WIDTH = 500
HEIGHT = 300

alien = Actor("alien")
alien.pos = 100, 56

def draw():
    screen.fill((0, 102, 255))
    alien.draw()
```

If you were to run this, you should see the alien but it won't move: without an `update()` function, its position never changes, so `draw()` draws it in the same spot every time.

Now, let's add some code that will let the player move the alien up and down with the up and down arrow keys. Create a new, function `on_key_down()` as follows:

```
def on_key_down(key):
    if key == keys.DOWN:
        alien.top += 10
```

`on_key_down()`, like `update()` and `draw()`, is another special function that Pygame Zero recognizes. If this function is defined in your program, Pygame Zero will call it whenever the player presses a key on the keyboard. `on_key_down` takes one parameter, `key`. This parameter will receive a value that you can use to determine which key was pressed.

In our implementation of `on_key_down()`, we are checking whether the `key` parameter is equal in value to `keys.DOWN`. Let me break this down:
* `key` is the parameter passed to `on_key_down`
* We compare it using the `==` operator. Notice that there are *two* equals signs: this is the way we express the concept of "is equal to". It's different from the single equals sign we use to assign a value to a variable `alien = Actor("alien")`.
* The thing we compare to is `keys.DOWN`. `keys` is another built-in object in Pygame Zero. Remember from the last lesson that we said an object is a grouping of certain variables and functions. The `keys` object contains a variable for each key on the keyboard. You can find a full list of these in the [Buttons and Keys section of the Pygame Zero documentation](https://pygame-zero.readthedocs.io/en/stable/hooks.html#buttons-and-keys). The value in `keys.DOWN` is the value representing the down arrow key.

You don't need to worry too much about what the actual value of the key parameter is (though if you were curious you could print it by a `print(key)` statement inside the function) or what value is stored in `keys.DOWN` (or any other variable in `keys`). It's just useful to be able to compare them to one another to see if the key pressed was a key you expected. In our `on_key_down()` we are comparing `key` to `keys.DOWN` to check if the down arrow key was pressed.

If the down arrow key was pressed, we add 10 to the `alien.top` variable. Run the program and try it out. When you press the down key, the alien should move down the screen. You can press it repeatedly to have the alien move multiple times. Why does *adding* to `alien.top` move the alien down? The answer is that `alien.top` represents the y-coordinate of the top of the alien and along the y-axis, 0 is at the top and values increase as you go down.

Note: In teaching this lesson, one point of confusion arose that we should clear up: Pygame Zero calls `on_key_down()` for *any* key pressed on the keyboard. If you pressed, say, the space bar, Pygame Zero would call `on_key_down()` with a value for `key` that equaled `keys.SPACE`. The word "down" in the function name refers not to the down arrow key, which we happen to be looking for, but to the action of pressing a key downwards. When you press a key on the keyboard, there are distinct events for the downward press of the key and then the release of the key back up. If you were interested in when a key is released, you could implement `on_key_up()` in your program and Pygame Zero would call it when any key was released.

OK, as is, we can move the alien down, but we have no way to move it up. Think for a moment about how you might implement this. We'd want the alien to move up when the up arrow key is pressed. Pressing the up arrow key will also result in Pygame Zero calling `on_key_down()` but the value of `key` will equal `keys.UP`. We can extend our code to check for this by adding an `elif` clause:

def on_key_down(key):
    if key == keys.DOWN:
        alien.top += 10
    elif key == keys.UP:
        alien.top -= 10

Remember, `elif` is short for "else if". So if the first condition `key == keys.DOWN` isn't met, we'll check if `key == keys.UP`. If so, we move subtract 10 from `alien.top` using the `-=` operator (which is the analog of the `+=` operator we've seen before; it just subtracts from whatever value is currently in the variable on the left). Because, along the y-axis, smaller values are higher up, subtracting 10 moves our alien up the screen.

Run the program and play with this. You may notice we have a bit of a problem: you can move the alien off the screen, either on the bottom or top of the window. We're not going to fix that now but it is one of the exercises you can try. Think about how we dealt with the alien moving off the side of the screen in the last lesson. Can you implement something similar to not let the alien go off the top or the bottom of the screen?

## Creating an Asteroid Sprite
In this section, we're going to add an asteroid to our game. The first thing we need to do is create the image we're going to use for the asteroid. When we created the alien, we didn't have to do this step because Pygame Zero comes with an alien image we can use. But there's no built-in asteroid image, so we'll have to create one.

You can use any sprite editor for this task. If you don't already have a favorite sprite editor, I suggest using pixilart.com, an online sprite editor. Visit https://www.pixilart.com/draw in your browser to start using it.

The pixilart interface offers a number of drawing tools you can use. Later, you can spend time experimenting and learning these so that you can create more sophisticated sprites. For now, we're going to create a very rough drawing, so all you need is the Pencil Tool, which should be selected by default when you start a new drawing. If it's not selected, you can select it by clicking on the top-left icon in the tools palette on the left or pressing P.

With the pencil tool selected, you can select a color from the swatch in the right-hand side panel. We're going to be drawing an asteroid, so start with a gray color. With the gray color selected, just start drawing. For now you can just trace out a rough round shape and fill it in. You might also choose some other colors and use them next to or on top of the gray. Remember, this can be very rough: you're not aiming for a prize-winning art piece here. Just make something that looks vaguely asteroid-ish. Here's what mine looks like:

Once you're happy with your asteroid drawing, download it by clicking on the Download item in the Pixilart toolbar. In the download dialog, click "Download PNG". This should download a file named something like `pixil-frame-0.png` in your browser's downloads folder.

We need to move this image to a specific place and rename it in order for us to use it as a sprite in Pygame Zero. Back in the Mu editor, hit the Images button in the toolbar:

This will open the Mu images folder, in Explorer if you're on Windows or Finder if you're on MacOS. Copy the file you just downloaded from PixilArt into this images folder and rename it to `asteroid.png`. This name is important - make sure you spell it right!

Now we can write a little code to use the image we just created as a sprite in our game. Edit your program to add the lines shown in bold below. Pay attention to where the bold code goes, so you add it in the right places!

alien = Actor("alien")
alien.pos = 100, 56

asteroid = Actor("asteroid")
asteroid.left = 200
asteroid.top = 50

def draw():
    screen.fill((0, 102, 255))
    alien.draw()
    asteroid.draw()

def on_key_down(key):
    if key == keys.DOWN:
        alien.top += 10
    elif key == keys.UP:
        alien.top -= 10

Let's go through the new code line by line. First, we create a new variable, `asteroid` and put in it a new Actor object. When we call the `Actor()` function, we pass `"asteroid"` as the argument. This tells Pygame Zero to look for an image file called `asteroid.png` in the Mu images directory. This is why it was important to name the file correctly. The string you pass to `Actor()` must be the same as the file name, minus the `.png` extension.

The next two lines just position the asteroid at (200, 50). This is just a temporary location where we'll put the asteroid for now, just to test that we can draw it correctly. In the next step, we'll position it off screen and then move it into view.

The last new line just adds `asteroid.draw()` to the `draw()` function. Remember that `draw()` is called 60 times per second to draw each frame. If we want our asteroid to appear, `draw()` must draw it. To accomplish this, we add a call to `asteroid.draw()`, the `draw()` function on the Actor object stored in the `asteroid` variable.

If you run the program, you should see something like this:

OK, so now we've successfully drawn a new sprite using the image we created. But we don't just want our asteroid to hang out in the middle of the screen. We'd like it to move towards the alien. To do this, we need to do two things: first, we'll make the initial position of the asteroid be off the screen and second, we'll make the asteroid move to the left.

To position the asteroid off screen, we just need to change one line. Currently, we're setting the x-coordinate of the left side of the asteroid to 200 with `asteroid.left = 200`. Change that line to say `asteroid.left = WIDTH`. Remember that WIDTH is set to 500, at the top of the program, and represents the number of pixels along the x-axis of our window. By setting `asteroid.left` to `WIDTH`, we are positioning it so that the left side, is one pixel off screen. Remember that we start counting pixels with 0 so the left-most pixel has an x-coordinate of 0 and since there are 500 pixels total, the right-most one is 499. So positioning the left side of the alien at 500 (the value of `WIDTH`) we are placing it one pixel off-screen.

Next, to make it move, we need to bring back our `update()` function. Remember that Pygame Zero calls `update()` right before it calls `draw()`, every time. If we change the position of things in `update()` then `draw()` will draw them in a different position. We can use this to implement animation, by drawing things at slightly different positions each time.

We want our asteroid to move left, towards the alien. So we'll implement an update function that changes the left position of the alien, bring it to the left. Add an `update()` function to your code as follows:

```
def update():
    asteroid.left -= 2
```

Our `update()` function subtracts 2 from `asteroid.left` each time it's called. Since x-axis values get smaller towards the left, this causes the asteroid to animate to the left.

Run your program and see what happens. You should see the asteroid move into the window from the right-hand side and move to the left. If you were a little anxious about what would happen when the asteroid hit the alien, you needn't have worried! The asteroid just sails over the alien.

In the next section, we'll change this. We'll make the alien react if the asteroid collides with it. With the keyboard controls we implemented in the previous section, the player can actually move the alien out of the way of the asteroid and avoid the collision. This will be the objective of our simple game.

## Detecting Collisions and Changing Appearances

We want our game to do something if the asteroid touches the alien. In game development, when two moving objects touch each other, we call that event a **collision**. Most game development frameworks, including Pygame Zero, offer some means of **collision detection**, a way to have some code run when a collision occurs.

In Pygame Zero, every Actor object has a function `colliderect()` that we can call to determine if the actor has collided with any other Actor. We can call `colliderect()` inside `update()`, after we have changed the position of the asteroid, to tell whether, in its new position, the asteroid has collided with the alien.

The `colliderect()` function returns a special value, `True`, if the two Actors have collided, or `False` otherwise. `True` and `False` are two built-in values in Python (called **Boolean** values) and when a function returns one of these values, we can use it in an if-statement. Let's look at an example. Change your `update()` function to call `colliderect()` on the alien object as follows (new code shown in bold):

def update():
    asteroid.left -= 2
    if alien.colliderect(asteroid):
        alien.image = "alien_hurt"

The new code, shown in bold, calls `alien.colliderect(asteroid)` inside an if-statement. Let's break this down:
* We're calling `colliderect()` on the object stored in the variable `alien`, which is of course our alien Actor. This will check whether another Actor has collided with the alien.
* The argument to `alien.colliderect()` is the other object we're interested in. Here, we're passing `asteroid`. So this call checks for a collision between the alien and the Actor stored in the variable `asteroid`, which is of course our asteroid.
* `alien.colliderect(asteroid)` is called in an if-statement. If the function returns `True` then the code block beneath the if-statement is run. If it returns `False` then we skip that code.
* Inside the if-statement, we set `alien.image` to `"alien_hurt"`. This changes the appearance of the alien. Setting the `.image` variable on an Actor object causes Pygame Zero to draw the actor with a new image. The string you set it to must correspond to an image file located in the Mu editor's images directory. It so happens that Mu comes built-in with an "alien_hurt.png" file that is the same alien character but in a hurt-looking pose. You could of course use another image, including one that you create yourself (to do this, you'd use the same set of steps you used to create the asteroid image).

If you run your game now, you should see the alien's appearance change to the hurt image if it collides with the asteroid.

## Playing Sounds

By changing the alien's appearance when it collides with the asteroid, we're giving the player a visual indication that the alien has been struck. It can also be very effective to use sound to communicate the important events in a game. Let's change our code to play a sound when the alien is hit by the asteroid.

Mu comes with some built-in sound files you can use. You can see these sound files by clicking on the Sounds button in the Mu toolbar to open the sounds directory:

You'll notice there's a file named `eep.wav` in the sounds directory. We'll play this sound to indicate the alien is hurt.

Playing a sound in Pygame Zero is really easy! To play the `eep.wav` sound, you just need to add one line of code, shown in bold below:

def update():
    asteroid.left -= 2
    if alien.colliderect(asteroid):
        alien.image = "alien_hurt"
        sounds.eep.play()

`sounds` is a built-in Pygame Zero object. It has a variable for each sound file that appears in the sound directory, named the same as the sound file name, without the `.wav` extension. So `eep.wav` is represented by `sounds.eep`. What's in the `sounds.eep` variable? Another object, with a `play()` function that you can call to play the sound.

By putting the call to `sounds.eep.play()` inside our if-statement that checks for the collision, the sound only plays when a collision occurs. Run your game now and wait for the asteroid to collide with the alien. The alien's appearance should change to the hurt image and the sound should play. Our game is starting to come alive!

Note: As you're continuing to develop and test the game, you might find it annoying to hear the sound over and over again. To get rid of the sound, you could temporarily delete the `sounds.eep.play()` line. But there's an even better way. You can put a `#` at the start of the line. In Python, any line that starts with `#` is considered a comment. The Python interpreter ignores these lines. Software developers often use comment lines to leave notes to themselves or others reading the code, explaining what the code does. But we can also put the `#` in front of a line of real code, to make the Python interpreter ignore it. This is called "commenting out the code". If you do this, you'll notice that Mu makes the line appear grayed out:

## Making Something Happen Later
You may notice a problem with our game as currently written: when the asteroid collides with the alien, the alien's appearance changes to the hurt image, but it never changes back to the regular, unhurt alien.

Changing the alien's image back to what's in `alien.png`, is easy. We can just set `alien.image = "alien"`. But where should we put this code?

After a collision with the asteroid, we want the alien to appear hurt for some period of time, say one second, and then change back to its regular appearance. After setting the alien's image to `"alien_hurt"` we want to tell Pygame Zero, "after one second, set the alien's image back to `"alien"`".

Pygame Zero offers a built-in `clock` object to do just this kind of thing. `clock` has a function, `schedule_unique()`, that lets you schedule a call to another function at a later time. You pass two arguments to `schedule_unique`: a function to call, and a number of seconds to wait before calling it.

To use `clock.schedule_unique()` to restore our alien's appearance, we first need to create a function that sets the alien's appearance back to normal. Add this function definition to your code:

```
def set_alien_normal():
    alien.image = "alien"
```

We've defined a new function, `set_alien_normal()`, that sets the `alien.image` back to the regular alien image. We'll now use `clock.schedule_unique()` to schedule a call to this function after one second. Add the bold line of code shown below to your `update()` function.

def update():
    asteroid.left -= 2
    if alien.colliderect(asteroid):
        alien.image = "alien_hurt"
        sounds.eep.play()
        clock.schedule_unique(set_alien_normal, 1.0)

This line of code tells Pygame Zero to call `set_alien_normal()` after `1.0` seconds. Notice that when we pass `set_alien_normal` to `clock.schedule_unique`, we do not put parentheses after it. That's because we are not *calling* `set_alien_normal()` here. Rather we are passing the function itself to `clock.schedule_unique()` to be called later.

Run the game now and let the asteroid collide with the alien. You should see the alien's appearance change, the sound play, and the appearance change back after one second.

## Exercises

1. Can you change the code in `on_key_down()` to make it so that the player can't move the alien off the top or bottom or the window?

2. Can you add code to let the player move the alien left and right, either with the left/right arrow keys or any other keys you choose? Can you prevent the player from moving the alien off the left/right edges of the window?

repository: spather/CousinsCodingCamp

repo_name: spather/CousinsCodingCamp