text:
---
layout: post
title: angular 2 selected libraries
published: true
---

Angular 2 libraries are less numerous than angular 1 equivalents, but they are growing fast. The good point is that you do not loose to much time finding the right one, as it used to be the case with angular 1. And as angular 2 is much clearer, they are generally easier to understand with less code, no dependency to jQuery...

### List of angular 2 resources

* **Awesome Angular**       [https://github.com/AngularClass/awesome-angular](https://github.com/AngularClass/awesome-angular2#ahead-of-time-compilation)

* **Awesome angular components** List of angular 2 components

[https://github.com/brillout/awesome-angular-components](https://github.com/brillout/awesome-angular-components)

### Font & icon

* **angular2-fontawesome** Font awesome wrapper,  make the icon a component or a directive and make font awesome options customisable

[https://github.com/travelist/angular2-fontawesome](https://github.com/travelist/angular2-fontawesome)

### Layout

* **flex layout** api on top of flexbox to automatize flex code and take account of breakpoint ...
Use directives to styles the page. Is independent of Angular material.

In their [flexbox api](https://github.com/angular/flex-layout/wiki/API-Documentation#containers)

There are
* container directives
* Child elements in a container directives
* Special directives (responsive utility...)

Code look like that
````pug
div(fxFlex fxLayout='row')
    div(fxFlex="20%")
      p Code
    div(fxFlex="30%")
      p Start Date
    div(fxFlex="30%")
      p End Date
    div(fxFlex="20%")
      p Status
````

And is then interpreted at run time to adapt to screen size.

### Parallax

* **Ang2 parallax**

[https://github.com/allenRoyston/ang2-parallax](https://github.com/allenRoyston/ang2-parallax)

###  Angular 2 UI components library

We have put our [the angular 2 & 4 UI components libraries](/angular-2-4-ui-components-libraries) list in a separate article

### Carousel

* [Ngx Slick](https://github.com/devmark/ngx-slick/tree/master/src) wrapper from [slick jquery plugin](http://kenwheeler.github.io/slick/)

### Complex stackable grid

* [Grid stack](http://gridstackjs.com/) and it's ng2 wrapper [ng2-gridstack](https://github.com/ApolloSSC/ng2-gridstack)
## Events

* **ng-radio** a message bus for angular to replace missing $cope.$emit and allow sibling components to talk and more generally global casting of  a message. Use RxJs [https://github.com/govorov/ng-radio](https://github.com/govorov/ng-radio)

* **angular2 notification** : toaster or browser notification to confirm events...
[https://github.com/flauc/angular2-notifications](https://github.com/flauc/angular2-notifications)

## Pipes

* **Angular pipes** : Shared pipes (filters) libraries. Standard  angular pipe are very limited but pipes are very similar project, so a library of pipes makes a lot of sense
[https://github.com/fknop/angular-pipes](https://github.com/fknop/angular-pipes)

The doc the [different available pipes](https://fknop.gitbooks.io/angular-pipes) it is available here or there on [how to define pipes in your modules and components](https://github.com/a8m/ng-pipes)

* **angular-linky** : angular wrapper on a js library that transform in links emails, urls, phone numbers...

[https://github.com/dzonatan/angular-linky](https://github.com/dzonatan/angular-linky)

* **Angular 2 Mardown** Convert markdown to html

Angular 2 markdown make also the auto-linking, you can  see all markdown styles in their [demo](https://dimpu.github.io/angular2-markdown/home).

[https://github.com/dimpu/angular2-markdown](https://github.com/dimpu/angular2-markdown)

* **Moment date pipes**

[https://github.com/urish/angular2-moment](https://github.com/urish/angular2-moment)

## Logging

* **ngLogger** a logger service for angular : allow to disable loging to group log....

[https://github.com/noemi-salaun/ng-logger](https://github.com/noemi-salaun/ng-logger)

## Forms

* credit card validation

[https://github.com/nogorilla/angular-cc-library](https://github.com/nogorilla/angular-cc-library)

* [ng2 validation](https://github.com/yuyang041060120/ng2-validation) / Add many form  validator to default one

## Data

* **JS-DATA** Data store for js  (front and back)
[Angular 2 example](https://github.com/js-data/js-data-examples/blob/master/client/angular2/src/store.ts)
[Using observable](http://www.js-data.io/v3.0/docs/jsdata-observables)

* **Angular + Redux** Integration of redux data store with angular 2

[https://github.com/angular-redux/store](https://github.com/angular-redux/store)

## Dynamic component....

* **ng-dynamic** One use case is "project" content to a content...dynamically

[https://github.com/laco0416/ng-dynamic](https://github.com/laco0416/ng-dynamic)

## Infinite scroll

* **Angular 2 infinite scroll**    [https://github.com/orizens/angular2-infinite-scroll](https://github.com/orizens/angular2-infinite-scroll)

* **ng2-page-scroll** Scroll in the page
[https://github.com/Nolanus/ng2-page-scroll](https://github.com/Nolanus/ng2-page-scroll)

* **ng2-scroll-to** Have the advantage of allowing to scroll inside an element. No service to though
[https://github.com/drusso85/ng2-scroll-to](https://github.com/drusso85/ng2-scroll-to)

* **ng2-scroll-to-el** [https://github.com/MarcinMichalik/ng-scrollTo](https://github.com/MarcinMichalik/ng-scrollTo)

* **Angular Perfect Scrollbar** Wrapper for perfect scroll bar, a lib to customise the scrollbars

[https://github.com/zefoy/ngx-perfect-scrollbar](https://github.com/zefoy/ngx-perfect-scrollbar)

## Layout

* Flex  layout : Angular team  implementation of flexbox

[https://github.com/angular/flex-layout](https://github.com/angular/flex-layout)

## Drag & Drop

* Dragula : the most popular but as a wrapper to a vanilla js lib [https://github.com/valor-software/ng2-dragula](https://github.com/valor-software/ng2-dragula)

* Ng-dnd : angular native library
[https://github.com/akserg/ng2-dnd](https://github.com/akserg/ng2-dnd)

## Documentation

* **Angular doc** : Online documentation from github repo    [http://angulardoc.io/main](http://angulardoc.io/main)

## translation and internationalization

* **ngx-translate** : the library for internationalization in angular

[https://github.com/ngx-translate/core](https://github.com/ngx-translate/core)

## Observable

* **Using RXJS n angular**

[https://auth0.com/blog/making-use-of-rxjs-angular/](https://auth0.com/blog/making-use-of-rxjs-angular/)

* **Hot and cold observable**

[https://medium.com/<EMAIL_ADDRESS>
* **Observable and subjects**

[http://stackoverflow.com/questions/39494058/angular-2-behavior-subject-vs-observable](http://stackoverflow.com/questions/39494058/angular-2-behavior-subject-vs-observable)

## Debug

* **pretty json** A nice json pipes with syntax highlighting

## Styling

* [Advanced styling for angular v4](https://medium.com/google-developer-experts/angular-advanced-styling-guide-v4-f0765616e635)

## Table

* [NgX-datatable](https://github.com/swimlane/ngx-datatable) complete big or small table

## Charts

* [ng2-charts](http://valor-software.com/ng2-charts/#doughnutChart) Integration of charts js for angular

## Local + session storage / Cookie management

* [angular2-localstorage](https://github.com/marcj/angular2-localstorage) a decorator to retrieve local storage data directly in component

* [local storage + session storage](https://github.com/PillowPillow/ng2-webstorage)

* [Cookie management](https://github.com/salemdar/ngx-cookie)

## Errors

* [Global errror handling](https://medium.com/@amcdnl/global-error-handling-with-angular2-6b992bdfb59c)

## Ng-template

* [Ng-template](https://toddmotto.com/angular-ngfor-template-element#ng-template-element)

## Animation

* [angular2-counto](https://github.com/izupet/angular2-counto) Animation from 0 to the number

### DOM

https://blog.angularindepth.com/exploring-angular-dom-abstractions-80b3ebcfc02

### Utility

* Generate UUID in the front endhttps://github.com/wulfsolter/angular2-uuid


text:
### [CVE-2006-1154](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-1154)
![](https://img.shields.io/static/v1?label=Product&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Vulnerability&message=n%2Fa&color=brighgreen)

### Description

PHP remote file inclusion vulnerability in archive.php in Fantastic News 2.1.2 allows remote attackers to include arbitrary files via the CONFIG[script_path] variable.  NOTE: 2.1.4 was also reported to be vulnerable.

### POC

#### Reference
- https://www.exploit-db.com/exploits/3027

#### Github
No PoCs found on GitHub currently.

license: MIT

repository: trickest/cve

branch_name: refs/heads/main

extension: md

gha_language: HTML

gha_license_id: MIT

license_type: permissive

repo_name: trickest/cve


text:
# UT Bus

## Transports

ut-bus supports the following transports:

* [hemera](###hemera)
* [jsonrpc](###jsonrpc)
* [rabbot](###rabbot)
* [moleculer](###moleculer)
* [utRpc](###utRpc)

### hemera

[Hemera repo](https://github.com/hemerajs/hemera)

#### configuration options

Check [hemera config schema](https://github.com/hemerajs/hemera/blob/master/packages/hemera/lib/configScheme.js)
for all options.

In addition to all the options you can also pass a `nats` property which will
be used for the nats connection.
Check the [Nats connect options](https://github.com/nats-io/nats.js?utm_source=recordnotfound.com#connect-options)

Configuration example:

```js
{
    utBus: {
        serviceBus: {
            hemera: {
                ...hemeraOptions,
                nats: {
                    ...natsConnectOptions
                }
            }
        }
    }
}
```

### jsonrpc

http transport over json-rpc 2.0 protocol.

#### jsonrpc configuration options

* `port` (number) [optional] - tcp port. If omitted then a random port will be used.
* `openId` (array) [optional] - a list of openId providers.
* `api` (object) [optional] - swagger configuration.
  * `ui` (boolean | object) [optional]
    * `base` (string) [optional] - ui path prefix (default '/api')
    * `initOAuth` (object) [optional] - swagger ui OAuth credentials
      * `clientId` (string) - pre-populated in swagger ui auth interface
      * `clientSecret` (string) - pre-populated in swagger ui auth interface
* `domain` (string | boolean) [optional] - Enables dns discovery and uses this
  property as a top-level domain to use for records. (both regular or multi-cast
  discovery mechanisms are supported).
  If set to `true` then machine's hostname will be used as a top-level domain
* `consul` (object) [optional] - used for configuring a [consul client](https://github.com/silas/node-consul)
  in case [`Consul`](https://www.consul.io/) service discovery is required.
  For reference check [consul client options](https://github.com/silas/node-consul#consuloptions)
* `prefix` (string) [optional] - prefix to be used in conjunction
  with the namespace to construct a `host` when resolving
  service locations. (e.g. host will become `prefix + namespace`)
* `suffix` (string) [optional] - suffix to be used in conjunction
  with the namespace to construct a `host` when resolving
  service locations. (e.g. host will become `namespace + suffix`)
* `capture` (string) [optional] - enable capturing of requests and responses in
  individual `<capture>/*.http` files for debugging purposes.
  Note that this is not suitable for use in production and the folder
  specified in this setting must exist. Also due to hapi API constraints,
  some validations are turned off when capture is activated.
* `gateway` (object) [optional] - call remote methods from bus running within different
  security context. This is an easy way to integrate two separate implementations
  where the gateway calls the other side with dedicated credentials for server to
  server calls.
  * `<prefix>` (object) - configuration to apply for calls with this prefix, i.e.
  calls like `utMethod('prefix/x.x.x')(...params)`
    * `url` - specifies the base URL of the remote bus. This is alternative to
    specifying the individual configuration options below, as all of them can
    form an URL<EMAIL_ADDRESS>    * `protocol` - remote bus protocol
    * `host`  - remote bus host
    * `port`  - remote bus port
    * `username` - specifies a username to use for authentication against
    the remote bus
    * `password` - specifies a password to use for authentication against
    the remote bus
* `tls` (object) [optional] - can be used to enable TLS. Accepts any of the options
  passed to node.js [https.createServer](https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener)
  Specifically, the following options, are interpreted as filesystem paths:
  * `cert` - Server certificate
  * `key` - Server private key
  * `ca` - Trusted root certificate for mutual TSL with self signed
  (client) certificates. To enable mutual TLS, use this option
  together with setting `tls.requestCert` to `true`.
  * `crl` - certificate revocation lists

  For more information consult [tls.createSecureContext](https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options).
* `cors` (object | boolean) [optional] - Enables cors for all routes.
  Additional place where cors can be enabled or/and overwritten
  is in validations. For detailed configuration, see docs for hapi `route.options.cors`
* `security` (object | boolean) [optional] - Enables security headers on all routes.
  For detailed configuration, see docs for hapi `route.options.security`
* `client` (object) [optional] - HTTP/HTTPS client configuration options:
  * `client.tls` (object) [optional] - use this option to enable
  TLS or mutual TLS for bus to bus communication.
  These options are passed to the
  [request](https://www.npmjs.com/package/request)
  module, and the following ones are interpreted as file paths:
    * `cert` - Client certificate
    * `key` - Client private key
    * `ca` - Trusted root certificate for mutual TSL with self signed
    (server) certificates.

Configuration examples:

```js
{
    utBus: {
        serviceBus: {
            jsonrpc: {
                port: 9876,
                ui: true
            }
        }
    }
}
```

```js
{
    utBus: {
        serviceBus: {
            jsonrpc: {
                port: 9876,
                openId: [
                    'https://accounts.google.com/.well-known/openid-configuration'
                ],
                ui: {
                    initOAuth: {
                        clientId: 'someClientId'
                        clientSecret: 'someClientSecret'
                    }
                }
            }
        }
    }
}
```

### rabbot

[Rabbot repo](https://github.com/arobson/rabbot)

#### rabbot configuration options

* debug (Boolean) - if set to true then additional debug queue and binding will
  be created. Also the reply queue in debug mode will not be subscribed for
  batch acknowledgement and will get auto deleted upon disconnection.
* connection (Object) - see [connection options](https://github.com/arobson/rabbot/blob/master/docs/connections.md#rabbotaddconnection--options-)
  for more info.
* exchanges (Array) - exchanges to be auto created
  upon establishing a connection.

  if omitted then te following exchange will be created:

  ```js
  {
    name: bus.id,
    type: 'fanout',
    autoDelete: true
  }
  ```

* queues (Array) - queues to be auto created upon establishing a connection.

  if omitted then te following queue will be created:

  ```js
  {
    name: bus.id,
    subscribe: true,
    autoDelete: true
  }
  ```

  if omitted and `debug` is set to true, then the following
  queue will also be created:

  ```js
  {
    name: bus.id + '(debug)',
    subscribe: false,
    autoDelete: false
  }
  ```

* bindings (Array) - bindings to be auto created upon establishing a connection.
  if omitted then te following binding will be created:

  ```js
  {
    exchange: bus.id,
    target: bus.id,
    keys: []
  }
  ```

  if omitted and `debug` is set to true, then the following
  binding will also be created:

  ```js
  {
    exchange: bus.id,
    target: bus.id + '(debug)',
    keys: []
  }
  ```

Example:

```js
{
    utBus: {
        serviceBus: {
            rabbot: {
                debug: true,
                connection: {
                    ...connectionOptions
                },
                exchanges: [
                    ...exchanges
                ],
                queues: [
                    ...queues
                ],
                bindings: [
                    ...bindings
                ]
            }
        }
    }
}
```

### moleculer

[moleculer repo](https://github.com/moleculerjs/moleculer)
This transport uses moleculer's `ServiceBroker` internally.

#### moleculer configuration options

See [Moleculer Broker options](https://moleculer.services/docs/0.14/configuration.html#Broker-options)
for full list.

Example:

```js
{
    utBus: {
        serviceBus: {
            moleculer: {
                ...moleculerOptions
            }
        }
    }
}
```

If the `moleculer` property is set to a `string` instead of an `object` then it
will be used as a transporter. E.g.

```js
{
    utBus: {
        serviceBus: {
            moleculer: 'abc'
        }
    }
}
// is equivalent to
{
    utBus: {
        serviceBus: {
            moleculer: {
                transporter: 'abc'
            }
        }
    }
}
```

### utRpc

This is an transport which relies on [ut-rpc](https://github.com/softwaregroup-bg/ut-rpc)
for delivering messages over tcp streams.

#### utRpc configuration options

`utRpc` configuration property can be either a `string` or a `number`.
If set to a `string` then the messages will be sent over a
[`domain socket`](https://en.wikipedia.org/wiki/Unix_domain_socket) (on Linux)
or a [`named pipe`](https://en.wikipedia.org/wiki/Named_pipe) (on windows).

If set to a `number` that would mean the messages will be sent over the
respective tcp port.

Example:

```js
{
    utBus: {
        serviceBus: {
            utRpc: 9876 // tcp port
        }
    }
}
// or
{
    utBus: {
        serviceBus: {
            utRpc: 'abc'
            // (for windows) named pipe: \\.\pipe\ut5-abc
            // (for linux) domain socket: /tmp/ut5-abc.sock
        }
    }
}
```

## Caching

Ut-bus provides built-in caching mechanisms.
There are 2 preconditions which are needed in order for caching to be achieved.

1) There should be an instance of ut-port-cache defined on implementation level.
This is necessary because ut-bus doesn't do the caching itself
but relies on having a running instance of ut-port-cache internally.

    E.g:

    ```js
    module.exports = () => () => ({
        adapter: [
            function cache(...params) {
                return class cache extends require('ut-port-cache')(...params) {};
            }
        ]
    });
    ```

2) Cache configuration must be explicitly provided as part of the options
when importing a bus method.

    E.g:

    ```js
    const options = {
        cache: {
            // cache options
        }
    };
    return bus.importMethod('namespace.entity.action', options)(msg);
    ```

    Where options.cache allows the following configuration:

    * `key` - an **object** or a **function** describing the storage options.
        Can be either an object or a function returning an object.
    * **object** - an object consisting of the following properties.
        * `id` - a **string** to be used as a storage key
        * `params` - a **string** or an **object** used to define the segment
        by appending these params to the imported method name.
        (Not used if a `segment` is passed).
        ut-port-cache will use the params
        to build the segment in the form of a query string.
        * **string** - E.g. if `segment` then `namespace.entity.action?segment`
        * **object** - E.g. if `{x: 1, y: 2}` then `namespace.entity.action?x=1&y=2`
        * `segment` - a **string** to bypass the params and define the segment directly
    * **function** - a function returning an object
    with the same properties as described above.
    The function accepts. Using a function instead of a predefined object
    provides the convenience of defining dynamic id, params and segment
    depending on the incoming message. E.g.

        ```js
        function(msg) {
            return {
                id: msg.id,
                params: msg.params
            }
        }
        ```

    * `before` - **string** - cache operation before calling the method,
        can be one of 'get', 'set', 'drop', undefined
        This property is optional.
        The method names usually follow the following pattern: `namespace.entity.action`.
        If the "action" part of the method name matches one of the predefined bindings
        then the respected cache operation will be applied automatically:

        ```json
        {
            "get": "get",
            "fetch": "get",
            "add": false,
            "create": false,
            "edit": "drop",
            "update": "drop",
            "delete": "drop",
            "remove": "drop"
        }
        ```

    * `after` - **string** - cache operation before calling the method,
        can be one of 'get', 'set', 'drop', undefined
        This property is optional.
        The method names usually follow the following pattern: `namespace.entity.action`.
        If the "action" part of the method name matches one of the predefined bindings
        then the respected cache operation will be applied automatically:

        ```json
        {
            "get": "set",
            "fetch": "set",
            "add": "set",
            "create": "set",
            "edit": "set",
            "update": "set",
            "delete": false,
            "remove": false
        }
        ```

    * `ttl` - **number** optional cache duration, default is set in cache port
    * `port` - **string** optional cache port namespace, default is `cache`
    * `optional` **boolean** optional - indicating whether caching itself is optional.
        I.e. no error will be thrown if caching doesn't succeed. default is `false`.

### Full example

```js
bus.importMethod('some.method', {
    cache: {
        key: msg => ({
            id: msg.id,
            params: 'op1',
            segment: 'my-segment',
        }),
        before: 'get',
        after: 'set',
        ttl: 5000
    }
})
```

repository: aalzehla/ut-bus

branch_name: refs/heads/master

repo_name: aalzehla/ut-bus


text:
# Boston.rb

This is the source code for the Boston Ruby Group website, [bostonrb.org](http://bostonrb.org).

It is licensed under the MIT License, so if you would like to fork and customize for your own user group, you are more than welcome to.

## Getting up and running

### Requirements

bostonrb.org is built and managed primarily the following:

 * Ruby 1.8.x
 * Rubygems 1.3.5
 * Ruby on Rails 2.3.9
 * MySQL
 * git

You will need these installed before you can start developing and running the application. For help getting this environment running, see [these excellent installation notes](http://wiki.devchix.com/index.php?title=Workshop_Installation_Notes)

(You can try Google for documentation on MySQL installation for your operating system.)

### Configure RVM and project gemset (RVM is optional, but recommended)

If necessary install Ruby 1.8.7

    rvm install 1.8.7-p249

Create a gemset to minimize gem conflicts

    rvm --create 1.8.7-p249@bostonrb

Make sure you use Ruby 1.8.7 and the bostonrb gemset in every terminal

    rvm use 1.8.7-p249@bostonrb

### Configuring RubyGems

Since we use some gems that are only on github (ie feedzirra), this needs to be run, if you haven't before:

    gem sources -a http://gems.github.com

### Downloading

We're using GitHub for our git hosting. To download the source, use the following command:

    git clone git://github.com/bostonrb/bostonrb.git

### Initial setup

Before anything else, change into the newly created `bostonrb` directory.

    cd bostonrb

Copy the sample database config file and edit as needed.

    cp config/database.yml.sample config/database.yml

Install Rails

    gem install rails -v 2.3.9

Install a couple gems to satisfy plugin requirements

    gem install chronic -v 0.2.3
    gem install haml -v 2.2.20
    gem install factory_girl -v 1.2.2
    gem install fakeweb -v 1.2.0

We need to make sure all the gem dependencies are installed. This may take several minutes:

    rake gems:install

Now we need to create an initial database. We currently assume you have MySQL installed, and that you can login as 'root' without a password.

    rake db:create

Next migrate the database to the latest version:

    rake db:migrate

At last, we can run the server:

    script/server

This will keep running until you hit Control-C, but now you can open a browser and go to http://localhost:3000 to see the app running.

 + If you get odd MySQL errors when you run the server, you may have a mismatch between the version of this gemset's mysql gem and your installation of MySQL.  Running "rake gems:install" installs the most recent version of each gem (unless specified otherwise in config/environment.rb).  If you use MySQL databases successfully in another project, check that project's version of the mysql gem.  Try uninstalling the version installed in this gemset by "rake gems:install", and install the version that works for you elsewhere, e.g. "gem install mysql -v 2.7".

You'll notice the site is kind of... empty. You can generate a bit of seed data with:

    rake db:bootstrap

## Testing

We need to make sure all the gem dependencies for the test environment are installed. This may take several minutes:

    rake gems:install RAILS_ENV=test

Also, you'll need to vendor and build your gems:

    rake gems:unpack RAILS_ENV=test
    rake gems:build RAILS_ENV=test

We are using shoulda for our testing. Before running them, you need to run the following to create the test database:

    rake db:create RAILS_ENV=test

At this point, you can run unit tests with:

    rake test

We are also using cucumber for user stories / integration testing. Install the gem dependencies:

    rake gems:install RAILS_ENV=cucumber

Vendor and build your gems:

    rake gems:unpack RAILS_ENV=cucumber
    rake gems:build RAILS_ENV=cucumber

Remove an extraneous file, if you have it:

    rm features/step_definitions/html_steps.rb

You can now run your cucumber tests with:

    rake features

## Regular scheduled tasks

Tweets and blog posts are regularly updated, based on the users in the system. You can run the following to make them update in development:

    rake get_tweets
    rake get_blogs

For our EY deployment, there's a custom wrapper to handle logging output at  /engineyard/custom/cron_wrapper, which among other things, adds logging to /data/bostonrb/current/logs. It takes four arguments: the application to run for (always will be bostonrb), the name of the log file, the rails environment, and lastly the command to run

The current crontab entries look like:

    */5 * * * * /engineyard/custom/cron_wrapper bostonrb get_tweets production 'rake get_tweets'
    */5 * * * * /engineyard/custom/cron_wrapper bostonrb get_blogs production 'rake get_blogs'

## Tools and libraries used

Here is a list, in no particular order, of the libraries and other tools used, and how or why we're using them.

### [RedCloth](http://redcloth.org/)

Library for generating HTML from [textile](http://redcloth.org/textile) markup. We use this so we don't have to have users enter HTML for descriptions of jobs, events, etc

### BlueCloth

Library for generating HTML from [markdown](http://daringfireball.net/projects/markdown/) markup. We use this so we don't have to have users enter HTML for descriptions of jobs, events, etc

### le-git

A library by Josh Nichols and Dan Croak to access the [GitHub API](http://develop.github.com/). Users enter their GitHub username when setting up an account, and we use le-git to aggregate them.

### twitter-search

A library by Dan Croak to access the [Twitter Search API](http://apiwiki.twitter.com/Twitter-API-Documentation). Users enter their Twitter usernames when setting up an account, and we use twitter-search to aggregate them.

### fakeweb

A test library that lets you intercept network connections setup by [net/http], and setup canned responses for them.

We use this to make sure no network connections happen during testing.

### feedra

A library by Josh Nichols that lets you easily setup add feed aggregation to a Rails app.

We use this to let users and companies enter the URL of their blog feed, so we can aggregate it.

### gravtastic

A library for interacting with [gravatar](http://en.gravatar.com/).

We use this to display user gravatars on the front page.

### haml

### mocha

### inherited_resources

### has_markup

### clearance

### factory_girl

### pacecar

### shoulda

### truncate_html

An extension to ActionView written by Harold Gimenez to truncate

### will_paginate

An extension to ActiveRecord to allow for easily pagination of queries.

We usually use this on index pages, where we want to show several smaller pages of results, rather than one extremely long one.

### bootstrapper

### fast_random

An extension to ActiveRecord written by Harold Gimenez to provide a database asgnostic named_scope to get a random record.

We use this to

### geokit

A library which can geocode an address into a latitude and longitude. We use this geocode the addresses of our events, so we can display a Google map to them in combination with Google Maps

### hoptoad_notifier

### validates_email_format_of

A plugin to add an ActiveRecord validation method for emails. This is used to validate a user's email address.

### validates_url_format_of

A plugin to add an ActiveRecord validation method for URLs. This is used to validate a user's website URL.

## Hosting

EngineYard is super awesome and provides us with a production environment. [Josh Nichols](http://github.com/technicalpickles) and [Dan Croak](http://github.com/dancroak) have access to it if any changes need to be deployed.

## Contributing

You should go through the steps lined out in 'Getting up and running'.

For bugs and features requests, we use GitHub Issues. You can see what is open here: http://github.com/bostonrb/bostonrb/issues

To contribute, you should fork on GitHub, make your changes, and then either comment on an existing issue pointing at your changes, or create a new issue if it's a new bug or feature.

## Contributors

Dan Croak, Josh Nichols, Harold Gimenez, Dan Pickett, Rebecca Frankel, Joe Ferris.

Design by Angelo Simeoni.

repository: adparadise/bostonrb

extension: markdown

repo_name: adparadise/bostonrb


text:
Disallows sparse arrays

Sparse arrays are arrays that contain _empty slots_, which later could be
handled either as `undefined` value or skipped by array methods, and this may
lead to unexpected behavior:

```typescript
[1, , 2].join(); // => '1,,2'
[1, undefined, 2].join(); // => '1,,2'

[1, , 2].flatMap((item) => item); // => [1, 2]
[1, undefined, 2].flatMap((item) => item); // => [1, undefined, 2]
```

### Invalid:

```typescript
const items = ["foo", , "bar"];
```

### Valid:

```typescript
const items = ["foo", "bar"];
```

gha_language: Rust


text:
---
categories:
- til
comments: true
date: "2016-10-28T00:00:00Z"
description: Some key point around issues with Ninject in OWIN WebApi application
tags:
- english
- dotnet
- nuget
title: 'Today I Learned: Nuget commands'
---

The following command will update all packages in every project to the latest version available from nuget.org.

{{< highlight bash >}}
Update-Package
{{< / highlight >}}

You can also restrict this down to one project.

{{< highlight bash >}}
Update-Package -Project YourProjectName
{{< / highlight >}}

If you want to reinstall the packages to the same versions as were previously installed then you can use the `-reinstall` argument with `Update-Package` command.

{{< highlight bash >}}
Update-Package -reinstall
{{< / highlight >}}

You can also restrict this down to one project.

{{< highlight bash >}}
Update-Package -reinstall -Project YourProjectName
{{< / highlight >}}

The `-reinstall` option will first uninstall and then install the package back again into a project.

Thanks to [stackoverflow](http://stackoverflow.com/a/6882750)


text:
# Docker PHP-FPM 7.3, NGINX 16
This image is based off https://github.com/TrafeX/docker-php-nginx
What's added is opcache extension and enabled it by default.

* Built on the lightweight and secure Alpine Linux distribution
* Very small Docker image size (+/-35MB)
* Uses PHP 7.3 for better performance, lower cpu usage & memory footprint
* Optimized for 100 concurrent users
* Optimized to only use resources when there's traffic (by using PHP-FPM's ondemand PM)
* The servers Nginx, PHP-FPM and supervisord run under a non-privileged user (nobody) to make it more secure
* The logs of all the services are redirected to the output of the Docker container (visible with `docker logs -f <container name>`)
* Follows the KISS principle (Keep It Simple, Stupid) to make it easy to understand and adjust the image to your needs

## Usage

Start the Docker container:

    docker run -p 80:8080 matthewsuan/nginx-php-fpm-opcache

See the PHP info on http://localhost, or the static html page on http://localhost/test.html
Or mount your own code to be served by PHP-FPM & Nginx

    docker run -p 80:8080 -v ~/my-codebase:/var/www/html matthewsuan/nginx-php-fpm-opcache

## Configuration
In [config/](config/) you'll find the default configuration files for Nginx, PHP and PHP-FPM.
If you want to extend or customize that you can do so by mounting a configuration file in the correct folder;

Nginx configuration:

    docker run -v "`pwd`/nginx-server.conf:/etc/nginx/conf.d/server.conf" matthewsuan/nginx-php-fpm-opcache

PHP configuration:

    docker run -v "`pwd`/php-setting.ini:/etc/php7/conf.d/settings.ini" matthewsuan/nginx-php-fpm-opcache

PHP-FPM configuration:

    docker run -v "`pwd`/php-fpm-settings.conf:/etc/php7/php-fpm.d/server.conf" matthewsuan/nginx-php-fpm-opcache

_Note; Because `-v` requires an absolute path I've added `pwd` in the example to return the absolute path to the current directory_

repository: matthewsuan/docker-php-nginx

repo_name: matthewsuan/docker-php-nginx


text:
---
id: sensible-folder-structure
title: How to create a sensible folder structure on the external data SSD/HDD?
sidebar_label: Sensible folder structure
---

Recommended is to create the folder structure on the external data SSD/HDD like this.

Create a folder on the drive that contains all your files. Inside this folder, there will be the user folders and other folders that shall get shared between users in the future. Every user-folder should contain an `Archive`, `Sync` and `Backup folder` and you should strictly separate between them. The `Sync` folder should contain files and folders that are used or changed often and thus will get synchronized via the Nextcloud Desktop client. `Archive` contains all files and folders that are not needed or changed often. `Backup` will contain folders in which e.g. photos from your smartphone will get automatically uploaded or e.g. you can sync your desktop from your laptop to a folder in the Backup folder. (Just so that you know: the backup folder is meant to be a backup folder for data from client devices but isn't the server backup.)

**Here is an example how it could look like:**
- external-SSD
    - your data folder
        - User1 folder
            - Backup
            - Sync
            - Archive
        - User2 folder
            - Backup
            - Sync
            - Archive
        - Data exchange folder
            - Folder that gets shared between users
            - Some other folder that gets shared between the same users
        - Some other data exchange folder
            - And some folder inside
        - user5 folder
            - Backup
            - Sync
            - Archive
    - Some other folder

:::note
The exact foldernames and order can be different
:::

:::tip
**BTW**: you can also spread your files over more than one external data SSD/HDD using the same system. Of course every `User folder` and `data exchange folder` will need to be completely on one disk but you could manually add some different user folders or data exchange folders on a second drive. (this might also be useful if you run out of space on your external data SSD/HDD someday in the future)
:::

**Now copy all private files to the external data SSD/HDD or at least create the folder structure.**

If you are done, **eject** the drive from your PC, **connect** the external data SSD/HDD to your server again and **power the server on** by pressing the `power button`


text:
# Stacks

Every `View` needs to return one type of view. Which is why this is OK.

```swift
var body: some View {
    Text("Hello World")
}
```

But this isn't as it returns x2 views.

```swift
var body: some View {
    Text("Hello World")
    Text("This is another text view")
}
```

The way we get around this is with stacks.

 It makes the views overlap.

```swift
ZStack {
    Text("Hello World")
    Text("This is inside a stack")
}
```

![](images/zstack.png)

## Spacers

Vertical and horizontal stacks automatically fill their available space in the center. If you want to push the content to the side, you need to use a spacer.

These automatically take up all the remaining space. So if you add one at the end of a `VStack` it wil push all your views to the top of the screen.

![](images/spacer.png)

### Links that help

- [Using stacks to arrange views](https://www.hackingwithswift.com/books/ios-swiftui/using-stacks-to-arrange-views)

repository: aitorsola/swiftui

repo_name: aitorsola/swiftui


text:
---
layout: post
title: Merging and reverse merging in Ruby on Rails
date: '2016-06-06T08:00:00.000-08:00'
author: Mark J. Lehman
tags:
- ruby
- rails
---

I've known about [`merge`](http://docs.ruby-lang.org/en/2.0.0/Hash.html#method-i-merge) in Ruby for awhile.

    song = { do_you_like: "piña coladas" }
    song.merge({ getting_caught: "in the rain" })
    # => {
    do_you_like: "piña coladas",
    getting_caught: "in the rain"
    }

But I just found a cool, helpful method that Rails (or specifically, ActiveSupport) adds called [`reverse_merge`](http://apidock.com/rails/Hash/reverse_merge).

It does... exactly what it sounds like.

    song = { if_you_are_not: "into yoga" }
    { if_you_have: "half a brain" }.reverse_merge(song)
    # => {
      if_you_are_not: "into yoga",
      if_you_have: "half a brain"
    }

Kinda like [`Array#unshift`](http://ruby-doc.org/core-2.0.0/Array.html#method-i-unshift).


text:
# Module 0, Challenge 3 (M0_C3)

## Prompt

Write a program that does the following:
1. **Prints the numbers from 1 to 100.**
2. **But, there are some catches:**
    - If the number is divisible by 3, print "Pizz" instead of the number.
    - If the number is divisible by 5, print "Pazz" instead of the number.
    - If the number is divisible by 3 and 5, print "PizzPazz" instead of the number.

## Example Output
```bash
$ python3 pizzpazz.py
1
2
Pizz
4
Pazz
Pizz
7
8
Pizz
Pazz
11
Pizz
13
14
PizzPazz
16
#
# ... output truncated
#
Pizz
97
98
Pizz
Pazz
```

## Assumptions
- No input needed from user

## Knowledge Tested
- **Loops**
- **Conditionals**
- **Nesting and scope**
- **Boolean logic**


text:
# Cloudflare Purge Action

This simple action calls the [Cloudflare API](https://api.cloudflare.com/#zone-purge-all-files) to purge the cache of your website.

## Usage

All sensitive variables should be [set as encrypted secrets](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) in the action's configuration.

### Configuration Variables

| Key | Value | Suggested Type | Required |
| ------------- | ------------- | ------------- | ------------- |
| `CLOUDFLARE_ZONE` | **Required for both methods below.** The Zone ID of your domain, which can be found in the right sidebar of your domain's overview page on the Cloudflare dashboard. For example, `xyz321xyz321xyz321xyz321xyz321xy`. | `secret` | **Yes** |
| `PURGE_URLS` | **Optional.** An array of **fully qualified URLs** to purge. For example: `["https://example.com/style.css", "https://example.com/favicon.ico"]`. If unset, the action will purge everything (which is suggested — [more info below](#purging-specific-files)). | `env` | No |

### Authentication Variables

Both authentication methods below require you to grab information from the [API Tokens page in the dashboard](https://dash.cloudflare.com/profile/api-tokens). Details on the inner workings of each method can be found [in Cloudflare's API docs](https://api.cloudflare.com/#getting-started-requests).

#### Option 1: Restricted API Token

API Tokens are [a new feature](https://blog.cloudflare.com/api-tokens-general-availability/) as of August 2019. They allow you to restrict the scope of this action to only purging the cache of zones you specify. In other words, this is much safer than allowing this action complete control of your entire Cloudflare account.

| Key | Value | Type |
| ------------- | ------------- | ------------- |
| `CLOUDFLARE_TOKEN` | The restricted API Token with permissions to purge the cache of one or more zones. | `secret` |

Creating a token can be tricky, so here's what you should enter [on this page](https://dash.cloudflare.com/profile/api-tokens) to create a token for purging the cache of a single domain on your account:

![Creating an API Token for purging](tokens.png)

#### Option 2: Global API Key

This is the "traditional" method of authenticating — simply grab your "Global API Key" from [the dashboard](https://dash.cloudflare.com/profile/api-tokens). Using this method also **requires a second environment variable** with the email address linked to your account.

| Key | Value | Type |
| ------------- | ------------- | ------------- |
| `CLOUDFLARE_EMAIL` | The email address you registered your Cloudflare account with. For example<EMAIL_ADDRESS>| `secret` |
| `CLOUDFLARE_KEY` | Your Cloudflare API key, which can be generated using [these instructions](https://support.cloudflare.com/hc/en-us/articles/200167836-Where-do-I-find-my-Cloudflare-API-key-). | `secret` |

### GitHub Actions

```yaml
name: Deploy my website
on: push

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:

    # Put steps here to build your site, deploy it to a service, etc.

    - name: Purge cache
      uses: docker://toumoro/cloudflare-purge-action:latest
      env:
        # Zone is required by both authentication methods
        CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}

        CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
        # ...or:
        CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }}
        CLOUDFLARE_KEY: ${{ secrets.CLOUDFLARE_KEY }}
```

### GitLab CI

```yaml
stage:
  ...
  - flush_cache

...

flush_cache:
  image: toumoro/cloudflare-purge-action:latest
  script: [ 'true' ]
  variables:
    # Zone is required by both authentication methods
    CLOUDFLARE_ZONE: $CLOUDFLARE_ZONE

    CLOUDFLARE_TOKEN: $CLOUDFLARE_TOKEN
    # ...or:
    CLOUDFLARE_EMAIL: $CLOUDFLARE_EMAIL
    CLOUDFLARE_KEY: $CLOUDFLARE_KEY
```

### Bitbucket Pipeline

```yaml
pipelines:
  default:
    ...
    - step:
      name: Flush Cloudflare Cache
      script:
        - *auto_devops
        - set_environment_variable
        - pipe: docker://toumoro/cloudflare-purge-action:latest
          variables:
            # Zone is required by both authentication methods
            CLOUDFLARE_ZONE: $CLOUDFLARE_ZONE

            CLOUDFLARE_TOKEN: $CLOUDFLARE_TOKEN
            # ...or:
            CLOUDFLARE_EMAIL: $CLOUDFLARE_EMAIL
            CLOUDFLARE_KEY: $CLOUDFLARE_KEY
```

### Purging specific files

To purge only specific files, you can pass an array of **fully qualified URLs** via a fourth environment variable named `PURGE_URLS`. Unfortunately, Cloudflare doesn't support wildcards (unless you're on the insanely expensive Enterprise plan) so in order to purge a folder, you'd need to list every file in that folder. It's probably safer to leave this out and purge everything, but in case you want really to, the syntax is as follows:

```yaml
PURGE_URLS: '["https://example.com/style.css", "https://example.com/favicon.ico"]'
```

## License

This project is distributed under the [MIT license](LICENSE).

repository: toumoro/cicd-tools

repo_name: toumoro/cicd-tools


text:
# Change Log SIMON

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.1.2] - 2023-02-02
- update GitHub actions
- update license 2023
- allow define **SIMON_MAXSIZE** from command line.
- update readme.md
- minor edits

## [0.1.1] - 2022-11-24
- Add RP2040 support to build-CI.
- Add CHANGELOG.md

## [0.1.0] - 2022-05-26
- initial version

repository: RobTillaart/Arduino

repo_name: RobTillaart/Arduino


text:
# JUnit 5 - An Early Test Drive - Part 1

###### Reference

[https://www.infoq.com/articles/JUnit-5-Early-Test-Drive]()

## Improvements

### Visibility

The most obvious change is that test methods no longer must be public. Package visibility suffices (but private does not), so we can keep our test classes free from the clutter of lots of public keywords.

Theoretically test classes can have default visibility as well. But because of the simple setup we just did, our tools will only scan public classes for annotations. This will change once JUnit 5 support comes around.

### Test Lifecycle
#### @Test
The most basic JUnit 4 annotation is @Test, used to mark methods that are to be run as tests.

The annotation is virtually unchanged, although it no longer takes optional arguments; expected exceptions can now be verified via assertions. (For timeouts there is not yet a replacement.)

#### Before And After
To run code to set up and tear down our tests we can use @BeforeAll, @BeforeEach, @AfterEach, and @AfterAll. They are more appropriately named but semantically identical to JUnit 4’s @BeforeClass, @Before, @After, and @AfterClass.

Because a new instance is created for each test, and @BeforeAll / @AfterAll are only called once for all of them, it is not clear on which instance they should be invoked so they have to be static (as was the case with @BeforeClass and @AfterClass in JUnit 4).

If different methods are annotated with the same annotation, the execution order is deliberately undefined.

#### Disabling Tests
Tests can simply be disabled with @Disabled, which is equivalent to JUnit 4's @Ignored. This is just a special case of a Condition, which we will see later when we talk about extending JUnit.

#### Assertions
After everything was set up and executed, it is ultimately up to assertions to verify the desired behavior. There have been a number of incremental improvements in that area as well:

* Assertion messages are now last on the parameter list. This makes calls with and without messages more uniform as the first two parameters are always the expected and actual value, and the optional argument comes last.
* Using lambdas, assert messages can be created lazily, which can improve performance if creation is a lengthy operation.
* Boolean assertions accept predicates.

Then there is the new `assertAll`, which checks a group of related invocation results and, if the assertion fails, does not short-circuit but prints values for all of them:

```
@Test
void assertRelatedProperties() {
    Developer dev = new Developer("Johannes", "Link");

    assertAll("developer",
   		 () -> assertEquals("Marc", dev.firstName()),
   		 () -> assertEquals("Philipp", dev.lastName())
    );
}
```

This yields the following failure message:

```
org.opentest4j.MultipleFailuresError: developer (2 failures)
    expected: <Marc> but was: <Johannes>
    expected: <Philipp> but was: <Link>
```

Note how the printout includes the last name failure even after the first names had already failed the assertion.

Finally we have `assertThrows` and `expectThrows`, both of which fail the test if the specified exception is not thrown by the called method. But to further assert properties of the exception (e.g. that the message contains certain information), `expectThrows` returns it.

```
@Test
void assertExceptions() {
    // assert that the method under test
    // throws the expected exception */
    assertThrows(Exception.class, unitUnderTest::methodUnderTest);

    Exception exception = expectThrows(
        Exception.class,
        unitUnderTest::methodUnderTest);
    assertEquals("This shouldn't happen.", exception.getMessage());
}
```

#### Assumptions

Assumptions make it possible to run tests if certain conditions are as expected. An assumption must be phrased as a boolean expression, and if the condition is not met the test exits. This can be used to reduce the run time and verbosity of test suites, especially in the failure case.

```
@Test
void exitIfFalseIsTrue() {
    assumeTrue(false);
    System.exit(1);
}

@Test
void exitIfTrueIsFalse() {
    assumeFalse(this::truism);
    System.exit(1);
}

private boolean truism() {
    return true;
}

@Test
void exitIfNullEqualsString() {
    assumingThat(
             // state an assumption (a false one in this case) ...
   		 "null".equals(null),
             // … and only execute the lambda if it is true
   		 () -> System.exit(1)
    );
}
```

Assumptions can either be used to abort tests whose preconditions are not met (`assumeTrue` and `assumeFalse`) or to execute specific parts of a test when a condition holds (`assumimgThat`). The main difference is that aborted tests are reported as disabled, whereas a test that was empty because a condition did not hold shows green.


text:
# Semantic Error

**Table of Contents**

- [Semantic Error](#semantic-error)
	- [Overview](#overview)
	- [Symbol Table](#symbol-table)
	- [Variable Declaration](#variable-declaration)
	- [Variable Reference](#variable-reference)
	- [Binary/Unary Operator](#binaryunary-operator)
	- [Function Invocation](#function-invocation)
	- [Print and Read](#print-and-read)
	- [Assignment](#assignment)
	- [If and While](#if-and-while)
	- [For](#for)
	- [Return](#return)

## Overview

When your parser encounters a semantic error, it should report the error with corresponding error message defined below.

The format of a semantic error report:

```
<Error> Found in line x, column y: <error message>
    <source code>
    <notation>
```

- \<error message>: specific error message corresponding to the semantic error.
- \<source code>: source code of the semantic error. Indented for 4 spaces.
- \<notation>: character "``^``" which points to the position of the error.
	- **(x, y) should be the same as the notation position.**

## Symbol Table

- Symbol redeclaration

	**Output Format**

	```
	<Error> Found in line x, column y: symbol '{symbol_name}' is redeclared
	    <source code that the error happened at>
	    <notation that points to the position of the symbol name>
	```

	**Sample Output**

	```
	<Error> Found in line 34, column 13: symbol i is redeclared
	        var i : real;
	            ^
	```

## Variable Declaration

- Dimensions in the array declaration should be greater than 0

	**Output Format**

	```
	<Error> Found in line x, column y: '{symbol_name}' declared as an array with an index that is not greater than 0
	    <source code that the error happened at>
	    <notation that points to the position of the symbol name>
	```

	**Sample Output**

	```
	<Error> Found in line 7, column 9: 'arrError' declared as an array with an index that is not greater than 0
	    var arrError: array 10 of array 0 of integer;
	        ^
	```

## Variable Reference

- The identifier has to be in symbol tables

	**Output Format**

	```
	<Error> Found in line x, column y: use of undeclared symbol '{symbol_name}'
	    <source code that the error happened at>
	    <notation that points to the position of the symbol name>
	```

	**Sample Output**

	```
	<Error> Found in line 11, column 11: use of undeclared symbol 'arrr'
	    print arrr[30];
	          ^
	```

- The kind of symbol has to be a parameter, variable, loop_var, or constant

	**Output Format**

	```
	<Error> Found in line x, column y: use of non-variable symbol '{symbol_name}'
	    <source code that the error happened at>
	    <notation that points to the position of the symbol name>
	```

	**Sample Output**

	```
	<Error> Found in line 12, column 11: use of non-variable symbol 'func'
	    print func[30];
	          ^
	```

- Each index of an array reference must be of the integer type

	**Output Format**

	```
	<Error> Found in line x, column y: index of array reference must be an integer
	    <source code that the error happened at>
	    <notation that points to the position of the expression node that represents the wrong index>
	```

	**Sample Output**

	```
	<Error> Found in line 14, column 15: index of array reference must be an integer
	    print arr[1.0];
	              ^
	```

- An over array subscript

	**Output Format**

	```
	<Error> Found in line x, column y: there is an over array subscript on '{symbol_name}'
	    <source code that the error happened at>
	    <notation that points to the position of the symbol name>
	```

	**Sample Output**

	```
	<Error> Found in line 15, column 11: there is an over array subscript on 'a'
	    print a[40][50][60];
	          ^
	```

## Binary/Unary Operator

- Errors related to binary operator

	**Output Format**

	```
	<Error> Found in line x, column y: invalid operands to binary operator '{op_symbol}' ('{type_of_left_operand}' and '{type_of_right_operand}')
	    <source code that the error happened at>
	    <notation that points to the position of the binary operator>
	```

	**Sample Output**

	```
	<Error> Found in line 103, column 19: invalid operands to binary operator '>' ('string' and 'string')
	    print "SSLAB" > "SS";
	                  ^
	```

- Errors related to unary operator

	**Output Format**

	```
	<Error> Found in line x, column y: invalid operand to unary operator '{op_symbol}' ('{type_of_the_operand}')
	    <source code that the error happened at>
	    <notation that points to the position of the unary operator>
	```

	**Sample Output**

	```
	<Error> Found in line 10, column 11: invalid operand to unary operator 'not' ('boolean [10][100]')
	    print not arr;
	          ^
	```

## Function Invocation

- The identifier has to be in symbol tables.

	**Output Format**

	```
	<Error> Found in line x, column y: use of undeclared symbol '{symbol_name}'
	    <source code that the error happened at>
	    <notation that points to the position of symbol name>
	```

	**Sample Output**

	```
	<Error> Found in line 25, column 5: use of undeclared symbol 'null'
	    null(123, 456);
	    ^
	```

- The kind of symbol has to be function.

	**Output Format**

	```
	<Error> Found in line x, column y: call of non-function symbol '{symbol_name}'
	    <source code that the error happened at>
	    <notation that points to the position of the symbol name>
	```

	**Sample Output**

	```
	<Error> Found in line 28, column 5: call of non-function symbol 'arr'
	    arr(123, 456);
	    ^
	```

- The number of arguments must be the same as one of the parameters.

	**Output Format**

	```
	<Error> Found in line x, column y: too few/much arguments provided for function '{function_name}'
	    <source code that the error happened at>
	    <notation that points to the position of the function>
	```

	**Sample Output**

	```
	<Error> Found in line 31, column 5: too few/much arguments provided for function 'func'
	    func("overflow");
	    ^
	```

- The type of the result of the expression (argument) must be the same type of the corresponding parameter after appropriate type coercion.

	**Output Format**

	```
	<Error> Found in line x, column y: incompatible type passing '{type_of_argument}' to parameter of type '{type_of_parameter}'
	    <source code that the error happened at>
	    <notation that points to the position of the argument>
	```

	**Sample Output**

	```
	<Error> Found in line 40, column 16: incompatible type passing 'integer' to parameter of type 'string'
	    func2(123, 456);
	               ^
	```

## Print and Read

- The type of the expression (target) must be scalar type

	**Output Format**

	```
	<Error> Found in line x, column y: expression of print statement must be scalar type
	    <source code that the error happened at>
	    <notation that points to the position of the expression>
	```

	**Sample Output**

	```
	<Error> Found in line 9, column 11: expression of print statement must be scalar type
	    print arr;
	          ^
	```

- The type of the variable reference must be scalar type

	**Output Format**

	```
	<Error> Found in line x, column y: variable reference of read statement must be scalar type
	    <source code that the error happened at>
	    <notation that points to the position of the variable reference>
	```

	**Sample Output**

	```
	<Error> Found in line 7, column 10: variable reference of read statement must be scalar type
	    read arr[1];
	         ^
	```

- The kind of symbol of the variable reference cannot be constant or loop_var

	**Output Format**

	```
	<Error> Found in line x, column y: variable reference of read statement cannot be a constant or loop variable
	    <source code that the error happened at>
	    <notation that points to the position of the variable reference>
	```

	**Sample Output**

	```
	<Error> Found in line 9, column 10: variable reference of read statement cannot be a constant or loop variable
	    read constant;
	         ^
	```

## Assignment

- The type of the result of the variable reference cannot be an array type.

	**Output Format**

	```
	<Error> Found in line x, column y: array assignment is not allowed
	    <source code that the error happened at>
	    <notation that points to the position of the variable reference>
	```

	**Sample Output**

	```
	<Error> Found in line 12, column 5: array assignment is not allowed
	    arr := 1.23;
	    ^
	```

- The variable reference cannot be a reference to a constant variable

	**Output Format**

	```
	<Error> Found in line x, column y: cannot assign to variable '{symbol_name}' which is a constant
	    <source code that the error happened at>
	    <notation that points to the position of the variable reference>
	```

	**Sample Output**

	```
	<Error> Found in line 9, column 5: cannot assign to variable 'const' which is a constant
	    const := "SSLAB";
	    ^
	```

- The variable reference cannot be a reference to a loop variable when the context is within a loop body.

	**Output Format**

	```
	<Error> Found in line x, column y: the value of loop variable cannot be modified inside the loop body
	    <source code that the error happened at>
	    <notation that points to the position of the variable reference>
	```

	**Sample Output**

	```
	<Error> Found in line 23, column 9: the value of loop variable cannot be modified inside the loop body
	        i := 213;
	        ^
	```

- The type of the result of the expression cannot be an array type.

	**Output Format**

	```
	<Error> Found in line x, column y: array assignment is not allowed
	    <source code that the error happened at>
	    <notation that points to the position of the expression>
	```

	**Sample Output**

	```
	<Error> Found in line 14, column 14: array assignment is not allowed
	    float := arr[10];
	             ^
	```

- The type of the variable reference (lvalue) must be the same as the one of the expression after appropriate type coercion.

	**Output Format**

	```
	<Error> Found in line x, column y: assigning to '{type_of_variable_reference}' from incompatible type '{type_of_expression}'
	    <source code that the error happened at>
	    <notation that points to the position of the assignment>
	```

	**Sample Output**

	```
	<Error> Found in line 19, column 11: assigning to 'real' from incompatible type 'string'
	    float := "string";
	          ^
	```

## If and While

- The type of the result of the expression (condition) must be boolean type

	**Output Format**

	```
	<Error> Found in line x, column y: the expression of condition must be boolean type
	    <source code that the error happened at>
	    <notation that points to the position of the expression>
	```

	**Sample Output**

	```
	<Error> Found in line 7, column 12: the expression of condition must be boolean type
	    if int + 10 then
	           ^
	```

## For

- The initial value of the loop variable and the constant value of the condition must be in the incremental order

	**Output Format**

	```
	<Error> Found in line x, column y: the lower bound and upper bound of iteration count must be in the incremental order
	    <source code that the error happened at>
	    <notation that points to the position of the for>
	```

	**Sample Output**

	```
	<Error> Found in line 6, column 5: the lower bound and upper bound of iteration count must be in the incremental order
	    for idx := 10 to 1 do
	    ^
	```

## Return

- The current context shouldn't be in the program or a procedure since their return type is void.

	**Output Format**

	```
	<Error> Found in line x, column y: program/procedure should not return a value
	    <source code that the error happened at>
	    <notation that points to the position of the return>
	```

	**Sample Output**

	```
	<Error> Found in line 22, column 5: program/procedure should not return a value
	    return 10;
	    ^
	```

- The type of the result of the expression (return value) must be the same type as the return type of current function after appropriate type coercion.

	**Output Format**

	```
	<Error> Found in line x, column y: return '{type_of_expression}' from a function with return type '{return_type}'
	    <source code that the error happened at>
	    <notation that points to the position of the expression>
	```

	**Sample Output**

	```
	<Error> Found in line 10, column 12: return 'boolean [100]' from a function with return type 'boolean'
	    return bool[1];
	           ^
	```

repository: idoleat/simple-P-compiler

repo_name: idoleat/simple-P-compiler