text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>Database Schema Reader now with extra SQLite</title>
<link rel="stylesheet" type="text/css" href="../../../../style.css" />

static void

About

Blog

Database Schema Reader now with extra SQLite

Published Saturday 09 April 2011

My Codeplex project, Database Schema Reader, has a new version.

I needed to create a SQLite database was a replica of a parent SQL Server database. The existing project could easily read the schema, and the code generation tools could give me the table DDL and the insert SQL. It was just a matter of executing the SQL and creating the database file.

So I created another simple Windows Forms UI. The SqlWriter class needed some tweaks for SQLite support (and I added integration tests).

For fun, I decided to see if it could also support Microsoft's latest version of SQL Server CE 4.0.

SQL Server CE 4.0 is, like SQLite, an in-process database which can be XCOPY deployed. And unlike previous versions, it is easily able to run ASP.Net websites (it's the default database behind WebMatrix). And 4.0 provides the standard ADO GetSchema which my Database Schema Reader uses (3.5 throws a Not Implemented exception).

It has some of the same limitations as SQLite, such as no stored procedures (good riddance), and no output parameters. But it also has additional limitations. In SQLite you can batch together multiple SQL statements in a single line and execute them in one command. You can't in SQL Server CE.

Unlike SQLite's weakly typed and very simple data types, SQL Server CE 4.0 has most of the standard data types as SQL Server Express and full versions. Unfortunately, this was the big problem. If your table is defined with an IDENTITY primary key, you can't insert the data row with the same primary key, and subsequent foreign key relationships are broken. It's a pretty critical limitation for my scenario.

SQL Server CE 4 only supports a subset of SQL Server data types. The one data type it didn't support, which my database (and later versions of Northwind) use, is NVARCHAR(MAX). You have to use the horrible old NTEXT data type. I could have written a DDL provider that translates varchar max to ntext, but I don't think it's worth the effort.

So my SQL Server CE creation program has major limitations, compared to the SQLite version. It's built into CopyToSQLite.exe, and auto-detects if you've installed SQL Server CE, but you have to have a very simple database for it to work.

SQL Server CE 4 also doesn't support the ADO Sync framework which allows you to synchronize a disconnected database to a parent SQL Server database. Even SQL Server 2008 R2 Management Studio doesn't support it (you have to use Visual Studio 2010 with SP1).

The new FETCH /OFFSET syntax for paging, that will be SQL Server 11, is very nice though. I'm looking forward to that.

Codeplex

Database Schema Reader

.net 4

Previously: Publish and Transform in MSBuild script (07 Apr 2011)


text:
<ion-modal-view>
	<ion-header-bar class="bar bar-dark">
		<button class="button button-clear right-buttons" ng-click="closeModal()">Close</button>

Source

	</ion-header-bar>
	<ion-content padding="true">

				.getPicture

var options = {
  quality : 75,
  destinationType : Camera.DestinationType.DATA_URL,
  sourceType : Camera.PictureSourceType.CAMERA,
  allowEdit : true,
  encodingType: Camera.EncodingType.JPEG,
  targetWidth: 100,
  targetHeight: 100,
  popoverOptions: CameraPopoverOptions,
  saveToPhotoAlbum: false
};

$cordovaCamera
  .getPicture(options)
  .then(function(imageData) {
    // Success! Image data
  }, function(err) {
    // An error occurred
  });

	</ion-content>
</ion-modal-view>

redpajama_set_name: RedPajamaGithub


text:
#include "gtest/gtest.h"

#include "application_manager/event_engine/event.h"
#include "application_manager/event_engine/event_dispatcher_impl.h"
#include "application_manager/event_engine/event_observer.h"
#include "application_manager/message.h"
#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_event_observer.h"
#include "smart_objects/smart_object.h"

#include "interfaces/MOBILE_API.h"

namespace test {
namespace components {
namespace event_engine_test {

using application_manager::event_engine::Event;
using application_manager::event_engine::EventDispatcherImpl;
using application_manager::event_engine::EventObserver;
using application_manager::event_engine::MobileEvent;
using testing::_;
using ::testing::An;
using ::testing::Matcher;

class MobileEventEngineTest : public testing::Test {
 public:
  MobileEventEngineTest()
      : event_id(MobileEvent::MobileEventID::GetAppServiceDataID)
      , event_observer_mock_(mock_event_dispatcher_) {}

 protected:
  EventDispatcherImpl* event_dispatcher_instance_;
  MobileEvent* event_;
  const MobileEvent::MobileEventID event_id;
  MockEventDispatcher mock_event_dispatcher_;
  MockEventObserver event_observer_mock_;
  const int32_t correlation_id = 1121;
  smart_objects::SmartObject smart_object_with_type_notification;
  smart_objects::SmartObject smart_object_with_type_response;
  smart_objects::SmartObject smart_object_with_type_error_response;
  smart_objects::SmartObject smart_object_with_type_request;
  smart_objects::SmartObject smart_object_with_invalid_type;

  virtual void SetUp() OVERRIDE {
    event_dispatcher_instance_ = new EventDispatcherImpl();
    event_ =
        new MobileEvent(mobile_apis::FunctionID::eType::GetAppServiceDataID);
    smart_object_with_type_notification["params"]["message_type"] =
        application_manager::MessageType::kNotification;
    smart_object_with_type_notification["params"]["correlation_id"] =
        correlation_id;
    smart_object_with_type_notification["params"]["function_id"] =
        mobile_apis::FunctionID::eType::GetAppServiceDataID;

    smart_object_with_type_response["params"]["message_type"] =
        application_manager::MessageType::kResponse;
    smart_object_with_type_response["params"]["correlation_id"] =
        correlation_id;
    smart_object_with_type_response["params"]["function_id"] =
        mobile_apis::FunctionID::eType::GetAppServiceDataID;

    smart_object_with_type_request["params"]["message_type"] =
        application_manager::MessageType::kRequest;
    smart_object_with_type_request["params"]["correlation_id"] = correlation_id;
    smart_object_with_type_request["params"]["function_id"] =
        mobile_apis::FunctionID::eType::GetAppServiceDataID;

    smart_object_with_invalid_type["params"]["message_type"] =
        application_manager::MessageType::kUnknownType;
    smart_object_with_invalid_type["params"]["correlation_id"] = correlation_id;
    smart_object_with_invalid_type["params"]["function_id"] =
        mobile_apis::FunctionID::eType::GetAppServiceDataID;
  }

  void TearDown() OVERRIDE {
    delete event_dispatcher_instance_;
    delete event_;
  }

  void CheckRaiseMobileEvent(const MobileEvent::MobileEventID& event_id,
                             const uint32_t calls_number,
                             const smart_objects::SmartObject& so) {
    // Arrange
    event_dispatcher_instance_->add_mobile_observer(
        event_id, correlation_id, event_observer_mock_);
    event_->set_smart_object(so);
    EXPECT_CALL(event_observer_mock_, HandleOnEvent(An<const MobileEvent&>()))
        .Times(calls_number);
    event_dispatcher_instance_->raise_mobile_event(*event_);
  }
};

TEST_F(MobileEventEngineTest, EventObserverTest_ExpectObserversEmpty) {
  // Arrange
  EventObserver* event_observer_ptr =
      static_cast<EventObserver*>(&event_observer_mock_);
  // Check
  EXPECT_EQ(reinterpret_cast<unsigned long>(event_observer_ptr),
            event_observer_mock_.id());
}

TEST_F(MobileEventEngineTest,
       EventDispatcherImpl_RaiseEvent_EventSOTypeResponse_ExpectEventRaised) {
  CheckRaiseMobileEvent(event_id, 1u, smart_object_with_type_response);
}

TEST_F(MobileEventEngineTest,
       EventDispatcherImpl_RaiseEvent_EventSOTypeInvalid_ExpectEventNotRaised) {
  CheckRaiseMobileEvent(event_id, 0u, smart_object_with_invalid_type);
}

TEST_F(MobileEventEngineTest,
       EventDispatcherImpl_RaiseEvent_EventSOTypeRequest_ExpectEventNotRaised) {
  CheckRaiseMobileEvent(event_id, 0u, smart_object_with_type_request);
}

TEST_F(
    MobileEventEngineTest,
    EventDispatcherImpl_RaiseEvent_EventSOTypeNotification_ExpectEventNotRaised) {
  CheckRaiseMobileEvent(event_id, 0u, smart_object_with_type_notification);
}

TEST_F(MobileEventEngineTest, Event_set_smart_object_ExpectObjectSet) {
  // Act
  event_->set_smart_object(smart_object_with_type_response);
  const int32_t obj_type =
      static_cast<int32_t>(application_manager::MessageType::kResponse);
  const int32_t function_id =
      static_cast<int32_t>(mobile_apis::FunctionID::eType::GetAppServiceDataID);
  // Checks
  EXPECT_EQ(obj_type, event_->smart_object_type());
  EXPECT_EQ(function_id, event_->smart_object_function_id());
  EXPECT_EQ(correlation_id, event_->smart_object_correlation_id());
  EXPECT_EQ(smart_object_with_type_response, event_->smart_object());
}

}  // namespace event_engine_test
}  // namespace components
}  // namespace test


text:
'use strict';

import {getCommits, getRepo} from './services/github';
import {render} from './components/repository';

Promise.all([getRepo(), getCommits()])
.then(([repository, commits]) => {
  document.body.innerHTML = render(repository, commits);
});


text:
<!DOCTYPE html>

  <title>Tippspiel - 500 Internal Server Error</title>
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet">
  <link rel="stylesheet" type="text/css" href="/css/static.css">

Tippspiel

            500 Internal Server Error

            Oooohhh eine böse Blutgrätsche im Hintergrund!!!

            Zurück zum Tippspiel

            Photo by Sören Mothes


text:
<?php
include("../templates/header.html");
include("index-debug.html");
include("../templates/footer.html");


text:
@class WCSourceTextStorage,WCSourceHighlighter,WCSourceScanner;

@protocol WCSourceTextStorageDelegate <NSTextStorageDelegate>
@required
- (WCSourceHighlighter *)sourceHighlighterForSourceTextStorage:(WCSourceTextStorage *)textStorage;
- (WCSourceScanner *)sourceScannerForSourceTextStorage:(WCSourceTextStorage *)textStorage;
@end


text:
/**
 * ModelBean.java
 *
 * Project: projecth
 *
 * @author mobileman
 * @date 1.2.2011
 * @version 1.0
 *
 * (c) 2010 MobileMan GmbH
 */

package com.mobileman.projecth.domain;

import java.util.HashMap;
import java.util.Map;

import com.mobileman.projecth.domain.util.security.AESEncoderDecoder;

/**
 * @author mobileman
 *
 */
public abstract class ModelBean {

	private Map<String, Object> decryptedPropertiesValue;

	/**
	 * @param <T>
	 * @param property
	 * @return encrypted property value
	 */
	@SuppressWarnings("unchecked")
	protected <T> T getDecryptedValue(String property) {
		if (this.decryptedPropertiesValue == null) {
			return null;
		}

		return (T) this.decryptedPropertiesValue.get(property);
	}

	/**
	 * @param property
	 * @return encrypted property value
	 */
	protected String getDecryptedValue(String property, String cryptedValue) {
		if (this.decryptedPropertiesValue == null) {
			this.decryptedPropertiesValue = new HashMap<String, Object>();
		}

		String result = null;
		if (!this.decryptedPropertiesValue.containsKey(property)) {
			result = AESEncoderDecoder.decode(cryptedValue);
			this.decryptedPropertiesValue.put(property, result);
		} else {
			result = (String)this.decryptedPropertiesValue.get(property);
		}

		return result;
	}

	/**
	 * @param <T>
	 * @param property
	 *
	 */
	protected <T> void setDecryptedValue(String property, String value) {
		if (this.decryptedPropertiesValue == null) {
			this.decryptedPropertiesValue = new HashMap<String, Object>();
		}

		this.decryptedPropertiesValue.put(property, value);
	}
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Buildron.Domain.Sorting;

namespace Buildron.Domain.Builds
{
    /// <summary>
    /// Build comparer factory.
    /// </summary>
    public static class BuildComparerFactory
    {
        /// <summary>
		/// Creates the comparer.
		/// </summary>
		/// <returns>The comparer.</returns>
		/// <param name="sortBy">Sort by.</param>
		public static IComparer<IBuild> Create(SortBy sortBy)
        {
            switch (sortBy)
            {
                case SortBy.Date:
                    return new BuildDateDescendingComparer();

                case SortBy.RelevantStatus:
                    return new BuildMostRelevantStatusComparer();

                default:
                    return new BuildTextComparer();
            }
        }
    }
}


text:
/**
 * Created by Administrator on 2017-05-22.
 */
public class ItemTest
{
    public static void main(String args[])
    {
        Item i1 = new Item("Excalibur", "The legendary sword of King Arthur", 12, 1024);
        Item i2 = new Item("Steel Armor", "Protective covering made by steel", 15, 805);

        i1.describe();
        i2.describe();
    }
}


text:
import { SepCon } from '../../src/index';
import Button from '../elements/described-button';

export default SepCon.createComponent({
    id: 'navbar-container',
}, {
    state: {
        props: {
            global: {
                pages: {
                    data: 'site',
                    key: 'pages'
                },
                currentPage: {
                    data: 'site',
                    key: 'currentPage'
                }
            }
        },
        methods: {
            local: {
                navigate(next, url) {
                    this.router.navigate(url);
                }
            }
        }
    },
    view: {
        lifecycle: {
            render() {
                let buttons = [];
                for (let key in this.props.pages) {
                    const page = this.props.pages[key];
                    buttons.push(Button.createTag()
                        .props({
                            label: page.title,
                            isActive: this.props.currentPage.id === key
                        })
                        .methods({
                            onclick: this.methods.navigate.bind(this, page.url)
                        })
                        .render());
                }
                return `
                    <div class="sepcon sepcon-container flex-container">
                        ${buttons.join('')}
                    </div>`;
            }
        }
    }
});


text:
require 'spec_helper'
module Alf
  module Support
    describe Config, "merge" do

      let(:config_class){
        Class.new(Config){
          option :ready, Boolean, true
          option :hello, String, "world"
        }
      }
      let(:config){ config_class.new }

      subject{ config.merge(ready: false) }

      it{ should be_a(config_class) }

      it 'is not the original' do
        subject.should_not be(config)
      end

      it 'merges the new options' do
        subject.ready?.should eq(false)
        subject.hello.should eq("world")
      end

      it 'does not touch the original' do
        config.ready?.should eq(true)
        config.hello.should eq("world")
      end

    end
  end
end


text:
<?php

declare(strict_types=1);

namespace Nelmio\Alice\scenario3;

class MutableUser implements UserInterface
{
    /**
     * @var string
     */
    private $username;

    /**
     * @var string
     */
    private $fullname;

    /**
     * @var \DateTimeInterface
     */
    private $createdAt;

    /**
     * @var \DateTimeInterface
     */
    private $updatedAt;

    private $owner;

    private $members;

    /**
     * @var string
     */
    private $email;

    /**
     * @var int
     */
    private $favoriteNumber;

    public function getUsername(): string
    {
        return $this->username;
    }

    public function setUsername(string $username)
    {
        $this->username = $username;
    }

    public function getFullname(): string
    {
        return $this->fullname;
    }

    public function setFullname(string $fullname)
    {
        $this->fullname = $fullname;
    }

    public function getCreatedAt(): \DateTimeInterface
    {
        return $this->createdAt;
    }

    public function setCreatedAt(\DateTimeInterface $createdAt)
    {
        $this->createdAt = $createdAt;
    }

    public function getUpdatedAt(): \DateTimeInterface
    {
        return $this->updatedAt;
    }

    public function setUpdatedAt(\DateTimeInterface $updatedAt)
    {
        $this->updatedAt = $updatedAt;
    }

    public function getOwner(): \stdClass
    {
        return $this->owner;
    }

    public function setOwner(ImmutableUser $owner)
    {
        $this->owner = $owner;
    }

    public function getMembers(): array
    {
        return $this->members;
    }

    public function addMember(ImmutableUser $member)
    {
        $this->members[] = $member;
    }

    public function setMembers(array $members)
    {
        $this->members = $members;
    }

    public function getEmail(): string
    {
        return $this->email;
    }

    public function setEmail(string $email)
    {
        $this->email = $email;
    }

    public function getFavoriteNumber(): int
    {
        return $this->favoriteNumber;
    }

    public function setFavoriteNumber(int $favoriteNumber)
    {
        $this->favoriteNumber = $favoriteNumber;
    }
}


text:
import os
import sys
import platform

# sys.path.insert(0, '.')
from host_systems_apis.host_system_api import determine_operating_system

os_type = determine_operating_system()

# check if pip (python package installer) is installed
return_code = os.system("pip -V")
if return_code:  # pip is not installed
    print("Installing python-pip...")
    if os_type.linux:
        print("Using Linux")
        command = "apt-get -y install python-pip"
        return_code = os.system(command)
        if return_code:
            raise Exception("Command '%s' executed with non-zero return code %s" %
                            (command, return_code))
    elif os_type.windows:
        print("Using Windows")
        command = "python -m pip install -U pip"
        return_code = os.system(command)
        if return_code:
            raise Exception("Could not install pip:\n'%s'" % command)
    else:
        raise Exception("Operating system '%s' not recognized!" % os_type)
else:
    print("Python-pip already installed")

if os_type.linux:
    command = "pip install --upgrade setuptools"
    os.system(command)
    command = "pip install -r host_systems_apis/api_linux/python_dependencies_linux.txt"
    return_code = os.system(command)
    if return_code:
        raise Exception("Command '%s' resulted in non-zero return code %s" %
                        (command, return_code))
elif os_type.windows:
    command = "python -m pip install --upgrade setuptools"
    os.system(command)
    command = "python -m pip install -r host_systems_apis/api_windows/python_dependencies_windows.txt"
    return_code = os.system(command)
    if return_code:
        raise Exception("Non-zero return code when running '%s'" % command)
else:
    raise Exception("Operating system '%s' not recognized!" % os_type)


text:
'''
Module to test openmanoclient class
'''
__author__="Alfonso Tierno"
__date__ ="$09-Mar-2016 09:09:48$"
__version__="0.0.2"
version_date="May 2016"

import logging
import imp

def _get_random_name(maxLength):
    '''generates a string with random craracters from space (ASCCI 32) to ~(ASCCI 126)
    with a random length up to maxLength
    '''
    long_name = "testing up to {} size name: ".format(maxLength)
    #long_name += ''.join(chr(random.randint(32,126)) for _ in range(random.randint(20, maxLength-len(long_name))))
    long_name += ''.join(random.choice('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ') for _ in range(20, maxLength-len(long_name)))
    return long_name

if __name__=="__main__":
    import getopt
    #import os
    import sys

    usage =\
    """Make a test against an openmano server.\nUsage: test_openmanoclient [options]
    -v|--verbose: prints more info in the test
    --version:    shows current version
    -h|--help:    shows this help
    -d|--debug:   set logs to debug level
    -t|--tenant:  set the tenant name to test. By default creates one
    --datacenter: set the datacenter name to test. By default creates one at http://localhost:9080/openvim
    -u|--url:     set the openmano server url. By default 'http://localhost:9090/openmano'
    --image:      use this image path for testing a VNF. By default a fake one is generated, valid for VIM in test mode'
    """

    #import openmanoclient from relative path
    module_info = imp.find_module("openmanoclient", [".."] )
    Client = imp.load_module("Client", *module_info)

    streamformat = "%(asctime)s %(name)s %(levelname)s: %(message)s"
    logging.basicConfig(format=streamformat)
    try:
        opts, args = getopt.getopt(sys.argv[1:], "t:u:dhv", ["url=", "tenant=", "debug", "help", "version", "verbose", "datacenter=", "image="])
    except getopt.GetoptError as err:
        print ("Error: {}\n Try '{} --help' for more information".format(str(err), sys.argv[0]))
        sys.exit(2)

    debug = False
    verbose = False
    url = "http://localhost:9090/openmano"
    to_delete_list=[]
    test_tenant = None
    test_datacenter = None
    test_vim_tenant = None
    test_image = None
    for o, a in opts:
        if o in ("-v", "--verbose"):
            verbose = True
        elif o in ("--version"):
            print ("{} version".format(sys.argv[0]), __version__, version_date)
            print ("(c) Copyright Telefonica")
            sys.exit()
        elif o in ("-h", "--help"):
            print(usage)
            sys.exit()
        elif o in ("-d", "--debug"):
            debug = True
        elif o in ("-u", "--url"):
            url = a
        elif o in ("-t", "--tenant"):
            test_tenant = a
        elif o in ("--datacenter"):
            test_datacenter = a
        elif o in ("--image"):
            test_image = a
        else:
            assert False, "Unhandled option"

    client = Client.openmanoclient(
                            endpoint_url=url,
                            tenant_name=test_tenant,
                            datacenter_name = test_datacenter,
                            debug = debug)

    import random
    test_number=1

    #TENANTS
    print("  {}. TEST create_tenant".format(test_number))
    test_number += 1
    long_name = _get_random_name(60)

    tenant = client.create_tenant(name=long_name, description=long_name)
    if verbose: print(tenant)

    print("  {}. TEST list_tenants".format(test_number))
    test_number += 1
    tenants = client.list_tenants()
    if verbose: print(tenants)

    print("  {}. TEST list_tenans filter by name".format(test_number))
    test_number += 1
    tenants_ = client.list_tenants(name=long_name)
    if not tenants_["tenants"]:
        raise Exception("Text error, no TENANT found with name")
    if verbose: print(tenants_)

    print("  {}. TEST get_tenant by UUID".format(test_number))
    test_number += 1
    tenant = client.get_tenant(uuid=tenants_["tenants"][0]["uuid"])
    if verbose: print(tenant)

    print("  {}. TEST delete_tenant by name".format(test_number))
    test_number += 1
    tenant = client.delete_tenant(name = long_name)
    if verbose: print(tenant)

    if not test_tenant:
        print("  {}. TEST create_tenant for remaining tests".format(test_number))
        test_number += 1
        test_tenant = "test-tenant "+\
        ''.join(random.choice('abcdefghijklmnopqrstuvwxyz') for _ in range(40))
        tenant = client.create_tenant(name = test_tenant)
        if verbose: print(tenant)
        client["tenant_name"] = test_tenant

        to_delete_list.insert(0,{"item": "tenant", "function": client.delete_tenant, "params":{"name": test_tenant} })

    #DATACENTERS
    print("  {}. TEST create_datacenter".format(test_number))
    test_number += 1
    long_name = _get_random_name(60)

    datacenter = client.create_datacenter(name=long_name, vim_url="http://fakeurl/fake")
    if verbose: print(datacenter)

    print("  {}. TEST list_datacenters".format(test_number))
    test_number += 1
    datacenters = client.list_datacenters(all_tenants=True)
    if verbose: print(datacenters)

    print("  {}. TEST list_tenans filter by name".format(test_number))
    test_number += 1
    datacenters_ = client.list_datacenters(all_tenants=True, name=long_name)
    if not datacenters_["datacenters"]:
        raise Exception("Text error, no TENANT found with name")
    if verbose: print(datacenters_)

    print("  {}. TEST get_datacenter by UUID".format(test_number))
    test_number += 1
    datacenter = client.get_datacenter(uuid=datacenters_["datacenters"][0]["uuid"], all_tenants=True)
    if verbose: print(datacenter)

    print("  {}. TEST delete_datacenter by name".format(test_number))
    test_number += 1
    datacenter = client.delete_datacenter(name=long_name)
    if verbose: print(datacenter)

    if not test_datacenter:
        print("  {}. TEST create_datacenter for remaining tests".format(test_number))
        test_number += 1
        test_datacenter = "test-datacenter "+\
        ''.join(random.choice('abcdefghijklmnopqrstuvwxyz') for _ in range(40))
        datacenter = client.create_datacenter(name=test_datacenter, vim_url="http://127.0.0.1:9080/openvim")
        if verbose: print(datacenter)
        client["datacenter_name"] = test_datacenter
        to_delete_list.insert(0,{"item": "datacenter", "function": client.delete_datacenter,
                                  "params":{
                                        "name": test_datacenter
                                    }
                                 })

        print("  {}. TEST datacenter new tenenat".format(test_number))
        test_number += 1
        test_vim_tenant = "test-vimtenant "+\
        ''.join(random.choice('abcdefghijklmnopqrstuvwxyz') for _ in range(40))
        vim_tenant = client.vim_action("create", "tenants", datacenter_name=test_datacenter, all_tenants=True, name=test_vim_tenant)
        if verbose: print(vim_tenant)
        client["datacenter_name"] = test_datacenter
        to_delete_list.insert(0,{"item": "vim_tenant",
                                 "function": client.vim_action,
                                  "params":{
                                            "action":"delete",
                                            "item":"tenants",
                                            "datacenter_name": test_datacenter,
                                            "all_tenants": True,
                                            "uuid": vim_tenant["tenant"]["id"]
                                            }
                                 })

        print("  {}. TEST datacenter attach".format(test_number))
        test_number += 1
        datacenter = client.attach_datacenter(name=test_datacenter, vim_tenant_name=test_vim_tenant)
        if verbose: print(datacenter)
        client["datacenter_name"] = test_datacenter
        to_delete_list.insert(0,{"item": "datacenter-detach", "function": client.detach_datacenter, "params":{"name": test_datacenter} })

        client["datacenter_name"] = test_datacenter

    #VIM_ACTIONS
    print("  {}. TEST create_VIM_tenant".format(test_number))
    test_number += 1
    long_name = _get_random_name(60)

    tenant = client.vim_action("create", "tenants", name=long_name)
    if verbose: print(tenant)
    tenant_uuid = tenant["tenant"]["id"]

    print("  {}. TEST list_VIM_tenants".format(test_number))
    test_number += 1
    tenants = client.vim_action("list", "tenants")
    if verbose: print(tenants)

    print("  {}. TEST get_VIM_tenant by UUID".format(test_number))
    test_number += 1
    tenant = client.vim_action("show", "tenants", uuid=tenant_uuid)
    if verbose: print(tenant)

    print("  {}. TEST delete_VIM_tenant by id".format(test_number))
    test_number += 1
    tenant = client.vim_action("delete", "tenants", uuid = tenant_uuid)
    if verbose: print(tenant)

    print("  {}. TEST create_VIM_network".format(test_number))
    test_number += 1
    long_name = _get_random_name(60)

    network = client.vim_action("create", "networks", name=long_name)
    if verbose: print(network)
    network_uuid = network["network"]["id"]

    print("  {}. TEST list_VIM_networks".format(test_number))
    test_number += 1
    networks = client.vim_action("list", "networks")
    if verbose: print(networks)

    print("  {}. TEST get_VIM_network by UUID".format(test_number))
    test_number += 1
    network = client.vim_action("show", "networks", uuid=network_uuid)
    if verbose: print(network)

    print("  {}. TEST delete_VIM_network by id".format(test_number))
    test_number += 1
    network = client.vim_action("delete", "networks", uuid = network_uuid)
    if verbose: print(network)
    #VNFS
    print("  {}. TEST create_vnf".format(test_number))
    test_number += 1
    test_vnf_name = _get_random_name(255)
    if test_image:
        test_vnf_path = test_image
    else:
        test_vnf_path = "/random/path/" + "".join(random.choice('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ') for _ in range(20))

    vnf_descriptor={'vnf': {'name': test_vnf_name,
                                'VNFC': [{'description': _get_random_name(255),
                                          'name': 'linux-VM',
                                          'VNFC image': test_vnf_path,
                                          'ram': 1024,
                                          'vcpus': 1,
                                          'bridge-ifaces': [{'name': 'eth0'}]
                                        }],
                                'description': _get_random_name(255),
                                'nets': [],
                                'external-connections': [{'name': 'eth0',
                                                          'local_iface_name': 'eth0',
                                                          'VNFC': 'linux-VM',
                                                          'type': 'bridge'}],
                                'public': False}}

    vnf = client.create_vnf(descriptor=vnf_descriptor)
    if verbose: print(vnf)
    to_delete_list.insert(0,{"item": "vnf", "function": client.delete_vnf, "params":{"name": test_vnf_name} })

    print("  {}. TEST list_vnfs".format(test_number))
    test_number += 1
    vnfs = client.list_vnfs()
    if verbose: print(vnfs)

    print("  {}. TEST list_vnfs filter by name".format(test_number))
    test_number += 1
    vnfs_ = client.list_vnfs(name=test_vnf_name)
    if not vnfs_["vnfs"]:
        raise Exception("Text error, no VNF found with name")
    if verbose: print(vnfs_)

    print("  {}. TEST get_vnf by UUID".format(test_number))
    test_number += 1
    vnf = client.get_vnf(uuid=vnfs_["vnfs"][0]["uuid"])
    if verbose: print(vnf)

    #SCENARIOS
    print("  {}. TEST create_scenario".format(test_number))
    test_number += 1
    test_scenario_name = _get_random_name(255)

    scenario_descriptor={   'schema_version': 2,
                            'scenario': {
                                'name': test_scenario_name,
                                'description': _get_random_name(255),
                                'public': True,
                                'vnfs':{
                                    'vnf1': {
                                        'vnf_name': test_vnf_name
                                    }
                                },
                                'networks':{
                                    'net1':{
                                        'external': True,
                                        'interfaces': [
                                            {'vnf1': 'eth0'}
                                        ]
                                    }
                                }
                            }
                        }

    scenario = client.create_scenario(descriptor=scenario_descriptor)
    if verbose: print(scenario)
    to_delete_list.insert(0,{"item": "scenario", "function": client.delete_scenario, "params":{"name": test_scenario_name} })

    print("  {}. TEST list_scenarios".format(test_number))
    test_number += 1
    scenarios = client.list_scenarios()
    if verbose: print(scenarios)

    print("  {}. TEST list_scenarios filter by name".format(test_number))
    test_number += 1
    scenarios_ = client.list_scenarios(name=test_scenario_name)
    if not scenarios_["scenarios"]:
        raise Exception("Text error, no VNF found with name")
    if verbose: print(scenarios_)

    print("  {}. TEST get_scenario by UUID".format(test_number))
    test_number += 1
    scenario = client.get_scenario(uuid=scenarios_["scenarios"][0]["uuid"])
    if verbose: print(scenario)

    #INSTANCES
    print("  {}. TEST create_instance".format(test_number))
    test_number += 1
    test_instance_name = _get_random_name(255)

    instance_descriptor={   'schema_version': 2,
                            'instance': {
                                'name': test_instance_name,
                                'description': _get_random_name(255),
                                'public': True,
                                'vnfs':{
                                    'vnf1': {
                                        'vnf_name': test_vnf_name
                                    }
                                },
                                'networks':{
                                    'net1':{
                                        'external': True,
                                        'interfaces': [
                                            {'vnf1': 'eth0'}
                                        ]
                                    }
                                }
                            }
                        }

    instance = client.create_instance(scenario_name=test_scenario_name, name=test_instance_name )
    if verbose: print(instance)
    to_delete_list.insert(0,{"item": "instance", "function": client.delete_instance, "params":{"name": test_instance_name} })

    print("  {}. TEST list_instances".format(test_number))
    test_number += 1
    instances = client.list_instances()
    if verbose: print(instances)

    print("  {}. TEST list_instances filter by name".format(test_number))
    test_number += 1
    instances_ = client.list_instances(name=test_instance_name)
    if not instances_["instances"]:
        raise Exception("Text error, no VNF found with name")
    if verbose: print(instances_)

    print("  {}. TEST get_instance by UUID".format(test_number))
    test_number += 1
    instance = client.get_instance(uuid=instances_["instances"][0]["uuid"])
    if verbose: print(instance)

    #DELETE Create things
    for item in to_delete_list:
        print("  {}. TEST delete_{}".format(test_number, item["item"]))
        test_number += 1
        response = item["function"](**item["params"])
        if verbose: print(response)


text:
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.

Imports System.Collections.Immutable
Imports System.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis.ChangeNamespace
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.LanguageServices
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax

Namespace Microsoft.CodeAnalysis.VisualBasic.ChangeNamespace
    <ExportLanguageService(GetType(IChangeNamespaceService), LanguageNames.VisualBasic), [Shared]>
    Friend Class VisualBasicChangeNamespaceService
        Inherits AbstractChangeNamespaceService(Of NamespaceStatementSyntax, CompilationUnitSyntax, StatementSyntax)

        <ImportingConstructor>
        Public Sub New()
        End Sub

        Public Overrides Function TryGetReplacementReferenceSyntax(reference As SyntaxNode, newNamespaceParts As ImmutableArray(Of String), syntaxFacts As ISyntaxFactsService, ByRef old As SyntaxNode, ByRef [new] As SyntaxNode) As Boolean
            Dim nameRef = TryCast(reference, SimpleNameSyntax)
            old = nameRef
            [new] = nameRef

            If nameRef Is Nothing Or newNamespaceParts.IsDefaultOrEmpty Then
                Return False
            End If

            If syntaxFacts.IsRightSideOfQualifiedName(nameRef) Then
                old = nameRef.Parent
                If IsGlobalNamespace(newNamespaceParts) Then
                    [new] = SyntaxFactory.QualifiedName(SyntaxFactory.GlobalName(), nameRef.WithoutTrivia())
                Else
                    Dim qualifiedNamespaceName = CreateNamespaceAsQualifiedName(newNamespaceParts, newNamespaceParts.Length - 1)
                    [new] = SyntaxFactory.QualifiedName(qualifiedNamespaceName, nameRef.WithoutTrivia())
                End If

                [new] = [new].WithTriviaFrom(old)

            ElseIf syntaxFacts.IsNameOfMemberAccessExpression(nameRef) Then
                old = nameRef.Parent
                If IsGlobalNamespace(newNamespaceParts) Then
                    [new] = SyntaxFactory.SimpleMemberAccessExpression(SyntaxFactory.GlobalName(), nameRef.WithoutTrivia())
                Else
                    Dim memberAccessNamespaceName = CreateNamespaceAsMemberAccess(newNamespaceParts, newNamespaceParts.Length - 1)
                    [new] = SyntaxFactory.SimpleMemberAccessExpression(memberAccessNamespaceName, nameRef.WithoutTrivia())
                End If

                [new] = [new].WithTriviaFrom(old)
            End If

            Return True
        End Function

        ' TODO: Implement the service for VB
        Protected Overrides Function GetValidContainersFromAllLinkedDocumentsAsync(document As Document, container As SyntaxNode, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of (DocumentId, SyntaxNode)))
            Return Task.FromResult(CType(Nothing, ImmutableArray(Of (DocumentId, SyntaxNode))))
        End Function

        ' This is only reachable when called from a VB service, which is not implemented yet.
        Protected Overrides Function ChangeNamespaceDeclaration(root As CompilationUnitSyntax, declaredNamespaceParts As ImmutableArray(Of String), targetNamespaceParts As ImmutableArray(Of String)) As CompilationUnitSyntax
            Throw ExceptionUtilities.Unreachable
        End Function

        ' This is only reachable when called from a VB service, which is not implemented yet.
        Protected Overrides Function GetMemberDeclarationsInContainer(container As SyntaxNode) As SyntaxList(Of StatementSyntax)
            Throw ExceptionUtilities.Unreachable
        End Function

        ' This is only reachable when called from a VB service, which is not implemented yet.
        Protected Overrides Function TryGetApplicableContainerFromSpanAsync(document As Document, span As TextSpan, cancellationToken As CancellationToken) As Task(Of SyntaxNode)
            Throw ExceptionUtilities.Unreachable
        End Function

        ' This is only reachable when called from a VB service, which is not implemented yet.
        Protected Overrides Function GetDeclaredNamespace(container As SyntaxNode) As String
            Throw ExceptionUtilities.Unreachable
        End Function

        Private Shared Function CreateNamespaceAsQualifiedName(namespaceParts As ImmutableArray(Of String), index As Integer) As NameSyntax
            Dim part = namespaceParts(index).EscapeIdentifier()
            Dim namePiece = SyntaxFactory.IdentifierName(part)

            If index = 0 Then
                Return namePiece
            Else
                Return SyntaxFactory.QualifiedName(CreateNamespaceAsQualifiedName(namespaceParts, index - 1), namePiece)
            End If
        End Function

        Private Shared Function CreateNamespaceAsMemberAccess(namespaceParts As ImmutableArray(Of String), index As Integer) As ExpressionSyntax
            Dim part = namespaceParts(index).EscapeIdentifier()
            Dim namePiece = SyntaxFactory.IdentifierName(part)

            If index = 0 Then
                Return namePiece
            Else
                Return SyntaxFactory.SimpleMemberAccessExpression(CreateNamespaceAsMemberAccess(namespaceParts, index - 1), namePiece)
            End If
        End Function
    End Class
End Namespace


text:
<Type Name="TreeNodeOrderEventArgs" FullName="Xwt.TreeNodeOrderEventArgs">
  <TypeSignature Language="C#" Value="public class TreeNodeOrderEventArgs : Xwt.TreeNodeEventArgs" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit TreeNodeOrderEventArgs extends Xwt.TreeNodeEventArgs" />
  <AssemblyInfo>
    <AssemblyName>Xwt</AssemblyName>
    <AssemblyVersion>1.0.4396.35768</AssemblyVersion>
  </AssemblyInfo>
  <Base>
    <BaseTypeName>Xwt.TreeNodeEventArgs</BaseTypeName>
  </Base>
  <Interfaces />
  <Docs>
    To be added.
    <remarks>To be added.</remarks>
  </Docs>
  <Members>
    <Member MemberName=".ctor">
      <MemberSignature Language="C#" Value="public TreeNodeOrderEventArgs (Xwt.TreePosition parentNode, int[] childrenOrder);" />
      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class Xwt.TreePosition parentNode, int32[] childrenOrder) cil managed" />
      <MemberType>Constructor</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.4396.35768</AssemblyVersion>
      </AssemblyInfo>
      <Parameters>
        <Parameter Name="parentNode" Type="Xwt.TreePosition" />
        <Parameter Name="childrenOrder" Type="System.Int32[]" />
      </Parameters>
      <Docs>
        <param name="parentNode">To be added.</param>
        <param name="childrenOrder">To be added.</param>
        To be added.
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
    <Member MemberName="ChildrenOrder">
      <MemberSignature Language="C#" Value="public int[] ChildrenOrder { get; }" />
      <MemberSignature Language="ILAsm" Value=".property instance int32[] ChildrenOrder" />
      <MemberType>Property</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.4396.35768</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>System.Int32[]</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
        <value>To be added.</value>
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
  </Members>
</Type>


text:
package uk.co.palmr.classfileparser;

public interface BasicInterface {
  String getOutputMessage();
}


text:
#pragma once
#include <aws/elastictranscoder/ElasticTranscoder_EXPORTS.h>
#include <aws/elastictranscoder/model/TimeSpan.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace ElasticTranscoder
{
namespace Model
{

  /**
   *
Settings for one clip in a composition. All jobs in a playlist must have the
   * same clip settings.

See Also:
   AWS
   * API Reference

   */
  class AWS_ELASTICTRANSCODER_API Clip
  {
  public:
    Clip();
    Clip(Aws::Utils::Json::JsonView jsonValue);
    Clip& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
Settings that determine when a clip begins and how long it lasts.

     */
    inline const TimeSpan& GetTimeSpan() const{ return m_timeSpan; }

    /**
     *
Settings that determine when a clip begins and how long it lasts.

     */
    inline void SetTimeSpan(const TimeSpan& value) { m_timeSpanHasBeenSet = true; m_timeSpan = value; }

    /**
     *
Settings that determine when a clip begins and how long it lasts.

     */
    inline void SetTimeSpan(TimeSpan&& value) { m_timeSpanHasBeenSet = true; m_timeSpan = std::move(value); }

    /**
     *
Settings that determine when a clip begins and how long it lasts.

     */
    inline Clip& WithTimeSpan(const TimeSpan& value) { SetTimeSpan(value); return *this;}

    /**
     *
Settings that determine when a clip begins and how long it lasts.

     */
    inline Clip& WithTimeSpan(TimeSpan&& value) { SetTimeSpan(std::move(value)); return *this;}

  private:

    TimeSpan m_timeSpan;
    bool m_timeSpanHasBeenSet;
  };

} // namespace Model
} // namespace ElasticTranscoder
} // namespace Aws


text:
package org.apache.myfaces.trinidadinternal.ui.laf.base.pda;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.faces.context.ResponseWriter;

import org.apache.myfaces.trinidad.component.core.layout.CorePanelHeader;
import org.apache.myfaces.trinidadinternal.ui.UINode;
import org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext;
import org.apache.myfaces.trinidadinternal.ui.laf.base.xhtml.XhtmlLafConstants;
import org.apache.myfaces.trinidadinternal.ui.laf.base.xhtml.XhtmlLafUtils;

/**
 * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/ui/laf/base/pda/HeaderRenderer.java#0 $) $Date: 10-nov-2005.18:54:56 $
 * @deprecated This class comes from the old Java 1.2 UIX codebase and should not be used anymore.
 */
@Deprecated
public class HeaderRenderer
        extends org.apache.myfaces.trinidadinternal.ui.laf.base.xhtml.HeaderRenderer
{
    private int _getSize(
            UIXRenderingContext context,
            UINode           node
            )throws IOException
    {
        setPrevHeaderSize( context );

        Number sizeNumber = (Number)getAttributeValue(context, node,
                SIZE_ATTR, null);

        int size;
        if (sizeNumber != null )
        {
            size = sizeNumber.intValue();
            setContextHeaderSize( context, sizeNumber);
        }
        else
        {
            sizeNumber = getContextHeaderSize(context, null);

            if ( sizeNumber == null )
                size = 0;
            else
                size = sizeNumber.intValue() + 1;

            setContextHeaderSize( context, size);
        }

        return size;
    }

    @Override
    protected void prerender(
            UIXRenderingContext context,
            UINode           node
            ) throws IOException
    {
        int size = _getSize(context, node);

        String messageType =
                XhtmlLafUtils.getStringAttributeValue(context,
                        node,
                        MESSAGE_TYPE_ATTR);

        Object label = getText( context, node, messageType);

        ResponseWriter writer = context.getResponseWriter();

        writer.startElement(DIV_ELEMENT, node.getUIComponent());
        super.renderAttributes( context, node);
        super.prerender(context, node);

       //jmw use H1, H2, etc instead. String headerElement = DIV_ELEMENT;
             // add the h1 tags so I can use the same styles!
        String headerElement = (size < HEADER_ELEMENT.length)
                                ? HEADER_ELEMENT[size]
                                : HEADER_ELEMENT[HEADER_ELEMENT.length-1];
        writer.startElement(headerElement, null);
        Object styleClass = AF_PANEL_HEADER_STYLE_CLASS;

        if ( MESSAGE_TYPE_ERROR.equals( messageType ))
        {
            styleClass = AF_PANEL_HEADER_ERROR_STYLE_CLASS;
        }
        else
        {

            styleClass = AF_PANEL_HEADER_STYLE_CLASS;
        }

        if (renderStyleElements(context))
            startRenderingStyleElements(context, null, styleClass);
        else
            renderStyleClassAttribute(context, styleClass);

        renderIcon(context, node);

        if (label != null)
          writer.writeText(label, CorePanelHeader.TEXT_KEY.getName());

        if (renderStyleElements(context))
            XhtmlLafUtils.endRenderingStyleElements(context);

        writer.endElement(headerElement);

        // increment header nesting
        incrementHeaderNestLevel(context);

    }

    protected void renderIcon(
            UIXRenderingContext context,
            UINode           node
            )throws IOException
    {
        ResponseWriter writer = context.getResponseWriter();

        String messageType =
                XhtmlLafUtils.getStringAttributeValue(context,
                        node,
                        MESSAGE_TYPE_ATTR);
        Object iconURI = getIconURI( context, node, messageType );
        if( iconURI != null )
        {
            writer.startElement(IMAGE_ELEMENT, null);
            writer.writeAttribute(ALT_ATTRIBUTE, EMPTY_STRING_ATTRIBUTE_VALUE, null);
            renderEncodedResourceURI(context, SOURCE_ATTRIBUTE, iconURI);
            writer.endElement(IMAGE_ELEMENT);
        }

    }

    @Override
    protected void postrender(
            UIXRenderingContext context,
            UINode           node
            ) throws IOException
    {

        decrementHeaderNestLevel(context);
        resetHeaderSize(context);
        ResponseWriter writer = context.getResponseWriter();
        super.postrender(context, node);
        writer.endElement(DIV_ELEMENT);

    }

    @Override
    protected void renderContent(
       UIXRenderingContext context,
       UINode           node
       ) throws IOException
     {
       Boolean isDisclosed = (Boolean)context.getLocalProperty(0,
                                                               _DISCLOSED_KEY,
                                                               Boolean.TRUE );

       if ( Boolean.TRUE.equals( isDisclosed ) )
         super.renderContent(context, node);
     }

    /**
     * Copies an attribute from a source node to a destination UINode
     */
    // -= Simon Lessard =-
    // TODO: Never used locally as of 2006-08-09. Remove permanently
    //       if no problem show up.
    /*private void _copyAttr(
            UIXRenderingContext context,
            UINode           sourceNode,
            AttributeKey     attrKey,
            MutableUINode    destNode
            )
    {
        Object value = sourceNode.getAttributeValue(context, attrKey);

        if (value != null)
        {
            destNode.setAttributeValue(attrKey, value);
        }
    }*/

    private static final Object _DISCLOSED_KEY = new Object();

    private static final Map<String, String> _RESOURCE_KEY_MAP;
    static
    {
      _RESOURCE_KEY_MAP = new HashMap<String, String>();

      _RESOURCE_KEY_MAP.put("af_showDetail.DISCLOSED" ,
                                "af_showDetailHeader.DISCLOSED");
      _RESOURCE_KEY_MAP.put("af_showDetail.UNDISCLOSED" ,
                                "af_showDetailHeader.UNDISCLOSED");
      _RESOURCE_KEY_MAP.put("af_showDetail.DISCLOSED_TIP" ,
                                "af_showDetailHeader.DISCLOSED_TIP");
      _RESOURCE_KEY_MAP.put("af_showDetail.UNDISCLOSED_TIP" ,
                                "af_showDetailHeader.UNDISCLOSED_TIP");
      _RESOURCE_KEY_MAP.put(XhtmlLafConstants.AF_SHOW_DETAIL_DISCLOSED_ICON_NAME,
                                XhtmlLafConstants.AF_SHOW_DETAIL_HEADER_SD_DISCLOSED_ICON_NAME);
      _RESOURCE_KEY_MAP.put(XhtmlLafConstants.AF_SHOW_DETAIL_UNDISCLOSED_ICON_NAME,
                                XhtmlLafConstants.AF_SHOW_DETAIL_HEADER_SD_UNDISCLOSED_ICON_NAME);
    }

}


text:
using System;
using Repository.Interfaces;
using System.Data.Entity;
using Repository.Exceptions;
using System.Linq;
using System.Collections.Generic;
using System.Data.Entity.Infrastructure;

namespace Repository.Base
{
    public abstract class Repository<T> : IRepository<T> where T : class
    {

        private readonly DbBKContext _dbContext;
        private DbSet<T> _dbSet;

        public Repository(DbBKContext dbContext)
        {
            _dbContext = dbContext;
            _dbSet = _dbContext.Set<T>();
        }

        public T Add(T entity)
        {
            try
            {
                return _dbSet.Add(entity);
            }
            catch (Exception e)
            {
                throw new RepositoryException(e.Message);
            }
        }

        public void Delete(T entity)
        {
            try
            {
                _dbSet.Attach(entity);
                _dbSet.Remove(entity);
            }
            catch (Exception e)
            {
                throw new RepositoryException(e.Message);
            }
        }

        public List<T> Find(Func<T, bool> predicate)
        {
            try
            {
                return _dbSet.Where(predicate).ToList();
            }
            catch (Exception e)
            {
                throw new RepositoryException(e.Message);
            }
        }

        public T Get(int id)
        {
            try
            {
                return _dbSet.Find(id);
            }
            catch (Exception e)
            {
                throw new RepositoryException(e.Message);
            }
        }

        public IEnumerable<T> ListAll()
        {
            try
            {
                return _dbSet;
            }
            catch (Exception e)
            {
                throw new RepositoryException(e.Message);
            }
        }

        public bool Update(T entity)
        {
            try
            {
                DbEntityEntry dbEntityEntry = _dbContext.Entry(entity);

                if (dbEntityEntry.State == EntityState.Detached)
                {
                    _dbSet.Attach(entity);
                }

                dbEntityEntry.State = EntityState.Modified;
                return true;
            }
            catch (Exception e)
            {
                throw new RepositoryException(e.Message);
            }
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<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>

    <artifactId>future-converter-guava-common</artifactId>

    <parent>
        <groupId>net.javacrumbs.future-converter</groupId>
        <artifactId>future-converter</artifactId>
        <version>1.2.1-SNAPSHOT</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>net.javacrumbs.future-converter</groupId>
            <artifactId>future-converter-common</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Automatic-Module-Name>net.javacrumbs.futureconverter.guavacommon</Automatic-Module-Name>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


text:
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Threading.Tasks;

namespace PlatformBenchmarks
{
    public class RawDb
    {
        private static readonly Comparison<World> WorldSortComparison = (a, b) => a.Id.CompareTo(b.Id);

        private readonly ConcurrentRandom _random;
        private readonly DbProviderFactory _dbProviderFactory;
        private readonly string _connectionString;

        public RawDb(ConcurrentRandom random, DbProviderFactory dbProviderFactory, AppSettings appSettings)
        {
            _random = random;
            _dbProviderFactory = dbProviderFactory;
            _connectionString = appSettings.ConnectionString;
        }

        public async Task<World> LoadSingleQueryRow()
        {
            using (var db = _dbProviderFactory.CreateConnection())
            {
                db.ConnectionString = _connectionString;
                await db.OpenAsync();

                using (var cmd = CreateReadCommand(db))
                {
                    return await ReadSingleRow(db, cmd);
                }
            }
        }

        async Task<World> ReadSingleRow(DbConnection connection, DbCommand cmd)
        {
            using (var rdr = await cmd.ExecuteReaderAsync(CommandBehavior.SingleRow))
            {
                await rdr.ReadAsync();

                return new World
                {
                    Id = rdr.GetInt32(0),
                    RandomNumber = rdr.GetInt32(1)
                };
            }
        }

        DbCommand CreateReadCommand(DbConnection connection)
        {
            var cmd = connection.CreateCommand();
            cmd.CommandText = "SELECT id, randomnumber FROM world WHERE id = @Id";
            var id = cmd.CreateParameter();
            id.ParameterName = "@Id";
            id.DbType = DbType.Int32;
            id.Value = _random.Next(1, 10001);
            cmd.Parameters.Add(id);

            (cmd as MySql.Data.MySqlClient.MySqlCommand)?.Prepare();

            return cmd;
        }

        public async Task<World[]> LoadMultipleQueriesRows(int count)
        {
            using (var db = _dbProviderFactory.CreateConnection())
            {
                db.ConnectionString = _connectionString;
                await db.OpenAsync();
                return await LoadMultipleRows(count, db);
            }

        }

        private async Task<World[]> LoadMultipleRows(int count, DbConnection db)
        {
            using (var cmd = CreateReadCommand(db))
            {
                cmd.Parameters["@Id"].Value = _random.Next(1, 10001);

                var result = new World[count];
                for (int i = 0; i < result.Length; i++)
                {
                    result[i] = await ReadSingleRow(db, cmd);
                    cmd.Parameters["@Id"].Value = _random.Next(1, 10001);
                }
                return result;
            }
        }

        public async Task<World[]> LoadMultipleUpdatesRows(int count)
        {
            using (var db = _dbProviderFactory.CreateConnection())
            {
                db.ConnectionString = _connectionString;
                await db.OpenAsync();

                var results = await LoadMultipleRows(count, db);

                // Postgres has problems with deadlocks when these aren't sorted
                Array.Sort<World>(results, WorldSortComparison);

                using (var updateCmd = db.CreateCommand())
                {
                    for (int i = 0; i < results.Length; i++)
                    {
                        var strings = BatchUpdateString.Strings[i];
                        var id = updateCmd.CreateParameter();
                        id.ParameterName = strings.Id;
                        id.DbType = DbType.Int32;
                        updateCmd.Parameters.Add(id);

                        var random = updateCmd.CreateParameter();
                        random.ParameterName = strings.Random;
                        random.DbType = DbType.Int32;
                        updateCmd.Parameters.Add(random);

                        var randomNumber = _random.Next(1, 10001);
                        id.Value = results[i].Id;
                        random.Value = randomNumber;
                        results[i].RandomNumber = randomNumber;
                    }

                    updateCmd.CommandText = BatchUpdateString.Strings[results.Length - 1].UpdateQuery;
                    await updateCmd.ExecuteNonQueryAsync();

                    return results;
                }
            }
        }

        public async Task<List<Fortune>> LoadFortunesRows()
        {
            var result = new List<Fortune>();

            using (var db = _dbProviderFactory.CreateConnection())
            using (var cmd = db.CreateCommand())
            {
                cmd.CommandText = "SELECT id, message FROM fortune";

                db.ConnectionString = _connectionString;
                await db.OpenAsync();

                (cmd as MySql.Data.MySqlClient.MySqlCommand)?.Prepare();

                using (var rdr = await cmd.ExecuteReaderAsync(CommandBehavior.CloseConnection))
                {
                    while (await rdr.ReadAsync())
                    {
                        result.Add(new Fortune
                        {
                            Id = rdr.GetInt32(0),
                            Message = rdr.GetString(1)
                        });
                    }
                }
            }

            result.Add(new Fortune { Message = "Additional fortune added at request time." });
            result.Sort();

            return result;
        }
    }
}


text:
<?php

declare(strict_types=1);

namespace Sylius\Bundle\CoreBundle\Installer\Setup;

use Sylius\Component\Locale\Model\LocaleInterface;
use Sylius\Component\Resource\Factory\FactoryInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Intl\Exception\MissingResourceException;
use Symfony\Component\Intl\Languages;

final class LocaleSetup implements LocaleSetupInterface
{
    private RepositoryInterface $localeRepository;

    private FactoryInterface $localeFactory;

    private string $locale;

    public function __construct(RepositoryInterface $localeRepository, FactoryInterface $localeFactory, string $locale)
    {
        $this->localeRepository = $localeRepository;
        $this->localeFactory = $localeFactory;
        $this->locale = trim($locale);
    }

    public function setup(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper): LocaleInterface
    {
        $code = $this->getLanguageCodeFromUser($input, $output, $questionHelper);

        $output->writeln(sprintf('Adding <info>%s</info> locale.', $code));

        if ($this->locale !== $code) {
            $output->writeln('<info>You may also need to add this locale into config/services.yaml configuration.</info>');
        }

        /** @var LocaleInterface|null $existingLocale */
        $existingLocale = $this->localeRepository->findOneBy(['code' => $code]);
        if (null !== $existingLocale) {
            return $existingLocale;
        }

        /** @var LocaleInterface $locale */
        $locale = $this->localeFactory->createNew();
        $locale->setCode($code);

        $this->localeRepository->add($locale);

        return $locale;
    }

    private function getLanguageCodeFromUser(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper): string
    {
        $code = $this->getNewLanguageCode($input, $output, $questionHelper);
        $name = $this->getLanguageName($code);

        while (null === $name) {
            $output->writeln(
                sprintf('<comment>Language with code <info>%s</info> could not be resolved.</comment>', $code)
            );

            $code = $this->getNewLanguageCode($input, $output, $questionHelper);
            $name = $this->getLanguageName($code);
        }

        $output->writeln(sprintf('Adding <info>%s</info> Language.', $name));

        return $code;
    }

    private function getNewLanguageCode(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper): string
    {
        $question = new Question('Language (press enter to use ' . $this->locale . '): ', $this->locale);

        return trim($questionHelper->ask($input, $output, $question));
    }

    private function getLanguageName(string $code): ?string
    {
        $language = $code;
        $region = null;

        if (count(explode('_', $code, 2)) === 2) {
            [$language, $region] = explode('_', $code, 2);
        }

        try {
            return Languages::getName($language, $region);
        } catch (MissingResourceException $exception) {
            return null;
        }
    }
}


text:
Reverse a singly linked list.

**Hint:**

A linked list can be reversed either iteratively or recursively. Could you implement both?

### [Editorial](https://leetcode.com/articles/reverse-linked-list/)


text:
Introduction
============

This is the documentation for the Jinja general purpose templating language.
Jinja is a library for Python that is designed to be flexible, fast and secure.

If you have any exposure to other text-based template languages, such as Smarty or
Django, you should feel right at home with Jinja.  It's both designer and
developer friendly by sticking to Python's principles and adding functionality
useful for templating environments.

Prerequisites
-------------

Jinja works with Python 2.7.x and >= 3.5.  If you are using Python
3.2 you can use an older release of Jinja (2.6) as support for Python 3.2
was dropped in Jinja version 2.7. The last release which supported Python 2.6
and 3.3 was Jinja 2.10.

If you wish to use the :class:`~jinja2.PackageLoader` class, you will also
need `setuptools`_ or `distribute`_ installed at runtime.

Installation
------------

You can install the most recent Jinja version using `pip`_::

    pip install Jinja2

This will install Jinja in your Python installation's site-packages directory.

Installing the development version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1.  Install `git`_
2.  ``git clone git://github.com/pallets/jinja.git``
3.  ``cd jinja2``
4.  ``ln -s jinja2 /usr/lib/python2.X/site-packages``

As an alternative to steps 4 you can also do ``python setup.py develop``
which will install the package via `distribute` in development mode.  This also
has the advantage that the C extensions are compiled.

.. _distribute: https://pypi.org/project/distribute/
.. _setuptools: https://pypi.org/project/setuptools/
.. _pip: https://pypi.org/project/pip/
.. _git: https://git-scm.com/

MarkupSafe Dependency
~~~~~~~~~~~~~~~~~~~~~

As of version 2.7 Jinja depends on the `MarkupSafe`_ module. If you install
Jinja via ``pip`` it will be installed automatically for you.

.. _MarkupSafe: https://markupsafe.palletsprojects.com/

Basic API Usage
---------------

This section gives you a brief introduction to the Python API for Jinja
templates.

The most basic way to create a template and render it is through
:class:`~jinja2.Template`.  This however is not the recommended way to
work with it if your templates are not loaded from strings but the file
system or another data source:

>>> from jinja2 import Template
>>> template = Template('Hello {{ name }}!')
>>> template.render(name='John Doe')
u'Hello John Doe!'

By creating an instance of :class:`~jinja2.Template` you get back a new template
object that provides a method called :meth:`~jinja2.Template.render` which when
called with a dict or keyword arguments expands the template.  The dict
or keywords arguments passed to the template are the so-called "context"
of the template.

What you can see here is that Jinja is using unicode internally and the
return value is an unicode string.  So make sure that your application is
indeed using unicode internally.


text:
<configuration>

  <statusListener class="ch.qos.logback.core.status.NopStatusListener" />

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>

  <root level="INFO">
    <appender-ref ref="STDOUT" />
  </root>

  <logger name="com.marklogic" level="INFO" additivity="false">
    <appender-ref ref="STDOUT" />
  </logger>

</configuration>


text:
<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<title>Ihmeellinen maailma: Skientismi</title>
<meta http-equiv="Content-Type" content />
<link type="image/x-icon" rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="../main.css" />
<link rel="stylesheet" type="text/css" href="ihmeellinen.css" />

Skientismi

(engl. scientism). Skientismi eli tieteisuskovaisuus on käsitys, jonka mukaan ainoastaan tiede tuottaa pätevää tietoa maailmasta, ja että tiede pystyy ratkaisemaan kaikki — mukaan lukien poliittiset ja moraalifilosofiset — ongelmat. Nimityksiä ”skientisti”, ”skientistinen” tai ”tiedeuskovainen” käytetään pääasiassa solvaamistarkoituksessa. Niiden kohteeksi joutuu yleensä mikä tahansa tieteellistä maailmankuvaa ja tietoa edistävä taho riippumatta tahon todellisista näkökannoista.

Katso: Tiede.


text:
#ifndef __wcecompat__ChildData_h__
#define __wcecompat__ChildData_h__

#include "args.h"

class ChildData
{
	typedef struct
	{
		TCHAR*	name;
		TCHAR*	value;
	} NameValuePair;

private:

	TCHAR*			currentDirectory;
	RedirArg*		redirArgs;
	int				numRedirArgs;
	NameValuePair*	environment;
	int				environmentLength;	// num of environment variables

public:

	ChildData();
	~ChildData();

	void dump();

	const TCHAR* getCurrentDirectory() const;
	void setCurrentDirectory(const TCHAR* directory);

	void resetCurrentDirectory();

	void resetRedirArgs();
	RedirArg* getRedirArg(int fd);
	bool setRedirArg(RedirArg* redirArg);
	bool setRedirArgs(RedirArg* redirArgs, int numRedirArgs);

	void resetEnvironment();
	bool addEnvironmentVar(WCHAR* env);
	bool addEnvironmentList(WCHAR* env);
	bool saveEnvironment();
	bool restoreEnvironment();

	// if childData is NULL, the size will be returned in childDataLen
	bool encode(void* childData, int* childDataSize);

	// if childData is NULL, the size will be returned in childDataLen
	bool decode(void* childData);//, int childDataSize);
};

#endif /* __wcecompat__ChildData_h__ */


text:
export PATH=/usr/local/share/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:~/bin

export PATH="$PATH:$HOME/.dotfiles/bin"

export PATH="/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/findutils/libexec/gnubin:$PATH"


text:
package org.apache.airavata.wsmg.client.amqp;

import org.apache.axiom.om.OMElement;

/**
 * AMQPBroadcastSender defines an interface that should be implemented by a message sender that
 * sends messages that can be consumed by any downstream client, irrespective of message routing key.
 */
public interface AMQPBroadcastSender {

    /**
     * Send a message.
     *
     * @param message Message to be delivered.
     * @throws AMQPException
     */
    public void Send(OMElement message) throws AMQPException;
}


text:
jq Cookbook
===========

This cookbook installs [jq](http://stedolan.github.io/jq/).

Requirements
------------

- Linux
- Mac OS X

attributes
----------

#### jq::default

    Key
    Type
    Description
    Default

    <tt>['jq']['path']</tt>
    String
    jq install path
    <tt>/usr/local/bin/jq</tt>

Usage
-----

Just include `jq` in your node's `run_list`:

```json
{
  "name":"my_node",
  "run_list": [
    "recipe[jq]"
  ]
}
```

Contributing
------------

1. Fork the repository on Github
2. Create a named feature branch (like `add_component_x`)
3. Write you change
4. Write tests for your change (if applicable)
5. Run the tests, ensuring they all pass
6. Submit a Pull Request using Github

License and Authors
-------------------

MIT

(C) Aiming Inc.

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/aiming-cookbooks/jq/trend.png)](https://bitdeli.com/free "Bitdeli Badge")


text:
<?php

namespace Tutto\SecurityBundle\Controller;

use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;

use Tutto\CommonBundle\Controller\AbstractController;
use Tutto\SecurityBundle\Entity\Account;
use Tutto\SecurityBundle\Entity\Role;
use Tutto\SecurityBundle\Entity\User;
use Tutto\SecurityBundle\Form\Type\RegistrationType;
use Tutto\SecurityBundle\Repository\RoleRepository;
use Tutto\SecurityBundle\Repository\UserRepository;

use DateTime;
use Exception;

/**
 * Annotation
 */
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Tutto\SecurityBundle\Configuration\Authorization;

/**
 * Class RegistrationController
 * @package Tutto\SecurityBundle\Controller
 *
 * @Route("/user")
 * @Authorization(omit=true)
 */
class RegistrationController extends AbstractController {
    /**
     * @Route("/registration", name="_registration")
     * @Template()
     *
     * @param Request $request
     * @return array|RedirectResponse
     */
    public function registerAction(Request $request) {
        if ($this->isLogged()) {
            /** todo Zastanowić się co zrobić z zalogowanym użytkownikiem */
        }

        /** @var $userManager \FOS\UserBundle\Model\UserManagerInterface */
        $userManager    = $this->container->get('fos_user.user_manager');
        /** @var RoleRepository $roleRepository */
        $roleRepository = $this->getRepository(Role::class);

        /** @var User $user */
        $user = $userManager->createUser();
        $form = $this->createForm(new RegistrationType(), $user);

        if($request->isMethod('post')) {
            if($form->submit($request)->isValid()) {
                if($userManager->findUserByEmail($user->getEmail())) {
                    $this->addFlashError('security:user.email_exists', ['%email%' => $user->getEmail()]);
                } else {
                    $this->getEm()->beginTransaction();
                    try {
                        $user->setAccount(new Account());
                        $user->setEnabled(false);
                        $user->setRoles([$roleRepository->getByName(Role::MEMBER)]);

                        if ($user instanceof User) {
                            $expiresAt = new DateTime();
                            $expiresAt->add(new \DateInterval('P7D'));
                            $user->setExpiresAt($expiresAt);
                        }

                        $user->setConfirmationToken($this->generateToken());
                        $userManager->updateUser($user);

//                        $this->getEm()->commit();
//                        return $this->redirect(
//                            $this->generateUrl(
//                                '_confirmRegistration',
//                                [
//                                    'id'    => $user->getId(),
//                                    'email' => $user->getEmail()
//                                ]
//                            )
//                        );
                    } catch(Exception $ex) {
                        $this->addFlashError($ex->getMessage());
                        $this->getEm()->rollback();
                    }
                }
            } else {
                $this->addFlashError('flash_bag.forms.formNotValid');
            }
        }

        return ['form' => $form->createView()];
    }

    /**
     * @Route("/confirm/{id}-{email}",
     *      name="_confirmRegistration",
     *      requirements={
     *          "id"="\d+",
     *          "email"="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"
     *      }
     * )
     * @Template()
     * @Method({"GET"})
     */
    public function confirmAction($id, $email) {
        /** @var UserRepository $userRepository */
        $userRepository = $this->getRepository(User::class);
        $user = $userRepository->findOneBy([
            'id'    => $id,
            'email' => $email
        ]);

        if($user instanceof User) {
            $this->addFlashSuccess('security.user.userCreated');
            $this->sendEmail(
                $user->getEmail(),
                'security.email.user_created',
                'TuttoSecurityBundle:emails:user-created.html.twig',
                [
                    'user' => $user
                ]
            );
        } else {
            $this->addFlashError('security.user.userNotCreated');
        }

        return ['user' => $user];
    }

    /**
     * @Route("/activate/{id}-{email}/{token}",
     *      name="_user_activate",
     *      requirements={
                "id"="\d+",
     *          "email"="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"
     *      }
     * )
     * @Template()
     * @Method({"GET"})
     */
    public function activateAction($id, $email, $token) {
        /** @var UserRepository $repository */
        $repository = $this->getRepository(User::class);

        $user    = $repository->findOneBy([
            'id'    => (int) $id,
            'email' => addslashes($email),
            'confirmationToken' => addslashes($token)
        ]);

        if($user instanceof User) {
            if($user->isEnabled()) {
                $this->addFlashAlert('security.user.enabledAlready');
            } else {
                $user->setEnabled(true);
                $user->setConfirmationToken(null);
                $this->getEm()->persist($user);
                $this->getEm()->flush();

                $this->addFlashSuccess('security.user.enabled');
                $this->sendEmail(
                    $user->getEmail(),
                    'security.email.user',
                    'TuttoSecurityBundle::/emails/user-enabled.html.twig',
                    [
                        'user' => $user
                    ]
                );
            }
        } else {
            $this->addFlashError('security.user.notFound');
            return $this->redirect($this->generateUrl('_registration'));
        }

        return ['user' => $user];
    }

    /**
     * @return string
     */
    protected function generateToken() {
        return md5(time());
    }
}


text:
<?php

declare(strict_types=1);

namespace DI\Test\IntegrationTest\Definitions;

use DI\ContainerBuilder;
use DI\Test\IntegrationTest\BaseContainerTest;

/**
 * Test environment variable definitions.
 */
class EnvironmentVariableDefinitionTest extends BaseContainerTest
{
    /**
     * @dataProvider provideContainer
     */
    public function test_existing_env_variable(ContainerBuilder $builder)
    {
        $expectedValue = getenv('USER');
        if (! $expectedValue) {
            $this->markTestSkipped(
                'This test relies on the presence of the USER environment variable.'
            );
        }

        $builder->addDefinitions([
            'var' => \DI\env('USER'),
        ]);
        $container = $builder->build();

        $this->assertEquals($expectedValue, $container->get('var'));
    }

    /**
     * @dataProvider provideContainer
     * @expectedException \DI\Definition\Exception\InvalidDefinition
     * @expectedExceptionMessage The environment variable 'PHP_DI_DO_NOT_DEFINE_THIS' has not been defined
     */
    public function test_nonexistent_env_variable(ContainerBuilder $builder)
    {
        $builder->addDefinitions([
            'var' => \DI\env('PHP_DI_DO_NOT_DEFINE_THIS'),
        ]);
        $container = $builder->build();

        $container->get('var');
    }

    /**
     * @dataProvider provideContainer
     */
    public function test_nonexistent_env_variable_with_default_value(ContainerBuilder $builder)
    {
        $builder->addDefinitions([
            'var' => \DI\env('PHP_DI_DO_NOT_DEFINE_THIS', '<default>'),
        ]);
        $container = $builder->build();

        $this->assertEquals('<default>', $container->get('var'));
    }

    /**
     * @dataProvider provideContainer
     */
    public function test_nonexistent_env_variable_with_null_as_default(ContainerBuilder $builder)
    {
        $builder->addDefinitions([
            'var' => \DI\env('PHP_DI_DO_NOT_DEFINE_THIS', null),
        ]);
        $container = $builder->build();

        $this->assertNull($container->get('var'));
    }

    /**
     * @dataProvider provideContainer
     */
    public function test_nonexistent_env_variable_with_other_entry_as_default(ContainerBuilder $builder)
    {
        $builder->addDefinitions([
            'var' => \DI\env('PHP_DI_DO_NOT_DEFINE_THIS', \DI\get('foo')),
            'foo' => 'bar',
        ]);
        $container = $builder->build();

        $this->assertEquals('bar', $container->get('var'));
    }
}