text:
JuntyTaskRunner
================
[![Packagist](https://img.shields.io/packagist/v/junty/junty-taskrunner.svg?style=flat-square)](https://packagist.org/packages/junty/junty-taskrunner) [![Travis](https://img.shields.io/travis/the-junty/junty-taskrunner.svg?style=flat-square)](https://travis-ci.org/the-junty/junty-taskrunner) [![Scrutinizer](https://img.shields.io/scrutinizer/g/the-junty/junty-taskrunner.svg?style=flat-square)](https://scrutinizer-ci.com/g/the-junty/junty-taskrunner/?branch=master) [![GitHub license](https://img.shields.io/github/license/the-junty/junty-taskrunner.svg?style=flat-square)](https://github.com/the-junty/junty-taskrunner/blob/master/LICENSE.md)

Junty task runner component.

## Install
```console
$ composer require junty/junty-taskrunner
```

## Usage
### Basig usage
```php
<?php
require 'vendor/autoload.php';

use Junty\TaskRunner\Runner\Runner;

$runner = new Runner();

$runner->task('say_hello', function () {
    echo 'hello!';
});

$runner->my_task_2 = function () {
    // ...
};

$runner->group('tests', function () {
    $this->task('tests_for_users', function () {
        // ...
    });

    $this->task('tests_for_admins', function () {
        // ...
    });
});

$runner->run(); // Runs all registred tasks
```

### Methods
#### ```task```
Creates a task with ```Junty\TaskRunner\Task\TaskInterface``` or callable one.
```php
$runner->task('my_task', function () {});

// or

$runner->task(new MyTask());
```

### ```group```
Creates a group of tasks with ```Junty\TaskRunner\Task\GroupInterface``` or callable one.
```php
$runner->group('my_group', function () {
    $this->task('my_task_from_group_1', function () {});

    // Another tasks
});
```

| A group and a task cannot have the same name!

### ```order```
Orders the execution task and groups order.
```php
$runner->order('my_group', 'my_task', 'my_group_2');
```

### ```run```
Runs all tasks and groups.
```php
$runner->run();
```

### ```runTask```
Runs a single registred task or instance of ```TaskInterface```.
```php
$runner->runTask('my_registred_task');

// or

$runner->runTask(new MyTask());
```

### ```runGroup```
Runs a single registred group or instance of ```GroupInterface```.
```php
$runner->runGroup('my_registred_group');

// or

use Junty\TaskRunner\Task\Group;

$runner->runGroup(new class() extends Group
{
    public function __construct()
    {
    }

    public function getName() : string
    {
        return 'my_group';
    }

    public function task($task, callable $task = null)
    {
    }

    public function getTasks() : TaskCollection
    {
        $collection = new TaskCollection();

        $collection->set(new MyTask());
        $collection->set(new MyOtherTask());

        return $collection;
    }
});
```


text:
/*
 * FRC Team 4343
 * Visit us at www.4343.ca
 */
package ca._4343.max3.commands.pickup;

import ca._4343.RobotConstants;
import ca._4343.max3.commands.CommandBase;

/**
 *
 * @author Brian Ho <www.4343.ca>
 * @author Tedi Papajorgji <www.4343.ca>
 */
public class UnstickBall extends CommandBase {

    public UnstickBall() {
        requires(pickupWheels);
    }

    /**
     * Called just before this Command runs the first time
     * Starts a timer
     */
    protected void initialize() {
        setTimeout(RobotConstants.UNSTICK_BALL_DURATION);
    }

    /**
     * Called repeatedly when this Command is scheduled to run
     * Runs the motor slowly so the ball doesn't get removed
     * from basket
     */
    protected void execute() {
        pickupWheels.unstickBall();
    }

    /**
     * Stops the command immediately after one execution
     * @return True once timed out
     */
    protected boolean isFinished() {
        return isTimedOut();
    }

    /**
     * Called once after isFinished returns true
     */
    protected void end() {
    }

    /**
     * Called when another command which requires one or more of the same
     * subsystems is scheduled to run
     */
    protected void interrupted() {
    }
}

redpajama_set_name: RedPajamaGithub


text:
{-# LANGUAGE OverloadedStrings #-}

import Control.Lens
import Data.Aeson.Lens (_Integer, _String, key)
import Data.Text.Encoding (encodeUtf8)

import Network.Wreq
import qualified Network.Wreq.Session as S

apiUrl = "https://api.masterleague.net"

apiUser = "username" :: String
apiPass = "password" :: String

main = S.withSession $ \s -> do

    -- Fetch authorization token for premium users
    let baseOpts = defaults & header "Accept" .~ ["application/json"]

    r1 <- S.postWith baseOpts s (apiUrl ++ "/auth/token/") ["username" := apiUser, "password" := apiPass]

    let token = r1 ^. responseBody . key "token" . _String

    -- Perform authenticated API requests
    let opts = baseOpts & auth ?~ oauth2Token (encodeUtf8 token)

    r2 <- S.getWith opts s (apiUrl ++ "/heroes/")

    let count = r2 ^? responseBody . key "count" . _Integer

    putStrLn $ "Found " ++ maybe "N/A" show count ++ " heroes!"


text:
import path from 'path';
import { granate } from 'granate';
import { readFile, assertResponse } from '../lib';

const schema = readFile(path.join(__dirname, './todos.graphql'));
const contextValue = {
    todos: [
        {completed: false},
        {completed: true}
    ]
};
const rootValue = {
    todos: (source, args, context) => {
        return context.todos.map((todo, index) => ({id: 1000 + index, title: todo.title, completed: todo.completed}))
    }
};
const query = `
    {
        todos {
            id
            title
            completed
        }
    }`;
const response = {
    data: {
        todos: [
            {id: 1000, title: 'Hello World', completed: false},
            {id: 1001, title: 'Hello World', completed: true}
        ]
    }
};

granate(schema, query, rootValue, contextValue).then(assertResponse(response));


text:
class CreateJambuCmsJavascriptFiles < ActiveRecord::Migration[5.0]
  def change
    create_table :jambu_cms_javascript_files do |t|
      t.string :name
      t.string :path

      t.timestamps
    end
  end
end


text:
package controllers.businessactivities

import com.google.inject.Inject
import connectors.DataCacheConnector
import controllers.{AmlsBaseController, CommonPlayDependencies}
import forms.{EmptyForm, Form2, InvalidForm, ValidForm}
import models.businessactivities._
import play.api.mvc.MessagesControllerComponents
import services.StatusService
import utils.AuthAction
import views.html.businessactivities._

import scala.concurrent.Future

class ExpectedBusinessTurnoverController @Inject() (val dataCacheConnector: DataCacheConnector,
                                                    implicit val statusService: StatusService,
                                                    val authAction: AuthAction,
                                                    val ds: CommonPlayDependencies,
                                                    val cc: MessagesControllerComponents,
                                                    expected_business_turnover: expected_business_turnover) extends AmlsBaseController(ds, cc) {

  def get(edit: Boolean = false) = authAction.async {
    implicit request =>
      dataCacheConnector.fetch[BusinessActivities](request.credId, BusinessActivities.key) map {
        response =>
          val form: Form2[ExpectedBusinessTurnover] = (for {
            businessActivities <- response
            expectedTurnover <- businessActivities.expectedBusinessTurnover
          } yield Form2[ExpectedBusinessTurnover](expectedTurnover)).getOrElse(EmptyForm)
          Ok(expected_business_turnover(form, edit))
      }
  }

  def post(edit: Boolean = false) = authAction.async {
    implicit request =>
      Form2[ExpectedBusinessTurnover](request.body) match {
        case f: InvalidForm =>
          Future.successful(BadRequest(expected_business_turnover(f, edit)))
        case ValidForm(_, data) =>
          for {
            businessActivities <- dataCacheConnector.fetch[BusinessActivities](request.credId, BusinessActivities.key)
            _ <- dataCacheConnector.save[BusinessActivities](request.credId, BusinessActivities.key,
              businessActivities.expectedBusinessTurnover(data)
            )
          } yield edit match {
            case true => Redirect(routes.SummaryController.get)
            case false => Redirect(routes.ExpectedAMLSTurnoverController.get())
          }
      }
    }
}


text:
import webbrowser
import time
import os

def renameFiles():
    saved_dir = os.getcwd()
    for fileName in os.listdir("/tmp/prank"):
        os.chdir("/tmp/prank")
        os.rename(fileName,fileName.translate(None,"0123456789"))
    os.chdir(saved_dir)

renameFiles()


text:
<!--
Copyright (c) 2018 YCSB contributors. All rights reserved.

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

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

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

## Quick Start

This section describes how to run YCSB on [Apache Ignite](https://ignite.apache.org).

### 1. Set Up YCSB

Git clone YCSB and compile:

    git clone http://github.com/brianfrankcooper/YCSB.git
    cd YCSB
    mvn -pl site.ycsb:ignite-binding -am clean package

### 2. Start Apache Ignite
1.1 Download latest binary [Apache Ignite release](https://ignite.apache.org/download.cgi#binaries)

1.2 Copy Ignite configs:

    cp YCSB/ignite/resources/config/ignite.xml path/to/apache-ignite-**ignite_version**-bin
    cp YCSB/ignite/resources/config/ignite-sql.xml path/to/apache-ignite-**ignite_version**-bin

NOTE: Pay attention that some parameters such us ****_storagePath_****, ****_walPath_****, ****_walArchivePath_****
     should be overwritten by certain pathes. Also please add ip addresses of your host(s) inside the bean ****_TcpDiscoveryVmIpFinder_****

1.3 Copy ignite-binding-**YCSB version**-SNAPSHOT.jar to Ignite libs:

    cp YCSB/ignite/target/ignite-binding-**YCSB_version**-SNAPSHOT.jar path/to/apache-ignite-fabric-**ignite_version**-bin/libs

Note: Please use YCSB/ignite/resources/**ignite.xml** for running **IgniteClient** tests and **ignite-sql.xml** for
**IgniteSqlClient** tests.

More information about Apache Ignite WAL (Write Ahead Log): https://apacheignite.readme.io/docs/write-ahead-log

1.4 Start ignite nodes:

    cd path/to/apache-ignite-**ignite_version**-bin
    bin/**ignite.sh** ignite.xml
or

    bin/**ignite.sh** ignite-sql.xml

### 3. Load Data and Run Tests

Load the data:

    cd path/to/YCSB
    bin/ycsb load ignite -p hosts="10.0.0.1"
        -s -P workloads/workloada \
        -threads 4 \
        -p operationcount=100000 \
        -p recordcount=100000 \
         > outputload.txt
Note: '10.0.0.1' is ip address of one of hosts where was started Apache Ignite nodes.

Run the workload test with ignite:

    cd path/to/YCSB
    bin/ycsb run ignite -p hosts="10.0.0.1"
         -s -P workloads/workloada \
         -threads 4 \
         -p operationcount=100000 \
         -p recordcount=100000 \
          > output-ignite.txt

Run the workload test with ignite-sql:

    cd path/to/YCSB
    bin/ycsb run ignite-sql -p hosts="10.0.0.1"
         -s -P workloads/workloada \
         -threads 4 \
         -p operationcount=100000 \
         -p recordcount=100000 \
          > output-ignite-sql.txt


text:
@extends('frontend/layouts/default')

{{-- Page title --}}
@section('title')
Account Sign up ::
@parent
@stop

{{-- Page content --}}
@section('content')

Sign up

	<form method="post" action="{{ route('signup') }}" class="form-horizontal" autocomplete="off">

		<input type="hidden" name="_token" value="{{ csrf_token() }}" />

first('first_name', ' error') }}">
					First Name

						<input class="form-control" type="text" name="first_name" id="first_name" value="{{ Input::old('first_name') }}" />
						{{ $errors->first('first_name', ':message') }}

first('last_name', ' error') }}">
					Last Name

						<input class="form-control" type="text" name="last_name" id="last_name" value="{{ Input::old('last_name') }}" />
						{{ $errors->first('last_name', ':message') }}

first('email', ' error') }}">
					Email

						<input class="form-control" type="text" name="email" id="email" value="{{ Input::old('email') }}" />
						{{ $errors->first('email', ':message') }}

first('email_confirm', ' error') }}">
					Confirm Email

						<input class="form-control" type="text" name="email_confirm" id="email_confirm" value="{{ Input::old('email_confirm') }}" />
						{{ $errors->first('email_confirm', ':message') }}

first('password', ' error') }}">
					Password

						<input class="form-control" type="password" name="password" id="password" value="" />
						{{ $errors->first('password', ':message') }}

first('password_confirm', ' error') }}">
					Confirm Password

						<input class="form-control" type="password" name="password_confirm" id="password_confirm" value="" />
						{{ $errors->first('password_confirm', ':message') }}

				<button type="submit" class="btn btn-success">Sign up</button>
				Cancel

	</form>

@stop


text:
namespace RqTools.Models
{
    using System;
    using System.Threading.Tasks;
    using System.Collections.Generic;

    using Inetdev.Context;
    using Inetdev.Data;
    using Inetdev.Data.Query;

    /// <summary>
    /// User data services
    /// </summary>
    public partial class UserDataServices : DataServices
    {
        /// <summary>
        /// Creates a new instance of <see cref="UserDataServices"/>.
        /// </summary>
        public UserDataServices()
        {
            Schema = "dbo";
            SequenceName = null;
        }

        /// <summary>
        /// Gets an alias for the underlaying table.
        /// </summary>
        public override string Alias
        {
            get { return "SEGUSUARIOSSISTEMA"; }
        }

        IDictionary<string, FieldDef> _flds;
        /// <summary>
        /// A collection of table field definition.
        /// </summary>
        public override IDictionary<string, FieldDef> Fields
        {
            get
            {
                if (_flds == null) {
                    _flds = new Dictionary<string, FieldDef>(3);
                    _flds["UserName"] = new FieldDef("USUARIO", 1, DbType.Text, AutomaticType.None);
                    _flds["DisplayName"] = new FieldDef("DESCRIPCION", 0, DbType.Text, AutomaticType.None);
                    _flds["Email"] = new FieldDef("EMAIL", 0, DbType.Text, AutomaticType.None);
                }
                return _flds;
            }
            set { _flds = value; }
        }

        /// <summary>
        /// Gets the table name.
        /// </summary>
        public override string Table
        {
            get { return "SEGUSUARIOSSISTEMA"; }
        }

        #region FieldKey constants

        /// <summary>
        /// Field definition key constants for UserDataServices
        /// </summary>
        public static class FKey
        {
            /// <summary>
            /// UserName, USUARIO, 1, DbType.Text.
            /// </summary>
            public const string UserName = "UserName";
            /// <summary>
            /// DisplayName, DESCRIPCION, 0, DbType.Text.
            /// </summary>
            public const string DisplayName = "DisplayName";
            /// <summary>
            /// Email, EMAIL, 0, DbType.Text.
            /// </summary>
            public const string Email = "Email";
        }

        #endregion
    }
}
// Tpl: C:\Dev\GitHub\VEDTTemplates\Inetdev\Code\DataServices-1.0.tt
// Src: C:\Dev\GitHub\RqTools\RqTools\RqTools.Models\UserDataServices.dsvc


text:
import copy
import datetime
import sqlalchemy

from oslo_config import cfg
from oslo_db import api as oslo_db_api

from keystone.common import provider_api
from keystone.common import sql
from keystone import exception
from keystone.identity.backends import base as identity_base
from keystone.identity.backends import sql_model as model
from keystone.identity.shadow_backends import base

CONF = cfg.CONF
PROVIDERS = provider_api.ProviderAPIs

class ShadowUsers(base.ShadowUsersDriverBase):
    @sql.handle_conflicts(conflict_type='federated_user')
    def create_federated_user(self, domain_id, federated_dict, email=None):

        local_entity = {'domain_id': domain_id,
                        'local_id': federated_dict['unique_id'],
                        'entity_type': 'user'}

        public_id = PROVIDERS.id_generator_api.generate_public_ID(local_entity)

        user = {
            'id': public_id,
            'domain_id': domain_id,
            'enabled': True
        }
        if email:
            user['email'] = email
        with sql.session_for_write() as session:
            federated_ref = model.FederatedUser.from_dict(federated_dict)
            user_ref = model.User.from_dict(user)
            user_ref.created_at = datetime.datetime.utcnow()
            user_ref.federated_users.append(federated_ref)
            session.add(user_ref)
            return identity_base.filter_user(user_ref.to_dict())

    @sql.handle_conflicts(conflict_type='federated_user')
    def create_federated_object(self, fed_dict):
        with sql.session_for_write() as session:
            fed_ref = model.FederatedUser.from_dict(fed_dict)
            session.add(fed_ref)

    def delete_federated_object(self, user_id):
        with sql.session_for_write() as session:
            q = session.query(model.FederatedUser)
            q = q.filter(model.FederatedUser.user_id == user_id)
            q.delete(False)

    def get_federated_objects(self, user_id):
        with sql.session_for_read() as session:
            query = session.query(model.FederatedUser)
            query = query.filter(model.FederatedUser.user_id == user_id)
            fed_ref = []
            for row in query:
                m = model.FederatedUser(
                    idp_id=row.idp_id,
                    protocol_id=row.protocol_id,
                    unique_id=row.unique_id)
                fed_ref.append(m.to_dict())
            return base.federated_objects_to_list(fed_ref)

    def _update_query_with_federated_statements(self, hints, query):
        statements = []
        for filter_ in hints.filters:
            if filter_['name'] == 'idp_id':
                statements.append(
                    model.FederatedUser.idp_id == filter_['value'])
            if filter_['name'] == 'protocol_id':
                statements.append(
                    model.FederatedUser.protocol_id == filter_['value'])
            if filter_['name'] == 'unique_id':
                statements.append(
                    model.FederatedUser.unique_id == filter_['value'])

        # Remove federated attributes to prevent redundancies from
        # sql.filter_limit_query which filters remaining hints
        hints.filters = [
            x for x in hints.filters if x['name'] not in ('idp_id',
                                                          'protocol_id',
                                                          'unique_id')]
        if statements:
            query = query.filter(sqlalchemy.and_(*statements))
        return query

    def get_federated_users(self, hints):
        with sql.session_for_read() as session:
            query = session.query(model.User).outerjoin(
                model.LocalUser).outerjoin(model.FederatedUser)
            query = query.filter(model.User.id == model.FederatedUser.user_id)
            query = self._update_query_with_federated_statements(hints, query)
            name_filter = None
            for filter_ in hints.filters:
                if filter_['name'] == 'name':
                    name_filter = filter_
                    query = query.filter(
                        model.FederatedUser.display_name == name_filter[
                            'value'])
                    break
            if name_filter:
                hints.filters.remove(name_filter)
            user_refs = sql.filter_limit_query(model.User, query, hints)
            return [identity_base.filter_user(x.to_dict()) for x in user_refs]

    def get_federated_user(self, idp_id, protocol_id, unique_id):
        # NOTE(notmorgan): Open a session here to ensure .to_dict is called
        # within an active session context. This will prevent lazy-load
        # relationship failure edge-cases
        # FIXME(notmorgan): Eventually this should not call `to_dict` here and
        # rely on something already in the session context to perform the
        # `to_dict` call.
        with sql.session_for_read():
            user_ref = self._get_federated_user(idp_id, protocol_id, unique_id)
            return identity_base.filter_user(user_ref.to_dict())

    def _get_federated_user(self, idp_id, protocol_id, unique_id):
        """Return the found user for the federated identity.

        :param idp_id: The identity provider ID
        :param protocol_id: The federation protocol ID
        :param unique_id: The user's unique ID (unique within the IdP)
        :returns User: Returns a reference to the User

        """
        with sql.session_for_read() as session:
            query = session.query(model.User).outerjoin(model.LocalUser)
            query = query.join(model.FederatedUser)
            query = query.filter(model.FederatedUser.idp_id == idp_id)
            query = query.filter(model.FederatedUser.protocol_id ==
                                 protocol_id)
            query = query.filter(model.FederatedUser.unique_id == unique_id)
            try:
                user_ref = query.one()
            except sql.NotFound:
                raise exception.UserNotFound(user_id=unique_id)
            return user_ref

    def set_last_active_at(self, user_id):
        if CONF.security_compliance.disable_user_account_days_inactive:
            with sql.session_for_write() as session:
                user_ref = session.query(model.User).get(user_id)
                user_ref.last_active_at = datetime.datetime.utcnow().date()

    @sql.handle_conflicts(conflict_type='federated_user')
    def update_federated_user_display_name(self, idp_id, protocol_id,
                                           unique_id, display_name):
        with sql.session_for_write() as session:
            query = session.query(model.FederatedUser)
            query = query.filter(model.FederatedUser.idp_id == idp_id)
            query = query.filter(model.FederatedUser.protocol_id ==
                                 protocol_id)
            query = query.filter(model.FederatedUser.unique_id == unique_id)
            query = query.filter(model.FederatedUser.display_name !=
                                 display_name)
            query.update({'display_name': display_name})
            return

    @sql.handle_conflicts(conflict_type='nonlocal_user')
    def create_nonlocal_user(self, user_dict):
        new_user_dict = copy.deepcopy(user_dict)
        # remove local_user attributes from new_user_dict
        new_user_dict.pop('name', None)
        new_user_dict.pop('password', None)
        # create nonlocal_user dict
        new_nonlocal_user_dict = {
            'name': user_dict['name']
        }
        with sql.session_for_write() as session:
            new_nonlocal_user_ref = model.NonLocalUser.from_dict(
                new_nonlocal_user_dict)
            new_user_ref = model.User.from_dict(new_user_dict)
            new_user_ref.created_at = datetime.datetime.utcnow()
            new_user_ref.nonlocal_user = new_nonlocal_user_ref
            session.add(new_user_ref)
            return identity_base.filter_user(new_user_ref.to_dict())

    @oslo_db_api.wrap_db_retry(retry_on_deadlock=True)
    def delete_user(self, user_id):
        with sql.session_for_write() as session:
            ref = self._get_user(session, user_id)

            q = session.query(model.UserGroupMembership)
            q = q.filter_by(user_id=user_id)
            q.delete(False)

            session.delete(ref)

    def get_user(self, user_id):
        with sql.session_for_read() as session:
            user_ref = self._get_user(session, user_id)
            return identity_base.filter_user(user_ref.to_dict())

    def _get_user(self, session, user_id):
        user_ref = session.query(model.User).get(user_id)
        if not user_ref:
            raise exception.UserNotFound(user_id=user_id)
        return user_ref

    def list_federated_users_info(self, hints=None):
        with sql.session_for_read() as session:
            query = session.query(model.FederatedUser)
            fed_user_refs = sql.filter_limit_query(model.FederatedUser, query,
                                                   hints)
            return [x.to_dict() for x in fed_user_refs]

    def add_user_to_group_expires(self, user_id, group_id):
        def get_federated_user():
            with sql.session_for_read() as session:
                query = session.query(model.FederatedUser)
                query = query.filter_by(user_id=user_id)
                user = query.first()
                if not user:
                    # Note(knikolla): This shouldn't really ever happen, since
                    # this requires the user to already be logged in.
                    raise exception.UserNotFound(user_id=user_id)
                return user

        with sql.session_for_write() as session:
            user = get_federated_user()
            query = session.query(model.ExpiringUserGroupMembership)
            query = query.filter_by(user_id=user_id)
            query = query.filter_by(group_id=group_id)
            membership = query.first()

            if membership:
                membership.last_verified = datetime.datetime.utcnow()
            else:
                session.add(model.ExpiringUserGroupMembership(
                    user_id=user_id,
                    group_id=group_id,
                    idp_id=user.idp_id,
                    last_verified=datetime.datetime.utcnow()
                ))


text:
package com.amazonaws.services.imagebuilder.model;

import javax.annotation.Generated;

/**
 * <p>
 * The service is unable to process your request at this time.
 * </p>
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ServiceUnavailableException extends com.amazonaws.services.imagebuilder.model.AWSimagebuilderException {
    private static final long serialVersionUID = 1L;

    /**
     * Constructs a new ServiceUnavailableException with the specified error message.
     *
     * @param message
     *        Describes the error encountered.
     */
    public ServiceUnavailableException(String message) {
        super(message);
    }

}


text:
Tilbage

  <?php
  	$sh_kat_sql = "SELECT * from forum_kat WHERE kat_id = '$kat'";
	$sh_kat_Result = mysql_query ($sh_kat_sql) or die (mysql_error());
	$sh_kat_row = mysql_fetch_assoc($sh_kat_Result);
	echo $sh_kat_row['kat_navn'];
  ?> -> Tråde

    Sidste svar
    Forfatter
    Antal indæg

  <?php
   // ================================================================
$sql = "Select * From forum_traad Inner Join user On forum_traad.fk_bruger_id = user.user_id Where forum_traad.fk_kat_id = '$kat' And forum_traad.fk_stik_id = '2' Order By fk_reply_date DESC";
	$Result = mysql_query ($sql) or die (mysql_error());
while ($row = mysql_fetch_assoc($Result))
  {
	  if($row["reply_on_off"] == 0)
	 {
	 echo '
	';
	 }
	 else
	 {
		 	 echo '
	';
	 }

	 ?>
  <a href="index.php?p=<?php echo $side; ?>&ind=<?php echo $row['traad_id']; ?>"><?php echo $row['ind_head'];?>
  <?php
	 if (isset($_SESSION['Forum traad mod']) == 1)
	 {
	 ?>

      <a id="navigation" onclick="return confirm('Er du sikker på at du vil gøre denne tråd ikke sticky');" href="index.php?p=<?php echo $side; ?>&kat=<?php echo $row['fk_kat_id']; ?>&ustik=<?php echo $row['traad_id']; ?>">Uvigtig Trå |
      <a id="navigation" onclick="return confirm('Er du sikker på at du vil flytte denne tråd');" href="index.php?p=<?php echo $side; ?>&kat=<?php echo $row['fk_kat_id']; ?>&t_flyt=<?php echo $row['traad_id']; ?>">Flyt Tråd |
      <a id="navigation" onclick="return confirm('Er du sikker på at du vil slette denne tråd');" href="index.php?p=<?php echo $side; ?>&kat=<?php echo $row['fk_kat_id']; ?>&t_slet=<?php echo $row['traad_id']; ?>">Slet Tråd
  <?php } ?>

    <?php
	 $traad_id = $row['traad_id'];
	 $last_reply = "Select * From forum_reply Inner Join user On forum_reply.fk_bruger_id = user.user_id Where forum_reply.fk_traad_id = '$traad_id' Order By forum_reply.re_id Desc Limit 1";
	 $last_result = mysql_query ($last_reply) or die (mysql_error());
while ($last = mysql_fetch_assoc($last_result))
  {
	  echo $last['frist_name'].' '.$last['last_name'].' '.date('d/m-Y',$last['re_date']);
  }
	 ?>
    <?php
     echo '	'.$row['username'].'	';
	 echo '';
	 	$reply = "SELECT * FROM forum_reply WHERE fk_traad_id = '$row[traad_id]'";
	 	$re_sult = mysql_query ($reply) or die (mysql_error());
	 	$reply_tal = mysql_num_rows($re_sult);
	 	echo $reply_tal;
	 echo '
';
  }
// ================================================================
// uvigtige tråde
$sql = "Select * From forum_traad Inner Join user On forum_traad.fk_bruger_id = user.user_id Where forum_traad.fk_kat_id = '$kat' And forum_traad.fk_stik_id = '1' Order By fk_reply_date DESC";
	$Result = mysql_query ($sql) or die (mysql_error());
while ($row = mysql_fetch_assoc($Result))
  {
	 if($row["reply_on_off"] == 0)
	 {
	 echo '
	';
	 }
	 else
	 {
		 	 echo '
	';
	 }
	 ?>
    <a href="index.php?p=<?php echo $side; ?>&ind=<?php echo $row['traad_id']; ?>"><?php echo $row['ind_head'];?>
    <?php
	 if (isset($_SESSION['Forum traad mod']) == 1)
	 {
	 ?>

    <a id="navigation" onclick="return confirm('Er du sikker på at du vil gøre denne tråd sticky');" href="index.php?p=<?php echo $side; ?>&kat=<?php echo $row['fk_kat_id']; ?>&stik=<?php echo $row['traad_id']; ?>">vigtig Tråd |
      <a id="navigation" onclick="return confirm('Er du sikker på at du vil flytte denne tråd');" href="index.php?p=<?php echo $side; ?>&kat=<?php echo $row['fk_kat_id']; ?>&t_flyt=<?php echo $row['traad_id']; ?>">Flyt Tråd |
      <a id="navigation" onclick="return confirm('Er du sikker på at du vil slette denne tråd');" href="index.php?p=<?php echo $side; ?>&kat=<?php echo $row['fk_kat_id']; ?>&t_slet=<?php echo $row['traad_id']; ?>">Slet Tråd
    <?php
	 }
     echo '	';
	 ?>
    <?php
	 $traad_id = $row['traad_id'];
	 $last_reply = "Select * From forum_reply Inner Join user On forum_reply.fk_bruger_id = user.user_id Where forum_reply.fk_traad_id = '$traad_id' Order By forum_reply.re_id Desc Limit 1";
	 $last_result = mysql_query ($last_reply) or die (mysql_error());
while ($last = mysql_fetch_assoc($last_result))
  {
	  echo $last['frist_name'].' '.$last['last_name'].' '.date('d/m-Y',$last['re_date']);
  }
	 ?>
    <?php echo ''.$row['username'].'	';
	 echo '';
	 	$reply = "SELECT * FROM forum_reply WHERE fk_traad_id = '$row[traad_id]'";
	 	$re_sult = mysql_query ($reply) or die (mysql_error());
	 	$reply_tal = mysql_num_rows($re_sult);
	 	echo $reply_tal;
	 echo '
';
  }

?>

<?php
// ================================================================
if (isset($_SESSION['Forum traad']) == 1)
	 {
		 ?>

		    <form action="" method="post">

      	Ny Tråd:

        <input type="text" name="head" required="required" style="width:723px;" maxlength="30" />

        <textarea name="text" id="traad" rows="8" style="width:723px; max-width:723px; min-height:140px"></textarea>

        <input type="submit" name="traad_op" value="Opret Tråd" />

    </form>

      <?php if(isset($msg)){echo $msg;} ?>

<?php
	 }
?>


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.05.16 at 11:58:34 AM IST
//

package org.akomantoso.schema.v3.csd09;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for anonymous complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <extension base="{http://docs.oasis-open.org/legaldocml/ns/akn/3.0/CSD09}anyOtherType">
 *       <attGroup ref="{http://docs.oasis-open.org/legaldocml/ns/akn/3.0/CSD09}refers"/>
 *       <attribute name="type" use="required" type="{http://docs.oasis-open.org/legaldocml/ns/akn/3.0/CSD09}restrictionType" />
 *       <anyAttribute processContents='lax' namespace='##other'/>
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "restriction")
public class Restriction
    extends AnyOtherType
{

    @XmlAttribute(name = "type", required = true)
    protected RestrictionType type;
    @XmlAttribute(name = "refersTo")
    protected List<String> refersTo;

    /**
     * Gets the value of the type property.
     *
     * @return
     *     possible object is
     *     {@link RestrictionType }
     *
     */
    public RestrictionType getType() {
        return type;
    }

    /**
     * Sets the value of the type property.
     *
     * @param value
     *     allowed object is
     *     {@link RestrictionType }
     *
     */
    public void setType(RestrictionType value) {
        this.type = value;
    }

    /**
     * Gets the value of the refersTo property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the refersTo property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getRefersTo().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link String }
     *
     *
     */
    public List<String> getRefersTo() {
        if (refersTo == null) {
            refersTo = new ArrayList<String>();
        }
        return this.refersTo;
    }

}


text:
using System;
using System.Xml;

namespace Reporting.Rdl
{
	///<summary>
	/// Chart (or axis) title definition.
	///</summary>
	[Serializable]
	internal class Title : ReportLink
	{
		Expression _Caption;	//(string) Caption of the title
		Style _Style;			// Defines text, border and background style
								// properties for the title.
								// All Textbox properties apply.
		TitlePositionEnum _Position;	// The position of the title; Default: center

		internal Title(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p)
		{
			_Caption=null;
			_Style=null;
			_Position=TitlePositionEnum.Center;

			// Loop thru all the child nodes
			foreach(XmlNode xNodeLoop in xNode.ChildNodes)
			{
				if (xNodeLoop.NodeType != XmlNodeType.Element)
					continue;
				switch (xNodeLoop.Name)
				{
					case "Caption":
						_Caption = new Expression(r, this, xNodeLoop, ExpressionType.String);
						break;
					case "Style":
						_Style = new Style(r, this, xNodeLoop);
						break;
					case "Position":
						_Position = TitlePosition.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
						break;
					default:
						// don't know this element - log it
						OwnerReport.rl.LogError(4, "Unknown Title element '" + xNodeLoop.Name + "' ignored.");
						break;
				}
			}
		}

		// Handle parsing of function in final pass
		override internal void FinalPass()
		{
			if (_Caption != null)
				_Caption.FinalPass();
			if (_Style != null)
				_Style.FinalPass();
			return;
		}

		internal Expression Caption
		{
			get { return  _Caption; }
			set {  _Caption = value; }
		}

		internal Style Style
		{
			get { return  _Style; }
			set {  _Style = value; }
		}

		internal TitlePositionEnum Position
		{
			get { return  _Position; }
			set {  _Position = value; }
		}
	}
}


text:
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

<#
.SYNOPSIS
Tests that when setting the storage account property's value in a database's auditing policy, that value is later fetched properly
#>
function Test-AuditingDatabaseUpdatePolicyWithStorageV2
{
	# Setup
	$testSuffix = 102
	Create-TestEnvironmentWithStorageV2 $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.StorageAccountName $params.storageAccount
		Assert-AreEqual $policy.AuditState "Enabled"
		Assert-AreEqual $policy.UseServerDefault "Disabled"
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that when setting the storage account property's value in a database's auditing policy, that value is later fetched properly
#>
function Test-AuditingDatabaseUpdatePolicyWithStorage
{
	# Setup
	$testSuffix = 101
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.StorageAccountName $params.storageAccount
		Assert-AreEqual $policy.AuditState "Enabled"
		Assert-AreEqual $policy.UseServerDefault "Disabled"
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests the flow in which re-setting the policy with storage account that has the same name as before, but it is now on a different region
#>
function Test-AuditingDatabaseUpdatePolicyWithSameNameStorageOnDifferentRegion
{
	# Setup
	$testSuffix = 173
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.StorageAccountName $params.storageAccount
		Assert-AreEqual $policy.AuditState "Enabled"
		Assert-AreEqual $policy.UseServerDefault "Disabled"

		Azure\Remove-AzureRmStorageAccount -StorageAccountName $params.storageAccount
		$newResourceGroupName =  "test-rg-for-sql-cmdlets-" + $testSuffix
		New-AzureRmResourceGroup -Name $newResourceGroupName -Location "japanwest"
		New-AzureRmStorageAccount -StorageAccountName $params.storageAccount  -ResourceGroupName $newResourceGroupName -Location "japanwest" -Type Standard_GRS

		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.StorageAccountName $params.storageAccount
		Assert-AreEqual $policy.AuditState "Enabled"
		Assert-AreEqual $policy.UseServerDefault "Disabled"

	}
	finally
	{
		# Cleanup
	}
}

<#
.SYNOPSIS
Tests that when setting the storage account property's value in a server's auditing policy, that value is later fetched properly
#>
function Test-AuditingServerUpdatePolicyWithStorage
{
	# Setup
	$testSuffix = 201
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-AreEqual $policy.StorageAccountName $params.storageAccount
		Assert-AreEqual $policy.AuditState "Enabled"
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that after setting the storage account property's value in a database's auditing policy, this value is used on next policy set operations as default. Meaning: if you don't want to change the
storage account, you don't need to provide it.
#>
function Test-AuditingDatabaseUpdatePolicyKeepPreviousStorage
{
	# Setup
	$testSuffix = 301
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount
		$policyBefore = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName
		$policyAfter = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policyBefore.StorageAccountName $policyAfter.StorageAccountName
		Assert-AreEqual $policyAfter.StorageAccountName $params.storageAccount

	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that after setting the storage account property's value in a server's auditing policy, this value is used on next policy set operations as default. Meaning: if you don't want to change the
storage account, you don't need to provide it.
#>
function Test-AuditingServerUpdatePolicyKeepPreviousStorage
{
	# Setup
	$testSuffix = 401
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount
		$policyBefore = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName
		$policyAfter = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-AreEqual $policyBefore.StorageAccountName $policyAfter.StorageAccountName
		Assert-AreEqual $policyAfter.StorageAccountName $params.storageAccount

	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that when modifying the eventType property of a databases's auditing policy (including the All and None values), these properties are later fetched properly
#>
function Test-AuditingDatabaseUpdatePolicyWithEventTypes
{
	# Setup
	$testSuffix = 501
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -EventType "All"
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.EventType.Length 10

		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -EventType "PlainSQL_Success","ParameterizedSQL_Success","ParameterizedSQL_Failure"
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.EventType.Length 3
		Assert-True {$policy.EventType.Contains([Microsoft.Azure.Commands.Sql.Auditing.Model.AuditEventType]::PlainSQL_Success)}
		Assert-True {$policy.EventType.Contains([Microsoft.Azure.Commands.Sql.Auditing.Model.AuditEventType]::ParameterizedSQL_Success)}
		Assert-True {$policy.EventType.Contains([Microsoft.Azure.Commands.Sql.Auditing.Model.AuditEventType]::ParameterizedSQL_Failure)}

		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -EventType "None"
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.EventType.Length 0
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that when modifying the eventType property of a server's auditing policy (including the All and None values), these properties are later fetched properly
#>
function Test-AuditingServerUpdatePolicyWithEventTypes
{
	# Setup
	$testSuffix = 601
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -EventType "All"
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-AreEqual $policy.EventType.Length 10

		# Test
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -EventType "PlainSQL_Success","ParameterizedSQL_Success","ParameterizedSQL_Failure"
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-AreEqual $policy.EventType.Length 3
		Assert-True {$policy.EventType.Contains([Microsoft.Azure.Commands.Sql.Auditing.Model.AuditEventType]::PlainSQL_Success)}
		Assert-True {$policy.EventType.Contains([Microsoft.Azure.Commands.Sql.Auditing.Model.AuditEventType]::ParameterizedSQL_Success)}
		Assert-True {$policy.EventType.Contains([Microsoft.Azure.Commands.Sql.Auditing.Model.AuditEventType]::ParameterizedSQL_Failure)}

		# Test
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -EventType "None"
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-AreEqual $policy.EventType.Length 0
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests the modification of a database's auditing policy event types with the 'All' or 'None' shortcuts
#>
function Test-AuditingDatabaseUpdatePolicyWithEventTypeShortcuts
{
	# Setup
	$testSuffix = 701
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -EventType "All"
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.EventType.Length 10

		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -EventType "All"
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.EventType.Length 10

		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -EventType "None"
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.EventType.Length 0

		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -EventType "None"
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.EventType.Length 0

		# Test
		Assert-Throws {Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -EventType "All", "None"}
		Assert-Throws {Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -EventType "None", "All"}
		Assert-Throws {Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -EventType "PlainSQL_Success", "All"}
		Assert-Throws {Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -EventType "PlainSQL_Success", "None"}

		#Test - If the event types includes new events and deprecated events we throw error
		Assert-Throws {Set-AzureRmSqlDatabaseServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -EventType "PlainSQL_Success", "DataAccess"}

	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests the modification of a server's auditing policy event types with the 'All' or 'None' shortcuts
#>
function Test-AuditingServerUpdatePolicyWithEventTypeShortcuts
{
	# Setup
	$testSuffix = 801
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -EventType "All"
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-AreEqual $policy.EventType.Length 10

		# Test
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -EventType "All"
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-AreEqual $policy.EventType.Length 10

		# Test
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -EventType "None"
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-AreEqual $policy.EventType.Length 0

		# Test
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -EventType "None"
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-AreEqual $policy.EventType.Length 0

		# Test
		Assert-Throws {Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -EventType "All", "None"}
		Assert-Throws {Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -EventType "None", "All"}
		Assert-Throws {Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -EventType "PlainSQL_Success", "All"}
		Assert-Throws {Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -EventType "PlainSQL_Success", "None"}

		#Test - If the event types includes new events and deprecated events we throw error
		Assert-Throws {Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -EventType "PlainSQL_Success", "DataAccess"}
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that when asking to disable auditing of a database, later when fetching the policy, it is marked as disabled
#>
function Test-AuditingDisableDatabaseAuditing
{
	# Setup
	$testSuffix = 901
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount
		Remove-AzureRmSqlDatabaseAuditing -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.AuditState "Disabled"
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that when asking to disable auditing of a server, later when fetching the policy, it is marked as disabled
#>
function Test-AuditingDisableServerAuditing
{
	# Setup
	$testSuffix = 111
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount
		Remove-AzureRmSqlServerAuditing -ResourceGroupName $params.rgname -ServerName $params.serverName
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-AreEqual $policy.AuditState "Disabled"
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that when disabling an already existing auditing policy on a database and then re-enabling it, the properties of the policy are kept
#>
function Test-AuditingDatabaseDisableEnableKeepProperties
{
	# Setup
	$testSuffix = 121
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -EventType "Login_Failure"
		Remove-AzureRmSqlDatabaseAuditing -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.StorageAccountName $params.storageAccount
		Assert-AreEqual $policy.AuditState "Enabled"
		Assert-AreEqual $policy.UseServerDefault "Disabled"
		Assert-AreEqual $policy.EventType.Length 1
		Assert-True {$policy.EventType.Contains([Microsoft.Azure.Commands.Sql.Auditing.Model.AuditEventType]::Login_Failure)}
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that when disabling an already existing auditing policy on a server and then re-enabling it, the properties of the policy are kept
#>
function Test-AuditingServerDisableEnableKeepProperties
{
	# Setup
	$testSuffix = 131
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -EventType "TransactionManagement_Success"
		Remove-AzureRmSqlServerAuditing -ResourceGroupName $params.rgname -ServerName $params.serverName
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-AreEqual $policy.StorageAccountName $params.storageAccount
		Assert-AreEqual $policy.AuditState "Enabled"
		Assert-AreEqual $policy.EventType.Length 1
		Assert-True {$policy.EventType.Contains([Microsoft.Azure.Commands.Sql.Auditing.Model.AuditEventType]::TransactionManagement_Success)}
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that after marking a database as using its server's policy, when fetching the database's policy, it is marked as using the server's policy
#>
function Test-AuditingUseServerDefault
{
    # Setup
	$testSuffix = 141
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount
		Use-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.UseServerDefault "Enabled"
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that a failure occurs when trying to set a policy to a database, and that database does not have a policy as well as the policy does not have a storage account
#>
function Test-AuditingFailedDatabaseUpdatePolicyWithNoStorage
{
	# Setup
	$testSuffix = 151
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Assert
		Assert-Throws { Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverWithoutPolicy -DatabaseName $params.databaseWithoutPolicy }
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that a failure occurs when trying to set a policy to a server, and that policy does not have a storage account
#>
function Test-AuditingFailedServerUpdatePolicyWithNoStorage
{
	# Setup
	$testSuffix = 161
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Assert
		Assert-Throws { Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverWithoutPolicy}
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that a failure occurs when trying to make a database use its server's auditing policy when the server's policy does not have a storage account
#>
function Test-AuditingFailedUseServerDefault
{
	# Setup
	$testSuffix = 171
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Assert
		Assert-Throws { Use-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverWithoutPolicy -DatabaseName $params.databaseWithoutPolicy }
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that it is impossible to use non existing database with the cmdlets
#>
function Test-AuditingFailWithBadDatabaseIndentity
{
	# Setup
	$testSuffix = 181
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Assert
		Assert-Throws { Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName "NONEXISTING-RG" -ServerName $params.serverName -DatabaseName $params.databaseName }
		Assert-Throws { Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName "NONEXISTING-SERVER"-DatabaseName $params.databaseName }
		Assert-Throws { Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName "NONEXISTING-RG"  -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount}
		Assert-Throws { Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName "NONEXISTING-SERVER" -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount}
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that it is impossible to use non existing server with the cmdlets
#>
function Test-AuditingFailWithBadServerIndentity
{
	# Setup
	$testSuffix = 191
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Assert
		Assert-Throws { Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName "NONEXISTING-RG" -ServerName $params.serverName }
		Assert-Throws { Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName "NONEXISTING-SERVER" }
		Assert-Throws { Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName "NONEXISTING-RG"  -ServerName $params.serverName -StorageAccountName $params.storageAccount}
		Assert-Throws { Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName "NONEXISTING-SERVER" -StorageAccountName $params.storageAccount}
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that storage key rotation process for a policy of a Sql database server is managed properly
#>
function Test-AuditingServerStorageKeyRotation
{
	# Setup
	$testSuffix = 680
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -StorageKeyType "Primary"
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-True { $policy.StorageKeyType -eq  "Primary"}

		# Test
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -StorageKeyType "Secondary"
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-True { $policy.StorageKeyType -eq  "Secondary"}

		# Test
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -StorageKeyType "Primary"
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-True { $policy.StorageKeyType -eq  "Primary"}
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that storage key rotation process for a policy of a Sql database is managed properly
#>
function Test-AuditingDatabaseStorageKeyRotation
{
	# Setup
	$testSuffix = 680
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName  -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -StorageKeyType "Primary"
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName  -DatabaseName $params.databaseName

		# Assert
		Assert-True { $policy.StorageKeyType -eq  "Primary"}

		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName  -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -StorageKeyType "Secondary"
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName  -DatabaseName $params.databaseName

		# Assert
		Assert-True { $policy.StorageKeyType -eq  "Secondary"}

		# Test
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName  -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -StorageKeyType "Primary"
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName  -DatabaseName $params.databaseName

		# Assert
		Assert-True { $policy.StorageKeyType -eq  "Primary"}
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}
<#
.SYNOPSIS
Tests that when setting the retention values of server policy, that values is later fetched properly.
#>
function Test-AuditingServerUpdatePolicyWithRetention
{
	# Setup
	$testSuffix = 202
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		$retentionTableIdentifier = "retentionTableIdentifier" + $testSuffix;
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -RetentionInDays 10 -TableIdentifier $retentionTableIdentifier;
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-AreEqual $policy.RetentionInDays 10
		Assert-AreEqual $policy.TableIdentifier $retentionTableIdentifier
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that when setting the retention values of database policy, that values is later fetched properly.
#>
function Test-AuditingDatabaseUpdatePolicyWithRetention
{
	# Setup
	$testSuffix = 203
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		$retentionTableIdentifier = "retentionTableIdentifier" + $testSuffix;
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -RetentionInDays 10 -TableIdentifier $retentionTableIdentifier;
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.RetentionInDays 10
		Assert-AreEqual $policy.TableIdentifier $retentionTableIdentifier
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that after setting the retention values to a server auditing policy, this value is used on next policy set operations as default.
#>
function Test-AuditingServerRetentionKeepProperties
{
	# Setup
	$testSuffix = 204
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		$retentionTableIdentifier = "retentionTableIdentifier" + $testSuffix;
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -RetentionInDays 10 -TableIdentifier $retentionTableIdentifier;

		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -RetentionInDays 11;
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-AreEqual $policy.RetentionInDays 11
		Assert-AreEqual $policy.TableIdentifier $retentionTableIdentifier

		# Test
		$retentionTableIdentifier = "retentionTableIdentifier1" + $testSuffix;
		Set-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -StorageAccountName $params.storageAccount -TableIdentifier $retentionTableIdentifier;
		$policy = Get-AzureRmSqlServerAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName

		# Assert
		Assert-AreEqual $policy.RetentionInDays 11
		Assert-AreEqual $policy.TableIdentifier $retentionTableIdentifier
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}

<#
.SYNOPSIS
Tests that after setting the retention values to a database auditing policy, this value is used on next policy set operations as default.
#>
function Test-AuditingDatabaseRetentionKeepProperties
{
	# Setup
	$testSuffix = 205
	Create-TestEnvironment $testSuffix
	$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix

	try
	{
		# Test
		$retentionTableIdentifier = "retentionTableIdentifier" + $testSuffix;
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -RetentionInDays 10 -TableIdentifier $retentionTableIdentifier;

		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -RetentionInDays 11;
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.RetentionInDays 11
		Assert-AreEqual $policy.TableIdentifier $retentionTableIdentifier

		# Test
		$retentionTableIdentifier = "retentionTableIdentifier1" + $testSuffix;
		Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount -TableIdentifier $retentionTableIdentifier;
		$policy = Get-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName

		# Assert
		Assert-AreEqual $policy.RetentionInDays 11
		Assert-AreEqual $policy.TableIdentifier $retentionTableIdentifier
	}
	finally
	{
		# Cleanup
		Remove-TestEnvironment $testSuffix
	}
}


text:
package org.knowm.xchange.poloniex.dto.trade;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
  "amount",
  "total",
  "basePrice",
  "liquidationPrice",
  "pl",
  "lendingFees",
  "type"
})
public class PoloniexMarginPostionResponse {
  @JsonProperty("amount")
  private BigDecimal amount;

  @JsonProperty("total")
  private BigDecimal total;

  @JsonProperty("basePrice")
  private BigDecimal basePrice;

  @JsonProperty("liquidationPrice")
  private BigDecimal liquidationPrice;

  @JsonProperty("pl")
  private BigDecimal pl;

  @JsonProperty("lendingFees")
  private BigDecimal lendingFees;

  @JsonProperty("type")
  private String type;

  @JsonIgnore private Map<String, Object> additionalProperties = new HashMap<String, Object>();

  public BigDecimal getAmount() {
    return amount;
  }

  public BigDecimal getTotal() {
    return total;
  }

  public BigDecimal getBasePrice() {
    return basePrice;
  }

  public BigDecimal getLiquidationPrice() {
    return liquidationPrice;
  }

  public BigDecimal getPl() {
    return pl;
  }

  public BigDecimal getLendingFees() {
    return lendingFees;
  }

  public String getType() {
    return type;
  }

  public Map<String, Object> getAdditionalProperties() {
    return additionalProperties;
  }

  @Override
  public String toString() {
    return "PoloniexMarginPostionResponse{"
        + "amount="
        + amount
        + ", total="
        + total
        + ", basePrice="
        + basePrice
        + ", liquidationPrice="
        + liquidationPrice
        + ", pl="
        + pl
        + ", lendingFees="
        + lendingFees
        + ", type='"
        + type
        + '\''
        + '}';
  }
}


text:
package io.opentelemetry.sdk.extension.trace.jaeger.sampler;

import io.grpc.ManagedChannel;
import io.opentelemetry.exporter.internal.grpc.MarshalerServiceStub;
import io.opentelemetry.exporter.internal.marshal.Marshaler;
import java.net.URI;
import java.util.function.Function;
import java.util.function.Supplier;

final class GrpcServiceUtil {

  private static final boolean USE_OKHTTP;

  static {
    boolean useOkhttp = true;
    // Use the OkHttp exporter unless grpc-stub is on the classpath.
    try {
      Class.forName("io.grpc.stub.AbstractStub");
      useOkhttp = false;
    } catch (ClassNotFoundException e) {
      // Fall through
    }
    USE_OKHTTP = useOkhttp;
  }

  static <ReqMarshalerT extends Marshaler, ResUnMarshalerT extends UnMarshaler>
      GrpcServiceBuilder<ReqMarshalerT, ResUnMarshalerT> serviceBuilder(
          String type,
          long defaultTimeoutSecs,
          URI defaultEndpoint,
          Supplier<
                  Function<ManagedChannel, MarshalerServiceStub<ReqMarshalerT, ResUnMarshalerT, ?>>>
              stubFactory,
          String grpcServiceName,
          String grpcEndpointPath) {
    if (USE_OKHTTP) {
      return new OkHttpGrpcServiceBuilder<>(
          type, grpcEndpointPath, defaultTimeoutSecs, defaultEndpoint);
    } else {
      return new DefaultGrpcServiceBuilder<>(
          type, stubFactory.get(), defaultTimeoutSecs, defaultEndpoint, grpcServiceName);
    }
  }

  private GrpcServiceUtil() {}
}


text:
require 'yt/collections/base'
require 'yt/models/content_detail'

module Yt
  module Collections
    class ContentDetails < Base

    private

      # @return [Yt::Models::ContentDetail] a new content detail initialized
      #   with one of the items returned by asking YouTube for a list of them.
      def new_item(data)
        Yt::ContentDetail.new data: data['contentDetails']
      end

      # @return [Hash] the parameters to submit to YouTube to get the
      #   content detail of a resource, for instance a video.
      # @see https://developers.google.com/youtube/v3/docs/videos#resource
      def list_params
        super.tap do |params|
          params[:params] = content_details_params
          params[:path] = '/youtube/v3/videos'
        end
      end

      def content_details_params
        {max_results: 50, part: 'contentDetails', id: @parent.id}
      end
    end
  end
end


text:
package org.drools.modelcompiler.builder.generator.declaredtype.api;

import java.util.ArrayList;
import java.util.List;

public class MethodWithStringBody implements MethodDefinition {

    private final String methodName;
    private final String returnType;

    private final String body;

    private final List<MethodParameter> parameters = new ArrayList<>();

    private List<AnnotationDefinition> annotations = new ArrayList<>();

    public MethodWithStringBody(String methodName, String returnType, String body) {
        this.methodName = methodName;
        this.returnType = returnType;
        this.body = body;
    }

    @Override
    public String getMethodName() {
        return methodName;
    }

    @Override
    public String getReturnType() {
        return returnType;
    }

    @Override
    public String getBody() {
        return body;
    }

    @Override
    public boolean isStatic() {
        return false;
    }

    @Override
    public boolean isPublic() {
        return true;
    }

    public MethodWithStringBody addParameter(String key, String value) {
        parameters.add(new MethodParameter(key, value));
        return this;
    }

    @Override
    public List<MethodParameter> parameters() {
        return parameters;
    }

    public MethodWithStringBody addAnnotation(String name) {
        annotations.add(new SimpleAnnotationDefinition(name));
        return this;
    }

    @Override
    public List<AnnotationDefinition> getAnnotations() {
        return annotations;
    }
}


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

namespace EPubLibraryContracts
{
    public enum PathType
    {
        Root = 0,
        Folder = 1,
        File = 2,
    };

    public enum DefaultLocations
    {
        DefaultTextFolder,
        DefaultLicenseFolder,
        DefaultImagesFolder,
    }

    public interface IPathElement : ICloneable
    {
        PathType Type { get; }
        string Name { get; }
    }

    public interface IEPubInternalPath : ICloneable
    {
        bool SupportFlatStructure { get; set; }
        PathType GetPathType();
        int GetNumberOfElementsInChain();
        void GetElement(int elementOrder, out string name, out PathType type);
        string GetFilePathInZip(bool flatStructure);
        string GetRelativePath(IEPubInternalPath otherObject, bool flatStructure);
        IEPubInternalPath GetPathWithoutFileName();
        string GetPathWithoutFileNameAsString();
        string GetRelativePath(string path, bool flatStructure);
        IList<IPathElement> Path { get; }
    }
}


text:
const fs = require("fs");
const path = require("path");
const https = require("https");
const { execFileSync } = require("child_process");
const { path7za } = require("7zip-bin");

const rssUrl =
  "https://sourceforge.net/projects/mpv-player-windows/rss?path=/libmpv";
const workDir = path.join(__dirname, "mpv");

(async () => {
  if (!fs.existsSync(workDir)) {
    fs.mkdirSync(workDir);
  }

  await download(workDir, path.join(workDir, "libmpv/x64"), "x86_64-20200830");
  await download(workDir, path.join(workDir, "libmpv/ia32"), "i686-20200830");
  console.log("Complete!");
})();

async function download(downloadDir, outDir, filter = "") {
  // get RSS
  const pattern = new RegExp(
    `<item>[\\s\\S]*?<link>(.*?${filter}.*?)</link>[\\s\\S]*?</item>`
  );
  const latest = await new Promise((resolve, reject) => {
    https.get(rssUrl, res => {
      let rss = "";
      res.on("data", chunk => {
        rss += chunk;
      });
      res.on("end", () => {
        const matches = rss.match(pattern);
        if (matches) {
          resolve(matches[1]);
        }
      });
      res.on("error", error => {
        reject(error);
      });
    });
  });
  // download
  let url = latest;
  let statusCode = 302;
  while (statusCode === 302) {
    res = await new Promise((resolve, reject) => {
      https.get(url, res => {
        if (res.statusCode === 200) {
          console.log(`Downloading MPV binary from ${url}`);
          const downloadPath = path.join(downloadDir, path.basename(url).split('?').shift());
          const outFile = fs.createWriteStream(downloadPath, {
            autoClose: false
          });
          const length = parseInt(res.headers["content-length"], 10);
          let current = 0;
          res.pipe(outFile);
          res.on("data", chunk => {
            current += chunk.length;
            process.stdout.write(`\r${((current / length) * 100).toFixed(1)}%`);
          });
          res.on("end", () => {
            process.stdout.write("\n");
            outFile.close();
          });
          outFile.on("close", () => {
            console.log("Decompressing...");
            execFileSync(path7za, ["x", "-y", downloadPath, `-o${outDir}`]);
            resolve(res);
          });
        } else {
          resolve(res);
        }
        res.on("error", error => {
          reject(error);
        });
      });
    });
    statusCode = res.statusCode;
    url = res.headers.location;
  }
}


text:
package org.eazegraph.showcase.fragments;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import org.eazegraph.lib.charts.StackedBarChart;
import org.eazegraph.lib.communication.IOnBarClickedListener;
import org.eazegraph.lib.models.BarModel;
import org.eazegraph.lib.models.StackedBarModel;
import org.eazegraph.showcase.R;

public class StackedBarChartFragment extends ChartFragment {

    public StackedBarChartFragment() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_stacked_bar_chart, container, false);
        mStackedBarChart = (StackedBarChart) view.findViewById(R.id.stackedbarchart);

        mStackedBarChart.setOnBarClickedListener(new IOnBarClickedListener() {
            @Override
            public void onBarClicked(int _Position) {
                Log.d("StackedBarChart", "Position: " + _Position);
            }
        });

        loadData();
        return view;
    }

    @Override
    public void onResume() {
        super.onResume();
        mStackedBarChart.startAnimation();
    }

    @Override
    public void restartAnimation() {
        mStackedBarChart.startAnimation();
    }

    private void loadData() {
        StackedBarModel s1 = new StackedBarModel("12.4");

        s1.addBar(new BarModel(2.3f, 0xFF63CBB0));
        s1.addBar(new BarModel(2.3f, 0xFF56B7F1));
        s1.addBar(new BarModel(2.3f, 0xFFCDA67F));

        StackedBarModel s2 = new StackedBarModel("13.4");
        s2.addBar(new BarModel(1.1f, 0xFF63CBB0));
        s2.addBar(new BarModel(2.7f, 0xFF56B7F1));
        s2.addBar(new BarModel(0.7f, 0xFFCDA67F));

        StackedBarModel s3 = new StackedBarModel("14.4");

        s3.addBar(new BarModel(2.3f, 0xFF63CBB0));
        s3.addBar(new BarModel(2.f, 0xFF56B7F1));
        s3.addBar(new BarModel(3.3f, 0xFFCDA67F));

        StackedBarModel s4 = new StackedBarModel("15.4");
        s4.addBar(new BarModel(1.f, 0xFF63CBB0));
        s4.addBar(new BarModel(4.2f, 0xFF56B7F1));
        s4.addBar(new BarModel(2.1f, 0xFFCDA67F));

        StackedBarModel s5 = new StackedBarModel("16.4");

        s5.addBar(new BarModel(32.3f, 0xFF63CBB0));
        s5.addBar(new BarModel(12.f, 0xFF56B7F1));
        s5.addBar(new BarModel(22.3f, 0xFFCDA67F));

        StackedBarModel s6 = new StackedBarModel("17.4");
        s6.addBar(new BarModel(3.f, 0xFF63CBB0));
        s6.addBar(new BarModel(.7f, 0xFF56B7F1));
        s6.addBar(new BarModel(1.7f, 0xFFCDA67F));

        StackedBarModel s7 = new StackedBarModel("18.4");

        s7.addBar(new BarModel(2.3f, 0xFF63CBB0));
        s7.addBar(new BarModel(2.f, 0xFF56B7F1));
        s7.addBar(new BarModel(3.3f, 0xFFCDA67F));

        StackedBarModel s8 = new StackedBarModel("19.4");
        s8.addBar(new BarModel(5.4f, 0xFF63CBB0));
        s8.addBar(new BarModel(2.7f, 0xFF56B7F1));
        s8.addBar(new BarModel(3.4f, 0xFFCDA67F));

        mStackedBarChart.addBar(s1);
        mStackedBarChart.addBar(s2);
        mStackedBarChart.addBar(s3);
        mStackedBarChart.addBar(s4);
        mStackedBarChart.addBar(s5);
        mStackedBarChart.addBar(s6);
        mStackedBarChart.addBar(s7);
        mStackedBarChart.addBar(s8);
    }

    private StackedBarChart mStackedBarChart;
}


text:
package org.yeti.server.admin.exceptions;

/**
 * Unchecked исключение, которое сигнализирует о том, что сервер уже остановлен, при попытке остановить не запущенный сервер.
 *
 * @author Kozlov Nikita
 */
public class NettyServerAlreadyStoppedException extends RuntimeException {

    public NettyServerAlreadyStoppedException() {
    }

    public NettyServerAlreadyStoppedException(String message) {
        super(message);
    }

    public NettyServerAlreadyStoppedException(String message, Throwable cause) {
        super(message, cause);
    }
}


text:
<?php

namespace Armd\DCXBundle\DCX;

use Buzz\Browser;
use Armd\DCXBundle\DCX\DCXParser;
use Armd\DCXBundle\Util\Url;
use Armd\DCXBundle\Exception\ClientException;

/**
 * @param \Buzz\Browser $browser
 */
class DCXClient
{
    private $browser;
    private $host;
    private $channel = null;
    private $scheme = 'http';
    private $path_channels = '/dcx_mkrf/atom/';
    private $path_document = '/dcx_mkrf/atom/document/';
    private $file_path = '/device_mkrf/';
    private $pub_path = '/dcx_mkrf/atom/pubinfos';

    /**
     * @param \Buzz\Browser $browser
     * @param string $host %dcx.host%
     */
    public function __construct(Browser $browser, $host)
    {
        $this->browser = $browser;
        $this->host = $host;
        Url::init();
    }

    /**
     * @param void
     * @return array objects DCXChannel
     */
    public function getListChannels()
    {
        $url = Url::build_url('',array('scheme' => $this->scheme, 'host' => $this->host, 'path' => $this->path_channels));
        $xml = $this->getFeed($url);
        $parser = new DCXParser();
        return $parser->parseListChannels($xml);
    }

    /**
     * @param string $title
     * @return object DCXChannel or false
     */
    public function searchChannel($title)
    {
        $channels = $this->getListChannels();
        if (empty($channels)){
            return false;
        }
        foreach ($channels as $key => $channel) {
            $channel_title = $channel->getTitle();
            if ($channel_title === $title){
                return $channel;
            }
        }
        return false;

    }

    public function getFile($subpath)
    {
        $url = Url::build_url('',array('scheme' => $this->scheme, 'host' => $this->host, 'path' => $this->file_path.$subpath));
        $file = $this->getFeed($url, true);
        return $file;
    }

    public function getImageFromArticle($path)
    {
        $url = Url::build_url('',array('scheme' => $this->scheme, 'host' => $this->host, 'path' => $path));
        $file = $this->getFeed($url, true);
        return $file;
    }

    /**
     * @param object DCXChannel
     * @return void
     */
    public function setChannel(DCXChannel $channel)
    {
        $this->channel = $channel;
    }

    /**
     * Simple search to DCX
     * @param string $search
     * @param int $search_limit
     * @param int $search_index_of
     * @return object DCXListDocuments
     */
    public function searchDocs($search, $search_limit = 10, $search_index_of = 0)
    {
        return $this->getListDocuments($search, $search_limit, $search_index_of);
    }

    /**
     * Get list documents from DCX
     * @param int $limit
     * @param int $index_of
     * @return object DCXListDocuments
     */
    public function listDocs($limit, $index_of)
    {
        return $this->getListDocuments(null, $limit, $index_of);
    }

    /**
     * @param string $id
     * @return object DCXDocument or string $response if document not found
     */
    public function getDoc($id)
    {
        $url = Url::build_url('',array('scheme' => $this->scheme, 'host' => $this->host, 'path' => $this->path_document.$id));
        $content = $this->getFeed($url);
        if (is_array($content)){
            return $content['response'];
        }
        $parser = new DCXParser();
        return $parser->parseDocument($content);
    }

    /**
     * @param string $search
     * @param int $limit
     * @param int $index_of
     * @return object DCXListDocuments
     */
    private function getListDocuments($search = null, $limit, $index_of)
    {
        $url = $this->getUrlChannel();

        $page_params = array('startIndex' => $index_of, 'itemsPerPage' => $limit);

        if ($search != null){
            $simple_search = array("q[fulltext][]" => $search);
        }

        $query = http_build_query(isset($simple_search) ? array_merge($simple_search, $page_params) : $page_params);
        $url = URL::build_url($url, array('query'=>$query), HTTP_URL_JOIN_QUERY);
        $xml = $this->getFeed($url);
        $parser = new DCXParser();
        return $parser->parseListDocuments($xml);
    }

    /**
     * @param string $url
     * @return string content or array if status code 404
     */
    private function getFeed($url)
    {
        $response = $this->browser->get($url);
        $status_code = $response->getStatusCode();
        if ($status_code === 404){
            return array('status_code' => 404, 'response' => $response->getContent());
        }
        if ($status_code !== 200) {
            throw new ClientException('Host returned status code:'.$response->getStatusCode());
        }
        return $response->getContent();
    }

    public function sendPublicateImage($doc_id)
    {
        $this->sendPublicate($doc_id, date(DATE_W3C), 'pubtype-image');
    }

    public function sendPublicateArticle($doc_id)
    {
        $this->sendPublicate($doc_id, date(DATE_W3C), 'pubtype-article');
    }

    private function sendPublicate($doc_id, $date, $type)
    {
        $content = $this->genaratePubInfoRequest($date, $type);
        $query = http_build_query(array('q[doc_id]'=>$doc_id));
        $url = Url::build_url('',array('scheme' => $this->scheme, 'host' => $this->host, 'path' => $this->pub_path, 'query'=>$query));
        $header = array('Content-type: application/atom+xml;type=entry');
        $response = $this->browser->post($url, $header, $content);
    }

    /**
     * @param void
     * @return object DCXChannel
     */
    private function getChannel()
    {
        if ($this->channel == null){
            throw new ClientException('Сhannel is not set');
        }
        return $this->channel;
    }

    /**
     * @param void
     * @return string $url channel
     */
    private function getUrlChannel()
    {
        $channel = $this->getChannel();
        return $channel->getUrl();
    }

    private function genaratePubInfoRequest($date, $type)
    {
        $xml_response = '<?xml version="1.0" encoding="UTF-8"?>
            <!-- pubinfo_create.xml -->
            <entry xmlns="http://www.w3.org/2005/Atom" xmlns:dcx="http://www.digicol.com/xmlns/dcx">
               <pubinfo xmlns="http://www.digicol.com/xmlns/dcx" id="" version="1.0">
                  <book></book>
                  <book_num></book_num>
                  <cover_date></cover_date>
                  <cover_display_date></cover_display_date>
                  <created></created>
                  <date>'.$date.'</date>
                  <ending_page></ending_page>
                  <ending_page_num></ending_page_num>
                  <identifier></identifier>
                  <info/>
                  <kill_date></kill_date>
                  <number></number>
                  <number_num></number_num>
                  <page></page>
                  <page_part></page_part>
                  <page_range></page_range>
                  <partpage></partpage>
                  <prod_path></prod_path>
                  <publication_id id="publication_russia-images"/>
                  <remark></remark>
                  <revision></revision>
                  <section_id id=""/>
                  <special_issue_id id=""/>
                  <starting_page></starting_page>
                  <starting_page_num></starting_page_num>
                  <status_id id="pubstatus-uploaded"></status_id>
                  <subsection_id id=""/>
                  <title></title>
                  <type_id id="'.$type.'"></type_id>
                  <uri></uri>
                  <volume></volume>
                  <volume_num></volume_num>
               </pubinfo>
            </entry>'
        ;
        return $xml_response;
    }
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.ilivoo</groupId>
	<artifactId>memcached</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>memcached</name>
	<url>http://maven.apache.org</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<sfl4j.version>1.5.11</sfl4j.version>
		<log4j.version>1.2.17</log4j.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>${sfl4j.version}</version>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>${log4j.version}</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>${sfl4j.version}</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.10</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.google.code.simple-spring-memcached</groupId>
			<artifactId>jmemcached-core</artifactId>
			<version>1.0.2</version>
		</dependency>
		<dependency>
			<groupId>net.spy</groupId>
			<artifactId>spymemcached</artifactId>
			<version>2.11.7</version>
		</dependency>
		<dependency>
			<groupId>com.typesafe.akka</groupId>
			<artifactId>akka-actor_2.11</artifactId>
			<version>2.3.14</version>
		</dependency>
		<dependency>
			<groupId>io.dropwizard.metrics</groupId>
			<artifactId>metrics-core</artifactId>
			<version>3.1.2</version>
		</dependency>

		<dependency>
			<groupId>commons-cli</groupId>
			<artifactId>commons-cli</artifactId>
			<version>1.2</version>
		</dependency>
		<dependency>
			<groupId>com.google.code.findbugs</groupId>
			<artifactId>jsr305</artifactId>
			<version>3.0.1</version>
		</dependency>
		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
			<version>18.0</version>
		</dependency>
		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<version>1.4.187</version>
		</dependency>
		<dependency>
			<groupId>org.apache.httpcomponents</groupId>
			<artifactId>httpclient</artifactId>
			<version>4.3.6</version>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-all</artifactId>
			<version>1.10.19</version>
		</dependency>

	</dependencies>
</project>