text:
from __future__ import print_function

import glob
import os
import re
import subprocess
import sys

from collections import deque, namedtuple

dep_match_re = \
    re.compile('^((python|f5-sdk|f5-icontrol-rest)[\w\-]*)' +
               '\s([<>=]{1,2})\s(\S+)')

def usage():
    print("fetch_dependencies.py working_dir")

def runCommand(cmd):
    output = ""
    print(" -- %s" % (cmd))
    try:
        p = subprocess.Popen(cmd.split(),
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE)
        (output) = p.communicate()[0]
    except OSError as e:
        print("Execution failed: ", e, file=sys.stderr)
    return (output, p.returncode)

def fetch_agent_dependencies(dist_dir, version, release, agent_pkg):
    # agent_pkg = "f5-openstack-agent-%s-%s.el7.noarch.rpm" % (version, release)
    ReqDetails = namedtuple('ReqDetails', 'name, oper, version')
    requires = deque()
    # Copy agent package to /tmp
    cpCmd = "cp %s /tmp" % agent_pkg
    print("Copying agent package to /tmp install directory")
    (output, status) = runCommand(cpCmd)
    if status != 0:
        print("Failed to copy f5-openstack-agent package")
    else:
        print("Success")

    # Get the sdk requirement.
    requiresCmd = "rpm -qRp %s" % agent_pkg
    agent_pkg_base = os.path.basename(agent_pkg)
    print("Getting dependencies for %s." % agent_pkg_base)
    (output, status) = runCommand(requiresCmd)

    if status != 0:
        print("Can't get package dependencies for %s" % agent_pkg_base)
        return 1
    else:
        print("Success")

    f5_sdk_version = None  # default for later evaluation for a clean exit...
    for line in output.split('\n'):
        print(line, dep_match_re.pattern)
        match = dep_match_re.match(line)
        if match:
            groups = list(match.groups())
            my_dep = ReqDetails(groups[0], groups[2], groups[3])
            if 'f5-sdk' in my_dep.name and re.search(' [><]?=', line):
                f5_sdk_version = my_dep.version
            else:
                requires.append(my_dep)

    # we know we will always need this...
    if not f5_sdk_version:
        print("Can't find f5-sdk dependency for %s" % (agent_pkg))
        return 1

    # Check if the required packages are present, then install the ones we are
    # aware of...
    # grab the sdk's:
    sdk_github_addr = \
        "https://github.com/F5Networks/f5-common-python/releases/download/v%s"
    github_sdk_url = (sdk_github_addr % f5_sdk_version)
    f5_sdk_pkg = "f5-sdk-%s-1.el7.noarch.rpm" % (f5_sdk_version)
    curlCmd = ("curl -L -o /tmp/%s %s/f5-sdk-%s-1.el7.noarch.rpm" %
               (f5_sdk_pkg, github_sdk_url, f5_sdk_version))

    print("Fetching f5-sdk package from github")
    (output, status) = runCommand(curlCmd)

    # Get the icontrol rest dependency
    requiresCmd = "rpm -qRp /tmp/%s" % (f5_sdk_pkg)
    print("Getting dependencies for %s." % (f5_sdk_pkg))
    (output, status) = runCommand(requiresCmd)
    if status != 0:
        print("Failed to to get requirements for %s." % (f5_sdk_pkg))
        return 1
    else:
        print("Success")

    sdk_reqs = deque()  # can use later in a loop-through to validate compliance
    for line in output.split('\n'):
        m = dep_match_re.search(line)
        if m:
            groups = m.groups()
            my_dep = ReqDetails(groups[0], groups[2], groups[3])
            if 'f5-icontrol-rest' in my_dep.name:
                if re.search('^>?=', my_dep.oper):
                    f5_icr_version = my_dep.version
            else:
                sdk_reqs.append(my_dep)
    if not f5_icr_version:
        print("Can't find f5-sdk dependency for %s" % (f5_sdk_pkg))
        return 1

    # Fectch the icontrol rest package
    github_icr_url = \
        ("https://github.com/F5Networks/f5-icontrol-rest/releases/download/v%s"
         % f5_icr_version)
    f5_icr_pkg = "f5-icontrol-rest-%s-1.el7.noarch.rpm" % (f5_icr_version)
    curlCmd = ("curl -L -o /tmp/%s %s/%s" %
               (f5_icr_pkg, github_icr_url, f5_icr_pkg))

    print("Fetching f5-icontrol-reset package from github")
    (output, status) = runCommand(curlCmd)

    if status != 0:
        print("Failed to to fetch f5-icontrol-rest package.")
        return 1
    else:
        print("Success on F5 Libraries")
    return check_other_dependencies(requires, dist_dir, agent_pkg)

def check_other_dependencies(requires, dist_dir, agent_pkg):
    # triage the packages already installed
    rpm_list_cmd = "rpm -qa"
    print("Collecting a list of already-install pkgs")
    (output, status) = runCommand(rpm_list_cmd)
    to_get = list()
    rpm_install = list()
    yum_install = list()
    ignore = []
    while requires:
        my_dep = requires.popleft()
        if my_dep.name not in output and my_dep.name not in ignore:
            to_get.append(my_dep)
    # install the repo-stored rpm's
    print("Grabbing the ones we have copies of")
    to_install = glob.glob(dist_dir + "/Docker/redhat/7/*.rpm")
    for rpm_file in to_install:
        for rpm_dep in to_get:
            if rpm_dep.name in rpm_file:
                rpm_install.append(rpm_dep)
        rpm_install_cmd = "rpm -i %s" % rpm_file
        runCommand(rpm_install_cmd)
    miss = set(to_get) - set(rpm_install)

    #(pzhang) we use yum to install some dependencies
    for pkg in list(miss):
        if pkg.name != "f5-sdk":
            yumCmd = ("yum install -y %s" % pkg.name)
            print(yumCmd)
            (output, status) = runCommand(yumCmd)
            if status:
               print("Error occurs in % installation" % pkg.name)
               sys.exit(1)
            yum_install.append(pkg)

    miss = set(miss) - set(yum_install)
    if miss:
        print("WARNING: there are missing dependencies!")
        for dep in miss:
            print("%s %s %s" % (dep.name, dep.oper, dep.version))
    else:
        print("""Succsess!
All dependencies search satisfied!  However, by-version check may still fail...
""")
    # change to be dynamic if we decide to be more rigorous at this stage...
    return 0

def install_agent_pkgs(repo):
    installCmd = "rpm -ivh /tmp/*.rpm"
    (output, status) = runCommand(installCmd)
    if status != 0:
        print("Agent install failed")
        sys.exit(1)

def main(args):
    if len(args) != 3:
        usage()
        sys.exit(1)

    working_dir = os.path.normpath(args[1])
    pkg_fullname = args[2]
    try:
        os.chdir("/var/wdir")
    except OSError as e:
        print("Can't change to directory %s (%s)" % (working_dir, e),
              file=sys.stderr)

    dist_dir = os.path.join(working_dir, "f5-openstack-agent-dist")
    version_tool = os.path.join(dist_dir, "scripts/get-version-release.py")

    cmd = "%s --version --release" % (version_tool)
    (output, status) = runCommand(cmd)
    if status == 0:
        (version, release) = output.rstrip().split()

    # Get all files for the f5-openstack agent.
    fetch_agent_dependencies(dist_dir, version, release, pkg_fullname)

    # Instal from the tmp directory.
    install_agent_pkgs("/tmp")

if __name__ == '__main__':
    main(sys.argv)


text:
import array

# arrays of objects
a = array.array('O')
a.append(1)
print(a[0])

# arrays of pointers
a = array.array('P')
a.append(1)
print(a[0])

redpajama_set_name: RedPajamaGithub


text:
from dv_apps.datasets.models import Dataset, DatasetVersion
from dv_apps.datafiles.models import Datafile, FileMetadata
from django.db.models import Q

Datafile.objects.filter(filesize=0).count()
Datafile.objects.filter(filesize__isnull=True).count()

Dataset.objects.filter(harvestingclient__isnull=True).values_list('dvobject__id', flat=True)

Dataset.objects.filter(harvestingclient__isnull=True).count()

ds_ids_harvested = Dataset.objects.filter(harvestingclient__isnull=True).values_list('dvobject__id', flat=False)

# Non-harvested datasets
Dataset.objects.filter(harvestingclient__isnull=True).count()

# count of harvested datasets
num_harvested_datasets = Dataset.objects.filter(harvestingclient__isnull=False).count()

# Dataset ids - Harvested
ds_ids_harvested = Dataset.objects.filter(harvestingclient__isnull=False\
                                ).values_list('dvobject__id', flat=True)

# Dataset ids - non-Harvested
ds_ids_non_harvested = Dataset.objects.filter(harvestingclient__isnull=True\
                                ).values_list('dvobject__id', flat=True)

# File count - harvested with size 0 or null
Datafile.objects.filter(Q(filesize=0) | Q(filesize__isnull=True),
                ).filter(dvobject__owner_id__in=ds_ids_harvested).count()

# File count - non-harvested with size 0 or null
Datafile.objects.filter(Q(filesize=0) | Q(filesize__isnull=True),
                ).filter(dvobject__owner_id__in=ds_ids_non_harvested).count()

Datafile.objects.filter(Q(filesize=0) | Q(filesize__isnull=True),
                ).filter(dvobject__owner_id__in=Dataset.objects.filter(harvestingclient__isnull=True\
                                                ).values_list('dvobject__id', flat=True)).count()

# Harvested datafiles

Datafile.objects.filter(dvobject__owner__harvestingclient__isnull=True).count()
Datafile.objects.filter(dvobject__owner__harvestingclient__isnull=False).count()

"""Fizesize is null

All: 31,177 (1c)
Local: 125  (1b)
Harvested: 31,052 (1c)

---

Fizesize is 0

All: 108,156 (2a)
Local: 493 (2b)
Harvested: 107,663 (2c)

---

(1a) ```Select count(*) from datafile where filesize is null;```

(1b) ```select count(df.id) from datafile df, dvobject dv
where df.filesize is null
and df.id = dv.id
and dv.owner_id in (select id from dataset where harvestingclient_id is not null);```

(1c) ```select count(df.id) from datafile df, dvobject dv
where df.filesize is null
and df.id = dv.id
and dv.owner_id in (select id from dataset where harvestingclient_id is null);```

---

(2a) ```Select count(*) from datafile where filesize = 0;```

(2b) ```select count(df.id) from datafile df, dvobject dv
where df.filesize = 0
and df.id = dv.id
and dv.owner_id in (select id from dataset where harvestingclient_id is null);```

(2c) ```select count(df.id) from datafile df, dvobject dv
where df.filesize = 0
and df.id = dv.id
and dv.owner_id in (select id from dataset where harvestingclient_id is not null);```
"""


text:
import { parse } from "@babel/parser";
import * as t from "@babel/types";

import _traverse from "../lib/index.js";
const traverse = _traverse.default;

describe("path/family", function () {
  describe("getBindingIdentifiers", function () {
    const ast = parse("var a = 1, {b} = c, [d] = e; function f() {}");
    let nodes = {},
      paths = {},
      outerNodes = {},
      outerPaths = {};
    traverse(ast, {
      VariableDeclaration(path) {
        nodes = path.getBindingIdentifiers();
        paths = path.getBindingIdentifierPaths();
      },
      FunctionDeclaration(path) {
        outerNodes = path.getOuterBindingIdentifiers();
        outerPaths = path.getOuterBindingIdentifierPaths();
      },
    });

    it("should contain keys of nodes in paths", function () {
      Object.keys(nodes).forEach(id => {
        expect(hop(paths, id)).toBe(true);
      });
    });

    it("should contain outer bindings", function () {
      Object.keys(outerNodes).forEach(id => {
        expect(hop(outerPaths, id)).toBe(true);
      });
    });

    it("should return paths", function () {
      Object.keys(paths).forEach(id => {
        expect(paths[id].node).toBeTruthy();
        expect(paths[id].type).toBe(paths[id].node.type);
      });

      Object.keys(outerPaths).forEach(id => {
        expect(outerPaths[id].node).toBeTruthy();
        expect(outerPaths[id].type).toBe(outerPaths[id].node.type);
      });
    });

    it("should match paths and nodes returned for the same ast", function () {
      Object.keys(nodes).forEach(id => {
        expect(nodes[id]).toBe(paths[id].node);
      });
    });

    it("should match paths and nodes returned for outer Bindings", function () {
      Object.keys(outerNodes).forEach(id => {
        expect(outerNodes[id]).toBe(outerPaths[id].node);
      });
    });
  });
  describe("getSibling", function () {
    const ast = parse(
      "var a = 1, {b} = c, [d] = e; function f() {} function g() {}",
    );
    let sibling = {},
      lastSibling = {};
    traverse(ast, {
      VariableDeclaration(path) {
        sibling = path.getSibling(path.key);
        lastSibling = sibling.getNextSibling().getNextSibling();
      },
    });

    it("should return traverse sibling nodes", function () {
      expect(sibling.getNextSibling().node).toBeTruthy();
      expect(lastSibling.getPrevSibling().node).toBeTruthy();
      expect(sibling.getPrevSibling().node).toBeFalsy();
      expect(lastSibling.getNextSibling().node).toBeFalsy();
    });

    it("should return all preceding and succeeding sibling nodes", function () {
      expect(sibling.getAllNextSiblings().length).toBeTruthy();
      expect(lastSibling.getAllPrevSiblings().length).toBeTruthy();
      expect(sibling.getAllNextSiblings()).toHaveLength(2);
      expect(lastSibling.getAllPrevSiblings()).toHaveLength(2);
    });

    it("should initialize path.scope when needed", function () {
      const ast = parse("if (0) {}");

      let testHasScope = false;
      let consequentHasScope = false;

      traverse(ast, {
        IfStatement(path) {
          // @babel/traverse pre-traverses the whole tree to populate the initial
          // scope. Thus, it pre-caches paths for all the original nodes.
          // We need to introduce two new nodes to avoid using the cached paths
          // that already have the path.scope property.
          path.set("test", t.identifier("a"));
          path.set("consequent", t.expressionStatement(t.identifier("b")));

          const testPath = path.get("test");

          testHasScope = !!testPath.scope;
          consequentHasScope = !!testPath.getSibling("consequent").scope;
        },
      });

      expect(testHasScope).toBe(true);
      expect(consequentHasScope).toBe(true);
    });
  });
  describe("getCompletionRecords", function () {
    it("should skip variable declarations", function () {
      const ast = parse("'foo' + 'bar'; var a = 10; let b = 20; const c = 30;");
      let records = [];
      traverse(ast, {
        Program(path) {
          records = path.getCompletionRecords();
        },
      });
      expect(records).toHaveLength(1);
      expect(records[0].node.type).toBe("ExpressionStatement");
      expect(records[0].node.expression.type).toBe("BinaryExpression");
    });

    it("should skip variable declarations in a BlockStatement", function () {
      const ast = parse("'foo' + 'bar'; { var a = 10; }");
      let records = [];
      traverse(ast, {
        Program(path) {
          records = path.getCompletionRecords();
        },
      });
      expect(records).toHaveLength(1);
      expect(records[0].node.type).toBe("ExpressionStatement");
      expect(records[0].node.expression.type).toBe("BinaryExpression");
    });

    it("should be empty if there are only variable declarations", function () {
      const ast = parse("var a = 10; let b = 20; const c = 30;");
      let records = [];
      traverse(ast, {
        Program(path) {
          records = path.getCompletionRecords();
        },
      });
      expect(records).toHaveLength(0);
    });
  });
});

function hop(o, key) {
  return Object.hasOwnProperty.call(o, key);
}


text:
# parse-less-import

[![Test coverage](https://img.shields.io/coveralls/LingyuCoder/parse-less-import.svg?style=flat-square)](https://coveralls.io/r/LingyuCoder/parse-less-import?branch=master)
[![Build Status](https://travis-ci.org/LingyuCoder/parse-less-import.png)](https://travis-ci.org/LingyuCoder/parse-less-import)
[![Dependency Status](https://david-dm.org/LingyuCoder/parse-less-import.svg)](https://david-dm.org/LingyuCoder/parse-less-import)
[![devDependency Status](https://david-dm.org/LingyuCoder/parse-less-import/dev-status.svg)](https://david-dm.org/LingyuCoder/parse-less-import#info=devDependencies)
[![NPM version](http://img.shields.io/npm/v/parse-less-import.svg?style=flat-square)](http://npmjs.org/package/parse-less-import)
[![node](https://img.shields.io/badge/node.js-%3E=_4.0-green.svg?style=flat-square)](http://nodejs.org/download/)
[![License](http://img.shields.io/npm/l/parse-less-import.svg?style=flat-square)](LICENSE)
[![npm download](https://img.shields.io/npm/dm/parse-less-import.svg?style=flat-square)](https://npmjs.org/package/parse-less-import)

Parse import from less file

**Node.js >= 4.0.0**

## Install

```bash
$ npm install --save parse-less-import
```

## Usage

```javascript
const parse = require('parse-less-import');

const content = `
@import '../a';
@import './b.less';
@import (multiple) './c.less';
@import (multiple, reference) './d.less';
`;

parse(content);
/*
[ { path: '../a', keywords: [] },
  { path: './b.less', keywords: [] },
  { path: './c.less', keywords: [ 'multiple' ] },
  { path: './d.less', keywords: [ 'multiple', 'reference' ] } ]
*/
```

## Test

```bash
$ npm run test
$ npm run test-cov
$ npm run test-travis
```

## License

The MIT License (MIT)

Copyright (c) 2015 LingyuCoder

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


text:
<?php

namespace app\modules\catalog\controllers;

use frontend\models\Users;
use app\models\City;
use yii\web\Controller;
use yii\data\Pagination;

class DefaultController extends Controller
{
    public function actionIndex()
    {
        $query = Users::find()->leftJoin('media', array('id' => 'user_id'))->where(['type' => 1, 'active' => 1]);

        $countQuery = clone $query;
        $pages = new Pagination(['totalCount' => $countQuery->count()]);
            echo $pages; die();
        $page = 1;

        if(isset($_REQUEST["page"]))
        {
            $page = intVal($_REQUEST["page"]);
        }

        $limit = 12;
        $offset = $limit * ($page - 1);
        $pageSize = ceil($countQuery->count()/$limit);
        $pages->setPageSize($pageSize);

        $models = $query->offset($offset)
            ->limit($limit)
            ->all();

        $city = City::find()->all();

        return $this->render('index', [
            'models' => $models,
            'pages' => $pages,
            'city' => $city
        ]);
    }
}


text:
require 'polisher/util/logger'

module Polisher
  module Git
    module PkgVersions
      def self.included(base)
        base.extend(ClassMethods)
      end

      module ClassMethods
        # Retrieve list of the versions of the specified package in git
        #
        # @param [String] name name of package to lookup
        # @param [Callable] bl optional block to invoke with version retrieved
        # @return [Array<String>] versions retrieved, or empty array if none found
        def versions_for(name, &bl)
          gitpkg = new :name => name
          gitpkg.url = "#{dist_git_url}#{gitpkg.rpm_name}.git"
          versions = []
          fetch_tgts.each do |tgt|
            begin
              gitpkg.fetch tgt
              versions << gitpkg.spec.version
            rescue => e
              logger.warn "error retrieving #{name} from #{gitpkg.url}/#{tgt}(distgit): #{e}"
            end
          end

          bl.call(:git, name, versions) unless bl.nil?
          versions
        end
      end # module ClassMethods
    end # module PkgVersions
  end # module Git
end # module Polisher


text:
{% extends "layout.html" %}

{% block page_title %}
  Exemptions: flood risk activities - GOV.UK
{% endblock %}

{% block proposition_header %}

{% endblock %} {% block header_class %}

{% endblock %} {% block content %}

Environmental management  – guidance

Exemptions: flood risk activities

From:

    Environment Agency and Department for Environment, Food & Rural Affairs

First published:

<time class="date" datetime="2016-04-06T08:30:00+01:00"> 6 April 2016</time>

Part of:

    Flooding and coastal change, Environmental permits and Flooding and coastal change

Applies to:

England

Find out which activities don't need an environmental permit (formerly flood risk consent), and the conditions you must meet in order to operate without one.

Contents

Check if your activity is exempt and read the conditions you'd need to meet in order to operate without a permit.

To operate without a permit you must:

register the exempt activity with the Environment Agency

meet the description and conditions required for that exemption

Electrical cable service crossing a main river (FRA2)

With this exemption you can erect an electrical cable way and associated supports across a main river.

You can't:

lay a cable on the surface of the river bed

Install the service crossing or duct within the cross section of the river channel.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on, or within 200m of, a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at : www.magic.gov.uk.

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

the service crossing is within 10° of perpendicular to the direction of flow of the main river

you erect permanent hazard markers on both banks of the main river

your works do not disturb the bed and banks of the main river

you remove from the floodplain all excavated material not re-used on the site of the works

Register

Register for this exemption

Service crossing below the bed of a main river by directional drilling (FRA3)

With this exemption you can install a service crossing below the bed of a main river not using an open cut technique but using directional drilling, for example to install an electricity service duct.

You cannot install a pipe crossing by excavating an open trench.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on, or within 200m of, a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

you cannot carry out any work in or within 100m of a river or lake in England or (if your activity is near the border) in Wales that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

the service crossing is within 10° of perpendicular to the direction of flow in the main river

the distance from the bed of the main river to the top of the service crossing is at least 1.5 metres along its whole length, and the same height above sea level is maintained between points 5 metres beyond the top of each bank of the main river

the distance from the launch and reception pits to the landward side of each bank of the main river is

8 metres or more in the case of a non-tidal main river

16 metres or more in the case of a tidal main river

the service crossing does not pass through any bank, culvert, remote defence or river control works on the main river or through any sea defence

the service crossing is 50 metres or more upstream of any impoundment or artificially raised channel

you erect permanent hazard markers on both banks of the main river; .

you remove from the flood plain all excavated material not re-used on the site of the works

your works do not disturb the bed and banks of the main river

Register

Register for this exemption

Service crossings attached to the outside of existing structures over a main river (FRA4)

With this exemption you can attach a service crossing to an existing structure over a main river, for example, attaching a duct to the parapet of a bridge above the arch openings.

You cannot:

erect a new structure to support a service crossing

attach a duct across the opening of a bridge

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

You cannot carry out the activity on or within 200m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

the service crossing does not project more than 1 metre horizontally from the structure; .

the service crossing follows the existing cross-sectional profile of the structure to the main river in both normal and flood flow; .

the service crossing does not pass through any bank, culvert, flood defence structure or river control works on the main river or through any sea defence

you erect permanent hazard markers on both banks of the main river

the Environment Agency has not notified the landowner that the structure has been identified for removal or modification in order to achieve the measures set out in the relevant River Basin Management Plan

Register

Register for this exemption

Footbridge over a main river not more than 8 metres wide from bank to bank (FRA5)

With this exemption you can construct a footbridge across a main river.

You can't construct a bridge for vehicles.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 500m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

you cannot carry out any work in within 100m of a river or lake in England or (if your activity is near the border) in Wales that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

you plan your works to ensure there are no significant adverse effects on protected or priority species of importance for nature conservation. You can find more information on the species that could be impacted by your works from your local record centre or Natural England's guidance on construction near protected areas and wildlife https://www.gov.uk/guidance/construction-near-protected-areas-and-wildlife

the length of the footbridge measured from the top of one bank of the main river to the top of the other bank is no more than 8 metres

the footbridge has no support in the watercourse, a deck width of no more than 1.5 metres and a kickerboard of no more than 100mm in height

the footbridge does not reduce the cross-sectional area of the channel in the main river

you cannot carry out the works within 100 metres of any non-agricultural building in the floodplain or another man-made structure on or in the main river

the construction does not affect the bed of the main river

the length of bank disturbed by the construction extends to no more than 1 metre on either side of the footbridge

the footbridge is securely attached to foundations which are no closer than 1 metre to the edge of the bank

construction of the footbridge does not require reinforcement of the bed or banks

the approach ramp or steps for the footbridge do not extend more than 4 metres from the landward side of the bank

the lowest point of the underside of the bridge is at least 600mm higher than the top of both banks of the main river

you remove from the floodplain all excavated material not re-used on the site of the works

the height of the land at each end of the footbridge is not changed by the construction

any parapet of the footbridge is of open construction comprising (i)post and rail, (ii)post and wire mesh fencing of at least 100mm spacing; or (iii)post and wire strands.

Register

Register for this exemption

Temporary scaffolding in or over a main river for no more than four weeks (FRA6)

With this exemption you can erect and use temporary scaffolding on a main river.

You can't erect scaffolding across whole structures such as bridges or weirs that cross a main river.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 200m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

the scaffolding is in place for no longer than 4 weeks

the scaffolding is not in place between 15th March and 15th June inclusive in any year

on a main river that is a designated salmonid river, the scaffolding is not in place between 1st October and 14th March inclusive in any year

the scaffolding does not occupy more than 10 metres of a river bank at any one time; .

the scaffolding projects into or over the main river no more than 1.2 metres or no more than 10% of the width of the main river, whichever is less

the scaffolding is located at least 100 metres from any other scaffolding which is in place and also registered under this exemption

you remove any debris lodged against the scaffolding within 24 hours (except where it is unsafe to do so)

any transoms and walking decks are set no lower than 600 mm above water level.

Register

Register for this exemption

Temporary dewatering of a work area for no more than four weeks (FRA7)

With this exemption you can temporarily dewater a working area of a main river, for example by installing a small coffer dam to inspect building foundation or to allow construction to take place in the dry.

You can't dewater the full width of the channel and over pump over the water.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 500m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

you cannot carry out any work in or within 100m of a river or lake in England or (if your work is near the border) in Wales that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

you cannot carry out any work in or within 500m upstream of a priority habitat that has been selected for the importance of its river or freshwater habitats. These are often called Natural Environment and Rural Communities Act 2006 section 41 and section 42 habitats. For information call the Environment Agency customer contact centre on 03708 506 506.

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

you plan your works to ensure there are no significant adverse effects on protected and priority species of importance for nature conservation. You can find more information on the species that could be impacted by your works from your local record centre or Natural England's guidance on construction near protected areas and wildlife https://www.gov.uk/guidance/construction-near-protected-areas-and-wildlife

any pumps used in the dewatering process must be fitted with a 20mm mesh screen.

you must take all reasonable steps to protect all aquatic plants and animals found in the area affected by dewatering. You would be expected to plan for how to manage any fish or other species (such as crayfish) that could become stranded during the works

the duration of the dewatering is no longer than 4 weeks

you do not carry out the dewatering between 15th March and 15th June inclusive in any year

on a main river that is a designated salmonid river, the dewatering is not in place between 1st October and 14th March inclusive in any year

the dewatering does not affect more than 10 metres of the bank of a main river at any one time

the dewatering is not within 8 metres of a flood defence structure or river control works

the depth of water adjacent to the dewatered area does not exceed 1.2 metres; .

the dewatering structure projects into or over the main river no more than 1.2 metres or no more than 10% of the width of the main river, whichever is less

you remove from the floodplain all excavated material not re-used on the site of the works

Register

Register for this exemption

Maintaining a raised river or sea defence (FRA8)

With this exemption you can maintain an existing raised river or sea defences. for example raising low spots in an existing bank.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 200m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

you must use materials of the same kind as those present in the raised defences for the maintenance works, and you must not alter the shape of those defences or the overall height of the protection afforded by those defences

the raised defences must be carrying out the functions for which they were originally designed

the works do not disturb the bed or, up to normal ground level, the banks of the main river.

Guidance notes

In order to meet the description and conditions for this exemption, you cannot:

erect a new defence

realign or increase the height of the defence.

Register

Register for this exemption

Maintaining structures within the channel of a main river that are not raised defences (FRA9)

With this exemption you can maintain a structure within the channel of a main river that is not a raised river or sea defence, for example cleaning stonework on a bridge or building

You can't strengthen a bridge pier by increasing its size.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 200m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

you plan your works to ensure there are no significant adverse effects on protected or priority species of importance for nature conservation. You can find more information on the species that could be impacted by your works from your local record centre or Natural England's guidance on construction near protected areas and wildlife https://www.gov.uk/guidance/construction-near-protected-areas-and-wildlife

the maintenance works do not alter any dimension of the structure

the structure is carrying out the functions for which it was originally designed

you must use materials of the same kind as those present in the structure for the maintenance works

the maintenance works do not occur between 15th March and 15th June inclusive in any year

on a main river that is a designated salmonid river, the maintenance works do not occur between 1st October and 14th March inclusive in any year

Register

Register for this exemption

Constructing drinking bays for livestock on the bank of a river (FRA10)

With this exemption you can create a drinking bay for livestock on the bank of a main river.

You can't install any structure that crosses into the channel, ie the drinking bay can't extend beyond the bank profile.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 500m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

you cannot carry out any work in or within 100m of a river or lake in England or (if your work is near the border) in Wales that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

you cannot carry out any work in or within 500m upstream of a priority habitat that has been selected for the importance of its river or freshwater habitats. These are often called Natural Environment and Rural Communities Act 2006 section 41 and section 42 habitats. For information call the Environment Agency customer contact centre on 03708 506 506.

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

you plan your works to ensure there are no significant adverse effects on protected and priority species of importance for nature conservation. You can find more information on the species that could be impacted by your works from your local record centre or Natural England's guidance on construction near protected areas and wildlife https://www.gov.uk/guidance/construction-near-protected-areas-and-wildlife

The drinking bay is not located within 100 metres of any other man-made structure on or in the main river

the bay is surrounded by a post and rail fence which must project into or over the main river no more than 1.2 metres or 10% of the width of the main river, whichever is less

the base of the bay has a surface made of concrete, stone or inert hard core

you remove from the floodplain all excavated material not re-used on the site of the works

the works must not adversely affect any culvert, remote defence, river control works, sea defence or any raised embankment or wall forming part of the bank of the main river

the remainder of the bank is fenced so as to prevent damage to the bank.

Register

Register for this exemption

Constructing small access platforms on the bank of a river or that project into or over a main river (FRA11)

With this exemption you can create a platform to allow access to the water's edge either on the bank or projecting into or over a main river, for example for the purposes of fishing.

You can't moor pontoons.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 500m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

you cannot carry out any work in or within 100m of a river or lake in England or (if your work is near the border) in Wales that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

you cannot carry out any work in or within 500m upstream of a priority habitat that has been selected for the importance of its river or freshwater habitats. These are often called Natural Environment and Rural Communities Act 2006 section 41 and section 42 habitats. For information call the Environment Agency customer contact centre on 03708 506 506.

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

you plan your works to ensure there are no significant adverse effects on protected and priority species of importance for nature conservation. You can find more information on the species that could be impacted by your works from your local record centre (Link to LRC site) or Natural England's guidance on construction near protected areas and wildlife https://www.gov.uk/guidance/construction-near-protected-areas-and-wildlife

the platform is not located within 50 metres of any other man-made structure

the platform projects no more than 1.2m into or over the main river and occupies no more than 2m of bank length

the works must not adversely affect any culvert, remote defence, river control works, sea defence or any raised embankment or wall forming part of the bank of the main river

the part of the platform which projects over the channel is constructed as a flat deck, with no solid infill beneath the platform, supported on piers or piles of no more than 300mm width

any steps cut into the bank are supported by timber risers on the vertical part of the step.

Register

Register for this exemption

Outfall pipes less than 300mm diameter through a headwall (FRA12)

With this exemption you can construct a small outfall pipe through a headwall on a main river.

You can't construct or install a structure that crosses the channel.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 200m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

you cannot carry out any work in or within 100m of a river or lake in England or (if your work is near the border) in Wales that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

you cannot carry out any work in or within 200m upstream of a priority habitat that has been selected for the importance of its river or freshwater habitats. These are often called Natural Environment and Rural Communities Act 2006 section 41 and section 42 habitats. For information call the Environment Agency customer contact centre on 03708 506 506.

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

you plan your works to ensure there are no significant adverse effects on protected and priority species of importance for nature conservation. You can find more information on the species that could be impacted by your works from your local record centre (Link to LRC site) or Natural England's guidance on construction near protected areas and wildlife https://www.gov.uk/guidance/construction-near-protected-areas-and-wildlife

the headwall is not located within 50 metres of another man-made structure on or in the main river

if the headwall is on a non-tidal main river, the outfall pipe is aligned to an angle of between 30° and 60° to the direction of flow in the river

the diameter of the outfall pipe is less than 300mm

the height of the headwall is no more than 1.5 metres or no more than 75% of the height of the bank, whichever is less

the total length of bank affected during construction of the headwall is no more than 1.5 metres

the headwall, wing walls and apron do not project beyond the line of the bank prior to the works being carried out

the headwall is not within 8 metres of a flood defence structure or river control works

the outfall pipe does not pass through or under any culvert, remote defence, river control works or sea defence, or any raised embankment or wall forming part of the bank of the main river

you remove from the floodplain all excavated material not re-used on the site of the works

any pipe that discharges through the headwall does not pass within 8 metres of a flood defence structure.

Register

Register for this exemption

Repairing and protecting up to 10 metres of main river banks using natural materials (FRA13)

With this exemption you can carry out repairs and protection to the banks of a main river using natural material.

You must use natural materials for the repair and protection work, for example spiling or coir rolls.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

You cannot carry out the activity on or within 200m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

you cannot carry out any work in or within 100m of a river or lake in England or (if your work is near the border) in Wales that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

you plan your works to ensure there are no significant adverse effects on protected and priority species of importance for nature conservation. You can find more information on the species that could be impacted by your works from your local record centre or Natural England's guidance on construction near protected areas and wildlife https://www.gov.uk/guidance/construction-near-protected-areas-and-wildlife • the length of bank affected by the works is no more than 10 metres

the works do not include the use of steel sheet piling, concrete, cement or concrete bagwork, brickwork, gabions or non-biodegradable materials

the works do not take place within 50 metres of a bank that has been reinforced • the works do not encroach into the channel of the main river beyond the line of the bank prior to the works being carried out

when the works are finished, the height of the bank does not exceed the lower of (i) the height of the bank on either side of the works, and (ii) the height of the bank prior to the works being carried out

the works are securely fastened to the bank at each end so as to prevent erosion behind the works

the works do not involve the use of vehicles or wheeled or tracked machinery on the bed or bank of the main river

the works are not to a bank consisting of an earth cliff over 1 metre in height

Register

Register for this exemption

Repairing bank slips and erosion using the fallen materials (FRA14)

With this exemption you can repair bank slips and erosion.

You can't realign a river channel.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 500m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

you cannot carry out any work in or within 100m of a river or lake in England or (if your work is near the border) in Wales that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

you plan your works to ensure there are no significant adverse effects on protected or priority species of importance for nature conservation. You can find more information on the species that could be impacted by your works from your local record centre or Natural England's guidance on construction near protected areas and wildlife https://www.gov.uk/guidance/construction-near-protected-areas-and-wildlife

any repair of a bank slippage is made using as materials only material that has subsided from that bank

any repair of erosion uses materials of the same kind as those present on the relevant site

the works do not involve removal of any material from the bed of the main river other than removing the bank slippage

the works do not affect more than 10 metres of the bank at any one time

the works do not encroach into the channel of the main river beyond the line of the bank prior to the works being carried out

when the works are finished, the height of the bank does not exceed the lower of (i) the height of the bank on either side of the works, and (ii) the height of the bank prior to the slip or erosion

the works are securely fastened to the bank at each end so as to prevent erosion behind the works

the works do not involve the use of a vehicle or of wheeled or tracked machinery on the bed or banks of the main river.

Register

Register for this exemption

Installing channel habitat structures made of natural materials excluding weirs and berms (FRA15)

With this exemption you can install a channel habitat structure on a Main River, made of natural materials (but not including weirs and berms).

You must use natural materials, for example creating woody debris structures for habitat purposes.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 200m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar Site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

you cannot carry out any work in or within 100m of a river or lake in England or (if your work is near the border) in Wales that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

the structure occupies no more than half the width of the cross-sectional area of the channel in the main river and no more than 20 metres of the length of the main river

no part of the structure is higher than 0.3 metres above the level of the river bed or 25% of the height of the bank (excluding any wall or embankment forming part of the bank), whichever is greater

the structure is made from naturally occurring woody material and is securely fastened to the bed of the main river, the bank or both

no works take place within 100 metres of a non-agricultural building in the floodplain, another natural channel habitat structure, stones or logs placed in the main river for habitat enhancement or a man-made structure on or in the main river.

Register

Register for this exemption

Installing temporary small rafts for surveys (FRA16)

With this exemption you can install temporary rafts for surveys.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 200m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

the raft has dimensions of no greater than 1.5 metres x 1 metre x 0.15 metre

any equipment box used on the raft has a height of no more than 0.75 metre

the raft is permanently and securely attached to the bank

the raft is installed no less than 100 metres from any other raft

when the raft is installed, there are no more than four other rafts within a distance of one kilometre

the raft is installed for no more than 12 months and removed immediately if, within that period, it is no longer required

the raft is not installed within 100 metres of any non-agricultural building in the floodplain or another man-made structure on or in the main river.

Register

Register for this exemption

Gravel-cleaning for fishspawning beds (FRA17)

With this exemption you can clean gravel fish-spawning beds.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 500m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

you cannot carry out the activity in or within 500m upstream of a priority habitat that has been selected for the importance of its river or freshwater habitats. These are often called Natural Environment and Rural Communities Act 2006 section 41 and section 42 habitats. For information call the Environment Agency customer contact centre on 03708 506 506.

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

the works are only carried out in September or October in any year

the works are to no more than 20m2 of gravel per location, with a gap of at least 30 metres between locations

the works do not adversely affect the banks or established bed of the main river

the works are carried out using only hand tools or machinery carried and operated by one person

Guidance notes

In order to meet the description and conditions in this exemption, you cannot carry out any dredging.

Register

Register for this exemption

Placing stones or logs in a main river to enhance habitats (FRA18)

With this exemption you can place stones or logs in the channel or a main river in order to create or enhance habitat

You can't create a weir but you can create groynes.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 200m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

you cannot carry out any work in within 100m of a river or lake in England or (if your work is near the border) in Wales that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

you cannot carry out any work in or within 200m upstream of a priority habitat that has been selected for the importance of its river or freshwater habitats. These are often called Natural Environment and Rural Communities Act 2006 section 41 and section 42 habitats. For information call the Environment Agency customer contact centre on 03708 506 506.

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

any stones placed in the channel must be of a type that occur naturally in the main river and do not exceed 400mm in any dimension

any log placed in the channel must be of less than 2 metres in length, less than 400mm in diameter and oriented at an angle of within 45° to the flow of water

any log placed in the channel must be from a type of tree that occurs naturally in the vicinity of the main river; and is securely fixed to the bed or bank of the main river

the stones or logs are placed in the channel over no more than 20 metres of the length, and 20% of the width, of the main river

no stones or logs are placed within 100 metres of a non-agricultural building in the floodplain, a natural channel habitat structure, an existing emplacement of stones or logs placed in the main river for habitat enhancement or a man-made structure on or in the main river.

Register

Register for this exemption

Constructing eel pass devices on existing structures (FRA19)

With this exemption you can construct an eel passage device to an existing structure in or over a main river.

You can't construct new independent structures. But you can use existing structures, eg attaching a pipe with a scrubbing brush to an existing weir.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 200m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

the existing structure is not located on a tidal river

the device is permanently and securely attached to the existing structure

the width of the device is no more than 5% of the width of the main river

the device does not extend upstream or downstream from the existing structure more than 10 metres or the width of the channel measured between the top of each bank of the main river, whichever is the lesser

Register

Register for this exemption

Constructing fish passage notches in an existing impounding structure (FRA20)

With this exemption you can construct fish passage notches on an existing impounding structure.

You can't construct new independent structures.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 200m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

the construction does not affect the structural integrity of the existing impoundment

construction of the notches does not change the water level in the main river by more than 20cm upstream or downstream from the existing structure

the existing impoundment is located on a main river with a width of no more than 5 metres measured between the top of each bank

the construction does not adversely affect the banks or established bed of the main river

the notch is no more than 0.6 metre in width.

Register

Register for this exemption

Removing silt and sand from bridge arches and any material from existing culverts (FRA21)

With this exemption you can remove silt and sand from within a bridge arch or any material from within culvert

You can't remove gravels from a bridge arch.

To use this exemption you must meet the dredging requirements.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 1km upstream of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

you cannot carry out the works in or within 1km upstream of a priority habitat that has been selected for its river or freshwater habitats. These are often called Natural Environment and Rural Communities Act 2006 section 41 and section 42 habitats. For information call the Environment Agency customer contact centre on 03708 506 506

you cannot carry out any work in or within 1km upstream or 500m downstream of a river or lake in England that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

(if your activity is near the border with Wales) you cannot carry out any work in or within 100m of a river or lake in Wales that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506

you must ensure that the removal or material and subsequent deposit of materials does not have a significant adverse effect on protected and priority species of importance for nature conservation. You can find more information on the species that could be impacted by your works from your local record centre or Natural England's guidance on construction near protected areas and wildlife https://www.gov.uk/guidance/construction-near-protected-areasand-wildlife

the works do not affect the structural integrity of the bridge arch or culvert

in the case of works within bridge arches, the removal of silt and sand is limited to the removal of accumulated silt and sand on the established bed of the main river

the works do not occur between 15th March and 15th June inclusive in any year

on a main river that is a designated salmonid river, the works do not occur between 1st October and 14th March inclusive in any year

the works do not expose the structural foundations or footings of the bridge or culvert

the works and any equipment used to remove the sand and silt comply with the dredging and removal of silt and sand requirements which are in the Environment Agency document 'Dredging and the removal of silt and sand from main rivers as a flood risk activity under the Environmental Permitting Regulations: Helping you maintain your watercourse' 1 February 2016. You can find a copy of these requirements on gov.uk.

the works do not involve the use of machinery on the bed or banks of the main river more than 20 metres from the bridge or culvert 26 of 40

the works do not involve the use of a vehicle on the bed or banks of the main river

the works do not damage the culvert or the banks or bed of the main river

Register

Register for this exemption

Removing silt and sand adjacent to in-river structures (FRA22)

With this exemption you can remove silt and sand from adjacent to an in river structure in a main river, such as a bridge arch or culvert.

To use this exemption you must meet the dredging requirements.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity in or within 1km upstream of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

you cannot carry out the works in or within 1km upstream of a priority habitat that has been selected for its river or freshwater habitats. These are often called Natural Environment and Rural Communities Act 2006 section 41 and section 42 habitats. For information call the Environment Agency customer contact centre on 03708 506 506.

you cannot carry out any work in or within 1km upstream or 500m downstream of a river or lake in England that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

(if your activity is near the border with Wales) you cannot carry out any work in or within 100m of a river or lake in Wales that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

you cannot carry out works within a designated sensitive waterbody shown on the Environment Agency's sealed map of 'Water bodies in England identified as sensitive for flood risk activities under the Environmental Permitting Regulations because sediment management may compromise the delivery of the environmental objectives of the Water Framework Directive'

you must ensure that the removal or silt or sand and subsequent deposit does not have a significant adverse effect on protected or priority species of importance for nature conservation. You can find more information on the species that could be impacted by your works from your local record centre or Natural England's guidance on construction near protected areas and wildlife https://www.gov.uk/guidance/construction-near-protected-areas-and-wildlife

the works take place no more than 10 metres upstream or downstream from the edge of the structure

the removal of silt and sand does not affect the structural integrity of the structure • the works do not damage the banks or bed of the main river

the works are limited to the removal of accumulated silt and sand on the established bed of the main river

the removal of silt and sand does not expose the structural foundations or footings of the structure

silt and sand is not removed to below the level of the base of the inside of an adjacent culvert

the works do not remove vegetation from the bed or banks of the main river, other than vegetation growing in or through the silt and sand 28 of 40

the works do not involve the use of a vehicle or machinery on the bed or banks of the main river

the removal of silt and sand does not occur between 15th March and 15th June inclusive in any year

on a main river that is a designated salmonid river, the removal of silt and sand does not occur between 1st October and 14th March inclusive in any year

the works and any equipment used to remove the sand and silt comply with the dredging and removal of silt and sand requirements which are in the Environment Agency document 'Dredging and the removal of silt and sand from main rivers as a flood risk activity under the Environmental Permitting Regulations: Helping you maintain your watercourse' 1 February 2016. You can find a copy of these requirements on gov.uk.

Register

Register for this exemption

Dredging to remove accumulated silt and sand from the bed of up to 1.5km of man-made ditches, land drains, agricultural drains and previously straightened watercourses that are main rivers (FRA23)

With this exemption you can dredge the following:

man-made ditches

land drains

agricultural drains

previously straightened watercourses that are classified as main rivers

You can't dredge more than 1.5km.

You can't:

carry out farm scale dredging

dredge natural main river channels

dredge below the established bed of the channel

re-shape the bed or banks of a channel

To use this exemption you must meet the dredging requirements.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity in or within 5 km upstream of a site notified for its freshwater habitats that is designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI), or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at : www.magic.gov.uk

you cannot carry out the activity in or within 1km upstream of a site designated as a Special Protection Area (SPA), Ramsar site, Special Area for Conservation (SAC), Site of Special Scientific Interest (SSSI), or Local Nature Reserve (LNR) and including a site which includes part of the flood plain but not the river itself. The locations of all these sites are available to view on MAGIC at : www.magic.gov.uk

you cannot carry out any work in or within 1km upstream or 500m downstream of a river or lake in England that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

(if your activity is near the border with Wales) you cannot carry out any work in or within 100m of a river or lake in Wales that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

you cannot carry out works within a designated sensitive waterbody shown on the Environment Agency's sealed map of 'Water bodies in England identified as sensitive for flood risk activities under the Environmental Permitting Regulations because sediment management may compromise the delivery of the environmental objectives of the Water Framework Directive'

you cannot carry out works in or within 1km upstream of a priority habitat that has been selected for its river or freshwater habitats. These are often called Natural Environment and Rural Communities Act 2006 section 41 and section 42 habitats. For information call the Environment Agency customer contact centre on 03708 506 506. 30 of 40

you must ensure that the dredging and subsequent deposit of any materials does not have a significant adverse effect on protected or priority species of importance for nature conservation. You can find more information on the species that could be impacted by your works from your local record centre or Natural England's guidance on construction near protected areas and wildlife https://www.gov.uk/guidance/construction-near-protected-areas-and-wildlife

the works do not occur in any location where dredging has been carried out within the previous three years

the works do not occur in any location on a watercourse where dredging has taken place within 1.5 kilometres upstream or downstream of that location in the previous 12 months

the works are completed within three years of registration of the exemption • the works do not damage the bed or banks of the main river

the dredging does not include the removal of gravel

the dredging is limited to the removal of accumulated silt and sand on the established bed of the main river

the works do not remove vegetation from the bed or banks of the main river, other than vegetation growing in or through the silt and sand

the works do not involve the use of a vehicle or machinery on the bed or banks of the main river

the works do not occur between 15th March and 15th June inclusive in any year

on a main river that is a designated salmonid river, the works do not occur between 1st October and 14th March inclusive in any year

the works and any equipment used comply with the dredging and removal of silt and sand requirements which are in the Environment Agency document 'Dredging and the removal of silt and sand from main rivers as a flood risk activity under the Environmental Permitting Regulations: Helping you maintain your watercourse' 1 February 2016. You can find a copy of these requirements on gov.uk.

on a non-tidal main river, the works do not occur within 8 metres of a flood defence structure or river control works

on a tidal main river, the works do not occur within 16 metres of a flood defence structure or sea defence.

Register

Register for this exemption

Dredging to remove accumulated silt and sand from the bed of up to 20 metres of a main river (FRA24)

With this exemption you can dredge up to 20 metres of a main river.

You can't:

carry out farm scale dredging

dredge below the established bed of the channel or re-shape the bed or banks in any way

To use this exemption you must meet the dredging requirements.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity in or within 1 km upstream of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI), or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

you cannot carry out any work in or within 1km upstream or 500m downstream of a river or lake in England that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

(if your activity is near the border with Wales) you cannot carry out any work in or within 100m of a river or lake in Wales that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

you cannot carry out works within a designated sensitive waterbody shown on the Environment Agency's sealed map of 'Water bodies in England identified as sensitive for flood risk activities under the Environmental Permitting Regulations because sediment management may compromise the delivery of the environmental objectives of the Water Framework Directive'

you cannot carry out works in or within 1km upstream of a priority habitat that has been selected for its river or freshwater habitats. These are often called Natural Environment and Rural Communities Act 2006 section 41 and section 42 habitats. For information call the Environment Agency customer contact centre on 03708 506 506.

you must ensure that the dredging and subsequent deposit of any materials does not have a significant adverse effect on protected or priority species of importance for nature conservation. You can find more information on the species that could be impacted by your works from your local record centre (Link to LRC site) or Natural England's guidance on construction near protected areas and wildlife https://www.gov.uk/guidance/construction-near-protected-areasand-wildlife

no dredging has been carried out in the previous 12 months in the same main river and property

the works are completed within 12 months of registration of the exemption

the works do not damage the bed or banks of the main river

the works do not remove vegetation from the bed or banks of the main river, other than vegetation growing in or through the silt and sand

the dredging is limited to the removal of accumulated silt and sand on the established bed of the main river

the dredging does not include the removal of gravel 32 of 40

the works do not involve the use of a vehicle or machinery on the bed or banks of the main river

the works do not occur between 15th March and 15th June inclusive in any year

on a main river that is a designated salmonid river, the works do not occur between 1st October and 14th March inclusive in any year

the works and any equipment used comply with the dredging and removal of silt and sand requirements which are in the Environment Agency document 'Dredging and the removal of silt and sand from main rivers as a flood risk activity under the Environmental Permitting Regulations: Helping you maintain your watercourse' 1 February 2016. You can find a copy of these requirements on gov.uk.

Register

Register for this exemption

Excavating scrapes and shallow wetland features totalling 0.1 hectare in a flood plain (FRA 25)

With this exemption you can excavate scrapes and shallow wetland features in a flood plain of a main river.

You can't excavate deep features such as fish ponds.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 200m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

the area of the excavation is no more than 0.1 hectare and takes place at least 100 metres from any other excavation in the floodplain

the excavation is no more than 500mm deep at any point

where spoil from the excavation is spread on the floodplain, the spoil is spread to a depth of no more than 100mm

the excavation is at least 8 metres from any structure forming part of a flood defence and from the landward side of each bank of the main river.

Register

Register for this exemption

Constructing raised flood defences around a maximum of 6 adjoining properties (FRA26)

With this exemption you can construct raised defences around between one and six adjoining properties.

This exemption can be used, for example, to protect residential properties from flooding, such as building a wall around a pair of semi-detached houses.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 200m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

you cannot carry out the activity within 8 metres of the main river

the dimensions of the flood defences are no more than 1 metre in height and 6 metres in width

the defences are located at least 20 metres from any building not owned by the owners of the properties

the total area protected by the defences is no more than 150m2 for each property

the defences are to protect existing buildings

the works are within the existing boundary of the properties.

Register

Register for this exemption

Constructing bankside wildlife refuge structures (FRA27)

With this exemption you can create bankside structures to provide shelter for wildlife such as otter holts.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 200m of a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

you do not carry out any work in or within 100m of a river or lake in England or (if your work is near the border) in Wales that is classified as of high morphological status under the Water Framework Directive. For information call the Environment Agency customer contact centre on 03708 506 506.

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

the length of bank excavated during construction of the structure is no more than 1.5 metres

the height of the structure is no more than 1.5 metres or no more than 75% of the height of the bank, whichever is less

the structure is not located within 50 metres of another man-made structure on or in the main river

the structure is not located within 8 metres of a flood defence structure or river control works

the structure does not project beyond the line of the bank prior to the works being carried out.

Register

Register for this exemption

Improvement works for existing tracks and paths (FRA28)

With this exemption you can carry out improvement work on existing tracks and paths. You can improve or maintain existing tracks and paths, eg resurfacing a cyclepath.

You can't construct a new or raised path.

What EA will check

EA will check that your activity meets the following conditions before they give you an exemption:

you cannot carry out the activity on or within 200m of to a site designated as a Special Protection Area (SPA), Special Area for Conservation (SAC), Ramsar site, Site of Special Scientific Interest (SSSI) or Local Nature Reserve (LNR). The locations of all these sites are available to view on MAGIC at www.magic.gov.uk

What you must check

Before you register this exemption, you must check your activity meets all of the following conditions:

the works are to an existing track or path

the works do not alter the route or width of the track or path

the works do not disturb the bed or banks of any main river

the works do not increase the level of the path by more than 100mm

when the works are completed, you remove all materials and debris from the site

Register

Register for this exemption

{% endblock %}


text:
/**
 * @ngdoc filter
 * @name formatBytes
 * @kind function
 *
 * @description
 * Convert bytes into appropriate display
 * 1024 kilobytes => 1 MB
 */

angular.module('a8m.math.kbFmt', ['a8m.math'])

  .filter('kbFmt', ['$math', function ($math) {
    return function (bytes, decimal) {

      if(isNumber(decimal) && isFinite(decimal) && decimal%1===0 && decimal >= 0 &&
        isNumber(bytes) && isFinite(bytes)) {

        if(bytes < 1024) { // within 1 MB so KB
            return convertToDecimal(bytes, decimal, $math) + ' KB';
        } else if(bytes < 1048576) { // within 1 GB so MB
            return convertToDecimal((bytes / 1024), decimal, $math) + ' MB';
        } else {
            return convertToDecimal((bytes / 1048576), decimal, $math) + ' GB';
        }

		} else {
			return "NaN";
		}
    }
}]);


text:
"usr strict";

var util = require('util');
var events = require('events');
var Interface = require('./interface');

var Bus = module.exports = function(dbus, busName) {
	var self = this;

	self.dbus = dbus;
	self.name = busName;
	self.signalHandlers = {};
	self.signalEnable = false;
	self.interfaces = {};

	switch(busName) {
	case 'system':
		self.connection = dbus._dbus.getBus(0);
		break;

	case 'session':
		self.connection = dbus._dbus.getBus(1);
		break;
	}

	self.on('signal', function(uniqueBusName, sender, objectPath, interfaceName, signalName, args) {

		if (objectPath == '/org/freedesktop/DBus/Local' &&
			interfaceName == 'org.freedesktop.DBus.Local' &&
			signalName == 'Disconnected') {

			self.reconnect();

			return;
		}

		var signalHash = objectPath + ':' + interfaceName;

		if (self.signalHandlers[signalHash]) {
			var args = [ signalName ].concat(args);

			var interfaceObj = self.signalHandlers[signalHash];
			interfaceObj.emit.apply(interfaceObj, args);
		}
	});

	// Register signal handler of this connection
	self.dbus.signalHandlers[self.connection.uniqueName] = self;
	self.dbus.enableSignal();
};

util.inherits(Bus, events.EventEmitter);

Bus.prototype.reconnect = function(callback) {
	var self = this;

	delete self.dbus.signalHandlers[self.connection.uniqueName];

	self.dbus._dbus.releaseBus(self.connection);

	switch(self.name) {
	case 'system':
		self.connection = self.dbus._dbus.getBus(0);
		break;

	case 'session':
		self.connection = self.dbus._dbus.getBus(1);
		break;
	}

	self.dbus.signalHandlers[self.connection.uniqueName] = self;

	// Reregister signal handler
	for (var hash in self.interfaces) {
		var iface = self.interfaces[hash];

		self.dbus.addSignalFilter(self, iface.interfaceName);
		self.registerSignalHandler(iface.serviceName, iface.objectPath, iface.interfaceName, iface);
	}

	if (callback)
		process.nextTick(callback);
};

Bus.prototype.introspect = function(serviceName, objectPath, callback) {
	var self = this;

	// Getting scheme of specific object
	self.dbus.callMethod(self.connection,
		serviceName,
		objectPath,
		'org.freedesktop.DBus.Introspectable',
		'Introspect',
		'',
		10000,
		[],
		function(introspect) {

			var obj = self.dbus.parseIntrospectSource(introspect);
			if (callback)
				callback(null, obj);
		});
};

Bus.prototype.getInterface = function(serviceName, objectPath, interfaceName, callback) {
	var self = this;

	if (self.interfaces[serviceName + ':' + objectPath + ':' +interfaceName]) {
		if (callback)
			process.nextTick(function() {
				callback(null, self.interfaces[serviceName + ':' + objectPath + ':' +interfaceName]);
			});

		return;
	}

	self.introspect(serviceName, objectPath, function(err, obj) {
		if (err) {
			if (callback)
				callback(err);

			return;
		}

		if (!(interfaceName in obj)) {
			if (callback)
				callback(new Error('No such interface'));

			return;
		}

		// Create a interface object based on introspect
		var iface = new Interface(self, serviceName, objectPath, interfaceName, obj[interfaceName]);
		iface.init(function() {

			self.interfaces[serviceName + ':' + objectPath + ':' +interfaceName] = iface;

			if (callback)
				callback(null, iface);
		});
	});
};

Bus.prototype.registerSignalHandler = function(serviceName, objectPath, interfaceName, interfaceObj, callback) {
	var self = this;

	// Make a hash
	var signalHash = objectPath + ':' + interfaceName;
	self.signalHandlers[signalHash] = interfaceObj;

	// Register interface signal handler
	self.dbus.addSignalFilter(self, objectPath, interfaceName, callback);
};

Bus.prototype.setMaxMessageSize = function(size) {
	var self = this;

	self.dbus.setMaxMessageSize(self, size || 1024000);
};


text:
Decimal128: [basx375] Engineering notation tests
--DESCRIPTION--
Generated by scripts/convert-bson-corpus-tests.php

DO NOT EDIT THIS FILE
--FILE--
<?php

require_once __DIR__ . '/../utils/tools.php';

$canonicalBson = hex2bin('1800000013640007000000000000000000000000004A3000');
$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+5"}}';
$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E5"}}';

// Canonical BSON -> Native -> Canonical BSON
echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";

// Canonical BSON -> Canonical extJSON
echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";

// Canonical extJSON -> Canonical BSON
echo bin2hex(fromJSON($canonicalExtJson)), "\n";

// Degenerate extJSON -> Canonical BSON
echo bin2hex(fromJSON($degenerateExtJson)), "\n";

?>
===DONE===
<?php exit(0); ?>
--EXPECT--
1800000013640007000000000000000000000000004a3000
{"d":{"$numberDecimal":"7E+5"}}
1800000013640007000000000000000000000000004a3000
1800000013640007000000000000000000000000004a3000
===DONE===


text:
module Rebase.Data.Map
(
  module Data.Map
)
where

import Data.Map


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Dotless
{
    public static class Null
    {

        public static readonly object[] Params = new object[] { };

        public static bool Is(object o)
        {
            return (o == null);
        }

        public static bool NotIs(object o)
        {
            return (o != null);
        }

        public static bool AnyOf(params object[] os)
        {
            foreach (var o in os)
                if (o == null) return true;

            return false;
        }

        public static bool AnyOf<T>(IEnumerable<T> os)
        {
            foreach (var o in os)
                if (o == null) return true;

            return false;
        }

        public static bool AllOf(params object[] os)
        {
            foreach (var o in os)
                if (o == null) return false;

            return true;
        }

        public static bool AllOf<T>(IEnumerable<T> os)
        {
            foreach (var o in os)
                if (o == null) return false;

            return true;
        }
    }
}


text:
namespace Macabresoft.Macabre2D.UI.Editor;

using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Macabresoft.Macabre2D.UI.Common;

public class SceneEditorView : UserControl {
    public SceneEditorView() {
        this.ViewModel = Resolver.Resolve<SceneEditorViewModel>();
        this.InitializeComponent();
    }

    public SceneEditorViewModel ViewModel { get; }

    private void InitializeComponent() {
        AvaloniaXamlLoader.Load(this);
    }
}