text:
# IBM Blockchain Hyperledger Fabric Redhat Enterprise 7 Images

These images are based on Redhat 7 Enterprise Linux.

_**NOTE:**_ In order to build these images, you must have an RHEL 7 workstation
with valid Redhat subscription.
## Prerequisites

* Redhat Enterprise Linux 7
* Valid Redhat subscription
* Docker 1.13 or later
* Development tools (e.g. make)

## Building the images

Install the following packages:
```
yum groupinstall "Development Tools"
yum install docker-latest
```

Run [build.sh](build.sh) which performs the following actions:

* builds ibmblockchain/fabric-baseimage  (from registry.access.redhat.com/rhel7)
* builds ibmblockchain/fabric-baseos  (registry.access.redhat.com/rhel7-atomic)
* clones the the [Hyperledger Fabric](https://github.com/hyperledger/fabric) repository and
  * builds ibmblockchain/fabric-peer
  * builds ibmblockchain/fabric-ccenv
  * builds ibmblockchain/fabric-javaenv
  * builds ibmlockchain/fabric-orderer
* clones the the [Hyperledger Fabric CA](https://github.com/hyperledger/fabric-ca) repository and
  * builds ibmblockchain/fabric-ca

After running the script, you should see something similar to the following after running `docker images` :
```
ibmblockchain/fabric-orderer              latest              5ecbb3127447        17 minutes ago      121 MB
ibmblockchain/fabric-orderer              rhel7-1.1.0-rc1     5ecbb3127447        17 minutes ago      121 MB
ibmblockchain/fabric-peer                 latest              e6ffd9b7ccef        18 minutes ago      129 MB
ibmblockchain/fabric-peer                 rhel7-1.1.0-rc1     e6ffd9b7ccef        18 minutes ago      129 MB
ibmblockchain/fabric-javaenv              latest<PHONE_NUMBER>bd        20 minutes ago      1.75 GB
ibmblockchain/fabric-javaenv              rhel7-1.1.0-rc1<PHONE_NUMBER>bd        20 minutes ago      1.75 GB
ibmblockchain/fabric-ccenv                latest              42f08bffd024        21 minutes ago      1.62 GB
ibmblockchain/fabric-ccenv                rhel7-1.1.0-rc1     42f08bffd024        21 minutes ago      1.62 GB
ibmblockchain/fabric-baseos               rhel7-0.4.6         fff64c4bef09        22 minutes ago      87.5 MB
ibmblockchain/fabric-baseimage            rhel7-0.4.6         23b403132796        23 minutes ago      1.59 GB
registry.access.redhat.com/rhel7          latest              d01d4f01d3c4        6 weeks ago         196 MB
registry.access.redhat.com/rhel7-atomic   latest              a9b2247c0747        6 weeks ago         78.4 MB
```

repository: liujiamingustc/phd

repo_name: liujiamingustc/phd


text:
# Milestone 5

[![Build Status](https://travis-ci.org/ShaneMuir/BugFeature-Tracker.svg?branch=master)](https://travis-ci.org/ShaneMuir/BugFeature-Tracker)

### [Demo Here](https://milestone-5.herokuapp.com/)

 What is Unicorn Attractor? It's an app built with Django.
 In this application I use technologies learnt on my coding journey to demonstrate how a SQL (Structured Query Language) based database can be utilised efficiently and effectively to create scalable apps on the web. The aim of this project is to showcase my skill set learnt throughout the course.

Throughout this project I will make use of [Python](https://www.python.org/) a high-end programming language along with [Django](https://www.djangoproject.com/) a Python framework.

---
#### About
Unicorn Attractor is an Issue tracking web app built on the back of the fictional app **'Wuzzat'** which allows users to request paid featuresto the app or to report bugs they have encountered.

## UX
I created this app to give my user's the ability to request new features to 'Wuzzat' or to report any bugs found on the app.
The app is designed to allow for users to create free bugs or request paid features.
I've developed the app to incorporate user authentication  and authorization, this means anonymous users cannot create bugs or features.
Within the app there is also more authorization restrictions in place to better protect my database and restricted pages.
Within the application design I have included a profile page, this creates a simple way for the logged user to view any self created bugs or features and manage them in one place.
To provide each user with some site statistics I have also included a graphical dashboard onto the user profile page to give analytics on the app.
Within my app I have created a cart to accommodate the process of buying and up voting of features, within this app the user has the ability to manage their purchases within the cart.
By this the user can remove items from their cart if no wanted or if up voting a feature they can increase or decrease the amount of up votes they want to
apply to that given feature(s).
I've implemented a password reset functionality to my app, this allows registered users the ability to recovery their account and reset their passwords.
From within the profile page a user has the ability to edit or delete their own bugs or features.
The app was designed mobile first, this was to aid the modern style of usability across all types of devices and screen sizes.

## User Stories
Reasons why I decided to build Unicorn Attractor.
> Wuzzat email inbox full of users request new features to the app

> Wuzzat users wanting a place to log bugs

> A user has found a bug on the app and wants a place to log these and track the progress

> A user wants to request a new feature to the app

> Unicorn Attractor Users have ability to request new features via a paid checkout features

> A user wants to check if a listed bug or feature has already been requested

> Users want the ability to edit or delete their requests

> A user needs the ability to reset their password

> As a user I want the ability to comment on requested bugs or features

## Wireframes

[wireframes here]

## Functionality
The app's main functionality is that it is capable of communicating and manipulating a SQL based database running on Heroku (PostgreSQL)
and shows my skill set learnt so far from the course. By using Django I have been able to create an application that can register and login users,
with the ability to password reset if required. Users can create, read, update and delete bugs or features.
Requested features are purchased via Stripe which gives the app the ability to take payments from users in order to list features on the app.
Up-voting of bugs and features but feature up-votes use the stripe app as they cost £5 per up-votes, this allows admin to easily identify the most wanted feature or the
most identified bug that users want dealing with first.

By allowing users to be able to registered with an account I can track bug and feature requests, restrict certain pages, and implement user authentication and authorisation.
This means I have the ability to restrict users from user activities and also lock down requests to certain users.

The app uses back-end logic where restrictions are used. This creates a better experience with user data and enables me to add a level of security to my app.

My app is scalable and responsive meaning it will perform well on any device its loaded on.

Within my app functionality there is the ability to search, this was implemented to give the user's the ability to quickly filter the database based on a particular search query.

Password reset gives my users the ability to recovery a lost password if required, by entering the email the user signed up with on the password reset page,
triggers an email from my apps account to the specified email with a password reset link to their account.

Users have the ability to login via email or username.

Only users who created the bug or feature can edit or delete their own.

My app uses the Stripe API so that users can make payments in order to request new features, and up votes on already requested features.

My app makes use of the Pygal Python libary to create some analytics of the database data.

Bugs and features page use Django's paginator to create a better user experience for the user not having to scroll down lengthy pages.

My application is developed with SEO practises in mind and is structured well inline with googles best practises.

Performance of my website is fast and database queries are performed effifiently.

The bug and feature pages use the browsers local stroage to better enhance the UX of the notification bar so a user doesnt get the message each and every time they go onto this page.

My login required returns the user back to the page they came from rather then a standard page.

## Technology Used
- [Python 3](https://www.python.org/download/releases/3.0/)
- [Django](https://www.djangoproject.com/)
- [HTML5](https://en.wikipedia.org/wiki/HTML5)
- [CCS3](https://www.w3.org/Style/CSS/)
- [BootStrap](https://getbootstrap.com/)
- [JavaScript](https://www.javascript.com/)
- [jQuery](https://jquery.com/)
- [PostgreSQL](https://www.postgresql.org/)
- [Heroku](https://www.heroku.com/)

### Features to be implemented
In the future I will implement the below features

- A live chat feature, this would allow users to directly chat with online admins of the app.
- Make use of Python's logging library to log system information, i.e log the user, browser they was using, time/date, request.path etc so that
  I can better understand when my app crashes or any error are encountered.
- AJAX functionality on the front-end, for example when a user deletes a bug from their profile page.
- Edit username/password

##### Why I Built Unicorn Attractor
The reasoning behind the project is simple, the 'Wuzzat' app is fictional and I came up with a use case for a real world app so that I can show case all the skill set
I've learnt from the whole of the Code Institute Course. The reason I decided to pick a bug tracker was for the fact that I could easily within the time-frame left
create a app that relied heavily on a back-end database. With this I was able to demonstrate CRUD activity against a SQL database, create user authentication and authorization,implement a admin back-end, password resets functionality, and many of the features outlines above in the functionality section.

## Testing

*Throughout the whole development process of my app I made use of [Unittest](https://docs.python.org/3/library/unittest.html) via [Django tests](https://docs.djangoproject.com/en/2.2/topics/testing/)*
*and manually testing by selected users or myself. Below I will outline and detail my processes and how these helped me identify issues and bugs within my app and rectify them.*

## Automated testing
### Unittesting
My unittesting consisted of test modules in each app using the unittest framework built into Django and running the coverage report to get a detailed report of how well each Django module was tested.
Where I was not able to automate tests for that particular module I used manually testing thoroughly to ensure my app was tested throughout. More on unittest package can be found on the link above.

[Travis CI](https://travis-ci.org/) was implemented to help continuously test my app through the development process.
You can click the 'build passing' icon at the top of my repo to check out Travis on this app. More on Travis CI can be found on the link [here.](https://travis-ci.org/)

[Coverage](https://coverage.readthedocs.io/en/v4.5.x/) was used to check how well my automated tests were performing on my app,
this library was golden to showing how much of code my automated tests were actually testing. Note - for any app that wasn't not showing a good coverage report I reverted to manually testing thoroughly.
More on the coverage package can be found using the link [here.](https://coverage.readthedocs.io/en/v4.5.x/)

By using the above mentioned technology through my development process of my app I was able to quickly check if any tests were failing and why,
and also get a detailed report of all my tests in a view that was easily digestible and then was able to adapt and adjust the tests to make them cover more or give me detail on where I need to manually
test my apps functionality for further improving my coverage.

## Manual Testing
**Testing Django** - Within my settings I had Django's debugger set to
```python
debug = False
```
This is so when ever the app encountered a error then Django would give a detailed report and outline what happened and why the error occurred.
This was vital during the development process as I would work in small sprints where every step in my development I would ensure my app is still working as expected and where any errors occurred I would debug the source until rectification was a success. Where needed I would document the error and the remediation taking in case of future occurrences.
Doing this meant that after a while the error codes became more familiar to me. And from debugging each error become less time consuming.

**Testing Python** - When writing any logic, I would write this is small chunks and do any routine testing from the CLI (Command Line Interface)
and where needed use the Python Interpreter to test any function or statements.

Built-in [Py Lint](https://www.pylint.org/), AWS Cloud9 implements a very handy Python Linter which outlines and identify possible incorrect python code. Using this helped me easily identify indentation errors or syntax errors along with any undefined class methods or function calls and much more. You can found more info on Py Lint by clicking the link [here.](https://www.pylint.org/)

Django server, Django has a built in httpserver which if there is any error on the source code would result in the server throwing a server error if anything was wrong, this helped identify any run time errors in my app.

**Testing Django Views** - In Django each app has views which are functions that invoked when a user navigate to a certain URL (Uniform Resource Location).
Throughout the entire development process of my app all my views were tested by automated tests and then by using the coverage report to outline what was not tested.
My manual testing process for my apps views consisted of me following the logic and perform each step manually in a browser to see if my app works as expected.
From automated testing and manually testing I was therefore confident that my app views worked. Through out testing within Python I see myself always using the` print()` method to ensure database calls were successfully and also that functions had worked properly.

**Testing the Database** - Alot of my database models were tested with automated tests and then further expanded on from the coverage report by manual tests.
Automated tests can be found within the apps source code names `test_models.py` and my manual testing process I will outline below.
When creating models and forms in Django, I would then write the corresponding URL and view so that I can manually test each logic.
Therefore I would need to run my app and then navigate to it via a browser to perform each step I wrote and ensure that my app was successful based on the logic wrote.
A lot of the database was covered in the automated tests but manual testing where needed was performed.

 Django makes use of SQLite when first creating a project, this is call a 'development database' I made use of this database throughout the entire development process until close to production where I switched to a PostgreSQL database hosted on Heroku. As most of my database was already tested throughout the development stages I had no issues when switch from SQLite to PostgreSQL.

 **Testing CRUD** *(Create, Read, Update, Delete)* - After creation of my models and forms I wanted to ensure the logic within my views was working as expected and further tested this by  manual testing against any forms within my app. Were there was any user input to my app after automated testing was complete I would then go manually test each form and ensure that the logic performed as expected without any errors.

**CREATE**
This was tested by me manually inputting data into the forms via the front-end and checking the operation was successfull from the admin panel. I tested all types of senarios such as long descritpions fields long titles anything that could potential break my site.

**EDIT**
To ensure the edit functionality of the bug and features views work correctly I manually used the front-end to edit some bugs and features I already created for testing purposes. In the process I also tested all the form validations from the logic in the backend.

**DELETE**
To delete a bug or feature from within my app database the user would need to navigate to their profile page and only be able to delete bugs or features that they had requested.
To prevent any bug or feature being delete by mistake I added some JavaScript to confirm the request to the user before actually making any changes to my database.
This was a measure I implemented to ensure the user didn't make a miss-click.

**EDIT**
To protect user request bug or features from being deleted or edited I implemented strict logic so that only the said user can edit or delete their own bug or feature.
This was achievable by creating a relationship from the bug or feature model to the user model. And if the creator of that bug or feature was the logged in user then the logic was allowed to be performed,
if not then within my app i implemented a alert message to give the user indication on why such action cant be performed.

**Authenitication and Authorisation** - Django comes built in with this so from using the docs and what I'd learnt front he course and already knew around this I implement a basic user registration and login system with the ability to reset a user's forgotten password. From the course we was taught how to allow user to log in via their email address as well as they're username. From the docs I further expanded on the user model and created custom forms for my login and register views. Password hashing is taken care of in Django so any password submitted to my database are hashed. From implementation of the user authentication and authorization I was able to further add security into my app for users and database protection. In Django I was able to restrict logic by using `request.user.is_authenitaticated` and restricting views with the `@login_required` decorator.

**Cart App**
My cart was taken from the Code Institute course where we created a mini-project that was a e-commerce application. I further adapted this functionality for the purpose of my app, the cart applys feautre up-votes from the user, a user can up-vote multiple features at once and also increase the amount of up-vote they submit onto each feature (up-votes cost £5 per up-vote). I tested this my manually click upvote on several features and processing the checkout too to ensure the cart was emptied as expected and up-viotes were appied to the correct features, the correct value of times also. I tested all different types of senarios on my cart app such as adding multiple to up-vote then removing one and increase one at the same time, spamming the increase or decrease button anything to try break my app. The cart app makes uses of Django sessions.

**Checkout App**
My checkout app was adapted from the Code Institute course for the purpose of my website. I tested this by using Stripes test card (4242 4242 4242 4242) I tested the forms and ensured all my validation worked as expected and my logic was performing as expected. The checkout app works from the Stripe API.

**Search Bar**
Within my application there is a search bar in the navigation menu that is accessible at all times when the navbar is present. The search bar searches my app for bugs or features, this was manually tested by entering search terms and checking the expected result. I tried to enter unusual types of search to see if I could break the app.

**Pagination**
My app makes use of Django's paginator, I created this from their docs but testing was done manually by me imeplemented the code then checking the functionality on the front-end to check if the logic was performing as expected. On the profile's page I found that the paginator would give a 500 server error when trying to access a page for a feature that wasn't availble for bugs aswell. To explain this better let's say on my user profile page I I had 5 bugs, 4 features, where my app only displayed 2 max on the profiles page there would be 3 available pages for bugs and 2 for features if you tried to access the 3rd page for bugs my app would encounter a server error. I rectified this issue by further expanding on Django's paginator and adapted it to suit my app's use case.

**Password Reset**
This functionality comes built-in to Django but I have further expanded on it to suit the use case of my app. The email sent uses my own domain and I have adapted the reset pages and html email sent to the user. I tested this part of my app through entering clicking the forgot password button and entering my email to ensure the functionality was working as expected.

**Site Analytics**
My app's profile page make use of Pygal a Python libary for creating interactive graphs on the web. I decided to use this package becuase I do data analyse already and want to further progress my Python skills around data science. The code was developed by using the pygal docs, and tested manually by checking the expected outcome on the profile page.

**Repsonsiveness**
My app makes use of the Bootstrap CSS framework, when implemented successfully it ensure my website is fully responsive on all devices. Further CSS was added to further enhance the UX of my site. I tested the repsonsiveness of my app by making use of chrome's devtools and applying each device preset which set the width and height to specific values based on mobile and tablet devices of all screen sizes. Further testing on this was perform by me on my mobile and tablet phone. The slack community further helped by riggerously testing my website in peer to peer code review.

**Browser compatibility**
My app does not work on IE, although I wanted to have my app backward compatible with all browsers, I couldn't have it on IE due to Materialize and using elements that are not support by old Browsers.

My app will be fully functional across all major modern browsers. I have tested my app on the following browsers.

- [Chrome](https://www.google.com/chrome/)
- [Firefox](https://www.mozilla.org/en-GB/firefox/new/)
- [Opera](https://www.opera.com/)
- [IE Edge](https://www.microsoft.com/en-gb/windows/microsoft-edge)
- [Safari](https://support.apple.com/en_GB/downloads/safari)
- [Chrome Mobile](https://chrome.en.softonic.com/)

## Resource Sites Used
- [Django Docs](https://docs.djangoproject.com/en/2.2/)
- [Pygal](http://www.pygal.org/en/stable/)
- [smtplib](https://docs.python.org/3/library/smtplib.html)
- [BootStrap](https://getbootstrap.com/)
- [Stripe API](https://stripe.com/docs/api)
- [Bootswatch LUX](https://bootswatch.com/lux/)
- [AWS S3 Bucket](https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html)
- [Google Fonts](https://fonts.google.com/)
- [jQuery](https://jquery.com/)
- [GitHub](https://github.com/)
- [Font Awesome](https://fontawesome.com/)
- [Unplsash](https://unsplash.com/)
- [Slack](https://slack.com/intl/en-gb/)
- [Stack Overflow](https://stackoverflow.com/)
- [Google](https://google.com/)
- [YouTube](https://www.youtube.com/)

#### Website Performance
Through the entirety of my project website performance is at the forefront of my mind. mark-up has been optimized for website performance along with CSS/JS. All images have been compressed. As the project is on Heroku the server cannot be optimized.

#### Django settings
I split my settings module into 3 files, one for the base settings and two others one for a production enviroment and one for a development enviroment. This ensured Travis CI wasn't affected by Heroku's PostgreSQL database in production. It also allowed me to seperate my settings for my static files. I also don't have to change the debugger. This also ensure when anyone wants to expand on my project there is no requirement to remove all my production ready code in order to have my app work locally for anybody without my database access.

## Deployment
Getting my application ready for deployment consisted of the following: -
1. Removing all my hard-coded environment variables to project my keys and secrets. These were placed in the .bashrc for development and entered into Heroku's Config Vars for production.
2. Ensuring the applications requirements.txt is up-to-date with all the latest packages installed for my app being noted on this file.
	**The command to update requirements**
		```
		pip3 freeze > requirements.txt
		```
3. Set up the Procfile - *A Procfile is required by Heroku in order to tell the service worker what command to run for my application to start.*
4. Push all static files to S3 Bucket `python3 manage.py collectstatic`
5. Enter all my ENV vars into Heroku's config vars (A list of all my config var is listed below in expanding on my project section)
6. Push all my latest production ready code to GitHub ready for deployment via Heroku's GitHub function where you can deploy from GitHub the production ready app.

**Upon successful deployment Heroku will give you the URL that is hosted your app**

*Upon unsuccessful deployment Heroku will log the cause of the error and this is view able in the 'view log' section on the Heroku website. Here you will find a detailed report of what has cause your application not to be deployed successfully. *

### Heroku Config Var's
| Key | Value |
 --- | ---
AWS_ACCESS_KEY_ID| `<your_access_key_id>`
AWS_SECRET_ACCESS_KEY| `<your_secret_key>`
DATABASE_URL| `<your_data_base_url>`
DEFAULT_FROM_EMAIL| `<your_from_email>`
DISABLE_COLLECTSTATIC| `1`
EMAIL_HOST | `<your_email_host>`
EMAIL_HOST_PASSWORD| `<your-email-password>`
EMAIL_HOST_USER| `<your-email-address>`
SECRET_KEY| `<a_secret_key>`
SERVER_EMAIL| `<your_email_address>`
STRIPE_PUBLISHABLE| `<your_stripe_key>`
STRIPE_SECRET| `<your_stripe_secret>`

## Expanding on my Project
To get set up with a copy of my project you can do these multiple ways.

**Via GitHub** -
1. You can manually download locally to your machine and then upload to your preferred IDE.
2. Install the projects requirements.txt using `pip3 install -r requirements.txt`
3. You will need to update a few project settings before we can run the app. Open settings folder and in local.py
	1. `ADD ALLOWED HOST`
	2.  `SET UP EMAIL CONFIG`
	3. `SET UP STRIPE API KEY/SECRET`
4. Once the above steps are complete you can try run the application using `python3 manage.py runserver $IP:$PORT`

*Please note* step 4 may be different depending on the operating system you are running, please refer to the documentation for more details on running the Django server on different OS's

**Via the CLI** -
1. Clone my repo via Git using the following command `https://github.com/ShaneMuir/Milestone-5.git`
2. Install the projects requirements.txt using `pip3 install -r requirements.txt`
3. You will need to update a few project settings before we can run the app. Open settings folder and in local.py
	1. `ADD ALLOWED HOST`
	2.  `SET UP EMAIL CONFIG`
	3. `SET UP STRIPE API KEY/SECRET`
4. Once the above steps are complete you can try run the application using `python3 manage.py runserver $IP:$PORT`

## Credits & Acknowledgments
Credit is due to the following names. I would like to thank each and every one who has helped or contributed to my project in any way. Please see list of names below:

[HTML5 Mockups](https://github.com/pixelsign/html5-device-mockups) - The device pictures used on the landing page, I want to credit this guys work very handy and plenty of devices to use!
[Django Pagination](https://simpleisbetterthancomplex.com/tutorial/2016/08/03/how-to-paginate-with-django.html) - This guide helped me implement pagination with ease!
[LUX Bootswatch](https://bootswatch.com/lux/) - This theme took care of most of my applications design!
[Custom 404/500 Pages](https://codepen.io/theyve
) - This guy Dave is awesome!

I would like to write a thank you to **Jorden Vijayaratnam**.

- Youtuber **Pretty Printed**
- Slack Users **johnL3_alumni, RyanCooper, Seán, Jorden**
- Flask Megua Tutorial creator **Miguel Grinberg**
- Head First Python: A Brain-Friendly Guide **Paul Barry**

# LICENSE
This project is release under the **MIT** licence. For more info [here.](https://raw.githubusercontent.com/ShaneMuir/milestone-5/master/LICENSE)

license: MIT

repository: ShaneMuir/BugFeature-Tracker

branch_name: refs/heads/master

extension: md

gha_language: Python

gha_license_id: MIT

license_type: permissive

repo_name: ShaneMuir/BugFeature-Tracker


text:
# Redis in Go

Recipes for integrating Redis in Go.

* [Counter](counter) - global atomic counter that showcases basic operations in Redis.
* [Expiring sessions](sessions) - implements ephemeral sessions in Redis by setting up Redis to remove expired content.
* [Authentication](auth) - authentication in Redis.


text:
---
title: "WebSocket Variable"
id: "websocket-variable"
---
---

**WebSocket Variable** is the interface for the app developer to interact with a WebSocket Service imported into a WaveMaker app. The Variable has methods to interact with the target service like opening and closing the connection, sending and receiving messages to and from the server. It also holds the data to be sent to the service and the data received from the service.

## Variable Lifecycle

[![socket_lifecycle](/learn/assets/socket_lifecycle.png)](/learn/assets/socket_lifecycle.png)

## Variable Creation

The **data source** for WebSocket Variables comes from a **Web Service**. We will see steps in creating a WebSocket variable here.

1. Select Variable option from the Create Menu

[![](/learn/assets/var_sel.png)](/learn/assets/var_sel.png)

2. Click New Variable from the Variable Dialog.

[![](/learn/assets/var_new.png)](/learn/assets/var_new.png)

3. For creating a variable to access WebSocket Web service APIs, select **Web Service** as the target action.
4. In the next dialog, enter details for the following properties.
    - **Service** - service (already imported) name,
    - **Name** - is set by default but can be modified
    - **Owner** - the scope of the Variable being created. By default it is set to Page, you can change it to Application if you want this variable to be available across the app.

5. Click **Done** to complete the variable creation process
6. You will be directed to the Variables page, with the new variable listed. As you can see:
    - a **Web Service** Variable is created,
    - with the default exposed method/selected method as target
    - the **properties tab** contains all the properties like **behavior** and **dataset** behavior. [Know more about properties](#properties).
    - the **data tab** will contain the fields serving as **input fields** for the API
    - the **events** tab will contain the events that can be configured to trigger any action. [Know more about events](#events).

## Properties

WebSocket Variables are special variables that interact with the imported Web Socket service.

| **Property** | **Description** |
| --- | --- |
| **Service** |
| Service | The WebSocket service targeted for the Variable. |
| **Behavior** |
| Connect on page load | If set to true, the variable will open the connection between the client and target WebSocket service on:   - page load, for a page variable   - app load, for an app variable. |
| **Dataset** |
| On New Data | A client once connected to a WebSocket service, can receive messages at any point in time and can receive many messages sequentially. This property determines what to do with data received from the variable.   - **Refresh dataSet**: dataSet will be updated with the data received.   - **Add as last record**: data will be appended at the end of dataSet. The latest data will be the last record in dataSet.   - **Add as first record**: data will be prepended at the beginning of dataSet. The latest data will be the first record in dataSet.   In the latter two cases, dataSet will always be a list of messages. |
| Data Limit | Maximum number of messages that dataSet will hold. This is applicable only if “On New Data” property is set to other than “Refresh”. E.g. if set to 10, dataSet will hold a maximum of 10 message received from the server. When a new message is received, the first message is removed from the dataSet and the new one is appended to the end. Set it to 0 if no such upper limit is required. |

## Events

Following events are triggered during the lifecycle of a WebSocket Variable. These events can be utilized by the end user application developer to customize the behavior of the app through more complex logic.

| **Event** | **Description** |
| --- | --- |
| on Before Open | The event is triggered just before the Variable attempts to establish a connection between the client and target WebSocket service. If returned false from here, the connection establishment will be aborted. |
| on Open | The event is triggered right after a successful connection is established between the client and the WebSocket service through the Variable. |
| on Before Message Send | The event is triggered just before the Variable attempts to send a message to the target service through the existing connection. You have a chance at this point to validate and edit the data to be sent to the service. Returning false from this event will prevent the message to be sent to the service. |
| on Message Receive | The event is triggered on the Variable when a message is received from the WebSocket service in an existing connection made by the Variable. |
| on Error | Triggered if an error is encountered in establishing a connection with the server in the open phase. |
| on Before Close | Triggered before an existing connection(opened by the Variable) is closed. Returning false from here will abort the closing of the connection. |
| **onClose** | Triggered after the connection is closed. |

:::note
WaveMaker supports binding multiple actions to a given event, i.e. a given event can trigger multiple actions.
:::

## Methods

open	send	close

### open()

This method is used to open up the connection between the client and the WebSocket service. This is the starting point of the Variable lifecycle.

**Parameters**: None
**Return Value**: None
**Usage:**

```js
Page.Variables.webSocketVariable.open();
```

### send()

This method is used to send a message to the WebSocket service through the currently established connection.

**Parameters**:

- **message**(object): the message to be sent to the service. If not provided, whatever is assigned to Variable RequestBody will be sent

**Return Value**: None

**Usage:**

```js
Page.Variables.webSocketVariable.send(message);
```

### close()

This method is used to close an existing WebSocket connection connected through the Variable.

**Parameters**: None

**Return Value**: None

**Usage:**

```js
Page.Variables.webSocketVariable.close();
```

repository: wavemaker/docs

gha_language: JavaScript

repo_name: wavemaker/docs


text:
### [CVE-2022-2795](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-2795)
![](https://img.shields.io/static/v1?label=Product&message=BIND9&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=Open%20Source%20Branches%209.0%20through%<IP_ADDRESS>%20through%20versions%20before%209.16.33%20&color=brighgreen)
![](https://img.shields.io/static/v1?label=Vulnerability&message=In%20BIND%209.0.0%20-%3E%209.16.32%2C%209.18.0%20-%3E%209.18.6%2C%20versions%209.9.3-S1%20-%3E%209.11.37-S1%2C%209.16.8-S1%20-%3E%209.16.32-S1%20of%20the%20BIND%20Supported%20Preview%20Edition%2C%20and%20versions%209.19.0%20-%3E%209.19.4%20of%20the%20BIND%209.19%20development%20branch%2C%20a%20flaw%20in%20resolver%20code%20can%20cause%20named%20to%20spend%20excessive%20amounts%20of%20time%20on%20processing%20large%20delegations.&color=brighgreen)

### Description

By flooding the target resolver with queries exploiting this flaw an attacker can significantly impair the resolver's performance, effectively denying legitimate clients access to the DNS resolution service.

### POC

#### Reference
No PoCs from references.

#### Github
- https://github.com/ARPSyndicate/cvemon
- https://github.com/DButter/whitehat_public
- https://github.com/Dokukin1/Metasploitable
- https://github.com/Iknowmyname/Nmap-Scans-M2
- https://github.com/NikulinMS/13-01-hw
- https://github.com/Zhivarev/13-01-hw
- https://github.com/karimhabush/cyberowl
- https://github.com/zzzWTF/db-13-01

repository: trickest/cve

branch_name: refs/heads/main

gha_language: HTML

repo_name: trickest/cve


text:
# dotnet-mono-docker
Base docker image including the dotnet cli (RTM) and mono

## Why?
The microsoft/dotnet image does not have any Mono support.

The previous microsoft/aspnet:latest or :clr tags would allow you to utilise .NET 4.5.1 DLLs with your ASP.NET MVC 6 application.

This docker image intends to fill this gap.

## Base operating system

The base operating system is Debian 8 (Jessie) due to importing from [microsoft/dotnet](https://hub.docker.com/r/microsoft/dotnet)

## What's included

### sdk tag (aka latest)

Good for building!

- dotnet sdk latest (specific version will come from base image's "sdk" / "latest" tag)
- Mono (version <IP_ADDRESS>), including ca-certificates-mono, fsharp, mono-vbnc, nuget, referenceassemblies-pcl

### runtime tag

Good for running! (see [http://blog.tomecek.net/post/build-docker-image-in-two-steps/](http://blog.tomecek.net/post/build-docker-image-in-two-steps/) for information on making a two-step docker build process.)

- dotnet runtime latest (specific version will come from base image's "sdk" / "latest" tag)
- Mono (version <IP_ADDRESS>)

## What's not

- NodeJS and therefore bower. If you need these, use [cl0sey/dotnet-mono-node-docker](https://github.com/CL0SeY/dotnet-mono-node-docker).
- An example app! See [cl0sey/dotnet-mono-aspnet-core-example](https://github.com/CL0SeY/dotnet-mono-aspnet-core-example) instead.


text:
# Managing Unstructured Data with the `tidytext` package
Pier Lorenzo Paracchini
15 december 2016

##Required packages & supporting functions

* `tidytext` package for reading the file containing the dataset,
* `magrittr` package used for uning the piping format,
* `dplyr` package used for transformation functions,
* `ggplot2` & `wordcloud` package used for plotting and visualization,
* `stringr` package used for text manipulation (regex).

```r
visualizeWordcloud <- function(term, freq, title = "", min.freq = 50, max.words = 200){
    mypal <- brewer.pal(8,"Dark2")
    wordcloud(words = term,
          freq = freq,
          colors = mypal,
          scale=c(8,.3),
          rot.per=.15,
          min.freq = min.freq, max.words = max.words,
          random.order = F)
}
```

## Introduction

The idea is to play around with the `tidytext` package and perform some common text mining operations on some documents __using the available vignettes and the "Tidy Text Mining with R" book as guides__ (see References).

The `tidytext` package allows to use [tidy text priciples](https://www.jstatsoft.org/article/view/v059i10) with unstructured data/ text making possible to use the [`tidyverse` ecosystem](http://tidyverse.org/).

## The tidy text format

__Tidy text format__ is define as _'a table with one-term-per-row'_.

### `unnest_tokens` function

Supporting document is a char vector with one element made of 3 sentences. The dataset is not yet compatible with tidy tools (not compliant with tidy data principles).

```r
document <- paste("Using tidy data principles is important.",
    "In this package, we provide functions for tidy formats.",
    "The novels of Jane Austen can be so tidy!")

df <- data.frame(text = document)
```

The `unnest_token` function splits a text column (`input`) into tokens (e.g. sentences, wors, ngrams, ect ) using the [`tokenizers` package](https://github.com/ropensci/tokenizers).

__Tokenize__ into lines...

```r
document_lines <- unnest_tokens(df, input = text, output = line, token = "sentences", to_lower = F)
document_lines$lineNo <- seq_along(document_lines$line)
head(document_lines)
## # A tibble: 3 × 2
##                                                      line lineNo
##                                                     <chr>  <int>
## 1                Using tidy data principles is important.      1
## 2 In this package, we provide functions for tidy formats.      2
## 3               The novels of Jane Austen can be so tidy!      3
```

__Tokenize__ into words (unigrams)...

```r
df_text_to_word_tidy <- document_lines %>%
    unnest_tokens(output = word, input = line, token = "words")

head(df_text_to_word_tidy)
## # A tibble: 6 × 2
##   lineNo       word
##    <int>      <chr>
## 1      1      using
## 2      1       tidy
## 3      1       data
## 4      1 principles
## 5      1         is
## 6      1  important
```

__Tokenize__ into bigrams...

```r
df_text_to_bigrams_tidy <- document_lines %>%
    unnest_tokens(output = bigram, input = line, token = "ngrams", n = 2)
head(df_text_to_bigrams_tidy)
## # A tibble: 6 × 2
##   lineNo          bigram
##    <int>           <chr>
## 1      1      using tidy
## 2      1       tidy data
## 3      1 data principles
## 4      1   principles is
## 5      1    is important
## 6      2         in this
```

__Tokenize__ into trigrams...

```r
df_text_to_trigrams_tidy <- document_lines %>%
    unnest_tokens(output = trigram, input = line, token = "ngrams", n = 3)
head(df_text_to_trigrams_tidy)
## # A tibble: 6 × 2
##   lineNo                 trigram
##    <int>                   <chr>
## 1      1         using tidy data
## 2      1    tidy data principles
## 3      1      data principles is
## 4      1 principles is important
## 5      2         in this package
## 6      2         this package we
```

__A new data structure is created that is compliant with the tidy data principles and that can be used with the standard set of tidytools (`tidyverse` package).__

### Removing stopwords: the `stop_words` dataset and the `anti_join` function

The `tidytext` package offers a data stucture containing a list of english stopwords from 3 different lexicons (onix, SMART and snowball sets) that, optionally, can be used to remove most common and meaningless words from the text under examination.

```r
head(stop_words)
## # A tibble: 6 × 2
##        word lexicon
##       <chr>   <chr>
## 1         a   SMART
## 2       a's   SMART
## 3      able   SMART
## 4     about   SMART
## 5     above   SMART
## 6 according   SMART
```

The `anti_join(x, y)` function of the `dplyr` package can be used to remove a list of words (e.g. stopwords). The function returns all rows from `x` where there is not matching value in `y` (keeping all the columns in `x`).

```r
df_tmp <- df_text_to_word_tidy %>%
    anti_join(stop_words, by = c("word" = "word"))
head(df_tmp)
## # A tibble: 6 × 2
##   lineNo       word
##    <int>      <chr>
## 1      1       tidy
## 2      2       tidy
## 3      3       tidy
## 4      1       data
## 5      1 principles
## 6      2    package
```

### Summarizing word frequencies: the `count` function

The `count` frunction in the `dplyr` package can be used on a tidy dataset to count observations.

```r
df_tmp %>%
    count(word, sort = TRUE)
## # A tibble: 10 × 2
##          word     n
##         <chr> <int>
## 1        tidy     3
## 2      austen     1
## 3        data     1
## 4     formats     1
## 5   functions     1
## 6        jane     1
## 7      novels     1
## 8     package     1
## 9  principles     1
## 10    provide     1
```

## Jan Austen Exploratory Case

Using the `janeaustenr` package containing 6 published novels.

Prepare the raw dataset adding a chapter and number of line features for each book.

```r
require(janeaustenr)
str(austen_books())
## Classes 'tbl_df', 'tbl' and 'data.frame':	73422 obs. of  2 variables:
##  $ text: chr  "SENSE AND SENSIBILITY" "" "by Jane Austen" "" ...
##  $ book: Factor w/ 6 levels "Sense & Sensibility",..: 1 1 1 1 1 1 1 1 1 1 ...

original_books <- austen_books() %>%
    group_by(book) %>%
    mutate(line = row_number(),
           chapter = cumsum(str_detect(text, regex("^chapter [\\divxlc]",
                                                 ignore_case = TRUE)))) %>%
    ungroup()

head(original_books)
## # A tibble: 6 × 4
##                    text                book  line chapter
##                   <chr>              <fctr> <int>   <int>
## 1 SENSE AND SENSIBILITY Sense & Sensibility     1       0
## 2                       Sense & Sensibility     2       0
## 3        by Jane Austen Sense & Sensibility     3       0
## 4                       Sense & Sensibility     4       0
## 5                (1811) Sense & Sensibility     5       0
## 6                       Sense & Sensibility     6       0
```

Transfor into a tidy dataset...

```r
tidy_books <- original_books %>%
    unnest_tokens(input = text, output = word, token = "words")
head(tidy_books)
## # A tibble: 6 × 4
##                  book  line chapter        word
##                <fctr> <int>   <int>       <chr>
## 1 Sense & Sensibility     1       0       sense
## 2 Sense & Sensibility     1       0         and
## 3 Sense & Sensibility     1       0 sensibility
## 4 Sense & Sensibility     3       0          by
## 5 Sense & Sensibility     3       0        jane
## 6 Sense & Sensibility     3       0      austen
```

Remove the stopwords...

```r
tidy_books <- tidy_books %>%
    anti_join(y = stop_words, by = c("word" = "word"))
```

Find the most common words...

```r
word_frequencies <- tidy_books %>%
    count(word, sort = TRUE)

head(word_frequencies)
## # A tibble: 6 × 2
##    word     n
##   <chr> <int>
## 1  miss  1855
## 2  time  1337
## 3 fanny   862
## 4  dear   822
## 5  lady   817
## 6   sir   806
```

```r
word_frequencies %>%
    filter(n > 400) %>%
    mutate(word = reorder(word, n)) %>%
    ggplot(mapping = aes(x = word, y = n)) +
    geom_col() +
    coord_flip()
```

![](exp_NLP_tidyetxt_package_files/figure-html/visualizeWordFrequencies-1.png)<!-- -->

```r
visualizeWordcloud(term = word_frequencies$word, freq = word_frequencies$n)
```

![](exp_NLP_tidyetxt_package_files/figure-html/visualizeWordFrequenciesByWordcloud-1.png)<!-- -->

## H.G. Wells Exploratory Case

The [`gutenbergr` package](https://ropensci.org/tutorials/gutenbergr_tutorial.html) provides access to the __Project Gutenberg__ collection. The package contains tools for downloading books and for finding works of interest.

```r
require(gutenbergr)

gutenberg_works(str_detect(author,"Wells, H. G."))$title[1:5]
## [1] "The Time Machine"
## [2] "The War of the Worlds"
## [3] "The Island of Doctor Moreau"
## [4] "The Door in the Wall, and Other Stories"
## [5] "Ann Veronica: A Modern Love Story"
ids <- gutenberg_works(str_detect(author,"Wells, H. G."))$gutenberg_id[1:3]
#Download the time machhine, the war of worlds, the island of doctor Moreau
hgwells <- gutenbergr::gutenberg_download(ids)
hgwells <- hgwells %>%
    group_by(gutenberg_id) %>%
    mutate(line = row_number()) %>%
    ungroup()
```

Transform into a __tidy dataset__...

```r
hgwells_tidy <- hgwells %>%
    unnest_tokens(output = word, input = text, token = "words")
```

Remove __stopwords__...

```r
hgwells_tidy <- hgwells_tidy %>%
    anti_join(stop_words, by = c("word" = "word"))
```

Calculate __word frequencies__...

```r
hgwell_word_freqs_by_book <- hgwells_tidy %>%
    group_by(gutenberg_id) %>%
    count(word, sort = TRUE) %>%
    ungroup()
```

__Visualize the words with frequency greater than 50 for each book__...

```r
hgwell_word_freqs_by_book %>%
    filter(n > 50) %>%
    ggplot(mapping = aes(x = word, y = n)) +
    geom_col() +
    coord_flip() + facet_wrap(facets = ~ gutenberg_id)
```

![](exp_NLP_tidyetxt_package_files/figure-html/HGVisualizeWordFrequencies-1.png)<!-- -->

__Visualize the words with frequency greater than 50 for each book__ using __wordclouds__. Books 35, 36, 159 respectively...

```r
par(mfrow = c(1,3), mar = c(0,0,0,0))
tmp <- hgwell_word_freqs_by_book[hgwell_word_freqs_by_book$gutenberg_id == 35,]
visualizeWordcloud(term = tmp$word, freq = tmp$n)

tmp <- hgwell_word_freqs_by_book[hgwell_word_freqs_by_book$gutenberg_id == 36,]
visualizeWordcloud(term = tmp$word, freq = tmp$n)

tmp <- hgwell_word_freqs_by_book[hgwell_word_freqs_by_book$gutenberg_id == 159,]
visualizeWordcloud(term = tmp$word, freq = tmp$n)
```

![](exp_NLP_tidyetxt_package_files/figure-html/visualizeWordFrequenciesByWordcloud_wells-1.png)<!-- -->

## Comparing works of different authors

Let's use Jane AUten, H.G. Wells and Brontë sisters to make a comparison of the wording used in their works.

```r
austen <- original_books
austen_tidy <- austen %>%
    unnest_tokens(word, text) %>%
    anti_join(stop_words)

austen_percent <- austen_tidy %>%
    mutate(word = str_extract(word, "[a-z]+")) %>%
    count(word) %>%
    transmute(word, austen = n/ sum(n), author = "Austen")

```

```r
#H. G. Wells
#Let’s get The Time Machine, The War of the Worlds, The Invisible Man, and The Island of Doctor Moreau.
hgwells <- gutenberg_download(c(35, 36, 5230, 159))
hgwells_tidy <- hgwells %>%
    unnest_tokens(word, text) %>%
    anti_join(stop_words)

hgwells_percent <- hgwells_tidy %>%
    mutate(word = str_extract(word, "[a-z]+")) %>%
    count(word) %>%
    transmute(word, other = n / sum(n), author = "Wells")
```

```r
# Brontë sisters
#get Jane Eyre, Wuthering Heights, The Tenant of Wildfell Hall, Villette, and Agnes Grey

bronte <- gutenberg_download(c(1260, 768, 969, 9182, 766))
bronte_tidy <- bronte %>%
    unnest_tokens(word, text) %>%
    anti_join(stop_words)

bronte_percent <- bronte_tidy %>%
    mutate(word = str_extract(word, "[a-z]+")) %>%
    count(word) %>%
    transmute(word, other = n/ sum(n), author = "Bronte")
```

```r
#Comparing Austen to others authors, using others words as reference
others_freqs_tidy <- bind_rows(bronte_percent, hgwells_percent)
authors_frequencies <- others_freqs_tidy %>%
    left_join(austen_percent, by = c("word" = "word")) %>%
    ungroup()

```

Visualize the comparison...

```r
library(scales)

ggplot(data = authors_frequencies, mapping = aes(x = other, y = austen, color = abs(austen - other))) +
    geom_abline(color = "gray40", lty = 2) +
    geom_jitter(alpha = 0.1, size = 2.5, width = 0.3, height = 0.3) +
    geom_text(aes(label = word), check_overlap = T, vjust = 1.5) +
    scale_x_log10(labels = percent_format()) +
    scale_y_log10(labels = percent_format()) +
    scale_color_gradient(limits = c(0, 0.001), low = "darkslategray4", high = "gray75") +
    facet_wrap(~ author.x, ncol = 2) +
    theme(legend.position="none") +
    labs(y = "Jane Austen", x = NULL)
```

![](exp_NLP_tidyetxt_package_files/figure-html/worksComparison-1.png)<!-- -->

_'Words that are close to the line in these plots have similar frequencies in both sets of texts, for example, in both Austen and Brontë texts (“miss”, “time”, “day” at the upper frequency end) or in both Austen and Wells texts (“time”, “day”, “brother” at the high frequency end). Words that are far from the line are words that are found more in one set of texts than another.'_

_'Overall, notice that the words in the Austen-Brontë plot are closer to the zero-slope line than in the Austen-Wells plot and also extend to lower frequencies; Austen and the Brontë sisters use more similar words than Austen and H.G. Wells. '_

## References

["Introduction to tidytext](https://cran.r-project.org/web/packages/tidytext/vignettes/tidytext.html), `tidytext` vignette
["Tidy Text Mining with R"](http://tidytextmining.com/), Julia Silge and David Robinson

## Session Information

```r
sessionInfo()
## R version 3.3.1 (2016-06-21)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 7 x64 (build 7601) Service Pack 1
##
## locale:
## [1] LC_COLLATE=Norwegian (Bokmål)_Norway.1252
## [2] LC_CTYPE=Norwegian (Bokmål)_Norway.1252
## [3] LC_MONETARY=Norwegian (Bokmål)_Norway.1252
## [4] LC_NUMERIC=C
## [5] LC_TIME=Norwegian (Bokmål)_Norway.1252
##
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base
##
## other attached packages:
##  [1] scales_0.4.1       gutenbergr_0.1.2   janeaustenr_0.1.4
##  [4] wordcloud_2.5      RColorBrewer_1.1-2 stringr_1.1.0
##  [7] ggplot2_2.2.0      dplyr_0.5.0        magrittr_1.5
## [10] tidytext_0.1.2
##
## loaded via a namespace (and not attached):
##  [1] Rcpp_0.12.7      formatR_1.4      plyr_1.8.4       tokenizers_0.1.4
##  [5] tools_3.3.1      digest_0.6.10    evaluate_0.10    tibble_1.2
##  [9] nlme_3.1-128     gtable_0.2.0     lattice_0.20-34  Matrix_1.2-7.1
## [13] psych_1.6.9      DBI_0.5-1        curl_2.1         yaml_2.1.13
## [17] parallel_3.3.1   knitr_1.14       triebeard_0.3.0  grid_3.3.1
## [21] R6_2.2.0         foreign_0.8-67   rmarkdown_1.1    readr_1.0.0
## [25] purrr_0.2.2      reshape2_1.4.1   tidyr_0.6.0      urltools_1.6.0
## [29] SnowballC_0.5.1  htmltools_0.3.5  assertthat_0.1   mnormt_1.5-5
## [33] colorspace_1.2-7 labeling_0.3     stringi_1.1.2    lazyeval_0.2.0
## [37] munsell_0.4.3    slam_0.1-38      broom_0.4.1
```

repository: chprianto/DataSciencePosts

repo_name: chprianto/DataSciencePosts


text:
# RME

Register Machine Environment

## Installation

Clone the repository, run `cargo build --release` and launch `main` executable.

## About register machine dialect

In theory, there are infinite amount of registers that can store some integer values and integers belong to the interval
of `(0, +infinity)`. Of course, the interpreter use finite set of registers and a program listing cannot contain
integers bigger than `usize` (64 bits on modern platforms), so there cannot be more than `usize` registers and the
program cannot operate with numbers bigger than this.

I guess it should enough for education purposes, don't think that somebody will use it for something complicated
seriously because of its inefficiency.

Types of instructions:

| Instruction | Meaning                                                                  |
|-------------|--------------------------------------------------------------------------|
| Z(n)        | zeroing of `n`-th register value                                         |
| I(n)        | increasing by 1 `n`-th register value                                    |
| T(n,m)      | copying `n`-th register value to `m`-th register                         |
| J(n,m,l)    | if `n` == `m` then jump to `l` line else next line after the instruction |

This instruction set is similar to sets from [Counter machine](https://en.wikipedia.org/wiki/Counter_machine)
and [Random-access machines](https://en.wikipedia.org/wiki/Random-access_machine).

Enumeration of instruction lines starts from 1.

Let `N` is amount of instructions in the program. A program finishes if current number of instruction is bigger than `N`
.

Tools:

- [x] interpreter
- [ ] compiler:
    - [ ] into Rust code
    - [ ] into WASM
    - [ ] into machine code
- [ ] REPL

## Example

`cargo run -- 2x.urm 3`

repository: PaulRaUnite/RME

repo_name: PaulRaUnite/RME


text:
+++
title = "aws_cloudwatch_alarm Resource"
platform = "aws"
draft = false
gh_repo = "inspec-aws"

[menu.inspec]
title = "aws_cloudwatch_alarm"
identifier = "inspec/resources/aws/aws_cloudwatch_alarm Resource"
parent = "inspec/resources/aws"
+++

Use the `aws_cloudwatch_alarm` InSpec audit resource to test properties of a single CloudWatch Alarm.

**If more than one Alarm matches, an error will be raised.**

## Installation

{{% inspec_aws_install %}}

## Syntax

### Ensure an Alarm exists.

```ruby
aws_cloudwatch_alarm(metric_name: 'my-metric-name', metric_namespace: 'my-metric-namespace') do
  it { should exist }
end
```

## Parameters

`metric_name` _(required)_

: The metric name used by this alarm. This must be passed as a `metric_name: 'value'` key-value entry in a hash.

`metric_namespace` _(required)_

: The metric namespace used by this alarm. This must be passed as a `metric_namespace: 'value'` key-value entry in a hash.

`dimensions` _(optional)_

: The dimensions associated with this alarm. This must be passed as an array of hashes `dimensions: [{key:'value'}]` .

## Properties

`alarm_actions`
: The actions to execute when this alarm transitions to the ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN).

`alarm_name`
: The name of the alarm.

`metric_name`
: The name of the metric.

`metric_namespace`
: The namespace of the metric.

## Examples

**Ensure an Alarm has at least one alarm action.**

```ruby
describe aws_cloudwatch_alarm(metric_name: 'my-metric-name', metric_namespace: 'my-metric-namespace') do
  its('alarm_actions') { should_not be_empty }
end
```

**Ensure an Alarm with Dimensions exists.**

```ruby
describe aws_cloudwatch_alarm(metric_name: 'my-metric-name', metric_namespace: 'my-metric-namespace', dimensions: [{key: 'value'}]) do
  it { should exist }
end
```

## Matchers

{{% inspec_matchers_link %}}

### exist

The control will pass if the describe returns at least one result.

Use `should_not` to test the entity should not exist.

```ruby
describe aws_cloudwatch_alarm(metric_name: 'good-metric', metric_namespace: 'my-metric-namespace') do
  it { should exist }
end
```

```ruby
describe aws_cloudwatch_alarm(metric_name: 'bed-metric', metric_namespace: 'my-metric-namespace') do
  it { should_not exist }
end
```

## AWS Permissions

{{% aws_permissions_principal action="CloudWatch:Client:DescribeAlarmsForMetricOutput" %}}

You can find detailed documentation at [Actions, Resources, and Condition Keys for Amazon CloudWatch](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazoncloudwatch.html).

repository: inspec/inspec-aws

gha_language: Ruby

gha_license_id: NOASSERTION

repo_name: inspec/inspec-aws


text:
---
layout: post
title: ASP.NET AJAX Cheet Sheets
date: '2007-01-13 02:38:00'
---

For those of you who are using ASP.NET AJAX, Milan Negovan has created some FREE Cheat Sheets for the client JavaScript libraries.

He has compiled sheets for the Array, Boolean, Date, Error, Number, Object, and String JavaScript Base Type Extensions.

These ASP.NET AJAX cheet sheets are available on Milan Negovan's Website.

Thank you Milan, and keep up the great work!

extension: markdown


text:
# FAQs

- [FAQs](#faqs)
    - [How to configure the settings in my project?](#how-to-configure-the-settings-in-my-project)
    - [How to use Live Server Web Extension?](#how-to-use-live-server-web-extension)
    - [How to setup Live Server for Dynamic Pages (like PHP)?](#how-to-setup-live-server-for-dynamic-pages-like-php)
    - [How to access the server from Mobile?](#how-to-access-the-server-from-mobile)
----------

## How to configure the settings in my project?

Create a `.vscode` folder in the root of project. Inside of `.vscode` folder create a json file named `settings.json`.
Inside of the `settings.json`, type following key-value pairs. By the way you'll get intelli-sense.

```json
{
    "liveServer.settings.port": 4500,
    "liveServer.settings.root": "/src",
    "liveServer.settings.CustomBrowser" : "chrome",
    "liveServer.settings.AdvanceCustomBrowserCmdLine": "chrome --incognito --remote-debugging-port=9222",
    "liveServer.settings.NoBrowser" : false,
    "liveServer.settings.ignoreFiles" : [
            ".vscode/**",
            "**/*.scss",
            "**/*.sass"
    ]

}
```
_Note: Use either `CustomBrowser` or `AdvanceCustomBrowserCmdLine` setting._

----------

## How to use Live Server Web Extension?

*  Please [check here](https://github.com/ritwickdey/live-server-web-extension)

----------

## How to setup Live Server for Dynamic Pages (like PHP)?

*  Please [check here](https://github.com/ritwickdey/live-server-web-extension)

----------

## How to access the server from Mobile?

 First, make a sure that your PC & Mobile are connected through same network.

* **Windows** :  Open `CMD` and enter `ipconfig`.
* **Linux/macOS** : Open `terminal` and enter `ifconfig`.

And note down the `IPv4 Address` (probably it will look like 192.168.xx.xx). This is your PC's IP address. Enter the address to your browser's URL Bar with the port number**.

        http://<IP Address> : <Port>

** For an example, if your server running at **http:// <IP_ADDRESS>:3500** on PC then port number is **3500**.

----------

## Are Multi-root workspaces supported?

Currently there is no support for multi-root workspaces. It's automatically the first folder in the workspace choosen.
The current state of this issue you can track [here](https://github.com/ritwickdey/vscode-live-server/issues/43).

repository: Zhou-zhi-peng/vscode-live-server

repo_name: Zhou-zhi-peng/vscode-live-server


text:
# TypeScript + Express + Firestore
An API REST created with Typescript and using Express and Firestore modules

[![](https://travis-ci.org/marcoshuck/typescript-express-firestore.svg?branch=master)](https://travis-ci.org/marcoshuck/typescript-express-firestore) [![](https://david-dm.org/marcoshuck/typescript-express-firestore.svg)](https://david-dm.org/marcoshuck/typescript-express-firestore) ![](https://img.shields.io/github/forks/marcoshuck/typescript-express-firestore.svg) ![](https://img.shields.io/github/stars/marcoshuck/typescript-express-firestore.svg) ![](https://img.shields.io/github/license/marcoshuck/typescript-express-firestore.svg) ![](https://img.shields.io/github/issues/marcoshuck/typescript-express-firestore.svg)

## Features
This project has or uses the following features:
- Typescript.
- Express.
- Google Firestore.
- Linting
- Model - View - Controller pattern.
- SOLID principles.
- Class validation.
- CI/CD with Travis.
- Tests with mocha and chai.
- Autogenerated documentation with typedoc.

## Getting started
This application was created using NodeJS, you can look at the package.json file for more information about what packages have been used.

You need to create a keys folder in the application root directory, and inside of it, you should move the .json file provided by Google Firestore. Read more information about this: [Google Firestore SDK documentation](https://firebase.google.com/docs/admin/setup?authuser=0). This file is required in [db.ts](https://github.com/marcoshuck/typescript-express-firestore/blob/master/src/db.ts#L3)

### Before start working on code
`yarn install` or `npm install`

### Building
`npm run build`
Gets the ./build directory with js files.

### Source code analysis
`npm run lint`
Uses lint to analyze the source code.

### Starting the application
`npm run start`
Runs the application in a node instance.

### Watch mode (build)
`npm run build-watch`
Compiles the application every time some change has been made.

### Watch mode (start)
`npm run start-watch`
Runs the application every time some change has been made. Should be run in parallel with Build watch mode.

### Documentation
`npm run doc`
Generates the project's documentation using typedoc.

## API Endpoint
In this application there is only one endpoint available, it's the [examples](https://github.com/marcoshuck/typescript-express-firestore/blob/master/src/routes/index.ts#L7) endpoint.
You can check how any route works reading its specific controller class. For further information about the examples route, you can read the [ExampleController](https://github.com/marcoshuck/typescript-express-firestore/blob/master/src/controllers/example.controller.ts) class.

## Test
The firestore test is related to my own firestore database. You can play around with the source file to understand mocha and chai modules. Be sure to check and change the id argument in both read and update methods.

## Project structure
```
|   .env.example
|   .gitignore
|   .travis.yml
|   LICENSE
|   package.json
|   README.md
|   tsconfig.json
|   tslint.json
|   yarn.lock
|
+---src
|   |   app.ts
|   |   db.ts
|   |   env.ts
|   |   index.ts
|   |
|   +---controllers
|   |   |   controller.ts
|   |   |   example.controller.ts
|   |   |
|   |   \---interfaces
|   |           controller.interface.ts
|   |
|   +---middleware
|   |       error.middleware.ts
|   |
|   +---models
|   |   |   example.model.ts
|   |   |
|   |   \---interfaces
|   |           example.interface.ts
|   |
|   +---repositories
|   |   |   firestore.repository.ts
|   |   |
|   |   \---interfaces
|   |           firestore.interface.ts
|   |
|   +---routes
|   |       example.routes.ts
|   |       index.ts
|   |
|   \---utils
|           error.interface.ts
|
+---tests
|   \---repositories
|           firestore.test.ts
|
\---views
        error.pug
```

## ToDo
- JWT


text:
# HTTP -> HTTPS Redirection

Most modern websites that force HTTPS will also automatically redirect any requests that come into it over HTTP.

```
Client                    Ambassador Edge Stack
|                             |
| http://<hostname>/api       |
| --------------------------> |
| 301: https://<hostname>/api |
| <-------------------------- |
| https://<hostname>/api      |
| --------------------------> |
|                             |
```

Ambassador Edge Stack exposes configuration for this in two ways:

- Redirecting based off the incoming port
- Redirecting based off the incoming protocol (via the `x-forwarded-proto` header)

Typically, port-based redirection is the preferred method since it is simpler to manage and will work with all use cases. Redirecting based off of the `x-forwarded-proto` header requires an L7 load-balancer or proxy in front of Ambassador Edge Stack to set that header.

## Using the `Host` resource

The [`Host`](../../host-crd) resource is used to configure how Ambassador handles cleartext on a domain. You can configure Ambassador to [deny, allow, or redirect](../../host-crd/#secure-and-insecure-requests) cleartext to HTTPS on a domain using a single resource.

The following `Host` gives an example of how to enable Ambassador to redirect cleartext to HTTPS on the `host.example.com` domain.

```yaml
---
apiVersion: getambassador.io/v2
kind: Host
metadata:
  name: example-host
spec:
  hostname: host.example.com
  acmeProvider:
    email<EMAIL_ADDRESS>  insecure:
    action: Redirect
```

**Note:** Ambassador defaults to redirecting cleartext to HTTPS for all `Host`s.

## For Ambassador 0.86.1 and below

In Ambassador 0.86.1 and below, TLS behavior was configured with the `TLSContext`. This included cleartext redirection.

The follow reference is **deprecated**. For those using old versions of Ambassador, [upgrade to the latest verion](../../../install/upgrade-to-edge-stack) of Ambassador to use the `Host` resource to manage TLS termination.

### Port-based Redirection

Port-based redirection opens up Ambassador to listen on a defined port and issue a `301` redirect to HTTPS for all traffic that comes in on that port.

In the example at the top of the page;

- The client sends a standard HTTP request (port 80) to Ambassador Edge Stack.
- The request hits Ambassador Edge Stack's redirect listener and Ambassador returns a `301` redirect to https.
- The client resends the request as a standard https request (port 443) to Ambassador Edge Stack.

To configure Ambassador to handle this behavior you need set `redirect_cleartext_from: <http_port>` in a `TLSContext`:

1. Create a `TLSContext` to handle TLS termination, and tell it to enforce redirection. This example shows redirecting traffic to Ambassador's default cleartext service port, `8080`:

    ```yaml
    apiVersion: getambassador.io/v2
    kind: TLSContext
    metadata:
      name: tls
    spec:
      hosts: ["*"]
      secret: ambassador-cert
      redirect_cleartext_from: 8080
    ```

2. Verify that the port assignments on the Ambassador service are correct.

    The below service definition uses the default HTTP and HTTPS port assignments

    ```yaml
    apiVersion: v1
    kind: Service
    metadata:
      name: ambassador
    spec:
      ports:
      - name: http
        port: 80
        targetPort: 8080
      - name: https
        port: 443
        targetPort: 8443
      selector:
        service: ambassador
    ```

**Notes:**

- The ability to `redirect_cleartext_from` was added to the `TLSContext` in Ambassador 0.84.0. Earlier versions of Ambassador need to use a tls `Module` for cleartext redirection.

- As shown above, Ambassador performs this http -> https redirection by issuing a `301` redirect to `https://<hostname>/`. The `<hostname>` represents the domain name/IP address and port of the incoming request. This means if a port is defined on an incoming request, it will be redirected to https on that port. Because of this, cleartext redirection is not supported when using non-default HTTP and HTTPS ports.

- If you use multiple `TLSContext`s, it doesn't matter which `TLSContext` sets `redirect_cleartext_from`. However, it is an error to attempt to set `redirect_cleartext_from` on multiple distinct ports in multiple distinct `TLSContext`s.

### Protocol-based Redirection

Ambassador can perform HTTP -> HTTPS redirection based on the protocol of the incoming request.

While port-based redirection is preferred for most use cases, using the `x-forwarded-proto` header to redirect to HTTPS is useful when the front load balancer or proxy is terminating TLS.

Protocol-based redirection is configured in the Ambassador `Module`:

```yaml
apiVersion: getambassador.io/v2
kind: Module
metadata:
  name: ambassador
spec:
  config:
    use_remote_address: false
    x_forwarded_proto_redirect: true
```

**Note**: Ambassador will need to be restarted for this configuration to take effect.

repository: Meemaw/ambassador

repo_name: Meemaw/ambassador


text:
Directory intended to store and test the different machine learning approaches. All of them are study cases.

### Classifiers
- __Numpy__: simple examples of numpy uses
- __Temperature__: RidgeCV
- __Stock__: RidgeCV
- __Weights__: trying out differnt weight initializations in NN
- __dtree.py__: DecisionTreeClassifier, KNeigborsClassifier, SVC
- __multilayerNN.py__: MLP (multi layer perceptron)
- __neighbors.py__: NearestNeighbors
- __sentiment-analysis-tflearn.py__: sentiment analysis from IMDB database and TFLearn

_Note: not all the files use the same python version. Take a look at the description._

### To Do
- Add AI in planes game (feedforward nn)
- Chatbot in telegram bots (seq2seq?)
- NLP NN
- Autoencoder (image -> text)

repository: samuxiii/prototypes

repo_name: samuxiii/prototypes


text:
# RxAndroidLog
A logger with an extensible API for RxJava
=======
(This project is still under heavy development and api may change very often and a lot in
the coming versions).

Debugging RxJava's code is pretty hard, *RxAndroidLog* is a library to help with
logging rxjava operations by providing an extensible api for logging.

Logging operations can be composed with rxjava's operation and granular control for what to log
is provided.

Binaries
========

Binaries and dependency information for Maven, Ivy, Gradle and others can be found at [http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Ccom.mounacheikhna).

for Gradle:
```groovy
compile 'com.mounacheikhna:rxAndroidLog:0.2'
```

and for Maven:

```xml
<dependency>
  <groupId>com.mounacheikhna</groupId>
  <artifactId>rxAndroidLog</artifactId>
  <version>0.2</version>
  <type>aar</type>
</dependency>
```

Usage
=====

Create a logging operator with details of what you want to log, for example here we want
to show the count of the emitted values,log even numbers and show the count of even numbers.

```java
final OperatorLogging<Integer> log = RxLogging.<Integer>logger().showCount("total")
            .when(x -> x % 2 == 0)
            .showCount("even numbers total")
            .onNext(false)
            .log();

Observable.range(1,20).lift(log)
```

Want to help?
=============

File new issues to discuss specific aspects of the API or the implementation and to propose new
features or improvements.

Licence
=======
    Copyright (c) 2015 Mouna Cheikhna

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

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

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

repository: chemouna/RxAndroidLog

repo_name: chemouna/RxAndroidLog


text:
# BookLibrary DOT Internship
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

This repository is used for applying internship in DOT

BookLibrary is a very simple library management app built with Laravel 7 and CoreUI as admin template.

#### Features
- 4 API endpoints
See [API documentation](https://documenter.getpostman.com/view/7499297/TzCJfpZu)
- Multi-role user
- Dynamic menu list
- Account Authentication
- Register Account

## Installation

``` bash

$ git clone https://github.com/cloudenum/BookLibrary.git

$ cd BookLibrary

$ composer install

$ npm install

# in your app directory
# generate laravel APP_KEY
$ php artisan key:generate

# run database migration and seed
$ php artisan migrate:refresh --seed

# generate mixing
$ npm run dev

# and repeat generate mixing
$ npm run dev
```

## Usage

``` bash
# start local server
$ php artisan serve
```

Open your browser with address: [localhost:8000](localhost:8000)

* E-mail<EMAIL_ADDRESS>* Password: _password_

This user has roles: _user_ and _admin_

---

## Database Diagram

![Imgur](https://i.imgur.com/3DwpNsv.png)

---

## Screenshots

![Imgur](https://i.imgur.com/TTmj5hA.png)
![Imgur](https://i.imgur.com/DbXLgsR.png)
![Imgur](https://i.imgur.com/jgx3k54.png)

For video [demo](https://drive.google.com/file/d/15oNWG_tK248WflrbQG_gwoa62rMvZCx-/view?usp=sharing).

repository: cloudenum/BookLibrary

repo_name: cloudenum/BookLibrary


text:
---
layout: post
section-type: post
title: Safaricom CEO Bob Collymore's Extension
category: news
tags: [ 'bob collymore', 'safaricom' ]
---

Bob Collymore has announced he will be staying on as CEO of Safaricom  for one more year (12-15 months) as his contract has been extended.  This is part compensation for the 9 month period of time he was out on  medical leave. So he will remain the CEO up to 2020.

A successor is yet to be picked and there’s been growing conversation
 over who will be able to take over from Bob as he was expected to leave
 in August. There’s been rumors that the government of Kenya wants to
have a Kenyan as the company’s CEO, but such conversation is yet to take
 shape.

During the Safaricom Full Year Results
 announcements, the Board Chair made a fun statement saying Safaricom
already has a Kenyan CEO pointing to Bob Collymore being Kenyan already.

Collymore who is of Guyanese descent, has been CEO of Safaricom since
 they year 2010 and has overseen the company’s growth to becoming one of
 the biggest, and most profitable companies in East and Central Africa.
In his tenure, M-Pesa has grown to become the world’s largest mobile
money solution, and going by stats from their results last year, there’s
 still so much more for M-Pesa.


text:
# LiveRecording

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | Base name for the recording |
**format** | **String** | Recording format (wav, gsm, etc.) |
**targetUri** | **String** | URI for the channel or bridge being recorded |
**state** | **String** |  |
**duration** | **Integer** | Duration in seconds of the recording |  [optional]
**talkingDuration** | **Integer** | Duration of talking, in seconds, detected in the recording. This is only available if the recording was initiated with a non-zero maxSilenceSeconds. |  [optional]
**silenceDuration** | **Integer** | Duration of silence, in seconds, detected in the recording. This is only available if the recording was initiated with a non-zero maxSilenceSeconds. |  [optional]
**cause** | **String** | Cause for recording failure if failed |  [optional]

repository: mohsenk/jasterisk

repo_name: mohsenk/jasterisk


text:
# JSegue

A Java library of animated image-to-image transitions useful for slide shows, photo montages, UI transitions and the like.

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

## Features

* 24 animations for transitioning one image to another including cross-dissolve, wipe, scroll, zoom, and checkerboard effects. May be used to generate realtime animations or to render frames offline (in batch).
* May substitute a `Paint` for either source or destination image for effects like fade-to-black.
* Configurable animation duration, frames-per-second and alpha blending.
* Simple to use and integrate; lightweight library with no transitive dependencies (approx. 40KB in size).

## Animated Segues

| Animated Segue | Name           | Description
|----------------|----------------|-------------------------------------
|![Test](doc/images/1.gif)         | `Test`     | Test
|![Test](doc/images/2.gif)         | `Test`     | Test
|![PixelDissolveEffect](doc/images/PixelDissolveEffect.gif)         | `PixelDissolveEffect`     | Cross-dissolve from source to destination by randomly replacing source pixels with destination pixels.
|![CheckerboardEffect](doc/images/CheckerboardEffect.gif)           | `CheckerboardEffect`      | Destination image appears over the source in a 8x8 matrix.
|![BlindsEffect](doc/images/BlindsEffect.gif)                       | `BlindsEffect`            | Destination appears in "louvered" horizontal stripes.
|![ScrollLeftEffect](doc/images/ScrollLeftEffect.gif)               | `ScrollLeftEffect`        | Scroll from right to left.
|![ScrollRightEffect](doc/images/ScrollRightEffect.gif)             | `ScrollRightEffect`       | Scroll from left to right.
|![ScrollUpEffect](doc/images/ScrollUpEffect.gif)                   | `ScrollUpEffect`          | Scroll from bottom to top.
|![ScrollDownEffect](doc/images/ScrollDownEffect.gif)               | `ScrollDownEffect`        | Scroll from top to bottom.
|![WipeLeftEffect](doc/images/WipeLeftEffect.gif)                   | `WipeLeftEffect`          | Slides the destination image over the source from right to left.
|![WipeRightEffect](doc/images/WipeRightEffect.gif)                 | `WipeRightEffect`         | Slides the destination image over the source from left to right.
|![WipeUpEffect](doc/images/WipeUpEffect.gif)                       | `WipeUpEffect`            | Slides the destination image over the source from bottom to top.
|![WipeDownEffect](doc/images/WipeDownEffect.gif)                   | `WipeDownEffect`          | Slides the destination image over the source from top to bottom.
|![ZoomOutEffect](doc/images/ZoomOutEffect.gif)                     | `ZoomOutEffect`           | The destination image expands over the source in a rectangle aperture.
|![ZoomInEffect](doc/images/ZoomInEffect.gif)                       | `ZoomInEffect`            | The source image collapses over the destination in a rectangle aperture.
|![IrisOpenEffect](doc/images/IrisOpenEffect.gif)                   | `IrisOpenEffect`          | The destination image expands over the source in a circular aperture.
|![IrisCloseEffect](doc/images/IrisCloseEffect.gif)                 | `IrisCloseEffect`         | The source image collapses over the destination in a circular aperture.
|![BarnDoorOpenEffect](doc/images/BarnDoorOpenEffect.gif)           | `BarnDoorOpenEffect`      | The source image is split horizontally and each side slides out left/right to expose the destination.
|![BarnDoorCloseEffect](doc/images/BarnDoorCloseEffect.gif)         | `BarnDoorCloseEffect`     | The destination image slides in the from the left/right obscuring the source image.
|![ShrinkToBottomEffect](doc/images/ShrinkToBottomEffect.gif)       | `ShrinkToBottomEffect`    | The source image shrinks downward exposing the destination.
|![ShrinkToTopEffect](doc/images/ShrinkToTopEffect.gif)             | `ShrinkToTopEffect`       | The source image shrinks upward exposing the destination.
|![ShrinkToCenterEffect](doc/images/ShrinkToCenterEffect.gif)       | `ShrinkToCenterEffect`    | The source image shrinks from the center of the screen exposing the destination.
|![StretchFromBottomEffect](doc/images/StretchFromBottomEffect.gif) | `StretchFromBottomEffect` | The destination image grows from the bottom obscuring the source underneath it.
|![StretchFromTopEffect](doc/images/StretchFromTopEffect.gif)       | `StretchFromTopEffect`    | The destination image grows from the top obscuring the source underneath it.
|![StretchFromCenterEffect](doc/images/StretchFromCenterEffect.gif) | `StretchFromCenterEffect` | The destination image grows from the center of the screen obscuring the source underneath it.
|![PlainEffect](doc/images/PlainEffect.gif)                         | `PlainEffect`             | A no-op transition that simply renders the source image.

## Getting Started

#### 1. Install the library:

JSegue is published to Maven Central; include the library in your Maven project's POM, like:

```
<dependency>
  <groupId>com.defano.jsegue</groupId>
  <artifactId>jsegue</artifactId>
  <version>0.0.3</version>
</dependency>
```

... or your Gradle build script:

```
repositories {
  mavenCentral()
}

dependencies {
  compile 'com.defano.jsegue:jsegue:0.0.3'
}
```

## Frequently Asked Questions

#### How do I fade-to-black or animate the appearance of a single image?

Use the `Paint` form of the `withSource()` and `withDestination()` methods in the builder.

For example, to fade an image to black:

```
SegueBuilder.of(AlphaDissolveEffect.class)
  .withSource(myImage)
  .withDestination(Color.BLACK)
  ...
  .build();
```

Or, to make an image appear using a zoom effect:

```
SegueBuilder.of(ZoomInEffect.class)
  .withSource(new Color(0, 0, 0, 0))     // Transparent color
  .withDestination(myImage)
  ...
  .build();
```

#### What does the `overlay` option do?

First, it has no effect if both images contain no areas of translucency. Otherwise, when true, the source and destination images will be alpha composited together. When false, the destination image is generally treated as fully opaque; the bounds of the destination will obscure the the other as the animation progresses. The exact impact of this property differs across segue animations and has no affect at all on some.

Which looks best is a matter of preference (as well as the composition of the source and destination images). Note that the animations shown in the table above were created with overlay on.

Kinda. The `AnimatedSegue` objects expect the source and destination images to be the same size. So if you create these objects yourself (or invoke the render() method directly), you'll need assure both source and destination images are the same size.

However, if you create a segue using `SegueBuilder`, the builder will automatically resize the image(s) to the largest dimensions.

#### Can I chain animations together or have more than two images participate in a segue?

Yes, but... This library does not manage segue sequences for you. But you can achieve this effect by registering yourself as an observer of animation completion. At the completion of each segue you can immediate start the next one in your sequence.

```
SegueBuilder.of(ZoomInEffect.class)
  .withSource(new Color(0, 0, 0, 0))    // Fully transparent
  .withDestination(myImage)
  .withCompletionObserver(segue -> startNextSegueInSequence())
  ...
  .build();
```

repository: ComandPromt/Image-Animations-Java

repo_name: ComandPromt/Image-Animations-Java


text:
# ide-theme-generator

🎨  A very simple web-app to generator a quick theme without the need of knowing the theme creating procedure at all. It was made in 2011 for [Scribes](http://scribes.sourceforge.net/) and it can be extended to support any IDE (you can help).

## Credits
- [Abdulrahman M.](https://github.com/abdumu)
- [All Contributors](../../contributors)

## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

repository: abdumu/ide-theme-generator

repo_name: abdumu/ide-theme-generator


text:
Boxes Visual Discrimination
===========================

This example comes from the visual discrimination task described in [A Hypercube-Based Indirect Encoding for Evolving Large-Scale Neural Networks](http://eplex.cs.ucf.edu/papers/stanley_alife09.pdf) (Stanley, et. al.). The paper utilises this task to demonstate HyperNEAT's ability to incorporate the problem's geometric information. For EVO, this tasks represents an ideal problem to demonstrate the differences in NEAT, HyperNEAT, HyperNEAT-LEO, ES-HyperNEAT, and ES-HyperNEAT-LEO.

## Visualising the best solution
When performing a single run of the experiment, an image file is created (use the `--image` flag to specify the output filename) showing, for each test case, the locations of the small and large boxes as well as the network's guess at the centre of the large box.

## TODO
• ~~add HyperNEAT experiment~~
• add ES-HyperNEAT experiment
• add archive and restore helpers
• use restore to enable running previous best at different resolutions

repository: sensorphalanx/evo

repo_name: sensorphalanx/evo


text:
---
layout: post
title: "Binary Search"
date: 2020-04-13 16:12:40
tags: [algorithms, python]
---

Binary search searches for the element from **sorted array**.

First, compare the target value with the middle element from the sorted array. If the target value is bigger than the middle element, eliminate the elements on the left of the array. *(Since the array is sorted, it would eliminate elements that are smaller than the middle element.)*

Repeat the process with the remaining elements. Each process eliminates half of the remaining array. So, in the worst case, it would take log n steps -- **O(log *n*)**.

```python
def binary_search (list, item):
  low = 0
  high = len(list)-1

  while low <= high:
    mid = (low + high)//2
    guess = list[mid]

    if guess == item:
      return mid
    if guess > item:
      high = mid - 1
    else:
      low = mid + 1
  return None

my_list = [4, 6, 8, 20, 39, 60, 67, 90, 104, 204]

print(binary_search(my_list, 20))
```

gha_language: CSS


text:
format: md1

# Golang Syntax

Some [flashcards](https://gist.github.com/cellularmitosis/530196ad25801ef5a4607ee480ee7034) about [golang](https://golang.org/) syntax.

---

Declare an empty function which returns nothing.

```
fake1

%

fake2
```

%

```go
func foo() {

}
```

---

Declare a function which returns an `int`.

%

```go
func foo() int {
  return 1
}
```

---

Declare a function which takes a `string` and returns `true`.

%

```go
func foo(name string) bool {
  return true
}
```

---

Declare a function which takes a pointer to a `sync.WaitGroup`.

%

```go
func foo(wg *sync.WaitGroup) {

}
```

---

Write a function with a statement which executes after the function has executed.

%

```go
func foo() int {
  defer bar()
  return 42
}
```

repository: jgarte/retainn

repo_name: jgarte/retainn


text:
# DeepTesla End-to-End Steering Model

This project showcases some of the Convolutional Neural Networks (CNNs) that can be used to model End-to-End steering from a dash-mounted camera.  The models run on MIT's [DeepTesla site](https://selfdrivingcars.mit.edu/deeptesla/), which allows for fast iteration and good visualization of the model during training

### Prerequisites

All training is done in the web browser so all that is required is a modern browser (Chrome, Firefox, etc.).  These examples were tested on both Firefox and Chrome

### Use

To experiment with one of the included networks, copy the text from the respective file in the 'Models' directory onto MIT's [DeepTesla site](https://selfdrivingcars.mit.edu/deeptesla/) and select 'Restart Training'

### Analysis

While the DeepTesla site enables one to dive straight into developing and visualizing a model, the predicted results can use improvement.  The biggest challenge appears to be that my model is not sufficiently turning the wheel, even in a turn.  This may be a reflection of the training dataset, where (like most normal driving), the wheel is usually centered.

To overcome this issue and explore greater functionality, I am building another model in Keras/TF

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

## Acknowledgments

* README template courtesy of Bille Thompson - [PurpleBooth](https://github.com/PurpleBooth)

repository: oshawkat/DeepTesla

repo_name: oshawkat/DeepTesla


text:
README

Asume Tweepy, nltk, Spark and SystemGlite environmets are properly set in your computer
Insert your own Twitter Secrect Keys

The coding for this project contains the following steps:
(1)     Get people's basic public linkedin information using /linkedin/3.py

(2)     Use people's name to do search these people in Twitter and return Twitter user_id using /twitter_search/find.py

(3)     (a)Use Twitter user_id to find users' most recent 100 tweets, text mining preprocesing is also included in /restapi/get_tweets.py

	(b)Use Twitter user_id to find users' followings using /restapi/get_followings.py

(4)     Clustering based on tweets using /restapi/use_tweets/tf.py under spark environment
	group.py can remove each person to the corresbonding cluster

(5)     Clustering based on tweets using /restapi/use_followings/mutal_friend_score.py under spark environment
	group.py can remove each person to the corresbonding cluster

(6)     On the Ubuntu terminal
        $sudo service apache2 start
        $cd /DIR/gshell
        $./sysGSuperMgr 6688 10

    Then open the browers and upload the node and edge to generate graphs
    Then open the browers and upload the node and edge to generate graphs


text:
# A Note on Permissions

You may receive an `EACCES` error when you try to install a package globally. This indicates that you do not have permission to write to the directories that npm uses to store global packages and commands.

You can fix this problem using one of three options:

1. Change the permission to npm's default directory.
2. Change npm's default directory to another directory.
3. Install node with a package manager that takes care of this for you.

You should back-up your computer before moving forward.

## Option 1: Change the permission to npm's default directory

1. Find the path to npm's directory:

        npm config get prefix

    For many systems, this will be `/usr/local`.
    >**WARNING**: If the displayed path is *just* `/usr`, **switch to [Option 2](#option-2-change-npms-default-directory-to-another-directory)** or you will mess up your permissions.

2. Change the owner of npm's directories to the name of the current user (your username!):

        sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

    This changes the permissions of the sub-folders used by npm and some other tools (`lib/node_modules`, `bin`, and `share`).

## Option 2: Change npm's default directory to another directory

There are times when you do not want to change ownership of the default directory that npm uses (i.e. `/usr`) as this could cause some problems, for example if you are sharing the system with other users.

Instead, you can configure npm to use a different directory altogether. In our case, this will be a hidden directory in our home folder.

1. Make a directory for global installations:

        mkdir ~/.npm-global

2. Configure npm to use the new directory path:

        npm config set prefix '~/.npm-global'

3. Open or create a `~/.profile` file and add this line:

        export PATH=~/.npm-global/bin:$PATH

4. Back on the command line, update your system variables:

        source ~/.profile

Test: Download a package globally without using `sudo`.

        npm install -g jshint

Instead of steps 2-4 you can also use the corresponding ENV variable (e.g. if you don't want to modify `~/.profile`):

        NPM_CONFIG_PREFIX=~/.npm-global npm install -g jshint

## Option 3: Use a package manager that takes care of this for you.

If you're doing a fresh install of node on Mac OS you can avoid this problem altogether by using the [Hombrew](brew.sh) package manager.  Homebrew sets things up out of the box with the correct permissions.

    brew install node

license: ISC

gha_license_id: ISC


text:
[SCION](https://github.com/jbeard4/SCION) is an implementation of [SCXML](http://www.w3.org/TR/scxml/) in JavaScript.

**SCION.NET** provides lightweight bindings to the SCION library for CLR languages (C#, etc.), via [ikvm](http://www.ikvm.net/) and [Rhino](http://www.mozilla.org/rhino/). This allows SCXML to easily be used in .NET development.

For a basic usage example of usage, see [Test.cs](https://github.com/jbeard4/SCION.NET/blob/master/test/Test.cs)


text:
# street-buff
Implementation and extension of the MEAN Stack tutorial from thinkster.io (https://thinkster.io/mean-stack-tutorial/)

Reddit clone :)

Independent exercises (end of the tutorial):
* feature downvote: Implement a 'downvoting' feature
* feature vote once: Only allow authenticated users to vote once.
* feature number of answers: Display the number of answers next to each question on the main page
* feature hide new answers box: use ng-hide to hide the 'new answer' and 'new question' input box until a user clicks a button to see the field
*

Independent exercises (thought up by myself, though, Reddit itself is the design document :) )
* feature: delete answers and questions: only authenticated user (and the user who posted the question or answer) (server and client)
* feature: upvoting causes the downvote to go away, and vice versa.
* feature: upvoting and already-upvoted (and vice versa) question/answer will un-upvote/downvote the question/answer

###To run:
1. ``cd`` to ``street-buff`` root directory
2. ``npm install``
3. ```set DEBUG=street-buff:server & npm start``` (Windows) | ```DEBUG=street-buff:server npm start``` (Mac and Linux)


text:
# dictobot

A discord bot built with [discord.py](https://pypi.org/project/discord.py/) and Merriam Webster's [dictionary api](https://dictionaryapi.com/).

To run on your own clone the repository, install dependencies, setup the env file with your own api key/discord token, and enjoy!


text:
# Welcome to atom docs:

- basic print function
```rb
print('hello world')
```

- basic def:
```rb
def hello()
    print('hello')
end

hello()
```

- soon more tutorials will be added soon!!

repository: atomlang/atomlang

repo_name: atomlang/atomlang


text:
# Changelog

### [0.9.2]

##### New

* Laravel 5.4 integration.
* Laravel 5.3 integration.
* New composer.json structure.
* New composer.json structure.
* Right controls.
* Release 0.9.2.
* Add key-value translation, delete and change item, CHG: view.
* Translations view for version 0.9.2.
* Translations view for version 0.9.2.

##### Changes

* Readme.md structure change.
* Change classname.
* Added homepage and friendly names to components.
* Updated ACL file.
* Remove unused html divs.

##### Other

* Update composer.json.
* Update composer.json.
* Fix for new composer handler.
* Changed project name on composer.
* INITIAL ANTARES COMMIT.
* Initial commit.

repository: tlsnaui/translations

repo_name: tlsnaui/translations


text:
---
hrs_structure:
  division: '1'
  volume: '1'
  title: '2'
  chapter: '11'
  section: 11-7.5
type: hrs_section
tags:
  - Government
menu:
  hrs:
    identifier: HRS_0011-0007_0005
    parent: HRS0011
    name: 11-7.5 Duties of the elections commission
weight: 20060
title: Duties of the elections commission
full_title: 11-7.5 Duties of the elections commission
---
**§11-7.5 Duties of the elections commission.** The duties of the elections commission are to:

(1) Hold public hearings;

(2) Investigate and hold hearings for receiving evidence of any violations and complaints;

(3) Adopt rules pursuant to chapter 91;

(4) Employ, without regard to chapter 76, a full-time chief election officer, pursuant to section 11-1.6;

(5) Conduct a performance evaluation of the chief election officer within two months after the date a general election is certified;

(6) Hold a public hearing on the performance of the chief election officer and consider the information gathered at the hearing in deliberations on the chief election officer's reappointment; and

(7) Advise the chief election officer on matters relating to elections. [L 2004, c 57, pt of §6; am L 2015, c 173, §2]

repository: SamMade/BlueAndKrabby

repo_name: SamMade/BlueAndKrabby