text:
# STL fundamentals
## Basic Abstract Data Types

C++ Fundamentals

Telerik Algo Academy

   http://academy.telerik.com

# Table of Contents
- Basic Abstract Data Types
  - List
  - Linked List
  - Stack
  - Queue
- ADTs in STL
  - STL Intro
  - Iterators
  - Vector, list, stack, queue

# Abstract Data Types
## Basic Data Structures

- An Abstract Data Type (ADT) is a data type together with the operations, whose properties are specified independently of any particular implementation
  - ADT are set of definitions of operations
  - Can have several different implementations
  - Different implementations can have different efficiency

# Basic Data Structures
- Linear structures
  - Lists: fixed size and variable size
  - Stacks: LIFO (Last In First Out) structure
  - Queues: FIFO (First In First Out) structure
- Trees
  - Binary, ordered, balanced, etc.
- Dictionaries (maps)
  - Contain pairs (key, value)
  - Hash tables: use hash functions to search/insert

# Lists

# The List ADT
- Data structure (container) that contains a sequence of elements
  - Can have variable size
  - Elements are arranged linearly, in sequence
- Can be implemented in several ways
  - Statically (using array → fixed size)
  - Dynamically (linked implementation)
  - Using resizable array

# Static List
- Implemented by an array
  - Direct access by index (fast)
  - Insertion, deletion and resizing are slow operations
- List:

| Index ||  0 |  1 |  2 |  3 |  4 |  5 |  6 |  7 |
|-------||----|----|----|----|----|----|----|----|
| List  ||  2 | 18 |  7 | 12 |  3 |  6 | 11 |  9 |

# Linked List
- Dynamic (pointer-based) implementation
  - Direct access to first/last element
  - No access by index
    - go through all previous elements (slow)
  - Insertion and deletion are fast
  - Resizing – add new element at the endor beginning

|        | 2      | 7      | 4      |   5    | `null` |
|:------:|:------:|:------:|:------:|:------:|
| `head` | `next` | `next` | `next` | `next` |

# Stacks

# The Stack ADT
- LIFO (Last In First Out) structure
- Elements inserted (push) at "top"
- Elements removed (pop) from "top"
- Useful in many situations
  - E.g. the execution stack of the program
- Can be implemented in several ways
  - Statically (using array)
  - Dynamically (linked implementation)

# Queues

# The Queue ADT
- FIFO (First In First Out) structure
- Elements inserted at the tail (Enqueue)
- Elements removed from the head (Dequeue)
- Useful in many situations
  - Print queues, message queues, etc.
- Can be implemented in several ways
  - Statically (using array)
  - Dynamically (using pointers)

# Standard Template Library
## Introduction, Basic ADT Implementations

# STL Introduction
- Standard Template Library
  - C++ Library
  - Implements a lot of computer science fundamentals
    - Container classes, Algorithms
  - Iterators
  - Mostly template-based
  - Algorithms decoupled from containers through iterators

- Containers
  - Data structures, hold collections of elements
  - Different benefits and downsides
  - Implement fundamental Abstract Data Types
    - Sequence, Associative, String, Adaptors...
- Iterators
  - Provide access to container elements
  - Used to "traverse" containers

- Algorithms
  - Fundamental algorithms over collections or single
  - Hook up with iterators to access container elements
- Function objects
  - Wrap functions/methods into objects
  - Implement `()` operator – called like functions
  - Called by algorithms and containers to act over elements (elements passed as parameters)

## Live Demo

# STL Iterators
## Mechanism for traversing container elements

- "Smart" pointers to objects
- Specific for each container type
  - Each container defines how it's iterators work
- If we have an iterator to one element
  - Increase/decrease it to get the other elements
- Types:
  - Input, Output
  - Forward iterator, Bidirectional iterator
  - Random access iterator

# STL Containers
## Fast data structures to store elements

- Store collections of other objects
- Has methods to access elements
- Types
  - By traversability:
    - Forward – elements ordered, Forward Iterators
    - Reversible – have Bidirectional iterators
    - Random access – have Random access iterators
  - By storage:
    - sequence, adaptors, associative

# Basic STL Containers
## Vector, List, Deque, Queue, Stack

# STL Vector
- Vector (`#include <vector>`)
  - Defined: `template <class T> vector`
  - Sequence, Random Access
  - Stores a sequence of elements in contiguous memory
  - Manages memory effectively
  - Fast at retrieving elements by index and adding elements at the end
  - Slow insertion/deletion in middle or beginning

- Declaring and initializing a vector

```cpp
#include<vector> // required header

vector<int> numbers;
numbers.push_back(42); // numbers is now {42}
numbers.push_back(13); // numbers is now {42, 13}
int consoleNumber;
cin >> consoleNumber;
numbers.push_back(consoleNumber)
```
- Vector size and is obtained by calling `size()`

```cpp
vector<int> numbers;
numbers.push_back(42);
numbers.push_back(13);
cout << numbers.size(); // prints 2
```

- Accessing vector elements
  - Done the same way as with arrays, i.e. `[]`

```cpp
vector<int> numbers;
numbers.push_back(42);
numbers.push_back(13);
cout << numbers[1]; // prints 13
cout << endl;
numbers[1] = numbers[0];
cout << numbers[1]; // prints 42
```
  - Traversing a vector is the same as traversing an array (e.g. with a for loop)
  - Element access does not depend on vector size

## Live Demo

# STL (Linked) List
- List (`#include <list>`)
  - Defined: `template <class T> list`
  - Sequence, Reversible
  - Stores a sequence of elements in a doubly-linked list
  - Fast at deletion/insertion anywhere
  - No random access to elements
    - Have to traverse list to get to an item

- Declaring and initializing alist

```cpp
list<int> numbers;

numbers.push_back(2);
numbers.push_front(1);
numbers.push_back(3);
```
- List size and is obtained by calling `size()`
- List elements can be removed from front and back fast

```cpp
numbers.pop_front();
numbers.pop_back();
```

- Accessing list elements
  - `front` and `back` methods provide first and last element access

```cpp
cout << numbers.front();
cout << numbers.back();
```

- Accessing list elements
  - Only way to get access to all elements – traversal by iterator

```cpp
list<int>::iterator numbersIterator;
for(numbersIterator = numbers.begin();
  numbersIterator != numbers.end();
  numbersIterator++)
{
  cout << *numbersIterator << endl;
}
```

# STL list
## Live Demo

# STL Queue
- Queue (`#include<queue>`)
  - Defined: `template <class T>queue`
  - Sequence Adaptor
  - First in, First outstructure (FIFO)
  - Stores a sequence of elements
  - Provides access only to first element
  - Can remove only at front
  - Can add only at back

- Declaring and initializing a queue

```cpp
queue<int> q;

q.push(1);
q.push(2);
q.push(3);
```

- Queue size is obtained by calling `size()`
- Queues allow removing elements only from the front of the sequence

```cpp
q.pop();
```

- Accessing queue elements
  - `front` and `back` methods provide first and last element access

```cpp
cout << q.front();
cout << q.back();
```
  - Other types of access to queue elements are meaningless
    - The idea of the queue is to restrict access and be FIFO

## Live Demo

# STL Stack
- Stack (`#include <stack>`)
  - Defined: `template <class T> stack`
  - Sequence adaptor
  - Last in, First out structure (LIFO)
  - Stores a sequence ofelements
  - Provides access only to last element
  - Can remove or add elements only at back/top

- Declaring and initializing a stack

```cpp
stack<int> s;

s.push(1);
s.push(2);
s.push(3);
```
- Stack size is obtained by calling `size()`
- Stacks allow removing elements only from the back (top) of the sequence

```cpp
s.pop();
```

- Accessing stack elements
  - `top` method provides first element access

```cpp
cout << s.top();
```
  - Other types of access to stack elements are meaningless
    - The idea of the stack is to restrict access and be LIFO

## Live Demo

# Basic ADTs in STL
## Questions


text:
// -----------------------------------------------------------------------
// <copyright file="ListBoxStyle.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------

namespace Perspex.Themes.Default
{
    using System.Linq;
    using Perspex.Controls;
    using Perspex.Controls.Presenters;
    using Perspex.Controls.Templates;
    using Perspex.Media;
    using Perspex.Styling;

    public class ListBoxStyle : Styles
    {
        public ListBoxStyle()
        {
            this.AddRange(new[]
            {
                new Style(x => x.OfType<ListBox>())
                {
                    Setters = new[]
                    {
                        new Setter(ListBox.TemplateProperty, new ControlTemplate<ListBox>(this.Template)),
                        new Setter(ListBox.BorderBrushProperty, Brushes.Black),
                        new Setter(ListBox.BorderThicknessProperty, 1.0),
                    },
                },
            });
        }

        private Control Template(ListBox control)
        {
            return new Border
            {
                Padding = new Thickness(4),
                [~Border.BackgroundProperty] = control[~ListBox.BackgroundProperty],
                [~Border.BorderBrushProperty] = control[~ListBox.BorderBrushProperty],
                [~Border.BorderThicknessProperty] = control[~ListBox.BorderThicknessProperty],
                Child = new ScrollViewer
                {
                    Content = new ItemsPresenter
                    {
                        Name = "itemsPresenter",
                        [~ItemsPresenter.ItemsProperty] = control[~ListBox.ItemsProperty],
                        [~ItemsPresenter.ItemsPanelProperty] = control[~ListBox.ItemsPanelProperty],
                    }
                }
            };
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package game.ui;

/**
This class does not appear to be used in the Linux C++ code
public class CRectangle extends CUIElement
{
public void Draw(CGame game, SInt2 translation) {
Pixmap Pixmap = game.Rendering().DWorkingBufferPixmap;
GdkGC DrawingContext;
if(IsPressed()) {
DrawingContext = game.DrawingArea().style.white_gc;
}
else if(IsSelected()) {
DrawingContext = game.DrawingArea().style.dark_gc[0];
}
else {
DrawingContext = game.DrawingArea().style.black_gc;
}
gdk_draw_rectangle(Pixmap, DrawingContext, 1, translation.DX, translation.DY, Size().DX, Size().DY);
super.Draw(game, new SInt2(translation));
}
public void Update(CGame game, SInt2 translation) {
super.Update(game, new SInt2(translation));
if(IsPressed()) {
Position(Position() + new SInt2(10, 0));
}
}
}
*/


text:
title: Configuring Systems for use with Calico
no_canonical: true
---

When running Calico with OpenStack, you also need to configure various
OpenStack components, as follows.

### Nova (/etc/nova/nova.conf)

Calico uses the Nova metadata service to provide metadata to VMs,
without any proxying by Neutron. To make that work:

-   An instance of the Nova metadata API must run on every compute node.
-   `/etc/nova/nova.conf` must not set `service_neutron_metadata_proxy`
    or `service_metadata_proxy` to `True`. (The default `False` value is
    correct for a Calico cluster.)

### Neutron server (/etc/neutron/neutron.conf)

In `/etc/neutron/neutron.conf` you need the following settings to
configure the Neutron service.

| Setting            | Value   | Meaning                     |
|--------------------|---------|-----------------------------|
| core_plugin        | calico  | Use the Calico core plugin  |
|--------------------|---------|-----------------------------|

Calico can operate either as a core plugin or as an ML2 mechanism driver.  The
function is the same both ways, except that floating IPs are only supported
when operating as a core plugin; hence the recommended setting here.

However, if you don't need floating IPs and have other reasons for using ML2,
you can, instead, set

| Setting            | Value                                | Meaning              |
|--------------------|--------------------------------------|----------------------|
| core_plugin        | neutron.plugins.ml2.plugin.ML2Plugin | Use ML2 plugin       |
|--------------------|--------------------------------------|----------------------|

and then the further ML2-specific configuration as covered below.

With OpenStack releases earlier than Liberty you will also need:

| Setting                 | Value                    | Meaning                    |
|-------------------------|--------------------------|----------------------------|
| dhcp_agents_per_network | 9999                     | Allow unlimited DHCP agents per network |

Optionally -- depending on how you want the Calico mechanism driver to
connect to the Etcd cluster -- you can also set the following options in
the `[calico]` section of `/etc/neutron/neutron.conf`.

| Setting   | Default Value | Meaning                                   |
|-----------|---------------|-------------------------------------------|
| etcd_host | localhost     | The hostname or IP of the etcd node/proxy |
| etcd_port | 4001          | The port to use for the etcd node/proxy   |

### ML2 (.../ml2_conf.ini)

In `/etc/neutron/plugins/ml2/ml2_conf.ini` you need the following
settings to configure the ML2 plugin.

| Setting              | Value       | Meaning                           |
|----------------------|-------------|-----------------------------------|
| mechanism_drivers    | calico      | Use Calico                        |
| type_drivers         | local, flat | Allow 'local' and 'flat' networks |
| tenant_network_types | local, flat | Allow 'local' and 'flat' networks |

DHCP agent (.../dhcp_agent.ini)
--------------------------------

With OpenStack releases earlier than Liberty, in
`/etc/neutron/dhcp_agent.ini` you need the following setting to
configure the Neutron DHCP agent.

| Setting          | Value                 | Meaning                                                                                |
|------------------|-----------------------|------------------------------------------------------------------------------------------------------|
| interface_driver | RoutedInterfaceDriver | Use Calico's modified DHCP agent support for TAP interfaces that are routed instead of being bridged |


text:
FROM mysql:5.6

WORKDIR /tmp

ADD registry.sql r.sql

ADD docker-entrypoint.sh /entrypoint.sh
RUN chmod u+x /entrypoint.sh


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.
// ----------------------------------------------------------------------------------

using System.Collections;
using System.Management.Automation;
using Microsoft.Azure.Management.OperationalInsights.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using System;

namespace Microsoft.Azure.Commands.OperationalInsights
{
    [Cmdlet(VerbsCommon.New, Constants.SavedSearch, SupportsShouldProcess = true)]
    public class NewAzureOperationalInsightsSavedSearchCommand : OperationalInsightsBaseCmdlet
    {
        [Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true,
            HelpMessage = "The resource group name.")]
        [ResourceGroupCompleter]
        [ValidateNotNullOrEmpty]
        public string ResourceGroupName { get; set; }

        [Alias("Name")]
        [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true,
            HelpMessage = "The workspace name.")]
        [ValidateNotNullOrEmpty]
        public string WorkspaceName { get; set; }

        [Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
            HelpMessage = "The saved search id.")]
        [ValidateNotNullOrEmpty]
        public string SavedSearchId { get; set; }

        [Parameter(Position = 3, Mandatory = true, ValueFromPipelineByPropertyName = true,
        HelpMessage = "The saved search display name.")]
        [ValidateNotNullOrEmpty]
        public string DisplayName { get; set; }

        [Parameter(Position = 4, Mandatory = true, ValueFromPipelineByPropertyName = true,
        HelpMessage = "The saved search category.")]
        [ValidateNotNullOrEmpty]
        public string Category { get; set; }

        [Parameter(Position = 5, Mandatory = true, ValueFromPipelineByPropertyName = true,
        HelpMessage = "The saved search query.")]
        [ValidateNotNullOrEmpty]
        public string Query { get; set; }

        [Parameter(Position = 6, Mandatory = false, ValueFromPipelineByPropertyName = true,
        HelpMessage = "The saved search tags.")]
        [Obsolete("New-AzureRmOperationalInsightsSavedSearch: -Tags will be removed in favor of -Tag in an upcoming breaking change release.  Please start using the -Tag parameter to avoid breaking scripts.")]
        [Alias("Tags")]
        [ValidateNotNullOrEmpty]
        public Hashtable Tag { get; set; }

        [Parameter(Position = 7, Mandatory = false, ValueFromPipelineByPropertyName = true,
        HelpMessage = "The saved search version.")]
        [ValidateNotNullOrEmpty]
        public long Version { get; set; }

        [Parameter(Mandatory = false, HelpMessage = "Don't ask for confirmation.")]
        public SwitchParameter Force { get; set; }

        protected override void ProcessRecord()
        {
            SavedSearch properties = new SavedSearch()
            {
                Category = this.Category,
                DisplayName = this.DisplayName,
                Query = this.Query,
                Version = this.Version
            };

#pragma warning disable CS0618
            properties.Tags = SearchCommandHelper.PopulateAndValidateTagsForProperties(this.Tag, properties.Query);
#pragma warning restore CS0618

            WriteObject(OperationalInsightsClient.CreateOrUpdateSavedSearch(ResourceGroupName, WorkspaceName, SavedSearchId, properties, Force, ConfirmAction), true);
        }

    }
}


text:
package data;

/**
 * Created by root on 17/12/14.
 */
public interface ReceivedStuff {
    public String toString();
}


text:
import cluster from "cluster";
import {Application} from "./application.js";
import {Server, ServerOptions} from "./server.js";

/** Contains all public information and methods about a request worker. */
export class Worker {

	/**
	 * The proxy servers managed by this worker.
	 * @type {Server[]}
	 */
	#servers: Server[] = [];

	/**
	 * Stops the worker from accepting new connections.
	 * @return Completes when all the servers managed by this worker are finally closed.
	 */
	stop(): Promise<void> {
		return Promise.all(this.#servers.map(server => server.close()));
	}

	/**
	 * Begins accepting connections.
	 * @param servers The settings of the servers managed by this worker.
	 * @return The ports that the servers managed by this worker are running on.
	 */
	start(servers: ServerOptions[] = []): Promise<number[]> {
		this.#servers = servers.map(options => new Server(options));

		const id = cluster.worker.id;
		const logger = Application.instance.logger;

		return Promise.all(this.#servers.map(server => server
			.on("close", () => logger.log(`#${id}: ${server.address}:${server.port} closed`))
			.on("error", err => logger.error(`#${id}: ${Application.instance.debug ? err : err.message}`))
			.on("listening", () => logger.log(`#${id}: listening on ${server.address}:${server.port}`))
			.on("request", (req, res) => logger.log(`#${id}: ` + Application.logFormat
				.replace(":date[iso]", new Date().toISOString())
				.replace(":http-version", req.httpVersion)
				.replace(":method", req.method)
				.replace(":referrer", req.headers.referer ?? (req.headers.referrer ?? "-"))
				.replace(":remote-addr", req.ip ?? req.socket.remoteAddress)
				.replace(":remote-user", this._extractUserFromRequest(req.headers.authorization))
				.replace(":req[host]", req.headers.host ?? "-")
				.replace(":res[content-length]", res.headers["content-length"] ?? "-")
				.replace(":status", res.statusCode)
				.replace(":user-agent", req.headers["user-agent"] ?? "-")
				.replace(":url", req.originalUrl ?? req.url)
			))
			.listen()
		));
	}

	/**
	 * Extracts the user name provided in the specified `Authorization` header.
	 * @param authorization The value of the `Authorization` header.
	 * @return The user name found, otherwise the string `"-"`.
	 */
	private _extractUserFromRequest(authorization?: string): string {
		if (authorization == undefined || !authorization.length) return "-";

		try {
			const credentials = Buffer.from(authorization, "base64").toString().split(":");
			return credentials.length ? credentials[0] : "-";
		}

		catch {
			return "-";
		}
	}
}


text:
ip6tables -t mangle -F

# confirm the redirect is gone
ip6tables -t mangle -L

# remove the /etc/ip6tables.up.rules and /etc/network/if-pre-up.d/iptables files


text:
---
layout: post
title: Where ESXi belongs - Nested under KVM
---

I can hear it now, why would you want to do that?  Well for me the motivation was I need to test vSphere (ESXi and vCenter) automation and I don't want to install VMware Workstation to do it.

## First up, Nested ESXi
As always dependencies are first.  I am using Fedora 21 so the packages commands will be related.

{% highlight bash %}
yum groupinstall "Development Tools" -y
yum install gcc-c++ glib2-devel zlibrary zlib-devel pixman-devel libfdt-devel spice-protocol SDL-devel spice-server-devel -y
{% endhighlight %}

### QEMU Changes
Fortunately we have some [very smart people at VMware](https://communities.vmware.com/people/jmattson) that are willing to help our crazy cause.
QEMU has changed since this [post](https://communities.vmware.com/message/2292878#2292878) was originally written and so we must modify the patch.
Below are the modifications required for QEMU 2.3, which is the latest development release - your mileage my vary kinda a thing but I haven't had a problem yet.

{% highlight diff %}
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 36c69d7..6952bb3 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -242,8 +242,7 @@ static void pc_init1(MachineState *machine,
     }

     /* init basic PC hardware */
-    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
-                         (pc_machine->vmport != ON_OFF_AUTO_ON), 0x4);
+    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,TRUE, 0x4);

     pc_nic_init(isa_bus, pci_bus);
{% endhighlight %}

With the modified QEMU lets get the source, patch and recompile.

### Patch and compile QEMU
{% highlight bash %}
cd /opt
sudo git clone https://github.com/qemu/qemu.git
cd qemu
sudo curl "https://gist.githubusercontent.com/jcpowermac/3d9c732be08404302083/raw/ba97ceceefb2ffb085fa8da0f5f5a6142127454e/qemu.patch" | sudo patch -p1
sudo ./configure --enable-kvm --target-list=x86_64-linux-user,x86_64-softmmu
sudo make -j8
sudo wget "https://gist.githubusercontent.com/jcpowermac/36bfa62cd60781264b3f/raw/f26aa286d5ab85f17555141e04ab549e10727475/qemu-kvm"
{% endhighlight %}

This will leave our original QEMU install untouched, which is probably a good thing.  Next up we need to define a virtual machine.

### Create the ESXi virtual machine

There is an issue with ESXi 5.5 and the e1000 network adapter, so we have no real choice except to use vmxnet3.
Below is an example domain specifically for 5.5 because of the inclusion of vmxnet3 adapter.
ESXi 6.0 can and [should](https://communities.vmware.com/message/2446952#2446952) be using e1000.

{% highlight xml %}
<domain type='kvm' id='12'>
  <name>esxi</name>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.1'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/opt/qemu/x86_64-softmmu/qemu-kvm</emulator>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source dev='/dev/virtualmachine/esxi2'/>
      <backingStore/>
      <target dev='sda' bus='sata'/>
      <boot order='2'/>
      <alias name='sata0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='sata0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <source bridge='ovsbr0'/>
      <vlan>
        <tag id='252'/>
      </vlan>
      <virtualport type='openvswitch'>
      </virtualport>
      <target dev='vnet1'/>
      <model type='vmxnet3'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='spice' port='5901' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
    <video>
      <model type='vga' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
  </devices>
</domain>
{% endhighlight %}

To define a new guest, do the following.  A cd-rom will need to be added and most likely source bridge will need to be changed but the general hardware will be correct.
Any of those changes can be done in virt-manager.
{% highlight bash %}
wget "https://gist.githubusercontent.com/jcpowermac/05e2faa322427f28b907/raw/6149bcc2e5420d13afa96d0f58abc91d6dc84058/esxi.xml"
sudo virsh define esxi.xml
{% endhighlight %}

### Sources
https://communities.vmware.com/thread/451412
http://mattinaction.blogspot.de/2014/05/install-and-run-full-functional-vmware.html


text:
#include "scriptcommand_p.h"
#include "metadatabase_p.h"

#include <QtDesigner/QDesignerFormWindowInterface>
#include <QtDesigner/QDesignerFormEditorInterface>

#include <QtCore/QCoreApplication>

QT_BEGIN_NAMESPACE

namespace qdesigner_internal {

ScriptCommand::ScriptCommand(QDesignerFormWindowInterface *formWindow) :
    QDesignerFormWindowCommand(QCoreApplication::translate("Command", "Change script"), formWindow)
{
}

bool ScriptCommand::init(const ObjectList &list, const QString &script)
{
    MetaDataBase *metaDataBase = qobject_cast<MetaDataBase*>(formWindow()->core()->metaDataBase());
    if (!metaDataBase)
        return false;

    // Save old values
    m_oldValues.clear();
    foreach (QObject *obj, list) {
        const MetaDataBaseItem* item = metaDataBase->metaDataBaseItem(obj);
        if (!item)
            return false;
        m_oldValues.push_back(ObjectScriptPair(obj, item->script()));
    }
    m_script = script;
    return true;
}

void ScriptCommand::redo()
{
    MetaDataBase *metaDataBase = qobject_cast<MetaDataBase*>(formWindow()->core()->metaDataBase());
    Q_ASSERT(metaDataBase);

    ObjectScriptList::const_iterator cend = m_oldValues.constEnd();
    for (ObjectScriptList::const_iterator it = m_oldValues.constBegin();it != cend; ++it )  {
        if (it->first)
            metaDataBase->metaDataBaseItem(it->first)->setScript(m_script);
    }
}

void ScriptCommand::undo()
{
    MetaDataBase *metaDataBase = qobject_cast<MetaDataBase*>(formWindow()->core()->metaDataBase());
    Q_ASSERT(metaDataBase);

    ObjectScriptList::const_iterator cend = m_oldValues.constEnd();
    for (ObjectScriptList::const_iterator it = m_oldValues.constBegin();it != cend; ++it )  {
        if (it->first)
            metaDataBase->metaDataBaseItem(it->first)->setScript(it->second);
    }
}

} // namespace qdesigner_internal

QT_END_NAMESPACE


text:
/**
 * @fileOverview Provide an easy way to attach classifications to a
 *     view with a legend widget.
 * @author David Huynh
 * @author Johan Sundström
 * @author Margaret Leibovic
 * @author David Karger
 * @author Ryan Lee
 */

/**
 * @constructor
 * @class
 * @param {Object} configuration
 * @param {Element} containerElmt
 * @param {Exhibit.UIContext} uiContext
 */
Exhibit.LegendWidget = function(configuration, containerElmt, uiContext) {
    this._configuration = configuration;
    this._div = containerElmt;
    this._uiContext = uiContext;

    this._colorMarkerGenerator = typeof configuration.colorMarkerGenerator !== "undefined" ?
        configuration.colorMarkerGenerator :
        Exhibit.LegendWidget._defaultColorMarkerGenerator;
	this._sizeMarkerGenerator = typeof configuration.sizeMarkerGenerator !== "undefined" ?
		configuration.sizeMarkerGenerator :
		Exhibit.LegendWidget._defaultSizeMarkerGenerator;
	this._iconMarkerGenerator = typeof configuration.iconMarkerGenerator !== "undefined" ?
		configuration.iconMarkerGenerator :
		Exhibit.LegendWidget._defaultIconMarkerGenerator;

    this._labelStyler = typeof configuration.labelStyler !== "undefined" ?
        configuration.labelStyler :
        Exhibit.LegendWidget._defaultColorLabelStyler;

    this._initializeUI();
};

/**
 * @static
 * @param {Object} configuration
 * @param {Element} containerElmt
 * @param {Exhibit.UIContext} uiContext
 * @returns {Exhibit.LegendWidget}
 */
Exhibit.LegendWidget.create = function(configuration, containerElmt, uiContext) {
    return new Exhibit.LegendWidget(configuration, containerElmt, uiContext);
};

/**
 *
 */
Exhibit.LegendWidget.prototype.dispose = function() {
    Exhibit.jQuery(this._div).empty();

    this._div = null;
    this._uiContext = null;
};

/**
 *
 */
Exhibit.LegendWidget.prototype._initializeUI = function() {
    Exhibit.jQuery(this._div).addClass("exhibit-legendWidget");
    this.clear();
};

/**
 *
 */
Exhibit.LegendWidget.prototype.clear = function() {
    Exhibit.jQuery(this._div).html('

');
};

/**
 * @param {String} label
 * @param {String} type
 */
Exhibit.LegendWidget.prototype.addLegendLabel = function(label, type) {
    var dom;
	dom = Exhibit.jQuery.simileDOM("string",
			"div",
			'
' +
				'' +
					label.replace(/\s+/g, " ") +
				"" +
			"
",
			{ }
		);
	Exhibit.jQuery(dom.elmt).addClass("exhibit-legendWidget-label");
	Exhibit.jQuery('.exhibit-' + type + '-legend', this._div).append(dom.elmt);
};

/**
 * @param {} value
 * @param {String} label
 * @param {String} type
 */
Exhibit.LegendWidget.prototype.addEntry = function(value, label, type) {
    var dom, legendDiv;

	type = type || "color";
    label = (typeof label !== "string") ? label.toString() : label;
    legendDiv = Exhibit.jQuery('.exhibit-' + type + '-legend', this._div);

    if (type === "color") {
		dom = Exhibit.jQuery.simileDOM("string",
			"span",
			' ' +
				'' +
					label.replace(/\s+/g, " ") +
				"" +
				"  ",
			{ marker: this._colorMarkerGenerator(value) }
		);
	}

	if (type === "size") {
		dom = Exhibit.jQuery.simileDOM("string",
			"span",
			' ' +
				'' +
					label.replace(/\s+/g, " ") +
				"" +
				"  ",
			{ marker: this._sizeMarkerGenerator(value) }
		);
	}

	if (type === "icon") {
		dom = Exhibit.jQuery.simileDOM("string",
			"span",
			' ' +
				'' +
					label.replace(/\s+/g, " ") +
				"",
			{ marker: this._iconMarkerGenerator(value) }
		);
	}
    Exhibit.jQuery(dom.elmt).addClass("exhibit-legendWidget-entry");
    this._labelStyler(dom.label, value);
    Exhibit.jQuery(legendDiv).append(dom.elmt).append("  ");
};

/**
 * @static
 * @private
 * @param {} a
 * @param {} b
 * @returns {Number}
 */
Exhibit.LegendWidget._localeSort = function(a, b) {
    return a.localeCompare(b);
}

/**
 * @static
 * @private
 * @param {String} value
 * @returns {Element}
 */
Exhibit.LegendWidget._defaultColorMarkerGenerator = function(value) {
    var span;
    span = Exhibit.jQuery("")
        .attr("class", "exhibit-legendWidget-entry-swatch")
        .css("background", value)
        .html("  ");
    return span.get(0);
};

/**
 * @static
 * @private
 * @param {Number} value
 * @returns {Element}
 */
Exhibit.LegendWidget._defaultSizeMarkerGenerator = function(value) {
    var span;
    span = Exhibit.jQuery("")
        .attr("class", "exhibit-legendWidget-entry-swatch")
        .height(value)
        .width(value)
        .css("background", "#C0C0C0")
        .html("  ");
    return span.get(0);
}

/**
 * @static
 * @private
 * @param {String} value
 * @returns {Element}
 */
Exhibit.LegendWidget._defaultIconMarkerGenerator = function(value) {
    var span;
    span = Exhibit.jQuery("")
        .append('');
    return span.get(0);
}

/**
 * @static
 * @private
 * @param {Element} elmt
 * @param {String} value
 */
Exhibit.LegendWidget._defaultColorLabelStyler = function(elmt, value) {
    // Exhibit.jQuery(elmt).css("color", "#" + value);
};


text:
typedef struct data {
  uint32_t addr;
  uint32_t timestamp;
  uint32_t type;
  int64_t value;
} data_t;

typedef struct packet {
  data_t data;
  size_t src;
  size_t dst;
  bool routed;
} packet_t;

typedef struct routing_switch {
  bool swap;
  bool set;
} switch_t;

void wak_route(data_t* input, data_t* intermediate, data_t* output, switch_t* switches, size_t width, size_t num_switches);


text:
'use strict';

/* global before, after */

var partDir = '../../../../../scripts/partitioner/sql';

var partUtils = require('../utils'),
  Cols = require(partDir + '/col/cols');

describe('cols', function () {

  var args = partUtils.init(this, beforeEach, afterEach, false, before, after);
  var utils = args.utils;

  var userUtils = null;
  beforeEach(function () {
    userUtils = args.userUtils;
  });

  it('should create reserved cols', function () {
    return args.db._sql.find(null, 'cols', null, ['id', '<=', Cols.ID_LAST_RESERVED], ['id',
      'asc'
    ]).then(function (results) {
      utils.contains([{
          id: Cols.ID_ALL,
          name: '$all'
        }, {
          id: Cols.ID_USER,
          name: '$user'
        }, {
          id: Cols.ID_ROLE_USERS_SUPER,
          name: '$ru$super'
        }, {
          id: Cols.ID_USER_ROLES_SUPER,
          name: '$ur$super'
        }
        //        { id: Cols.ID_ROLE_USERS_ADMIN, name: '$ru$admin' }
      ], results.rows);
    });
  });

});


text:
package com.c2c.learnopedia.other;

/**
 * Created by acer on 05-11-2016.
 */

public class UrlUtils {
    private static final String BASE_URL = "http://click2clinicapp.azurewebsites.net/";

    public static final String User_registration = BASE_URL + "SaveUserRegistration";
    public static final String Verify_user_mobile=BASE_URL+"OTP/GetOTP/";
    public static final String GetVerify_mobile=BASE_URL+"VerifyOTP";
    public static final String Get_All_Subjects=BASE_URL+"GetSubjectsList";
}


text:
package org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact;

import com.google.common.collect.Lists;
import org.gradle.api.artifacts.component.ComponentArtifactIdentifier;
import org.gradle.api.artifacts.component.ComponentIdentifier;
import org.gradle.api.internal.artifacts.transform.VariantSelector;
import org.gradle.api.internal.artifacts.type.ArtifactTypeRegistry;
import org.gradle.api.internal.attributes.AttributeContainerInternal;
import org.gradle.api.internal.attributes.AttributesSchemaInternal;
import org.gradle.api.internal.attributes.EmptySchema;
import org.gradle.api.internal.attributes.ImmutableAttributes;
import org.gradle.api.specs.Spec;
import org.gradle.api.tasks.TaskDependency;
import org.gradle.internal.Describables;
import org.gradle.internal.DisplayName;
import org.gradle.internal.component.local.model.ComponentFileArtifactIdentifier;
import org.gradle.internal.component.local.model.LocalFileDependencyMetadata;
import org.gradle.internal.component.local.model.OpaqueComponentArtifactIdentifier;
import org.gradle.internal.operations.BuildOperationQueue;
import org.gradle.internal.operations.RunnableBuildOperation;

import java.io.File;
import java.util.Collections;
import java.util.List;
import java.util.Set;

public class LocalFileDependencyBackedArtifactSet implements ResolvedArtifactSet {
    private static final DisplayName LOCAL_FILE = Describables.of("local file");

    private final LocalFileDependencyMetadata dependencyMetadata;
    private final Spec<? super ComponentIdentifier> componentFilter;
    private final VariantSelector selector;
    private final ArtifactTypeRegistry artifactTypeRegistry;

    public LocalFileDependencyBackedArtifactSet(LocalFileDependencyMetadata dependencyMetadata, Spec<? super ComponentIdentifier> componentFilter, VariantSelector selector, ArtifactTypeRegistry artifactTypeRegistry) {
        this.dependencyMetadata = dependencyMetadata;
        this.componentFilter = componentFilter;
        this.selector = selector;
        this.artifactTypeRegistry = artifactTypeRegistry;
    }

    @Override
    public Completion startVisit(BuildOperationQueue<RunnableBuildOperation> actions, AsyncArtifactListener listener) {
        if (!listener.includeFileDependencies()) {
            return EMPTY_RESULT;
        }

        ComponentIdentifier componentIdentifier = dependencyMetadata.getComponentId();
        if (componentIdentifier != null && !componentFilter.isSatisfiedBy(componentIdentifier)) {
            return EMPTY_RESULT;
        }

        Set<File> files;
        try {
            files = dependencyMetadata.getFiles().getFiles();
        } catch (Throwable throwable) {
            return new BrokenResolvedArtifactSet(throwable);
        }

        List<ResolvedArtifactSet> selectedArtifacts = Lists.newArrayListWithCapacity(files.size());
        for (File file : files) {
            ComponentArtifactIdentifier artifactIdentifier;
            if (componentIdentifier == null) {
                artifactIdentifier = new OpaqueComponentArtifactIdentifier(file);
                if (!componentFilter.isSatisfiedBy(artifactIdentifier.getComponentIdentifier())) {
                    continue;
                }
            } else {
                artifactIdentifier = new ComponentFileArtifactIdentifier(componentIdentifier, file.getName());
            }

            AttributeContainerInternal variantAttributes = artifactTypeRegistry.mapAttributesFor(file);
            SingletonFileResolvedVariant variant = new SingletonFileResolvedVariant(file, artifactIdentifier, LOCAL_FILE, variantAttributes, dependencyMetadata);
            selectedArtifacts.add(selector.select(variant));
        }

        return CompositeResolvedArtifactSet.of(selectedArtifacts).startVisit(actions, listener);
    }

    @Override
    public void collectBuildDependencies(BuildDependenciesVisitor visitor) {
        visitor.visitDependency(dependencyMetadata.getFiles().getBuildDependencies());
    }

    private static class SingletonFileResolvedVariant implements ResolvedVariant, BuildableSingleResolvedArtifactSet, Completion, ResolvedVariantSet {
        private final File file;
        private final ComponentArtifactIdentifier artifactIdentifier;
        private final DisplayName variantName;
        private final AttributeContainerInternal variantAttributes;
        private final LocalFileDependencyMetadata dependencyMetadata;

        SingletonFileResolvedVariant(File file, ComponentArtifactIdentifier artifactIdentifier, DisplayName variantName, AttributeContainerInternal variantAttributes, LocalFileDependencyMetadata dependencyMetadata) {
            this.file = file;
            this.artifactIdentifier = artifactIdentifier;
            this.variantName = variantName;
            this.variantAttributes = variantAttributes;
            this.dependencyMetadata = dependencyMetadata;
        }

        @Override
        public String toString() {
            return asDescribable().getDisplayName();
        }

        @Override
        public ResolvedArtifactSet getArtifacts() {
            return this;
        }

        @Override
        public DisplayName asDescribable() {
            return Describables.of(artifactIdentifier);
        }

        @Override
        public Set<ResolvedVariant> getVariants() {
            return Collections.<ResolvedVariant>singleton(this);
        }

        @Override
        public ImmutableAttributes getOverridenAttributes() {
            return ImmutableAttributes.EMPTY;
        }

        @Override
        public AttributesSchemaInternal getSchema() {
            return EmptySchema.INSTANCE;
        }

        @Override
        public Completion startVisit(BuildOperationQueue<RunnableBuildOperation> actions, AsyncArtifactListener listener) {
            if (listener.includeFileDependencies()) {
                listener.fileAvailable(file);
                return this;
            }
            return EMPTY_RESULT;
        }

        @Override
        public void visit(ArtifactVisitor visitor) {
            visitor.visitFile(artifactIdentifier, variantName, variantAttributes, file);
        }

        @Override
        public void collectBuildDependencies(BuildDependenciesVisitor visitor) {
            visitor.visitDependency(getBuildDependencies());
        }

        @Override
        public AttributeContainerInternal getAttributes() {
            return variantAttributes;
        }

        @Override
        public ComponentArtifactIdentifier getArtifactId() {
            return artifactIdentifier;
        }

        @Override
        public TaskDependency getBuildDependencies() {
            return dependencyMetadata.getFiles().getBuildDependencies();
        }
    }
}


text:
//
//  MFContactsModels.h
//  AddressBook
//
//  Created by Mason on 16/9/21.
//  Copyright © 2016年 Mason. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AddressBook/AddressBook.h>
#import <UIKit/UIKit.h>
#import "MFTypes.h"

@interface MFAddressBookRefWrapper : NSObject

@property (nullable, nonatomic, readonly) ABAddressBookRef ref;

@end

@class MFName;
@class MFJob;
@class MFPhone;
@class MFEmail;
@class MFAddress;
@class MFSocialProfile;
@class MFRelatedPerson;
@class MFSource;
@class MFContactDate;
@class MFRecordDate;
@class MFWebSite;

@interface MFContact : NSObject

/*! For Contacts Framework, The identifier is unique among contacts on the device. It can be saved and used for fetching contacts next application launch.
    For AddressBook framework, it is RecordID (NSUInteger value) and not unique among contacts, The Apple suggest developer to identified use RecordID+Name in local
 */
@property (nonnull, nonatomic, strong) NSString *identifier;
@property (nullable, nonatomic, strong) MFName *name;
@property (nullable, nonatomic, strong) MFJob *job;
@property (nullable, nonatomic, strong) NSData *imageData;
@property (nullable, nonatomic, strong) NSArray <MFPhone *> *phones;
@property (nullable, nonatomic, strong) NSArray <MFEmail *> *emails;
@property (nullable, nonatomic, strong) NSArray <MFAddress *> *addresses;
@property (nullable, nonatomic, strong) NSArray <MFSocialProfile *> *socialProfiles;
@property (nullable, nonatomic, strong) NSArray <MFWebSite *> *websites;
@property (nullable, nonatomic, strong) NSDate *birthday;
@property (nullable, nonatomic, strong) NSString *note;
@property (nullable, nonatomic, strong) NSArray <MFRelatedPerson *> *relatedPersons;
@property (nullable, nonatomic, strong) NSArray <NSNumber *> *linkedRecordIDs; // addressbook
@property (nullable, nonatomic, strong) MFSource *source; // addressbook
@property (nullable, nonatomic, strong) NSArray <MFContactDate *> *dates;
@property (nullable, nonatomic, strong) MFRecordDate *recordDate; // addressbook

@end

@interface MFName : NSObject

- (nullable instancetype)initWithFirstName:(nullable NSString*)firstName lastName:(nullable NSString*)lastName;

@property (nullable, nonatomic, strong) NSString *firstName;
@property (nullable, nonatomic, strong) NSString *lastName;
@property (nullable, nonatomic, strong) NSString *middleName;
@property (nullable, nonatomic, strong) NSString *compositeName;

@end

@interface MFJob : NSObject

@property (nullable, nonatomic, strong) NSString *orgnazition;
@property (nullable, nonatomic, strong) NSString *department;
@property (nullable, nonatomic, strong) NSString *jobTitle;

@end

@interface MFPhone : NSObject

@property (nullable, nonatomic, strong) NSString *number;
@property (nullable, nonatomic, strong) NSString *originalLabel;
@property (nullable, nonatomic, strong) NSString *localizedLabel;

@end

@interface MFEmail : NSObject

@property (nullable, nonatomic, strong) NSString *address;
@property (nullable, nonatomic, strong) NSString *originalLabel;
@property (nullable, nonatomic, strong) NSString *localizedLabel;

@end

@interface MFAddress : NSObject

@property (nullable, nonatomic, strong) NSString *street;
@property (nullable, nonatomic, strong) NSString *city;
@property (nullable, nonatomic, strong) NSString *state;
@property (nullable, nonatomic, strong) NSString *zip;
@property (nullable, nonatomic, strong) NSString *country;
@property (nullable, nonatomic, strong) NSString *countryCode;
@property (nullable, nonatomic, strong) NSString *originalLabel;
@property (nullable, nonatomic, strong) NSString *localizedLabel;

@end

@interface MFWebSite : NSObject

@property (nullable, nonatomic, strong) NSString *website;
@property (nullable, nonatomic, strong) NSString *originalLabel;
@property (nullable, nonatomic, strong) NSString *localizedLabel;

@end

@interface MFSocialProfile : NSObject

@property (nonatomic, assign) MFSocialNetworkType socialNetwork;
@property (nullable, nonatomic, strong) NSString *username;
@property (nullable, nonatomic, strong) NSString *userIdentifier;
@property (nullable, nonatomic, strong) NSURL *url;

@end

@interface MFRelatedPerson : NSObject

@property (nullable, nonatomic, strong) NSString *name;
@property (nullable, nonatomic, strong) NSString *originalLabel;
@property (nullable, nonatomic, strong) NSString *localizedLabel;

@end

@interface MFSource : NSObject

@property (nonnull, nonatomic, strong) NSString *sourceType;
@property (nonnull, nonatomic, strong) NSNumber *sourceID;

@end

@interface MFContactDate : NSObject

@property (nullable, nonatomic, strong) NSDate *date;
@property (nullable, nonatomic, strong) NSString *originalLabel;
@property (nullable, nonatomic, strong) NSString *localizedLabel;

@end

@interface MFRecordDate : NSObject

@property (nonnull, nonatomic, strong) NSDate *creationDate;
@property (nonnull, nonatomic, strong) NSDate *modificationDate;

@end


text:
<?xml version="1.0" ?>
<doc>
	<str name="Patent Number">
		US7604733
	</str>
	<str name="Application Number">
		US12405029
	</str>
	<str name="Kind Code">
		B2
	</str>
	<str name="Title">
		Apparatus for biological removal of phosphorus and nitrogen using granulated methane-oxidizing bacteria
	</str>
	<str name="Abstract">
		A biological removal method of phosphorus and nitrogen includes supplying a mixture gas into a gas holder. Inflow water and return water are supplied into the gas holder to make the mixture gas dissolved in the inflow water and the return water. The return water was provided from a granulation biological reaction tank. The inflow water and the return water including the dissolved mixture gas are transported to the granulation biological reaction tank. A nitrogen-based component is removed from the inflow water and the return water using methan-oxidizing bacteria granulated in the granulation biological reaction tank. Treated water without the nitrogen-based component is transported to an anoxic tank for treatment, and discharged from the anoxic tank.
	</str>
	<str name="Document Types">
		US | USB | DOCDB
	</str>
	<str name="Application Date">
		2009-03-16
	</str>
	<str name="Application Year">
		2009
	</str>
	<str name="Application(Year/Month)">
		2009-03
	</str>
	<str name="Publication Date">
		2009-10-20
	</str>
	<str name="Publication Year">
		2009
	</str>
	<str name="Publication(Year/Month)">
		2009-10
	</str>
	<str name="All IPC">
		C02F3/00
	</str>
	<str name="IPC Primary">
		C02F3/00
	</str>
	<str name="IPC Section">
		C
	</str>
	<str name="IPC Class">
		C02
	</str>
	<str name="IPC Subclass">
		C02F
	</str>
	<str name="IPC Group">
		C02F3
	</str>
	<str name="All UPC">
		210/416.1 | 210/150 | 210/500.23 | 210/151 | 210/903 | 210/906
	</str>
	<str name="UPC Primary">
		210/416.1
	</str>
	<str name="UPC Class">
		210
	</str>
	<str name="Family Members">
		KR100804624B1 | KR1020070117354A | US7520991 | US7604733 | US20090173679A1 | CN101085693A | US20070284305A1
	</str>
	<str name="Family Member Count">
		7
	</str>
	<str name="Family Members Cited By Count">
		0
	</str>
	<str name="Other References">
		Williams, Jon Christopher, "Initial Investigations of Aerobic Granulation in an Annular Gap Bioreactor", Raleigh, 2004. cited by other.
	</str>
	<str name="Other References Count">
		1
	</str>
	<str name="Cited By Count">
		0
	</str>
	<str name="Cites">
		US7459076 | US6099731 | US5057221 | JP1999262793
	</str>
	<str name="Cites Count">
		4
	</str>
	<str name="Priority Country">
		KR
	</str>
	<str name="Priority Number">
		1020060051523
	</str>
	<str name="Priority Date">
		2006-06-08
	</str>
	<str name="Assignee(s)">
		KOREA INSTITUTE OF CONSTRUCTION TECHNOLOGY (GYEONGGI-DO, KR), DAEWOO ENGINEERING & CONSTRUCTION CO., LTD.
	</str>
	<str name="1st Assignee">
		KOREA INSTITUTE OF CONSTRUCTION TECHNOLOGY (GYEONGGI-DO, KR), DAEWOO ENGINEERING & CONSTRUCTION CO., LTD.
	</str>
	<str name="Number of Assignees">
		1
	</str>
	<str name="1st Assignee Address">
		Seoul, KR
	</str>
	<str name="Assignee(s) Address">
		Seoul, KR
	</str>
	<str name="Inventor(s)">
		KIM, KWANG-SOO | LEE, HEE-JA | KIM, I-TAE | AHN, KWANG-HO | GEE, CHAI-SUNG | KIM, SUNG-YOUN | YOO, JI-SEON | LEE, EUI-SIN | PAIK, SUNG-POK | OH, CHUL-KI | LEE, KWANG-YOON
	</str>
	<str name="1st Inventor">
		KIM, KWANG-SOO
	</str>
	<str name="Number of Inventors">
		11
	</str>
	<str name="1st Inventor Address">
		Gyeonggi-do, KR
	</str>
	<str name="Inventor(s) Address">
		Gyeonggi-do, KR | Gyeonggi-do, KR | Gyeonggi-do, KR | Seoul, KR | Seoul, KR | Gyeonggi-do, KR | Gyeonggi-do, KR | Gyeonggi-do, KR | Seoul, KR | Gyeonggi-do, KR | Gyeonggi-do, KR
	</str>
	<str name="Agent/Attorney">
		VENABLE LLP SARTORI, MICHAEL A. GOZZI, JUSTINE A.
	</str>
	<str name="Primary Examiner">
		BARRY, CHESTER T
	</str>
	<str name="cited by within 3 years">
		0
	</str>
	<str name="cited by within 5 years">
		0
	</str>
</doc>


text:
package io.hops.metadata.yarn.entity;

/**
 * HOP representation of ContainerStatus yarn object.
 */
public class ContainerStatus implements Comparable<ContainerStatus> {

  private final String containerid;
  private final String state;
  private final String diagnostics;
  private final int exitstatus;
  private final String rMNodeId;
  private final Integer uciId;
  private final int pendingEventId;

  public ContainerStatus(String containerid, String state, String diagnostics,
          int exitstatus, String rMNodeId) {
    this(containerid, state, diagnostics, exitstatus, rMNodeId, -1, -1);
  }

  public ContainerStatus(String containerid, String state, String diagnostics,
          int exitstatus, String rMNodeId, int pendingId, int uciId) {
    this.containerid = containerid;
    this.state = state;
    this.diagnostics = diagnostics.substring(0, Math.min(500, diagnostics.
            length()));
    this.exitstatus = exitstatus;
    this.rMNodeId = rMNodeId;
    this.pendingEventId = pendingId;
    this.uciId = uciId;
  }

  public ContainerStatus(String containerid, String rMNodeId, int uciId) {
    this.containerid = containerid;
    this.state = "";
    this.diagnostics = "";
    this.exitstatus = 0;
    this.rMNodeId = rMNodeId;
    this.pendingEventId = -1;
    this.uciId = uciId;
  }

  public int getUciId() {
    return uciId;
  }

  public int getPendingEventId() {
    return pendingEventId;
  }

  public String getContainerid() {
    return containerid;
  }

  public String getState() {
    return state;
  }

  public String getDiagnostics() {
    return diagnostics;
  }

  public int getExitstatus() {
    return exitstatus;
  }

  public String getRMNodeId() {
    return rMNodeId;
  }

  @Override
  public String toString() {
    return "HopContainerStatus{" + "containerid=" + containerid + ", state=" +
        state + ", diagnostics=" + diagnostics + ", exitstatus=" + exitstatus +
        "uciId= " + uciId + '}';
  }

  @Override
  public int hashCode() {
    return containerid.hashCode() + 100 * uciId.hashCode();
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof ContainerStatus)) {
      return false;
    }

    return containerid
            .equals(((ContainerStatus) o).getContainerid());
  }

  @Override
  public int compareTo(ContainerStatus other) {
    if (this.equals(other)) {
      return 0;
    }
    if(containerid.compareTo(other.getContainerid())!=0){
        return containerid.compareTo(other.getContainerid());
    }else{
        return uciId.compareTo(other.getUciId());
    }
  }

}


text:
local get_room_by_name_and_subdomain = module:require 'util'.get_room_by_name_and_subdomain;
local is_healthcheck_room = module:require 'util'.is_healthcheck_room;
local internal_room_jid_match_rewrite = module:require "util".internal_room_jid_match_rewrite;
local room_jid_match_rewrite = module:require "util".room_jid_match_rewrite;
local array = require "util.array";
local json = require 'util.json';
local st = require 'util.stanza';

local muc_component_host = module:get_option_string('muc_component');
if muc_component_host == nil then
    module:log('error', 'No muc_component specified. No muc to operate on!');
    return;
end

module:log('info', 'Starting av_moderation for %s', muc_component_host);

-- Returns the index of the given element in the table
-- @param table in which to look
-- @param elem the element for which to find the index
function get_index_in_table(table, elem)
    for index, value in pairs(table) do
        if value == elem then
            return index
        end
    end
end

-- Sends a json-message to the destination jid
-- @param to_jid the destination jid
-- @param json_message the message content to send
function send_json_message(to_jid, json_message)
    local stanza = st.message({ from = module.host; to = to_jid; })
         :tag('json-message', { xmlns = 'http://jitsi.org/jitmeet' }):text(json_message):up();
    module:send(stanza);
end

-- Notifies that av moderation has been enabled or disabled
-- @param jid the jid to notify, if missing will notify all occupants
-- @param enable whether it is enabled or disabled
-- @param room the room
-- @param actorJid the jid that is performing the enable/disable operation (the muc jid)
-- @param mediaType the media type for the moderation
function notify_occupants_enable(jid, enable, room, actorJid, mediaType)
    local body_json = {};
    body_json.type = 'av_moderation';
    body_json.enabled = enable;
    body_json.room = internal_room_jid_match_rewrite(room.jid);
    body_json.actor = actorJid;
    body_json.mediaType = mediaType;
    local body_json_str = json.encode(body_json);

    if jid then
        send_json_message(jid, body_json_str)
    else
        for _, occupant in room:each_occupant() do
            send_json_message(occupant.jid, body_json_str)
        end
    end
end

-- Notifies about a change to the whitelist. Notifies all moderators and admin and the jid itself
-- @param jid the jid to notify about the change
-- @param moderators whether to notify all moderators in the room
-- @param room the room where to send it
-- @param mediaType used only when a participant is approved (not sent to moderators)
-- @param removed whether the jid is removed or added
function notify_whitelist_change(jid, moderators, room, mediaType, removed)
    local body_json = {};
    body_json.type = 'av_moderation';
    body_json.room = internal_room_jid_match_rewrite(room.jid);
    body_json.whitelists = room.av_moderation;
    if removed then
        body_json.removed = true;
    end
    body_json.mediaType = mediaType;
    local moderators_body_json_str = json.encode(body_json);
    body_json.whitelists = nil;
    if not removed then
        body_json.approved = true; -- we want to send to participants only that they were approved to unmute
    end
    local participant_body_json_str = json.encode(body_json);

    for _, occupant in room:each_occupant() do
        if moderators and occupant.role == 'moderator' then
            send_json_message(occupant.jid, moderators_body_json_str);
        elseif occupant.jid == jid then
            -- if the occupant is not moderator we send him that it is approved
            -- if it is moderator we update him with the list, this is moderator joining or grant moderation was executed
            if occupant.role == 'moderator' then
                send_json_message(occupant.jid, moderators_body_json_str);
            else
                send_json_message(occupant.jid, participant_body_json_str);
            end
        end
    end
end

-- Notifies jid that is approved. This is a moderator to jid message to ask to unmute,
-- @param jid the jid to notify about the change
-- @param from the jid that triggered this
-- @param room the room where to send it
-- @param mediaType the mediaType it was approved for
function notify_jid_approved(jid, from, room, mediaType)
    local body_json = {};
    body_json.type = 'av_moderation';
    body_json.room = internal_room_jid_match_rewrite(room.jid);
    body_json.approved = true; -- we want to send to participants only that they were approved to unmute
    body_json.mediaType = mediaType;
    body_json.from = from;

    send_json_message(jid, json.encode(body_json));
end

-- receives messages from clients to the component sending A/V moderation enable/disable commands or adding
-- jids to the whitelist
function on_message(event)
    local session = event.origin;

    -- Check the type of the incoming stanza to avoid loops:
    if event.stanza.attr.type == 'error' then
        return; -- We do not want to reply to these, so leave.
    end

    if not session or not session.jitsi_web_query_room then
        return false;
    end

    local moderation_command = event.stanza:get_child('av_moderation');

    if moderation_command then
        -- get room name with tenant and find room
        local room = get_room_by_name_and_subdomain(session.jitsi_web_query_room, session.jitsi_web_query_prefix);

        if not room then
            module:log('warn', 'No room found found for %s/%s',
                    session.jitsi_web_query_prefix, session.jitsi_web_query_room);
            return false;
        end

        -- check that the participant requesting is a moderator and is an occupant in the room
        local from = event.stanza.attr.from;
        local occupant = room:get_occupant_by_real_jid(from);
        if not occupant then
            log('warn', 'No occupant %s found for %s', from, room.jid);
            return false;
        end
        if occupant.role ~= 'moderator' then
            log('warn', 'Occupant %s is not moderator and not allowed this operation for %s', from, room.jid);
            return false;
        end

        local mediaType = moderation_command.attr.mediaType;
        if mediaType then
            if mediaType ~= 'audio' and mediaType ~= 'video' then
                module:log('warn', 'Wrong mediaType %s for %s', mediaType, room.jid);
                return false;
            end
        else
            module:log('warn', 'Missing mediaType for %s', room.jid);
            return false;
        end

        if moderation_command.attr.enable ~= nil then
            local enabled;
            if moderation_command.attr.enable == 'true' then
                enabled = true;
                if room.av_moderation and room.av_moderation[mediaType] then
                    module:log('warn', 'Concurrent moderator enable/disable request or something is out of sync');
                    return true;
                else
                    if not room.av_moderation then
                        room.av_moderation = {};
                        room.av_moderation_actors = {};
                    end
                    room.av_moderation[mediaType] = array{};
                    room.av_moderation_actors[mediaType] = occupant.nick;
                end
            else
                enabled = false;
                if not room.av_moderation then
                    module:log('warn', 'Concurrent moderator enable/disable request or something is out of sync');
                    return true;
                else
                    room.av_moderation[mediaType] = nil;
                    room.av_moderation_actors[mediaType] = nil;

                    -- clears room.av_moderation if empty
                    local is_empty = true;
                    for key,_ in pairs(room.av_moderation) do
                        if room.av_moderation[key] then
                            is_empty = false;
                        end
                    end
                    if is_empty then
                        room.av_moderation = nil;
                    end
                end
            end

            -- send message to all occupants
            notify_occupants_enable(nil, enabled, room, occupant.nick, mediaType);
            return true;
        elseif moderation_command.attr.jidToWhitelist then
            local occupant_jid = moderation_command.attr.jidToWhitelist;
            -- check if jid is in the room, if so add it to whitelist
            -- inform all moderators and admins and the jid
            local occupant_to_add = room:get_occupant_by_nick(room_jid_match_rewrite(occupant_jid));
            if not occupant_to_add then
                module:log('warn', 'No occupant %s found for %s', occupant_jid, room.jid);
                return false;
            end

            if room.av_moderation then
                local whitelist = room.av_moderation[mediaType];
                if not whitelist then
                    whitelist = array{};
                    room.av_moderation[mediaType] = whitelist;
                end
                whitelist:push(occupant_jid);

                notify_whitelist_change(occupant_to_add.jid, true, room, mediaType, false);

                return true;
            else
                -- this is a moderator asking the jid to unmute without enabling av moderation
                -- let's just send the event
                notify_jid_approved(occupant_to_add.jid, occupant.nick, room, mediaType);
            end
        elseif moderation_command.attr.jidToBlacklist then
            local occupant_jid = moderation_command.attr.jidToBlacklist;
            -- check if jid is in the room, if so remove it from the whitelist
            -- inform all moderators and admins
            local occupant_to_remove = room:get_occupant_by_nick(room_jid_match_rewrite(occupant_jid));
            if not occupant_to_remove then
                module:log('warn', 'No occupant %s found for %s', occupant_jid, room.jid);
                return false;
            end

            if room.av_moderation then
                local whitelist = room.av_moderation[mediaType];
                if whitelist then
                    local index = get_index_in_table(whitelist, occupant_jid)
                    if(index) then
                        whitelist:pop(index);
                        notify_whitelist_change(occupant_to_remove.jid, true, room, mediaType, true);
                    end
                end

                return true;
            end
        end
    end

    -- return error
    return false
end

-- handles new occupants to inform them about the state enabled/disabled, new moderators also get and the whitelist
function occupant_joined(event)
    local room, occupant = event.room, event.occupant;

    if is_healthcheck_room(room.jid) then
        return;
    end

    if room.av_moderation then
        for _,mediaType in pairs({'audio', 'video'}) do
            if room.av_moderation[mediaType] then
                notify_occupants_enable(
                    occupant.jid, true, room, room.av_moderation_actors[mediaType], mediaType);
            end
        end

        -- NOTE for some reason event.occupant.role is not reflecting the actual occupant role (when changed
        -- from allowners module) but iterating over room occupants returns the correct role
        for _, room_occupant in room:each_occupant() do
            -- if moderator send the whitelist
            if room_occupant.nick == occupant.nick and room_occupant.role == 'moderator'  then
                notify_whitelist_change(room_occupant.jid, false, room);
            end
        end
    end
end

-- when a occupant was granted moderator we need to update him with the whitelist
function occupant_affiliation_changed(event)
    -- the actor can be nil if is coming from allowners or similar module we want to skip it here
    -- as we will handle it in occupant_joined
    if event.actor and event.affiliation == 'owner' and event.room.av_moderation then
        local room = event.room;
        -- event.jid is the bare jid of participant
        for _, occupant in room:each_occupant() do
            if occupant.bare_jid == event.jid then
                notify_whitelist_change(occupant.jid, false, room);
            end
        end
    end
end

-- we will receive messages from the clients
module:hook('message/host', on_message);

-- executed on every host added internally in prosody, including components
function process_host(host)
    if host == muc_component_host then -- the conference muc component
        module:log('info','Hook to muc events on %s', host);

        local muc_module = module:context(host);
        muc_module:hook('muc-occupant-joined', occupant_joined, -2); -- make sure it runs after allowners or similar
        muc_module:hook('muc-set-affiliation', occupant_affiliation_changed, -1);
    end
end

if prosody.hosts[muc_component_host] == nil then
    module:log('info', 'No muc component found, will listen for it: %s', muc_component_host);

    -- when a host or component is added
    prosody.events.add_handler('host-activated', process_host);
else
    process_host(muc_component_host);
end


text:
#pragma once
#include <aws/organizations/Organizations_EXPORTS.h>
#include <aws/organizations/OrganizationsRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace Organizations
{
namespace Model
{

  /**
   */
  class AWS_ORGANIZATIONS_API ListDelegatedAdministratorsRequest : public OrganizationsRequest
  {
  public:
    ListDelegatedAdministratorsRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "ListDelegatedAdministrators"; }

    Aws::String SerializePayload() const override;

    Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;

    /**
     *
Specifies a service principal name. If specified, then the operation lists
     * the delegated administrators only for the specified service.

If you don't
     * specify a service principal, the operation lists all delegated administrators
     * for all services in your organization.

     */
    inline const Aws::String& GetServicePrincipal() const{ return m_servicePrincipal; }

    /**
     *
Specifies a service principal name. If specified, then the operation lists
     * the delegated administrators only for the specified service.

If you don't
     * specify a service principal, the operation lists all delegated administrators
     * for all services in your organization.

     */
    inline bool ServicePrincipalHasBeenSet() const { return m_servicePrincipalHasBeenSet; }

    /**
     *
Specifies a service principal name. If specified, then the operation lists
     * the delegated administrators only for the specified service.

If you don't
     * specify a service principal, the operation lists all delegated administrators
     * for all services in your organization.

     */
    inline void SetServicePrincipal(const Aws::String& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = value; }

    /**
     *
Specifies a service principal name. If specified, then the operation lists
     * the delegated administrators only for the specified service.

If you don't
     * specify a service principal, the operation lists all delegated administrators
     * for all services in your organization.

     */
    inline void SetServicePrincipal(Aws::String&& value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal = std::move(value); }

    /**
     *
Specifies a service principal name. If specified, then the operation lists
     * the delegated administrators only for the specified service.

If you don't
     * specify a service principal, the operation lists all delegated administrators
     * for all services in your organization.

     */
    inline void SetServicePrincipal(const char* value) { m_servicePrincipalHasBeenSet = true; m_servicePrincipal.assign(value); }

    /**
     *
Specifies a service principal name. If specified, then the operation lists
     * the delegated administrators only for the specified service.

If you don't
     * specify a service principal, the operation lists all delegated administrators
     * for all services in your organization.

     */
    inline ListDelegatedAdministratorsRequest& WithServicePrincipal(const Aws::String& value) { SetServicePrincipal(value); return *this;}

    /**
     *
Specifies a service principal name. If specified, then the operation lists
     * the delegated administrators only for the specified service.

If you don't
     * specify a service principal, the operation lists all delegated administrators
     * for all services in your organization.

     */
    inline ListDelegatedAdministratorsRequest& WithServicePrincipal(Aws::String&& value) { SetServicePrincipal(std::move(value)); return *this;}

    /**
     *
Specifies a service principal name. If specified, then the operation lists
     * the delegated administrators only for the specified service.

If you don't
     * specify a service principal, the operation lists all delegated administrators
     * for all services in your organization.

     */
    inline ListDelegatedAdministratorsRequest& WithServicePrincipal(const char* value) { SetServicePrincipal(value); return *this;}

    /**
     *
The parameter for receiving additional results if you receive a
     * NextToken response in a previous request. A NextToken
     * response indicates that more output is available. Set this parameter to the
     * value of the previous call's NextToken response to indicate where
     * the output should continue from.

     */
    inline const Aws::String& GetNextToken() const{ return m_nextToken; }

    /**
     *
The parameter for receiving additional results if you receive a
     * NextToken response in a previous request. A NextToken
     * response indicates that more output is available. Set this parameter to the
     * value of the previous call's NextToken response to indicate where
     * the output should continue from.

     */
    inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; }

    /**
     *
The parameter for receiving additional results if you receive a
     * NextToken response in a previous request. A NextToken
     * response indicates that more output is available. Set this parameter to the
     * value of the previous call's NextToken response to indicate where
     * the output should continue from.

     */
    inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; }

    /**
     *
The parameter for receiving additional results if you receive a
     * NextToken response in a previous request. A NextToken
     * response indicates that more output is available. Set this parameter to the
     * value of the previous call's NextToken response to indicate where
     * the output should continue from.

     */
    inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); }

    /**
     *
The parameter for receiving additional results if you receive a
     * NextToken response in a previous request. A NextToken
     * response indicates that more output is available. Set this parameter to the
     * value of the previous call's NextToken response to indicate where
     * the output should continue from.

     */
    inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); }

    /**
     *
The parameter for receiving additional results if you receive a
     * NextToken response in a previous request. A NextToken
     * response indicates that more output is available. Set this parameter to the
     * value of the previous call's NextToken response to indicate where
     * the output should continue from.

     */
    inline ListDelegatedAdministratorsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}

    /**
     *
The parameter for receiving additional results if you receive a
     * NextToken response in a previous request. A NextToken
     * response indicates that more output is available. Set this parameter to the
     * value of the previous call's NextToken response to indicate where
     * the output should continue from.

     */
    inline ListDelegatedAdministratorsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}

    /**
     *
The parameter for receiving additional results if you receive a
     * NextToken response in a previous request. A NextToken
     * response indicates that more output is available. Set this parameter to the
     * value of the previous call's NextToken response to indicate where
     * the output should continue from.

     */
    inline ListDelegatedAdministratorsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;}

    /**
     *
The total number of results that you want included on each page of the
     * response. If you do not include this parameter, it defaults to a value that is
     * specific to the operation. If additional items exist beyond the maximum you
     * specify, the NextToken response element is present and has a value
     * (is not null). Include that value as the NextToken request
     * parameter in the next call to the operation to get the next part of the results.
     * Note that Organizations might return fewer results than the maximum even when
     * there are more results available. You should check NextToken after
     * every operation to ensure that you receive all of the results.

     */
    inline int GetMaxResults() const{ return m_maxResults; }

    /**
     *
The total number of results that you want included on each page of the
     * response. If you do not include this parameter, it defaults to a value that is
     * specific to the operation. If additional items exist beyond the maximum you
     * specify, the NextToken response element is present and has a value
     * (is not null). Include that value as the NextToken request
     * parameter in the next call to the operation to get the next part of the results.
     * Note that Organizations might return fewer results than the maximum even when
     * there are more results available. You should check NextToken after
     * every operation to ensure that you receive all of the results.

     */
    inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; }

    /**
     *
The total number of results that you want included on each page of the
     * response. If you do not include this parameter, it defaults to a value that is
     * specific to the operation. If additional items exist beyond the maximum you
     * specify, the NextToken response element is present and has a value
     * (is not null). Include that value as the NextToken request
     * parameter in the next call to the operation to get the next part of the results.
     * Note that Organizations might return fewer results than the maximum even when
     * there are more results available. You should check NextToken after
     * every operation to ensure that you receive all of the results.

     */
    inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; }

    /**
     *
The total number of results that you want included on each page of the
     * response. If you do not include this parameter, it defaults to a value that is
     * specific to the operation. If additional items exist beyond the maximum you
     * specify, the NextToken response element is present and has a value
     * (is not null). Include that value as the NextToken request
     * parameter in the next call to the operation to get the next part of the results.
     * Note that Organizations might return fewer results than the maximum even when
     * there are more results available. You should check NextToken after
     * every operation to ensure that you receive all of the results.

     */
    inline ListDelegatedAdministratorsRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;}

  private:

    Aws::String m_servicePrincipal;
    bool m_servicePrincipalHasBeenSet;

    Aws::String m_nextToken;
    bool m_nextTokenHasBeenSet;

    int m_maxResults;
    bool m_maxResultsHasBeenSet;
  };

} // namespace Model
} // namespace Organizations
} // namespace Aws


text:
package com.florDeLiz.seminarios.entidades;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import javax.persistence.JoinColumn;

import com.florDeLiz.seminarios.enums.ColecaoEnum;
import com.florDeLiz.seminarios.enums.CoresEnum;

@Entity
@Table(name = "produto")
public class Produto
{
	private Long codigo;
	private String nome;
	private ColecaoEnum colecao;
	private Integer menorNumero;
	private Integer maiorNumero;
	private CoresEnum cor;
	private List<Producao> producao;
	private List<PedidoLinha> pedidoLinha;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="produto_codigo")
	public Long getCodigo()
	{
		return codigo;
	}

	public void setCodigo(Long codigo)
	{
		this.codigo = codigo;
	}

	@Column(name = "produto_nome", nullable = false)
	public String getNome()
	{
		return nome;
	}

	public void setNome(String nome)
	{
		this.nome = nome;
	}

	@Enumerated(EnumType.STRING)
	@Column(name = "colecao")
	public ColecaoEnum getColecao()
	{
		return colecao;
	}

	public void setColecao(ColecaoEnum colecao)
	{
		this.colecao = colecao;
	}

	@Column(name = "produto_menor_numero", nullable = false)
	public Integer getMenorNumero()
	{
		return menorNumero;
	}

	public void setMenorNumero(Integer menorNumero)
	{
		this.menorNumero = menorNumero;
	}

	@Column(name = "produto_maior_numero", nullable = false)
	public Integer getMaiorNumero()
	{
		return maiorNumero;
	}

	public void setMaiorNumero(Integer maiorNumero)
	{
		this.maiorNumero = maiorNumero;
	}

	@Enumerated(EnumType.STRING)
	@Column(name = "cor")
	public CoresEnum getCor()
	{
		return cor;
	}

	public void setCor(CoresEnum cor)
	{
		this.cor = cor;
	}

	@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinTable(name = "estoque",
	joinColumns = { @JoinColumn(name = "produto_codigo") },
	inverseJoinColumns = { @JoinColumn(name = "producao_codigo") })
	public List<Producao> getProducao()
	{
		return producao;
	}

	public void setProducao(List<Producao> producao)
	{
		this.producao = producao;
	}

	@OneToMany(mappedBy = "produto", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@Column(name="pedido_linha_codigo", nullable = false)
	public List<PedidoLinha> getPedidoLinha()
	{
		return pedidoLinha;
	}

	public void setPedidoLinha(List<PedidoLinha> pedidoLinha)
	{
		this.pedidoLinha = pedidoLinha;
	}

	@Override
	public String toString()
	{
		return "Produto [codigo=" + codigo + ", nome=" + nome + ", colecao=" + colecao + ", menorNumero=" + menorNumero + ", maiorNumero="
				+ maiorNumero + ", cor=" + cor + ", producao=" + producao + ", pedidoLinha=" + pedidoLinha + "]";
	}

}


text:
import { PreviousController } from './previous.controller';

export function FlickityPreviousDirective(
    $log, $timeout, $rootScope,
    FlickityConfig, FlickityService
) {
    'ngInject';

    const directive = {
        restrict: 'A',
        scope: {},
        bindToController: {
            bcFlickityPrevious: '=?',
            bcFlickityId: '@?',
        },
        compile: () => {
            return {
                pre: preLinkFunction,
            };
        },
        controller: PreviousController,
        controllerAs: 'vm',
    };

    return directive;

    /**
     * Pre Link
     */
    function preLinkFunction(
        $scope, $element, $attrs, $controller
    ) {
        'ngInject';

        // Get the ID
        const ID = $controller.flickityId;

        // Define the broadcast names to listen for
        const selectEvent = `Flickity:${ID}:cellSelect`;
        const settleEvent = `Flickity:${ID}:settle`;

        // Listen
        const cellSelect = $rootScope.$on(selectEvent, (event, data) => {
            _disableButtonIfNeeded(data.instance.selectedIndex);
        });
        const settle = $rootScope.$on(settleEvent, (event, data) => {
            _disableButtonIfNeeded(data.instance.selectedIndex);
        });

        $element.on('click', () => {

            // Move to the next cell
            FlickityService.previous($controller.flickityId, $controller.wrapAround)
                .then((instance) => {
                    _disableButtonIfNeeded(instance.instance.selectedIndex);
                })
            ;

        });

        /**
         * Disable button if needed
         *
         * @param {number} index
         */
        function _disableButtonIfNeeded(index) {
            // Disable button if at the beginning and we shouldn't wrap
            if (!$controller.wrapAround && index === 0) {
                $attrs.$set('disabled', 'disabled');
            } else {
                $attrs.$set('disabled', false);
            }
        }

    }

}


text:
<?php

namespace Matryoshka\Service\Api\Exception\ApiProblem;

use Matryoshka\Service\Api\Exception\ExceptionInterface;
use ZF\ApiProblem\Exception\DomainException as ZFApiProblemDomainException;

/**
 * Class DomainException
 */
class DomainException extends ZFApiProblemDomainException implements ExceptionInterface
{
}


text:
package routem

import (
	"fmt"
	"net/http"
)

type (
	router struct {
		creator
		factory HandlerFactory
	}
)

// =-=-=-=-=-=
// Constructor
// =-=-=-=-=-=

// NewRouter constructs a new Router which can be used to setup and run
// the routem Router.
func NewRouter(factory HandlerFactory) Router {
	return &router{
		creator: newCreator(defaultConfig()),
		factory: factory,
	}
}

// =-=-=-=
// Execute
// =-=-=-=

func (r *router) Run(address string) (Service, error) {
	handler, err := r.Handler()

	if err != nil {
		return nil, err
	}

	s := newService(address, handler)

	err = s.run()

	if err != nil {
		return nil, err
	}

	return s, nil
}

func (r *router) RunTLS(address, certFile, keyFile string) (Service, error) {
	handler, err := r.Handler()

	if err != nil {
		return nil, err
	}

	s := newService(address, handler)

	err = s.runTLS(certFile, keyFile)

	if err != nil {
		return nil, err
	}

	return s, nil
}

// =-=-=-=
// Helpers
// =-=-=-=

func flatten(prefix string, routes []Routable) ([]Route, error) {
	flat := make([]Route, 0, len(routes))
	for _, route := range routes {
		group, isGroup := route.(Group)
		if isGroup {
			groupRoutes, err := flatten(prefix+group.Path(), group.Routes())
			if err != nil {
				return nil, err
			}
			for _, gr := range groupRoutes {
				flat = append(flat, gr)
			}
		} else {
			route, isRoute := route.(Route)
			// This is impossible but just in case
			if !isRoute {
				return nil, fmt.Errorf("Found Routable not a Group or Route? WTF! %v", route)
			}
			flat = append(flat, route.Prefix(prefix))
		}
	}

	return flat, nil
}

func (r *router) Handler() (http.Handler, error) {
	routes, err := flatten("", r.Routes())

	if err == nil {
		return r.factory.Handler(routes)
	}

	return nil, err
}


text:
package net.kiberion.swampmachine.styling;

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

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import com.badlogic.gdx.Files.FileType;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.Window;
import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle;

import lombok.Getter;
import net.kiberion.swampmachine.assets.GameConfig;
import net.kiberion.swampmachine.assets.UiManager;

/**
 * @author kibertoad
 */

//ToDo Very old code, probably should be rewritten
@Deprecated
public class StyleFactory {

    private static final Logger log = LogManager.getLogger();

    @Autowired
    private GameConfig gameConfig;

    private final Map<String, Label.LabelStyle> labelStyles = new HashMap<>();
    private final Map<String, TextButton.TextButtonStyle> buttonStyles = new HashMap<>();
    private final Map<String, Window.WindowStyle> windowStyles = new HashMap<>();

    @Getter
    private final Map<String, Map<Integer, BitmapFont>> fonts = new HashMap<>();

    private BitmapFont produceFont(String fontName, int size) {
        String path = gameConfig.getPathToResourcesAsString() + "/fonts/" + fontName + ".ttf";
        log.info ("Path to fonts: "+path);
        FileHandle fontHandle = Gdx.files.getFileHandle(path, FileType.Internal);

        FreeTypeFontGenerator fontGenerator = new FreeTypeFontGenerator(fontHandle);
        FreeTypeFontGenerator.FreeTypeFontParameter params = new FreeTypeFontGenerator.FreeTypeFontParameter();
        params.size = size;

        BitmapFont font = fontGenerator.generateFont(params);
        fontGenerator.dispose();

        return font;
    }

    public void addLabelFontStyle(String styleName, String fontName, int size) {
        Label.LabelStyle style = new Label.LabelStyle(
                UiManager.instance().getDefaultSkin().get("default", Label.LabelStyle.class));
        style.font = getFont(fontName, size);

        labelStyles.put(styleName, style);
    }

    public void addButtonFontStyle(String styleName, String fontName, int size) {
        addButtonFontStyle(styleName, fontName, size, UiManager.instance().getDefaultSkin());
    }

    public void addButtonFontStyle(String styleName, String fontName, int size, Skin skin) {
        TextButton.TextButtonStyle style = new TextButton.TextButtonStyle(
                skin.get("default", TextButton.TextButtonStyle.class));
        style.font = getFont(fontName, size);
        buttonStyles.put(styleName, style);
    }

    public void addWindowFontStyle(String styleName, Skin skin) {
        Window.WindowStyle style = new Window.WindowStyle(skin.get("default", Window.WindowStyle.class));
        windowStyles.put(styleName, style);
    }

    public BitmapFont getFont(String fontName, int size) {
        Map<Integer, BitmapFont> fontList;

        if (!fonts.containsKey(fontName)) {
            fontList = new HashMap<>();
            fonts.put(fontName, fontList);
        } else {
            fontList = fonts.get(fontName);
        }

        if (!fontList.containsKey(size)) {
            fontList.put(size, produceFont(fontName, size));
        }

        return fontList.get(size);
    }

    public Label.LabelStyle getLabelStyle(String styleName) {
        if (!labelStyles.containsKey(styleName)) {
            log.error("No style: " + styleName);
            for (String style : labelStyles.keySet()) {
                log.error("Has style: " + style);
            }
        }

        return labelStyles.get(styleName);
    }

    public TextButton.TextButtonStyle getButtonStyle(String styleName) {
        if (!buttonStyles.containsKey(styleName)) {
            log.error("No style: " + styleName);

            for (String style : buttonStyles.keySet()) {
                log.error("Has style: " + style);
            }
        }

        return buttonStyles.get(styleName);
    }

    public void setLabelStyleColour(String styleName, Color color) {
        getLabelStyle(styleName).fontColor = color;
    }

    public void setButtonStyleColour(String styleName, Color color) {
        getButtonStyle(styleName).fontColor = color;
    }

    public WindowStyle getWindowStyle(String style) {
        return windowStyles.get(style);
    }

}


text:
<!doctype html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Calp - Versão Beta</title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="bower_components/html5-boilerplate/css/normalize.css">
  <link rel="stylesheet" href="bower_components/html5-boilerplate/css/main.css">
  <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css">
  <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.css">

  <link rel="stylesheet" href="css/style.css"/>

Bem-Vindo, {{ usuario.name }}

Você está logado como ADMIN.

Você está logado como professor.

Você não está logado

          CALP

                     Home

                    Usuários

                    Alunos

                    Projetos

                     Sobre

                   Login
                   Logout

home

chat

logins

account


text:
package teamA; import app.*; import org.junit.Test;
import static org.junit.Assert.*;
public class TestB {
@Test
public void testPlus() {
 Application my = new Application();
String result = my.getC();
assertEquals("C", result); } }