text:
//
// InsnInfo is used to hold info about the opcode and parameters needed
// by an instruction. Instances of InsnInfo are created by a static
// initializer and stored in a table.
//

package jasmin;

import jas.RuntimeConstants;
import java.util.Hashtable;

class InsnInfo {
    // maps instruction name -> InsnInfo object
    private static Hashtable infoTable;

    // information maintained about each instruction:
    public String name;     // instruction name
    public int opcode;      // its opcode
    public String args;     // the argument code

    public static InsnInfo get(String name) {
	return (InsnInfo)infoTable.get(name);
    }

    public static boolean contains(String name) {
	return infoTable.get(name) != null;
    }

    //
    // used to initialize the infoTable table (see below)
    //
    static private void addInfo(String name, int opcode, String args) {
	InsnInfo info = new InsnInfo();
	info.name = name;
	info.opcode = opcode;
	info.args = args;
        infoTable.put(name, info);
    }

    //
    // initializes the infoTable table
    //
    static {
        infoTable = new Hashtable();

        addInfo("aaload", RuntimeConstants.opc_aaload, "");
        addInfo("aastore", RuntimeConstants.opc_aastore, "");
        addInfo("aconst_null", RuntimeConstants.opc_aconst_null, "");
        addInfo("aload", RuntimeConstants.opc_aload, "i");
        addInfo("aload_w", RuntimeConstants.opc_aload, "I");
        addInfo("aload_0", RuntimeConstants.opc_aload_0, "");
        addInfo("aload_1", RuntimeConstants.opc_aload_1, "");
        addInfo("aload_2", RuntimeConstants.opc_aload_2, "");
        addInfo("aload_3", RuntimeConstants.opc_aload_3, "");
        addInfo("anewarray", RuntimeConstants.opc_anewarray, "class");
        addInfo("areturn", RuntimeConstants.opc_areturn, "");
        addInfo("arraylength", RuntimeConstants.opc_arraylength, "");
        addInfo("astore", RuntimeConstants.opc_astore, "i");
        addInfo("astore_w", RuntimeConstants.opc_astore, "I");
        addInfo("astore_0", RuntimeConstants.opc_astore_0, "");
        addInfo("astore_1", RuntimeConstants.opc_astore_1, "");
        addInfo("astore_2", RuntimeConstants.opc_astore_2, "");
        addInfo("astore_3", RuntimeConstants.opc_astore_3, "");
        addInfo("athrow", RuntimeConstants.opc_athrow, "");
        addInfo("baload", RuntimeConstants.opc_baload, "");
        addInfo("bastore", RuntimeConstants.opc_bastore, "");
        addInfo("bipush", RuntimeConstants.opc_bipush, "i");
        addInfo("breakpoint", RuntimeConstants.opc_breakpoint, "");
        addInfo("caload", RuntimeConstants.opc_caload, "");
        addInfo("castore", RuntimeConstants.opc_castore, "");
        addInfo("checkcast", RuntimeConstants.opc_checkcast, "class");
        addInfo("d2f", RuntimeConstants.opc_d2f, "");
        addInfo("d2i", RuntimeConstants.opc_d2i, "");
        addInfo("d2l", RuntimeConstants.opc_d2l, "");
        addInfo("dadd", RuntimeConstants.opc_dadd, "");
        addInfo("daload", RuntimeConstants.opc_daload, "");
        addInfo("dastore", RuntimeConstants.opc_dastore, "");
        addInfo("dcmpg", RuntimeConstants.opc_dcmpg, "");
        addInfo("dcmpl", RuntimeConstants.opc_dcmpl, "");
        addInfo("dconst_0", RuntimeConstants.opc_dconst_0, "");
        addInfo("dconst_1", RuntimeConstants.opc_dconst_1, "");
        addInfo("ddiv", RuntimeConstants.opc_ddiv, "");
        addInfo("dload", RuntimeConstants.opc_dload, "i");
        addInfo("dload_w", RuntimeConstants.opc_dload, "I");
        addInfo("dload_0", RuntimeConstants.opc_dload_0, "");
        addInfo("dload_1", RuntimeConstants.opc_dload_1, "");
        addInfo("dload_2", RuntimeConstants.opc_dload_2, "");
        addInfo("dload_3", RuntimeConstants.opc_dload_3, "");
        addInfo("dmul", RuntimeConstants.opc_dmul, "");
        addInfo("dneg", RuntimeConstants.opc_dneg, "");
        addInfo("drem", RuntimeConstants.opc_drem, "");
        addInfo("dreturn", RuntimeConstants.opc_dreturn, "");
        addInfo("dstore", RuntimeConstants.opc_dstore, "i");
        addInfo("dstore_w", RuntimeConstants.opc_dstore, "I");
        addInfo("dstore_0", RuntimeConstants.opc_dstore_0, "");
        addInfo("dstore_1", RuntimeConstants.opc_dstore_1, "");
        addInfo("dstore_2", RuntimeConstants.opc_dstore_2, "");
        addInfo("dstore_3", RuntimeConstants.opc_dstore_3, "");
        addInfo("dsub", RuntimeConstants.opc_dsub, "");
        addInfo("dup", RuntimeConstants.opc_dup, "");
        addInfo("dup2", RuntimeConstants.opc_dup2, "");
        addInfo("dup2_x1", RuntimeConstants.opc_dup2_x1, "");
        addInfo("dup2_x2", RuntimeConstants.opc_dup2_x2, "");
        addInfo("dup_x1", RuntimeConstants.opc_dup_x1, "");
        addInfo("dup_x2", RuntimeConstants.opc_dup_x2, "");
        addInfo("f2d", RuntimeConstants.opc_f2d, "");
        addInfo("f2i", RuntimeConstants.opc_f2i, "");
        addInfo("f2l", RuntimeConstants.opc_f2l, "");
        addInfo("fadd", RuntimeConstants.opc_fadd, "");
        addInfo("faload", RuntimeConstants.opc_faload, "");
        addInfo("fastore", RuntimeConstants.opc_fastore, "");
        addInfo("fcmpg", RuntimeConstants.opc_fcmpg, "");
        addInfo("fcmpl", RuntimeConstants.opc_fcmpl, "");
        addInfo("fconst_0", RuntimeConstants.opc_fconst_0, "");
        addInfo("fconst_1", RuntimeConstants.opc_fconst_1, "");
        addInfo("fconst_2", RuntimeConstants.opc_fconst_2, "");
        addInfo("fdiv", RuntimeConstants.opc_fdiv, "");
        addInfo("fload", RuntimeConstants.opc_fload, "i");
        addInfo("fload_w", RuntimeConstants.opc_fload, "I");
        addInfo("fload_0", RuntimeConstants.opc_fload_0, "");
        addInfo("fload_1", RuntimeConstants.opc_fload_1, "");
        addInfo("fload_2", RuntimeConstants.opc_fload_2, "");
        addInfo("fload_3", RuntimeConstants.opc_fload_3, "");
        addInfo("fmul", RuntimeConstants.opc_fmul, "");
        addInfo("fneg", RuntimeConstants.opc_fneg, "");
        addInfo("frem", RuntimeConstants.opc_frem, "");
        addInfo("freturn", RuntimeConstants.opc_freturn, "");
        addInfo("fstore", RuntimeConstants.opc_fstore, "i");
        addInfo("fstore_w", RuntimeConstants.opc_fstore, "I");
        addInfo("fstore_0", RuntimeConstants.opc_fstore_0, "");
        addInfo("fstore_1", RuntimeConstants.opc_fstore_1, "");
        addInfo("fstore_2", RuntimeConstants.opc_fstore_2, "");
        addInfo("fstore_3", RuntimeConstants.opc_fstore_3, "");
        addInfo("fsub", RuntimeConstants.opc_fsub, "");
        addInfo("getfield", RuntimeConstants.opc_getfield, "field");
        addInfo("getstatic", RuntimeConstants.opc_getstatic, "field");
        addInfo("goto", RuntimeConstants.opc_goto, "label");
        addInfo("goto_w", RuntimeConstants.opc_goto_w, "label");
        addInfo("i2d", RuntimeConstants.opc_i2d, "");
        addInfo("i2f", RuntimeConstants.opc_i2f, "");
        addInfo("i2l", RuntimeConstants.opc_i2l, "");
        addInfo("iadd", RuntimeConstants.opc_iadd, "");
        addInfo("iaload", RuntimeConstants.opc_iaload, "");
        addInfo("iand", RuntimeConstants.opc_iand, "");
        addInfo("iastore", RuntimeConstants.opc_iastore, "");
        addInfo("iconst_0", RuntimeConstants.opc_iconst_0, "");
        addInfo("iconst_1", RuntimeConstants.opc_iconst_1, "");
        addInfo("iconst_2", RuntimeConstants.opc_iconst_2, "");
        addInfo("iconst_3", RuntimeConstants.opc_iconst_3, "");
        addInfo("iconst_4", RuntimeConstants.opc_iconst_4, "");
        addInfo("iconst_5", RuntimeConstants.opc_iconst_5, "");
        addInfo("iconst_m1", RuntimeConstants.opc_iconst_m1, "");
        addInfo("idiv", RuntimeConstants.opc_idiv, "");
        addInfo("if_acmpeq", RuntimeConstants.opc_if_acmpeq, "label");
        addInfo("if_acmpne", RuntimeConstants.opc_if_acmpne, "label");
        addInfo("if_icmpeq", RuntimeConstants.opc_if_icmpeq, "label");
        addInfo("if_icmpge", RuntimeConstants.opc_if_icmpge, "label");
        addInfo("if_icmpgt", RuntimeConstants.opc_if_icmpgt, "label");
        addInfo("if_icmple", RuntimeConstants.opc_if_icmple, "label");
        addInfo("if_icmplt", RuntimeConstants.opc_if_icmplt, "label");
        addInfo("if_icmpne", RuntimeConstants.opc_if_icmpne, "label");
        addInfo("ifeq", RuntimeConstants.opc_ifeq, "label");
        addInfo("ifge", RuntimeConstants.opc_ifge, "label");
        addInfo("ifgt", RuntimeConstants.opc_ifgt, "label");
        addInfo("ifle", RuntimeConstants.opc_ifle, "label");
        addInfo("iflt", RuntimeConstants.opc_iflt, "label");
        addInfo("ifne", RuntimeConstants.opc_ifne, "label");
        addInfo("ifnonnull", RuntimeConstants.opc_ifnonnull, "label");
        addInfo("ifnull", RuntimeConstants.opc_ifnull, "label");
        addInfo("iinc", RuntimeConstants.opc_iinc, "ii");
        addInfo("iinc_w", RuntimeConstants.opc_iinc, "Ii");
        addInfo("iload", RuntimeConstants.opc_iload, "i");
        addInfo("iload_w", RuntimeConstants.opc_iload, "I");
        addInfo("iload_0", RuntimeConstants.opc_iload_0, "");
        addInfo("iload_1", RuntimeConstants.opc_iload_1, "");
        addInfo("iload_2", RuntimeConstants.opc_iload_2, "");
        addInfo("iload_3", RuntimeConstants.opc_iload_3, "");
        addInfo("imul", RuntimeConstants.opc_imul, "");
        addInfo("ineg", RuntimeConstants.opc_ineg, "");
        addInfo("instanceof", RuntimeConstants.opc_instanceof, "class");
        addInfo("int2byte", RuntimeConstants.opc_int2byte, "");
        addInfo("int2char", RuntimeConstants.opc_int2char, "");
        addInfo("int2short", RuntimeConstants.opc_int2short, "");
        // added this synonym
        addInfo("i2b", RuntimeConstants.opc_int2byte, "");
        // added this synonym
        addInfo("i2c", RuntimeConstants.opc_int2char, "");
        // added this synonym
        addInfo("i2s", RuntimeConstants.opc_int2short, "");
        addInfo("invokedynamic", RuntimeConstants.opc_invokedynamic, "method");
        addInfo("invokeinterface", RuntimeConstants.opc_invokeinterface, "interface");
        addInfo("invokenonvirtual", RuntimeConstants.opc_invokenonvirtual, "method");
        // added this synonym
        addInfo("invokespecial", RuntimeConstants.opc_invokenonvirtual, "method");
        addInfo("invokestatic", RuntimeConstants.opc_invokestatic, "method");
        addInfo("invokevirtual", RuntimeConstants.opc_invokevirtual, "method");
        addInfo("ior", RuntimeConstants.opc_ior, "");
        addInfo("irem", RuntimeConstants.opc_irem, "");
        addInfo("ireturn", RuntimeConstants.opc_ireturn, "");
        addInfo("ishl", RuntimeConstants.opc_ishl, "");
        addInfo("ishr", RuntimeConstants.opc_ishr, "");
        addInfo("istore", RuntimeConstants.opc_istore, "i");
        addInfo("istore_w", RuntimeConstants.opc_istore, "I");
        addInfo("istore_0", RuntimeConstants.opc_istore_0, "");
        addInfo("istore_1", RuntimeConstants.opc_istore_1, "");
        addInfo("istore_2", RuntimeConstants.opc_istore_2, "");
        addInfo("istore_3", RuntimeConstants.opc_istore_3, "");
        addInfo("isub", RuntimeConstants.opc_isub, "");
        addInfo("iushr", RuntimeConstants.opc_iushr, "");
        addInfo("ixor", RuntimeConstants.opc_ixor, "");
        addInfo("jsr", RuntimeConstants.opc_jsr, "label");
        addInfo("jsr_w", RuntimeConstants.opc_jsr_w, "label");
        addInfo("l2d", RuntimeConstants.opc_l2d, "");
        addInfo("l2f", RuntimeConstants.opc_l2f, "");
        addInfo("l2i", RuntimeConstants.opc_l2i, "");
        addInfo("ladd", RuntimeConstants.opc_ladd, "");
        addInfo("laload", RuntimeConstants.opc_laload, "");
        addInfo("land", RuntimeConstants.opc_land, "");
        addInfo("lastore", RuntimeConstants.opc_lastore, "");
        addInfo("lcmp", RuntimeConstants.opc_lcmp, "");
        addInfo("lconst_0", RuntimeConstants.opc_lconst_0, "");
        addInfo("lconst_1", RuntimeConstants.opc_lconst_1, "");
        addInfo("ldc", RuntimeConstants.opc_ldc, "constant");
        addInfo("ldc_w", RuntimeConstants.opc_ldc_w, "constant");
        addInfo("ldc2_w", RuntimeConstants.opc_ldc2_w, "bigconstant");
        addInfo("ldiv", RuntimeConstants.opc_ldiv, "");
        addInfo("lload", RuntimeConstants.opc_lload, "i");
        addInfo("lload_w", RuntimeConstants.opc_lload, "I");
        addInfo("lload_0", RuntimeConstants.opc_lload_0, "");
        addInfo("lload_1", RuntimeConstants.opc_lload_1, "");
        addInfo("lload_2", RuntimeConstants.opc_lload_2, "");
        addInfo("lload_3", RuntimeConstants.opc_lload_3, "");
        addInfo("lmul", RuntimeConstants.opc_lmul, "");
        addInfo("lneg", RuntimeConstants.opc_lneg, "");
        addInfo("lookupswitch", RuntimeConstants.opc_lookupswitch, "switch");
        addInfo("lor", RuntimeConstants.opc_lor, "");
        addInfo("lrem", RuntimeConstants.opc_lrem, "");
        addInfo("lreturn", RuntimeConstants.opc_lreturn, "");
        addInfo("lshl", RuntimeConstants.opc_lshl, "");
        addInfo("lshr", RuntimeConstants.opc_lshr, "");
        addInfo("lstore", RuntimeConstants.opc_lstore, "i");
        addInfo("lstore_w", RuntimeConstants.opc_lstore, "I");
        addInfo("lstore_0", RuntimeConstants.opc_lstore_0, "");
        addInfo("lstore_1", RuntimeConstants.opc_lstore_1, "");
        addInfo("lstore_2", RuntimeConstants.opc_lstore_2, "");
        addInfo("lstore_3", RuntimeConstants.opc_lstore_3, "");
        addInfo("lsub", RuntimeConstants.opc_lsub, "");
        addInfo("lushr", RuntimeConstants.opc_lushr, "");
        addInfo("lxor", RuntimeConstants.opc_lxor, "");
        addInfo("monitorenter", RuntimeConstants.opc_monitorenter, "");
        addInfo("monitorexit", RuntimeConstants.opc_monitorexit, "");
        addInfo("multianewarray", RuntimeConstants.opc_multianewarray, "marray");
        addInfo("new", RuntimeConstants.opc_new, "class");
        addInfo("newarray", RuntimeConstants.opc_newarray, "atype");
        addInfo("nop", RuntimeConstants.opc_nop, "");
        addInfo("pop", RuntimeConstants.opc_pop, "");
        addInfo("pop2", RuntimeConstants.opc_pop2, "");
        addInfo("putfield", RuntimeConstants.opc_putfield, "field");
        addInfo("putstatic", RuntimeConstants.opc_putstatic, "field");
        addInfo("ret", RuntimeConstants.opc_ret, "i");
        addInfo("ret_w", RuntimeConstants.opc_ret, "I");
        addInfo("return", RuntimeConstants.opc_return, "");
        addInfo("saload", RuntimeConstants.opc_saload, "");
        addInfo("sastore", RuntimeConstants.opc_sastore, "");
        addInfo("sipush", RuntimeConstants.opc_sipush, "i");
        addInfo("swap", RuntimeConstants.opc_swap, "");
        addInfo("tableswitch", RuntimeConstants.opc_tableswitch, "switch");
    }

};

/* --- Revision History ---------------------------------------------------
--- Iouri Kharon, Aug 10 2006
    Removed 'wide' as 'ignored' instruction
    Added definition for '_w' aliases for some instructions
--- Iouri Kharon, Mar 14 2006
    Change: 'ldc_w' is NOT synonym for 'ldc'
--- Iouri Kharon, Dec 23 2005
    Added invokedynamic
    Change: 'jsr_w' is NOT synonym for 'jsr'
--- Jonathan Meyer, Feb 8 1997
    Added invokespecial as a synonym for invokenonvirtual
*/


text:
The Nancy.Authentication.Token project was built for use by heterogeneous clients (iOS apps, Android apps, Angular SPA apps, etc.) that all communicate with the same back-end Nancy application.

## Rationale

Token authentication and authorization was built with the following requirements:

* No Cookies (since not all client apps are web browsers)
* Avoid retrieving users and permissions from a backend data store once the user has been authenticated/authorized
* Allow client apps to store a token containing the current user's credentials for resubmission on subsequent requests (after first authenticating)
* Prevent rogue clients from simply generating their own spoofed credentials by incorporating a one-way hashing algorithm that ensures the token has not been tampered with
* Use server side keys for token hash generation with a configurable key expiration interval
* Use file system storage of server-side token generation private keys to allow keys to survive an application restart or an app pool recycle. Note: an "in memory" option is available primarily for testing, but could be used in a situation where expiring all user sessions on an application restart is acceptable behavior.

Token Authentication can be wired up in a simliar fashion to other available forms of Nancy authentication.

```csharp
public class Bootstrapper : DefaultNancyBootstrapper
{
    protected override void RequestStartup(TinyIoCContainer container, IPipelines pipelines, NancyContext context)
    {
        TokenAuthentication.Enable(pipelines, new TokenAuthenticationConfiguration(container.Resolve<ITokenizer>()));
    }
}
```

You will need to provide your own form of initial user authentication. This can use your own custom implementation that queries
from a database, from an AD store, from a webservice, or any other form you choose. It could also use another form of Nancy authentication (Basic with an IUserValidator implementation
for example).

Tokens are generated from an `IUserIdentity` and a `NancyContext` by an implementation of `ITokenizer`. The
default implementation is named `Tokenizer` and provides some configuration options. By default, it generates a token
that includes the following components:

* User name
* Pipe separated list of user claims
* UTC now in ticks
* The client's "User-Agent" http header value (required)

It is recommended that you configure the Tokenizer to use an additional piece of information that can uniquely identify
the client device.

The following code shows an example of how you can perform the initial user authorization and return the generated token to the client.

```csharp
public class AuthModule : NancyModule
{
    public AuthModule(ITokenizer tokenizer)
        : base("/auth")
    {
        Post["/"] = x =>
            {
                var userName = (string)this.Request.Form.UserName;
                var password = (string)this.Request.Form.Password;

                var userIdentity = UserDatabase.ValidateUser(userName, password);

                if (userIdentity == null)
                {
                    return HttpStatusCode.Unauthorized;
                }

                var token = tokenizer.Tokenize(userIdentity, Context);

                return new
                    {
                        Token = token,
                    };
            };

        Get["/validation"] = _ =>
            {
                this.RequiresAuthentication();
                return "Yay! You are authenticated!";
            };

        Get["/admin"] = _ =>
        {
            this.RequiresAuthentication();
            this.RequiresClaims(new[] { "admin" });
            return "Yay! You are authorized!";
        };
    }
}
```

## Contributors

Nancy.Authentication.Token was originally created by the crack development team at [Lotpath](http://lotpath.com) ([Lotpath on github](http://github.com/Lotpath)).

redpajama_set_name: RedPajamaGithub


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

namespace SerializationUtilities
{
	//TODO find a better implementation
	public class OneToOneDictionary<TKey,TValue> : IDictionary<TKey,TValue>
	{
		private Dictionary<TKey, TValue> m_link1;
		private Dictionary<TValue, TKey> m_link2;

		public OneToOneDictionary(IEqualityComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer)
		{
			if(keyComparer!=null)
				m_link1 = new Dictionary<TKey, TValue>(keyComparer);
			else
				m_link1 = new Dictionary<TKey, TValue>();

			if(valueComparer!=null)
				m_link2 = new Dictionary<TValue, TKey>(valueComparer);
			else
				m_link2 = new Dictionary<TValue, TKey>();
		}

		public void Add(TKey key, TValue value)
		{
			if (m_link1.ContainsKey(key))
				throw new Exception("key is already associated to a value"); //TODO better exception

			if(m_link2.ContainsKey(value))
				throw new Exception("value is already associated to a key"); //TODO better exception

			m_link1.Add(key, value);
			m_link2.Add(value, key);
		}

		public bool ContainsKey(TKey key)
		{
			return m_link1.ContainsKey(key);
		}

		public bool ContainsValue(TValue value)
		{
			return m_link2.ContainsKey(value);
		}

		public ICollection<TKey> Keys
		{
			get { return m_link1.Keys; }
		}

		public bool Remove(TKey key)
		{
			TValue v;
			if (m_link1.TryGetValue(key, out v))
			{
				m_link1.Remove(key);
				m_link2.Remove(v);
				return true;
			}
			return false;
		}

		public bool RemoveValue(TValue value)
		{
			TKey k;
			if (m_link2.TryGetValue(value, out k))
			{
				m_link2.Remove(value);
				m_link1.Remove(k);
				return true;
			}
			return false;
		}

		public bool TryGetValue(TKey key, out TValue value)
		{
			return m_link1.TryGetValue(key, out value);
		}

		public bool TryGetKey(TValue value, out TKey key)
		{
			return m_link2.TryGetValue(value, out key);
		}

		public ICollection<TValue> Values
		{
			get { return m_link1.Values; }
		}

		public TValue this[TKey key]
		{
			get
			{
				return m_link1[key];
			}
			set
			{
				Add(key, value);
			}
		}

		public void Add(KeyValuePair<TKey, TValue> item)
		{
			Add(item.Key, item.Value);
		}

		public void Clear()
		{
			m_link1.Clear();
			m_link2.Clear();
		}

		public bool Contains(KeyValuePair<TKey, TValue> item)
		{
			return m_link1.Contains(item);
		}

		public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
		{
			using (var it = m_link1.GetEnumerator())
			{
				while (it.MoveNext() && arrayIndex < array.Length)
				{
					array[arrayIndex] = it.Current;
					arrayIndex++;
				}
			}
		}

		public int Count
		{
			get { return m_link1.Count; }
		}

		public bool IsReadOnly
		{
			get { return false; }
		}

		public bool Remove(KeyValuePair<TKey, TValue> item)
		{
			TValue v;
			if (!m_link1.TryGetValue(item.Key, out v))
				return false;

			if (!v.Equals(item.Value))
				return false;

			m_link1.Remove(item.Key);
			m_link2.Remove(item.Value);
			return true;
		}

		public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
		{
			return m_link1.GetEnumerator();
		}

		System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<items version="2" >

    <item
        jar="/home/deviser/Development/Android/workspace/BluetoothLeGatt/Application/build/intermediates/exploded-aar/com.android.support/cardview-v7/21.0.2/classes.jar"
        jumboMode="false"
        revision="21.1.1"
        sha1="b017100da14f9c158c9f5f2f508333c224b24a7c">
        <dex dex="/home/deviser/Development/Android/workspace/BluetoothLeGatt/Application/build/intermediates/pre-dexed/debug/classes-9f75ec8ea18ae9b7dabb4eedb3613c1e773f9a33.jar" />
    </item>
    <item
        jar="/home/deviser/Development/Android/workspace/BluetoothLeGatt/Application/build/intermediates/exploded-aar/com.android.support/support-v4/21.0.2/libs/internal_impl-21.0.2.jar"
        jumboMode="false"
        revision="21.1.1"
        sha1="962e8b12569c56dbdcf8367eb4eac8bb129cd18f">
        <dex dex="/home/deviser/Development/Android/workspace/BluetoothLeGatt/Application/build/intermediates/pre-dexed/debug/internal_impl-21.0.2-a4d6a2af58418f9d02b4cc48c0121bdf2bed60e4.jar" />
    </item>
    <item
        jar="/home/deviser/Development/Android/adt-bundle-linux-x86_64-20140702/sdk/extras/android/m2repository/com/android/support/support-annotations/21.0.2/support-annotations-21.0.2.jar"
        jumboMode="false"
        revision="21.1.1"
        sha1="99373741f99a0556ee293c41e8faa1ca3ae8a4e6">
        <dex dex="/home/deviser/Development/Android/workspace/BluetoothLeGatt/Application/build/intermediates/pre-dexed/debug/support-annotations-21.0.2-fde7c8727944292f7e8c6185e2ea2d2b212a13a5.jar" />
    </item>
    <item
        jar="/home/deviser/Development/Android/workspace/BluetoothLeGatt/Application/build/intermediates/exploded-aar/com.android.support/support-v4/21.0.2/classes.jar"
        jumboMode="false"
        revision="21.1.1"
        sha1="d1bf02de1c56d942e7a9d093b8610ba1ef4128e3">
        <dex dex="/home/deviser/Development/Android/workspace/BluetoothLeGatt/Application/build/intermediates/pre-dexed/debug/classes-264e46eb532b985c0f4425b6e3b4cea890e47195.jar" />
    </item>
    <item
        jar="/home/deviser/Development/Android/workspace/BluetoothLeGatt/Application/build/intermediates/exploded-aar/com.android.support/support-v13/21.0.2/libs/internal_impl-21.0.2.jar"
        jumboMode="false"
        revision="21.1.1"
        sha1="9346da9fb778af9e451211bbc3541daced174ba7">
        <dex dex="/home/deviser/Development/Android/workspace/BluetoothLeGatt/Application/build/intermediates/pre-dexed/debug/internal_impl-21.0.2-1989cf642b49998e7f3ca350e0e08b231bb0918b.jar" />
    </item>
    <item
        jar="/home/deviser/Development/Android/workspace/BluetoothLeGatt/Application/build/intermediates/exploded-aar/com.android.support/support-v13/21.0.2/classes.jar"
        jumboMode="false"
        revision="21.1.1"
        sha1="61965ae058916e6a57950dd61b0164dc866af19a">
        <dex dex="/home/deviser/Development/Android/workspace/BluetoothLeGatt/Application/build/intermediates/pre-dexed/debug/classes-55215f0ab4db781173db291cee7e3351f7a79504.jar" />
    </item>

</items>


text:
import * as cdk from '@aws-cdk/core';
import * as cognito from '@aws-cdk/aws-cognito';
import * as iam from '@aws-cdk/aws-iam';
import {Effect, PolicyStatement} from '@aws-cdk/aws-iam';
import * as s3 from '@aws-cdk/aws-s3';
import {Bucket, BucketAccessControl, BlockPublicAccess, BlockPublicAccessOptions} from '@aws-cdk/aws-s3';

export class  SetupStackTranscription extends cdk.Stack {
  constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const transcriptionBucket = new Bucket(this, 'transciptions', {
      removalPolicy: cdk.RemovalPolicy.DESTROY,
      publicReadAccess: true,
      accessControl: BucketAccessControl.PUBLIC_READ,

    });

    transcriptionBucket.addToResourcePolicy(new iam.PolicyStatement({
      effect: Effect.ALLOW,
      actions: ["*"],
      resources: [transcriptionBucket.arnForObjects('*')],
      principals: [new iam.AccountRootPrincipal()],
    }));
    transcriptionBucket.grantPublicAccess('*', 's3:GetObject');
    transcriptionBucket.grantPublicAccess('*', 's3:PutObject');
    transcriptionBucket.grantPublicAccess('*', 's3:DeleteObject');

    const cfnBucket = transcriptionBucket.node.findChild('Resource') as s3.CfnBucket
    cfnBucket.addPropertyOverride('CorsConfiguration', {
      CorsRules: [
        {
          "AllowedHeaders": [
            "*"
          ],
          "AllowedMethods": [
            "GET",
            "POST",
            "PUT",
            "DELETE"
          ],
          "AllowedOrigins": [
            "*"
          ],
        }
      ]
    });

    const appBucket = new s3.Bucket(this, 'appbucket',{
      removalPolicy: cdk.RemovalPolicy.DESTROY,
      websiteIndexDocument: 'index.html',
      websiteErrorDocument: 'index.html',
      blockPublicAccess:  {
        blockPublicAcls: true,
        blockPublicPolicy: false,
        ignorePublicAcls: true,
        restrictPublicBuckets: false
      }
    });
    appBucket.grantPublicAccess('*', 's3:GetObject');
    appBucket.grantPublicAccess('*', 's3:PutObject');

    const randomUserPoolName = `ExampleUserPoolName-${Math.ceil(Math.random() * 10 ** 10)}`;

    const myUserPool = new cognito.UserPool(this, 'exampleuserpoolid', {
      userPoolName: randomUserPoolName,
      selfSignUpEnabled: true,
      autoVerify: {
        email: true
      },
      userVerification: {
        emailSubject: 'Verify your email for our awesome app!',
        emailBody: 'Hello, Thanks for signing up to our awesome app! Your verification code is {####}',
        smsMessage: 'Hello, Thanks for signing up to our awesome app! Your verification code is {####}',
      },
      standardAttributes: {
        email: {
          required: true,
          mutable: false,
        }
      }
    });

    const randomUserPoolClientName = `ExampleUserPoolName-${Math.ceil(Math.random() * 10 ** 10)}`;

    const userPoolClient = new cognito.UserPoolClient(this, 'ExampleUserPoolClient', {
      userPool: myUserPool,
      userPoolClientName: randomUserPoolClientName,
      oAuth: {
        callbackUrls: [appBucket.urlForObject('index.html')]
      }
    });

    const randomDomain = `exampleuserpoolname-${Math.ceil(Math.random() * 10 ** 10)}`;

    myUserPool.addDomain('CognitoDomain', {
      cognitoDomain: {
        domainPrefix: randomDomain
      }
    });

    const myIdentityPool = new cognito.CfnIdentityPool(this, "ExampleIdentityPool", {
      allowUnauthenticatedIdentities: false,
      cognitoIdentityProviders: [{
        clientId: userPoolClient.userPoolClientId,
        providerName: myUserPool.userPoolProviderName,
      }]
    });
    const authenticatedRole = new iam.Role(this, 'ExampleCognitoDefaultAuthenticatedRole', {
      assumedBy: new iam.FederatedPrincipal('cognito-identity.amazonaws.com', {
        "StringEquals": {"cognito-identity.amazonaws.com:aud": myIdentityPool.ref},
        "ForAnyValue:StringLike": {"cognito-identity.amazonaws.com:amr": "authenticated"},
      }, "sts:AssumeRoleWithWebIdentity"),
    });
    authenticatedRole.addToPolicy(new PolicyStatement({
      effect: Effect.ALLOW,
      actions: [
        "mobileanalytics:PutEvents",
        "cognito-sync:*",
        "cognito-identity:*"
      ],
      resources: ["*"]
    }));

    authenticatedRole.addToPolicy(new PolicyStatement({
      effect: Effect.ALLOW,
      actions: ["sns:*"],
      resources: ["*"]
    }));
    authenticatedRole.addToPolicy(new PolicyStatement({
      effect: Effect.ALLOW,
      actions: ["transcribe:StartTranscriptionJob",
        "transcribe:GetTranscriptionJob"],
      resources: ["*"]
    }));
    const defaultPolicy = new cognito.CfnIdentityPoolRoleAttachment(this, 'DefaultValid', {
      identityPoolId: myIdentityPool.ref,
      roles: {
        'authenticated': authenticatedRole.roleArn
      }
    });
  }
};

const stackName = 'SetupStack'

const app = new cdk.App();

new SetupStack(app, stackName);


text:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="omron.HVC"
    android:versionCode="1"
    android:versionName="1.2" >
    <uses-sdk android:minSdkVersion="18" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

</manifest>


text:
import { Control } from './Control';

export class ColorControl extends Control {}


text:
package de.hshannover.f4.trust.visitmeta.gui.nodeinformation.panel.policy.action;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagLayout;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.TitledBorder;

import de.hshannover.f4.trust.visitmeta.graphDrawer.graphicwrapper.piccolo2d.PolicyActionGraphicWrapper;
import de.hshannover.f4.trust.visitmeta.gui.dialog.LayoutHelper;

public class DevicePanelAction extends JPanel {

	private static final long serialVersionUID = 1224028342347312989L;

	public static final String LABEL_STATUS_OLD = "OLD";

	public static final String LABEL_ACTION_COUNT = "Action-Count";

	private PolicyActionGraphicWrapper mSelectedNode;

	private JLabel mjlActionCount;

	private JLabel mjlActionCountValue;

	private JLabel mjlOldStatus;

	private TitledBorder mTtitel;

	public DevicePanelAction(PolicyActionGraphicWrapper selectedNode) {
		mSelectedNode = selectedNode;

		initPanel();
		initJLabels();

		if (!mSelectedNode.isCurrentRuleResultForDevice()) {
			mjlOldStatus.setVisible(true);
		}

		super.setMinimumSize(new Dimension(mTtitel.getMinimumSize(this).width, super.getPreferredSize().width));
	}

	private void initPanel() {
		mTtitel = BorderFactory.createTitledBorder("Device: " + mSelectedNode.getDevice());

		super.setLayout(new GridBagLayout());
		super.setBorder(mTtitel);
	}

	private void setBOLD(JLabel label) {
		label.setFont(new Font(label.getFont().getFontName(), Font.BOLD, label.getFont().getSize()));
	}

	private void initJLabels() {

		mjlActionCount = new JLabel(LABEL_ACTION_COUNT, SwingConstants.CENTER);
		mjlActionCount.setEnabled(false);
		mjlOldStatus = new JLabel(LABEL_STATUS_OLD, SwingConstants.CENTER);
		mjlOldStatus.setVisible(false);
		mjlOldStatus.setForeground(Color.RED);
		setBOLD(mjlOldStatus);

		mjlActionCountValue = new JLabel(Integer.toString(mSelectedNode.getActionTrueCountForDevice()),
				SwingConstants.CENTER);
		setBOLD(mjlActionCountValue);

		LayoutHelper.addComponent(0, 0, 1, 1, 1.0, 0.0, this, mjlActionCountValue, LayoutHelper.LABEL_INSETS);
		LayoutHelper.addComponent(0, 1, 1, 1, 1.0, 0.0, this, mjlActionCount, LayoutHelper.LABEL_INSETS);
		LayoutHelper.addComponent(0, 2, 1, 1, 0.0, 0.0, this, mjlOldStatus, LayoutHelper.LABEL_INSETS);
	}

}


text:
namespace Microsoft.Protocols.TestSuites.MS_CPSWS
{
    using System;
    using System.Globalization;
    using System.ServiceModel;
    using Microsoft.Protocols.TestSuites.Common;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    /// <summary>
    /// Scenario 2 Test cases. Test the requirements of 2 operations GetHierarchy and GetHierarchyAll.
    /// These operations are used to retrieve claim provider hierarchy trees from a list of claim providers available to the protocol client.
    /// </summary>
    [TestClass]
    public class S02_RetrieveProviderHierarchyTree : TestSuiteBase
    {
        #region Test suite initialization and cleanup
        /// <summary>
        /// Initialize the test suite.
        /// </summary>
        /// <param name="testContext">The test context instance</param>
        [ClassInitialize]
        public static void ClassInitialize(TestContext testContext)
        {
            TestSuiteBase.TestSuiteClassInitialize(testContext);
        }

        /// <summary>
        /// Reset the test environment.
        /// </summary>
        [ClassCleanup]
        public static void ClassCleanup()
        {
            // Cleanup test site, must be called to ensure closing of logs.
            TestSuiteBase.TestSuiteClassCleanup();
        }
        #endregion

        #region Test Cases
        /// <summary>
        /// A test case used to test GetHierarchy method with hierarchyNodeID parameter is set to null.
        /// </summary>
        [TestCategory("MSCPSWS"), TestMethod]
        public void MSCPSWS_S02_TC01_GetHierarchy_NullHierarchyNodeID()
        {
            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            SPPrincipalType principalType = SPPrincipalType.SharePointGroup;
            string providerName = null;

            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                // Filter the providers, hierarchy providers which name is started with "_HierarchyProvider_" are not supported by GetHierarchy method.
                if (!provider.ProviderName.StartsWith(Common.GetConfigurationPropertyValue("HierarchyProviderPrefix", this.Site)) && provider.Children.Length != 0)
                {
                    providerName = provider.ProviderName;
                    //Verify MS-CPSWS requirement: MS-CPSWS_R540001
                    Site.CaptureRequirementIfIsTrue(
                        provider.HierarchyNodeID.Length == 0,
                        540001,
                        @"[In SPProviderHierarchyElement] This value[HierarchyNodeID] is empty for the hierarchy provider and the root element of the hierarchy tree.");

                    if (providerName != null)
                    {
                        break;
                    }
                }
            }

            Site.Assume.IsNotNull(providerName, "The providerName should not be null!");

            // Call GetHierarchy method to get a claims provider hierarchy tree with a null hierarchyNodeID in the request.
            SPProviderHierarchyTree responseOfGetHierarchyResult = CPSWSAdapter.GetHierarchy(providerName, principalType, null, numberOfLevels);
            Site.Assert.AreEqual<string>("true", responseOfGetHierarchyResult.IsRoot.ToString().ToLower(CultureInfo.CurrentCulture), "Should return the existing root of current claims provider hierarchy tree.");

            // Verify MS-CPSWS requirement: MS-CPSWS_R209
            Site.CaptureRequirementIfAreEqual<string>(
                "true",
                responseOfGetHierarchyResult.IsRoot.ToString().ToLower(CultureInfo.CurrentCulture),
                209,
                @"[In GetHierarchy] hierarchyNodeID: If NULL is specified, then the protocol server MUST return the existing root of claims provider hierarchy tree.");
        }

        /// <summary>
        /// A test case used to test GetHierarchy method with a valid hierarchyNodeID parameter.
        /// </summary>
        [TestCategory("MSCPSWS"), TestMethod]
        public void MSCPSWS_S02_TC02_GetHierarchy_ValidHierarchyNodeID()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            SPPrincipalType principalType = SPPrincipalType.SharePointGroup;
            string providerName = null;
            string hierarchyNodeID = null;

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                // Filter the providers, hierarchy providers which name is started with "_HierarchyProvider_" are not supported by GetHierarchy method.
                if (provider.ProviderName != null && !provider.ProviderName.StartsWith(Common.GetConfigurationPropertyValue("HierarchyProviderPrefix", this.Site)))
                {
                    providerName = provider.ProviderName;

                    foreach (SPProviderHierarchyNode children in provider.Children)
                    {
                        if (children.HierarchyNodeID != null)
                        {
                            hierarchyNodeID = children.HierarchyNodeID;
                        }
                    }

                    if (providerName != null && hierarchyNodeID != null)
                    {
                        break;
                    }
                }
            }

            Site.Assert.IsNotNull(providerName, "No such claim provider which have a hierarchyNodeID exists in the server!");
            Site.Assert.IsNotNull(hierarchyNodeID, "No such claim provider which have a hierarchyNodeID exists in the server!");

            // Call GetHierarchy method to get a claims provider hierarchy tree with a valid child hierarchyNodeID in the request.
            SPProviderHierarchyTree responseOfGetHierarchyResult = CPSWSAdapter.GetHierarchy(providerName, principalType, hierarchyNodeID, numberOfLevels);
            Site.Assert.AreEqual<string>("false", responseOfGetHierarchyResult.IsRoot.ToString().ToLower(CultureInfo.CurrentCulture), "Should return the hierarchyNodeID specified claims provider hierarchy tree, which is not existing root of current claims provider hierarchy tree.");

            // If the claims providers listed in the provider names in the input message is retrieved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                responseOfGetHierarchyResult.IsRoot.ToString().ToLower(CultureInfo.CurrentCulture) == "false",
                194,
                @"[In GetHierarchy] The protocol server MUST retrieve a claims provider hierarchy tree from the claims provider that meets all the following criteria:
The claims provider name is specified in the input message.
The claims provider is associated with the Web application (1) specified in the input message.
The claims provider supports hierarchy.");

            // If the providerName is not null, then the protocol server retrieve a hierarchy provider hierarchy tree in the input message, then the following requirement can be captured.
            Site.CaptureRequirementIfIsNotNull(
                providerName,
                194001,
                @"[In GetHierarchy] The protocol server MUST retrieve a hierarchy provider hierarchy tree if the name of an available hierarchy provider is specified in the input message.");
        }

        /// <summary>
        /// A test case used to test GetHierarchy method with a valid numberOfLevels parameter.
        /// </summary>
        [TestCategory("MSCPSWS"), TestMethod]
        public void MSCPSWS_S02_TC03_GetHierarchy_ValidNumberOfLevels()
        {
            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            SPPrincipalType principalType = SPPrincipalType.SharePointGroup;
            string providerName = null;
            bool isGetHierarchySuccess = false;

            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                // Filter the providers, hierarchy providers which name is started with "_HierarchyProvider_" are not supported by GetHierarchy method.
                if (provider.ProviderName != null && !provider.ProviderName.StartsWith(Common.GetConfigurationPropertyValue("HierarchyProviderPrefix", this.Site)))
                {
                    providerName = provider.ProviderName;

                    // Call GetHierarchy method to get a claims provider hierarchy tree with a valid numberOfLevels parameter in the request.
                    SPProviderHierarchyTree responseOfGetHierarchyResult = CPSWSAdapter.GetHierarchy(providerName, principalType, null, numberOfLevels);
                    Site.Assert.IsNotNull(responseOfGetHierarchyResult, "If the numberOfLevels is a valid value, the protocol server MUST use the current available claims providers.");
                    isGetHierarchySuccess = true;

                    // If the claims providers listed in the provider names in the input message is retrieved successfully, then the following requirement can be captured.
                    Site.CaptureRequirementIfIsTrue(
                        isGetHierarchySuccess,
                        194,
                        @"[In GetHierarchy] The protocol server MUST retrieve a claims provider hierarchy tree from the claims provider that meets all the following criteria:
The claims provider name is specified in the input message.
The claims provider is associated with the Web application (1) specified in the input message.
The claims provider supports hierarchy.");
                }
            }
        }

        /// <summary>
        /// A test case used to test GetHierarchy method with numberOfLevels parameter is less than 1.
        /// </summary>
        [TestCategory("MSCPSWS"), TestMethod]
        public void MSCPSWS_S02_TC04_GetHierarchy_InvalidNumberOfLevels()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            SPPrincipalType principalType = SPPrincipalType.SharePointGroup;
            int numberOfLevels = 0;
            string providerName = null;

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                // Filter the providers, hierarchy providers which name is started with "_HierarchyProvider_" are not supported by GetHierarchy method.
                if (provider.ProviderName != null && !provider.ProviderName.StartsWith(Common.GetConfigurationPropertyValue("HierarchyProviderPrefix", this.Site)))
                {
                    providerName = provider.ProviderName;
                    break;
                }
            }

            bool caughtException = false;
            try
            {
                // Call GetHierarchy method with numberOfLevels parameter sets to invalid.
                CPSWSAdapter.GetHierarchy(providerName, principalType, null, numberOfLevels);
            }
            catch (FaultException faultException)
            {
                caughtException = true;

                // If the server returns an ArgumentNullException<""numberOfLevels""> message, then the following requirement can be captured.
                Site.CaptureRequirementIfIsTrue(
                    this.VerifyArgumentOutOfRangeException(faultException, "numberOfLevels"),
                    583,
                    @"[In GetHierarchy] The protocol server MUST return ArgumentOutOfRangeException<""numberOfLevels""> message if the value of this element [numberOfLevels] is less than 1.");
            }
            finally
            {
                this.Site.Assert.IsTrue(caughtException, "The protocol server should return ArgumentOutOfRangeException<numberOfLevels> message if the value of this element [numberOfLevels] is less than 1.");
            }
        }

        /// <summary>
        /// A test case used to test GetHierarchyAll method with providerNames parameter is set to null.
        /// </summary>
        [TestCategory("MSCPSWS"), TestMethod]
        public void MSCPSWS_S02_TC05_GetHierarchyAll_NullProviderNames()
        {
            SPPrincipalType principalType = SPPrincipalType.User;

            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            // Call GetHierarchyAll method to get a list of claims provider hierarchy trees with a null providerNames in the request.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = CPSWSAdapter.GetHierarchyAll(null, principalType, numberOfLevels);
            Site.Assert.IsNotNull(responseOfGetHierarchyAllResult, "If the providerNames is NULL, the protocol server MUST use all the available claims providers.");
        }

        /// <summary>
        /// A test case used to test GetHierarchyAll method with providerNames parameter is set to all of valid provider name.
        /// </summary>
        [TestCategory("MSCPSWS"), TestMethod]
        public void MSCPSWS_S02_TC06_GetHierarchyAll_AllOfProviderNames()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] getAllProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.User;

            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            foreach (SPProviderHierarchyTree provider in getAllProviders)
            {
                providerNames.Add(provider.ProviderName);
            }

            // Call GetHierarchyAll method to get a list of claims provider hierarchy trees with all of valid providerNames in the request.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = CPSWSAdapter.GetHierarchyAll(providerNames, principalType, numberOfLevels);
            Site.Assert.IsNotNull(responseOfGetHierarchyAllResult, "If the providerNames is all of valid providerNames, the protocol server MUST use all the available claims providers.");

            // If the claims providers listed in the provider names in the input message is retrieved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                responseOfGetHierarchyAllResult.Length == providerNames.Count,
                219,
                @"[In GetHierarchyAll] The protocol server MUST retrieve claims provider hierarchy trees from claims providers that meet all the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support hierarchy.");

            Site.CaptureRequirementIfIsTrue(
                responseOfGetHierarchyAllResult.Length == providerNames.Count,
                239,
                @"[In GetHierarchyAllResponse]The protocol server MUST return one claims provider hierarchy tree for each claims provider that match the criteria specified in the input message.");

            bool isHierarchyProviderHierarchyTree = false;

            foreach (SPProviderHierarchyTree providerHierarchyTree in responseOfGetHierarchyAllResult)
            {
                if (providerHierarchyTree.ProviderName.Contains("_HierarchyProvider_"))
                {
                    isHierarchyProviderHierarchyTree = true;
                    break;
                }
            }

            Site.CaptureRequirementIfIsTrue(
               isHierarchyProviderHierarchyTree,
               584,
               @"[In GetHierarchyAll] The protocol server MUST also retrieve hierarchy provider hierarchy tree if one is available.");
        }

        /// <summary>
        /// A test case used to test GetHierarchyAll method with valid input parameters.
        /// </summary>
        [TestCategory("MSCPSWS"), TestMethod]
        public void MSCPSWS_S02_TC07_GetHierarchyAll_ValidInputParameters()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] getAllProviders = TestSuiteBase.GetAllProviders();

            SPPrincipalType principalType = SPPrincipalType.User;

            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            foreach (SPProviderHierarchyTree provider in getAllProviders)
            {
                ArrayOfString providerNames = new ArrayOfString();
                providerNames.Add(provider.ProviderName);

                // Call GetHierarchyAll method to get a list of claims provider hierarchy trees with a valid providerNames in the request.
                SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = CPSWSAdapter.GetHierarchyAll(providerNames, principalType, numberOfLevels);
                Site.Assert.IsNotNull(responseOfGetHierarchyAllResult, "If the provider names are valid, the protocol server will return the hierarchy trees that match the claims providers.");
            }
        }

        /// <summary>
        /// A test case used to test GetHierarchyAll method with valid value of numberOfLevels.
        /// </summary>
        [TestCategory("MSCPSWS"), TestMethod]
        public void MSCPSWS_S02_TC08_GetHierarchyAll_ValidNumberOfLevels()
        {
            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            SPPrincipalType principalType = SPPrincipalType.SharePointGroup;
            bool isGetHierarchyAllSuccess = false;

            // Call GetHierarchy method to get a claims provider hierarchy tree with a valid numberOfLevels parameter in the request.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = CPSWSAdapter.GetHierarchyAll(null, principalType, numberOfLevels);
            Site.Assert.IsNotNull(responseOfGetHierarchyAllResult, "If the numberOfLevels is a valid value, the protocol server MUST use the current available claims providers.");
            isGetHierarchyAllSuccess = true;

            // If the claims providers listed in the provider names in the input message is retrieved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                isGetHierarchyAllSuccess,
                219,
                @"[In GetHierarchyAll] The protocol server MUST retrieve claims provider hierarchy trees from claims providers that meet all the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support hierarchy.");
        }

        /// <summary>
        /// A test case used to test GetHierarchyAll method with numberOfLevels parameter is less than 1.
        /// </summary>
        [TestCategory("MSCPSWS"), TestMethod]
        public void MSCPSWS_S02_TC09_GetHierarchyAll_InvalidNumberOfLevels()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] getAllProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.SharePointGroup;
            int numberOfLevels = 0;

            foreach (SPProviderHierarchyTree provider in getAllProviders)
            {
                providerNames.Add(provider.ProviderName);
            }

            bool caughtException = false;
            try
            {
                // Call GetHierarchyAll method with numberOfLevels parameter sets to invalid.
                CPSWSAdapter.GetHierarchyAll(providerNames, principalType, numberOfLevels);
            }
            catch (FaultException faultException)
            {
                caughtException = true;

                // If the server returns an ArgumentNullException<""numberOfLevels""> message, then the following requirement can be captured.
                Site.CaptureRequirementIfIsTrue(
                    this.VerifyArgumentOutOfRangeException(faultException, "numberOfLevels"),
                    591,
                    @"[In GetHierarchyAll] The protocol server MUST return an ArgumentOutOfRangeException<""numberOfLevels""> message if the value of this element [numberOfLevels] is less than 1.");
            }
            finally
            {
                this.Site.Assert.IsTrue(caughtException, "The protocol server should return ArgumentOutOfRangeException<numberOfLevels> message if the value of this element [numberOfLevels] is less than 1.");
            }
        }
        #endregion
    }
}


text:
package com.snowplowanalytics
package snowplow
package enrich
package stream

import java.io.File
import java.net.URI

import scala.io.Source
import scala.util.Try
import scala.sys.process._
import com.typesafe.config.ConfigFactory
import org.json4s.jackson.JsonMethods._
import org.json4s.JsonDSL._
import org.slf4j.LoggerFactory
import pureconfig._
import scalaz.{Sink => _, Source => _, _}
import Scalaz._

import common.adapters.AdapterRegistry
import common.adapters.registry.RemoteAdapter
import common.enrichments.EnrichmentRegistry
import common.utils.JsonUtils
import config._
import iglu.client.Resolver
import model._
import scalatracker.Tracker

/** Interface for the entry point for Stream Enrich. */
trait Enrich {

  lazy val log = LoggerFactory.getLogger(getClass())

  val FilepathRegex    = "^file:(.+)$".r
  private val regexMsg = "'file:[filename]'"

  implicit val creds: Credentials = NoCredentials

  def run(args: Array[String]): Unit = {
    val trackerSource = for {
      config <- parseConfig(args).validation
      (enrichConfig, resolverArg, enrichmentsArg, forceDownload) = config
      resolver           <- parseResolver(resolverArg)
      enrichmentRegistry <- parseEnrichmentRegistry(enrichmentsArg)(resolver, implicitly)
      _                  <- cacheFiles(enrichmentRegistry, forceDownload)
      adapterRegistry     = new AdapterRegistry(prepareRemoteAdapters(enrichConfig.remoteAdapters))
      tracker = enrichConfig.monitoring.map(c => SnowplowTracking.initializeTracker(c.snowplow))
      source <- getSource(enrichConfig.streams, resolver, adapterRegistry, enrichmentRegistry, tracker)
    } yield (tracker, source)

    trackerSource match {
      case Failure(e) =>
        System.err.println(s"An error occured: $e")
        System.exit(1)
      case Success((tracker, source)) =>
        tracker.foreach(SnowplowTracking.initializeSnowplowTracking)
        source.run()
    }
  }

  /**
   * Source of events
   * @param streamsConfig configuration for the streams
   * @param resolver iglu resolver
   * @param enrichmentRegistry registry of enrichments
   * @param tracker optional tracker
   * @return a validated source, ready to be read from
   */
  def getSource(
    streamsConfig: StreamsConfig,
    resolver: Resolver,
    adapterRegistry: AdapterRegistry,
    enrichmentRegistry: EnrichmentRegistry,
    tracker: Option[Tracker]
  ): Validation[String, sources.Source]

  /**
   * Parses the configuration from cli arguments
   * @param args cli arguments
   * @return a validated tuple containing the parsed enrich configuration, the resolver argument,
   * the optional enrichments argument and the force download flag
   */
  def parseConfig(
    args: Array[String]): \/[String, (EnrichConfig, String, Option[String], Boolean)] = {
    implicit def hint[T]              = ProductHint[T](ConfigFieldMapping(CamelCase, CamelCase))
    implicit val sourceSinkConfigHint = new FieldCoproductHint[SourceSinkConfig]("enabled")
    for {
      parsedCliArgs <- \/.fromEither(
        parser.parse(args, FileConfig()).toRight("Error while parsing command line arguments"))
      unparsedConfig = utils.fold(Try(ConfigFactory.parseFile(parsedCliArgs.config).resolve()))(
        t => t.getMessage.left,
        c =>
          (c, parsedCliArgs.resolver, parsedCliArgs.enrichmentsDir, parsedCliArgs.forceDownload).right
      )
      validatedConfig <- utils.filterOrElse(unparsedConfig)(
        t => t._1.hasPath("enrich"),
        "No top-level \"enrich\" could be found in the configuration")
      (config, resolverArg, enrichmentsArg, forceDownload) = validatedConfig
      parsedConfig <- utils
        .toEither(Try(loadConfigOrThrow[EnrichConfig](config.getConfig("enrich"))))
        .map(ec => (ec, resolverArg, enrichmentsArg, forceDownload))
        .leftMap(_.getMessage)
    } yield parsedConfig
  }

  /** Cli arguments parser */
  def parser: scopt.OptionParser[FileConfig]
  val localParser =
    new scopt.OptionParser[FileConfig](generated.BuildInfo.name) with FileConfigOptions {
      head(generated.BuildInfo.name, generated.BuildInfo.version)
      help("help")
      version("version")
      configOption()
      localResolverOption()
      localEnrichmentsOption()
      forceCachedFilesDownloadOption()
    }

  /**
   * Retrieve and parse an iglu resolver from the corresponding cli argument value
   * @param resolverArg location of the resolver as a cli argument
a  * @param creds optionally necessary credentials to download the resolver
   * @return a validated iglu resolver
   */
  def parseResolver(resolverArg: String)(
    implicit creds: Credentials): Validation[String, Resolver] =
    for {
      parsedResolver <- extractResolver(resolverArg)
      json           <- JsonUtils.extractJson("", parsedResolver)
      resolver       <- Resolver.parse(json).leftMap(_.toString)
    } yield resolver

  /**
   * Return a JSON string based on the resolver argument
   * @param resolverArg location of the resolver
   * @param creds optionally necessary credentials to download the resolver
   * @return JSON from a local file or stored in DynamoDB
   */
  def extractResolver(resolverArg: String)(implicit creds: Credentials): Validation[String, String]
  val localResolverExtractor = (resolverArgument: String) =>
    resolverArgument match {
      case FilepathRegex(filepath) =>
        val file = new File(filepath)
        if (file.exists) Source.fromFile(file).mkString.success
        else "Iglu resolver configuration file \"%s\" does not exist".format(filepath).failure
      case _ => s"Resolver argument [$resolverArgument] must match $regexMsg".failure
  }

  /**
   * Retrieve and parse an enrichment registry from the corresponding cli argument value
   * @param enrichmentsDirArg location of the enrichments directory as a cli argument
   * @param resolver iglu resolver
   * @param creds optionally necessary credentials to download the enrichments
   * @return a validated enrichment registry
   */
  def parseEnrichmentRegistry(enrichmentsDirArg: Option[String])(
    implicit resolver: Resolver,
    creds: Credentials): Validation[String, EnrichmentRegistry] =
    for {
      enrichmentConfig <- extractEnrichmentConfigs(enrichmentsDirArg)
      registryConfig   <- JsonUtils.extractJson("", enrichmentConfig)
      reg              <- EnrichmentRegistry.parse(fromJsonNode(registryConfig), false).leftMap(_.toString)
    } yield reg

  /**
   * Return an enrichment configuration JSON based on the enrichments argument
   * @param enrichmentArgument location of the enrichments directory
   * @param creds optionally necessary credentials to download the enrichments
   * @return JSON containing configuration for all enrichments
   */
  def extractEnrichmentConfigs(enrichmentArgument: Option[String])(
    implicit creds: Credentials): Validation[String, String]
  val localEnrichmentConfigsExtractor = (enrichmentArgument: Option[String]) => {
    val jsons: Validation[String, List[String]] = enrichmentArgument
      .map {
        case FilepathRegex(path) =>
          new File(path).listFiles
            .filter(_.getName.endsWith(".json"))
            .map(scala.io.Source.fromFile(_).mkString)
            .toList
            .success
        case other => s"Enrichments argument [$other] must match $regexMsg".failure
      }
      .getOrElse(Nil.success)

    jsons.map { js =>
      val combinedJson =
        ("schema" -> "iglu:com.snowplowanalytics.snowplow/enrichments/jsonschema/1-0-0") ~
          ("data" -> js.toList.map(parse(_)))
      compact(combinedJson)
    }
  }

  /**
   * Download a file locally
   * @param uri of the file to be downloaded
   * @param targetFile local file to download to
   * @param creds optionally necessary credentials to download the file
   * @return the return code of the downloading command
   */
  def download(uri: URI, targetFile: File)(implicit creds: Credentials): Validation[String, Int]
  val httpDownloader = (uri: URI, targetFile: File) =>
    uri.getScheme match {
      case "http" | "https" => (uri.toURL #> targetFile).!.success
      case s                => s"Scheme $s for file $uri not supported".failure
  }

  /**
   * Download the IP lookup files locally.
   * @param registry Enrichment registry
   * @param forceDownload CLI flag that invalidates the cached files on each startup
   * @param creds optionally necessary credentials to cache the files
   * @return a list of download command return codes
   */
  def cacheFiles(
    registry: EnrichmentRegistry,
    forceDownload: Boolean
  )(implicit creds: Credentials): ValidationNel[String, List[Int]] =
    registry.filesToCache
      .map { case (uri, path) =>
        (new java.net.URI(uri.toString.replaceAll("(?<!(http:|https:|s3:))//", "/")),
          new File(path))
      }
      .filter { case (_, targetFile) => forceDownload || targetFile.length == 0L }
      .map {
        case (cleanURI, targetFile) =>
          download(cleanURI, targetFile).flatMap {
            case i if i != 0 => s"Attempt to download $cleanURI to $targetFile failed".failure
            case o           => o.success
          }.toValidationNel
      }
      .sequenceU

  /**
    *  Sets up the Remote adapters for the ETL
    * @param remoteAdaptersConfig List of configuration per remote adapter
    * @return Mapping of vender-version and the adapter assigned for it
    */
  def prepareRemoteAdapters(remoteAdaptersConfig: Option[List[RemoteAdapterConfig]]) = {
    remoteAdaptersConfig match {
      case Some(configList) => configList.map { config =>
        val adapter = new RemoteAdapter(
          config.url,
          config.connectionTimeout,
          config.readTimeout
        )
        (config.vendor, config.version) -> adapter
      }.toMap
      case None => Map.empty[(String, String), RemoteAdapter]
    }
  }
}


text:
#ifndef NET_GRPC_PHP_GRPC_SERVER_CREDENTIALS_H_
#define NET_GRPC_PHP_GRPC_SERVER_CREDENTIALS_H_

#include "php_grpc.h"

#include <grpc/grpc_security.h>

/* Class entry for the Server_Credentials PHP class */
extern zend_class_entry *grpc_ce_server_credentials;

/* Wrapper struct for grpc_server_credentials that can be associated with a PHP
 * object */
PHP_GRPC_WRAP_OBJECT_START(wrapped_grpc_server_credentials)
  grpc_server_credentials *wrapped;
PHP_GRPC_WRAP_OBJECT_END(wrapped_grpc_server_credentials)

static inline wrapped_grpc_server_credentials
*wrapped_grpc_server_credentials_from_obj(zend_object *obj) {
  return (wrapped_grpc_server_credentials*)(
      (char*)(obj) - XtOffsetOf(wrapped_grpc_server_credentials, std));
}

/* Initializes the Server_Credentials PHP class */
void grpc_init_server_credentials(TSRMLS_D);

#endif /* NET_GRPC_PHP_GRPC_SERVER_CREDENTIALS_H_ */


text:
'use strict';

describe('Controller: ConversationsCtrl', function () {

  // load the controller's module
  beforeEach(module('pulsarClientApp'));

  var ConversationsCtrl,
    scope;

  // Initialize the controller and a mock scope
  beforeEach(inject(function ($controller, $rootScope) {
    scope = $rootScope.$new();
    ConversationsCtrl = $controller('ConversationsCtrl', {
      $scope: scope
    });
  }));

//   it('should attach a list of awesomeThings to the scope', function () {
//     expect(scope.awesomeThings.length).toBe(3);
//   });
});


text:
PREFIX=$(awk '{for(i=1;i<=NF;i++) if ($i=="prefix:") print $(i+1)}' options.yaml)
ZONE=$(awk '{for(i=1;i<=NF;i++) if ($i=="zone:") print $(i+1)}' options.yaml)
PROJECT_ID=$(gcloud config list project | awk 'FNR ==2 { print $3 }')

echo "Resizing Swarm Deplyoment"

gcloud compute instance-groups managed resize $PREFIX-igm --size $1 --zone $ZONE

echo "Cluster Resized - please wait a minute for new nodes to register or delete"


text:
from django.apps import AppConfig

class WebviewConfig(AppConfig):
    name = 'webview'


text:
/**
 * Created by David on 12/11/2016.
 */
public class Main {

    public static void main(String args[]) {
        Window w = new Window();
    }
}


text:
__author__ = "Laurent Faucheux <faucheux@centre-cired.fr>"
__all__    = ['cache']

class cache(object):

        def __init__(self,*args,**kwargs):
                """ Homemade cache class which aims at being inherited """
                self._cache = {}

	@classmethod
	def _property(cls,meth):
		@property
		def __property(cls,*args,**kwargs):
			meth_name = meth.__name__
			if meth_name not in cls._cache:
				cls._cache[meth_name] = meth(cls,*args,**kwargs)
			return cls._cache[meth_name]
		return __property


text:
tags: programming
layout: post
title: "Results of demo, ugly reporting hack"
---

I love Perl:
check out
some cool
stuff people are doing. The fact that Perl can be a glue
for so many different things is (IMO) amazing.

Today was the demo that's been sucking up 12+ hour days
for the last couple of weeks. Things went great -- we didn't
have everything done, but everything that was there worked
like it was supposed to. My boss and I created a nice (but
ugly) hack: call a servlet with the right parameters; the
parameters are passed to a command-line Win32 app which
feeds them to a Crystal Reports engine and a report template
which prints out the report to the default printer which has
to be setup beforehand to pipe the output to ghostscript
which saves the data to a file which is then sent directly
to the browser.

U-G-L-Y you ain't got no alibi!

All of this could have been avoided if Crystal's engine
wasn't so retarded. Closed-source sucks.

Anyway, we're using a number of open-source technologies
(the previously mentioned JBoss, XMLC, and Tomcat) and the
management (surprisingly) seemed very cool with this.
Particularly when we told them that, in theory, the beans
could be ported to a mega-expensive proprietary platform
(read: Weblogic) if the client really wants.

So now we just see what happens and how much we'll start
moving to Java + middleware from VB + client-server. I
suspect that we can develop quickly enough (particularly
with two or three more smart people) that the higher-ups
would be astonished how much functionality we can replicate
from the existing system within, say, six months.

Reading note: been going over Refactoring
by Martin Fowler (et al). What a great book.

More soon on OpenInteract stuff, too. Things are hitting
on all cylinders programming-wise right now. Nice
feeling.

(Originally posted elsewhere)


text:
<?php

/**
 * @file
 * Definition of Drupal\views\Tests\Plugin\CacheTest.
 */

namespace Drupal\views\Tests\Plugin;

use Drupal\views\ViewExecutable;

/**
 * Basic test for pluggable caching.
 *
 * @see views_plugin_cache
 */
class CacheTest extends PluginTestBase {

  /**
   * Views used by this test.
   *
   * @var array
   */
  public static $testViews = array('test_view', 'test_cache');

  public static function getInfo() {
    return array(
      'name' => 'Cache',
      'description' => 'Tests pluggable caching for views.',
      'group' => 'Views Plugins'
    );
  }

  protected function setUp() {
    parent::setUp();

    $this->enableViewsTestModule();
  }

  /**
   * Tests time based caching.
   *
   * @see views_plugin_cache_time
   */
  function testTimeCaching() {
    // Create a basic result which just 2 results.
    $view = views_get_view('test_cache');
    $view->setDisplay();
    $view->display_handler->overrideOption('cache', array(
      'type' => 'time',
      'options' => array(
        'results_lifespan' => '3600',
        'output_lifespan' => '3600'
      )
    ));

    $this->executeView($view);
    // Verify the result.
    $this->assertEqual(5, count($view->result), 'The number of returned rows match.');

    // Add another man to the beatles.
    $record = array(
      'name' => 'Rod Davis',
      'age' => 29,
      'job' => 'Banjo',
    );
    drupal_write_record('views_test_data', $record);

    // The Result should be the same as before, because of the caching.
    $view = views_get_view('test_cache');
    $view->setDisplay();
    $view->display_handler->overrideOption('cache', array(
      'type' => 'time',
      'options' => array(
        'results_lifespan' => '3600',
        'output_lifespan' => '3600'
      )
    ));

    $this->executeView($view);
    // Verify the result.
    $this->assertEqual(5, count($view->result), 'The number of returned rows match.');
  }

  /**
   * Tests no caching.
   *
   * @see views_plugin_cache_time
   */
  function testNoneCaching() {
    // Create a basic result which just 2 results.
    $view = views_get_view('test_cache');
    $view->setDisplay();
    $view->display_handler->overrideOption('cache', array(
      'type' => 'none',
      'options' => array()
    ));

    $this->executeView($view);
    // Verify the result.
    $this->assertEqual(5, count($view->result), 'The number of returned rows match.');

    // Add another man to the beatles.
    $record = array(
      'name' => 'Rod Davis',
      'age' => 29,
      'job' => 'Banjo',
    );

    drupal_write_record('views_test_data', $record);

    // The Result changes, because the view is not cached.
    $view = views_get_view('test_cache');
    $view->setDisplay();
    $view->display_handler->overrideOption('cache', array(
      'type' => 'none',
      'options' => array()
    ));

    $this->executeView($view);
    // Verify the result.
    $this->assertEqual(6, count($view->result), 'The number of returned rows match.');
  }

  /**
   * Tests css/js storage and restoring mechanism.
   */
  function testHeaderStorage() {
    // Create a view with output caching enabled.
    // Some hook_views_pre_render in views_test_data.module adds the test css/js file.
    // so they should be added to the css/js storage.
    $view = views_get_view('test_view');
    $view->setDisplay();
    $view->storage->set('id', 'test_cache_header_storage');
    $view->display_handler->overrideOption('cache', array(
      'type' => 'time',
      'options' => array(
        'output_lifespan' => '3600'
      )
    ));

    $output = $view->preview();
    drupal_render($output);
    unset($view->pre_render_called);
    drupal_static_reset('drupal_add_css');
    drupal_static_reset('drupal_add_js');
    $view->destroy();

    $view->setDisplay();
    $output = $view->preview();
    drupal_render($output);
    $css = drupal_add_css();
    $css_path = drupal_get_path('module', 'views_test_data') . '/views_cache.test.css';
    $js_path = drupal_get_path('module', 'views_test_data') . '/views_cache.test.js';
    $js = drupal_add_js();

    $this->assertTrue(isset($css[basename($css_path)]), 'Make sure the css is added for cached views.');
    $this->assertTrue(isset($js[$js_path]), 'Make sure the js is added for cached views.');
    $this->assertFalse(!empty($view->build_info['pre_render_called']), 'Make sure hook_views_pre_render is not called for the cached view.');

    // Now add some css/jss before running the view.
    // Make sure that this css is not added when running the cached view.
    $view->storage->set('id', 'test_cache_header_storage_2');

    $system_css_path = drupal_get_path('module', 'system') . '/css/system.maintenance.css';
    drupal_add_css($system_css_path);
    $system_js_path = drupal_get_path('module', 'system') . '/system.cron.js';
    drupal_add_js($system_js_path);
    $view->destroy();

    $output = $view->preview();
    drupal_render($output);
    drupal_static_reset('drupal_add_css');
    drupal_static_reset('drupal_add_js');
    $view->destroy();

    $output = $view->preview();
    drupal_render($output);

    $css = drupal_add_css();
    $js = drupal_add_js();

    $this->assertFalse(isset($css[basename($system_css_path)]), 'Make sure that unrelated css is not added.');
    $this->assertFalse(isset($js[$system_js_path]), 'Make sure that unrelated js is not added.');
  }

}


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

// IMPLEMENTATION STATUS: STABLE (you can assume the interface will not change,
// or will change but keep backward compatibility).

namespace AchaMachines
{
	// Same principle as FrozenMatrix, but with dimension = 1 instead of 2.
	// See FrozenMatrix for documentation.
	public class FrozenVector<T>
	{
		private T[] vector;

		public T this[int i] {
			get {
				return vector[i];
			}
		}

		public int Length {
			get {
				return vector.Length;
			}
		}

		public FrozenVector(T[] sourceVector)
		{
			vector = (T[]) sourceVector.Clone();
		}
	}
}


text:
WINRT_EXPORT namespace winrt {

namespace ABI::Windows::Foundation {

#ifndef WINRT_GENERIC_f874197a_bf19_5482_9ab1_34923de6738d
#define WINRT_GENERIC_f874197a_bf19_5482_9ab1_34923de6738d
template <> struct __declspec(uuid("f874197a-bf19-5482-9ab1-34923de6738d")) __declspec(novtable) TypedEventHandler<Windows::IInspectable, Windows::ApplicationModel::ExtendedExecution::Foreground::ExtendedExecutionForegroundRevokedEventArgs> : impl_TypedEventHandler<Windows::IInspectable, Windows::ApplicationModel::ExtendedExecution::Foreground::ExtendedExecutionForegroundRevokedEventArgs> {};
#endif

#ifndef WINRT_GENERIC_b18ea00f_8c20_5ac2_9246_3ef405271f1a
#define WINRT_GENERIC_b18ea00f_8c20_5ac2_9246_3ef405271f1a
template <> struct __declspec(uuid("b18ea00f-8c20-5ac2-9246-3ef405271f1a")) __declspec(novtable) IAsyncOperation<winrt::Windows::ApplicationModel::ExtendedExecution::Foreground::ExtendedExecutionForegroundResult> : impl_IAsyncOperation<winrt::Windows::ApplicationModel::ExtendedExecution::Foreground::ExtendedExecutionForegroundResult> {};
#endif

#ifndef WINRT_GENERIC_07e1dc01_18ba_596a_b745_79f9cde44ccc
#define WINRT_GENERIC_07e1dc01_18ba_596a_b745_79f9cde44ccc
template <> struct __declspec(uuid("07e1dc01-18ba-596a-b745-79f9cde44ccc")) __declspec(novtable) AsyncOperationCompletedHandler<winrt::Windows::ApplicationModel::ExtendedExecution::Foreground::ExtendedExecutionForegroundResult> : impl_AsyncOperationCompletedHandler<winrt::Windows::ApplicationModel::ExtendedExecution::Foreground::ExtendedExecutionForegroundResult> {};
#endif

}

namespace Windows::ApplicationModel::ExtendedExecution::Foreground {

template <typename D>
struct WINRT_EBO impl_IExtendedExecutionForegroundRevokedEventArgs
{
    Windows::ApplicationModel::ExtendedExecution::Foreground::ExtendedExecutionForegroundRevokedReason Reason() const;
};

template <typename D>
struct WINRT_EBO impl_IExtendedExecutionForegroundSession
{
    hstring Description() const;
    void Description(hstring_ref value) const;
    event_token Revoked(const Windows::Foundation::TypedEventHandler<Windows::IInspectable, Windows::ApplicationModel::ExtendedExecution::Foreground::ExtendedExecutionForegroundRevokedEventArgs> & handler) const;
    using Revoked_revoker = event_revoker<IExtendedExecutionForegroundSession>;
    Revoked_revoker Revoked(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::IInspectable, Windows::ApplicationModel::ExtendedExecution::Foreground::ExtendedExecutionForegroundRevokedEventArgs> & handler) const;
    void Revoked(event_token token) const;
    Windows::Foundation::IAsyncOperation<winrt::Windows::ApplicationModel::ExtendedExecution::Foreground::ExtendedExecutionForegroundResult> RequestExtensionAsync() const;
    Windows::ApplicationModel::ExtendedExecution::Foreground::ExtendedExecutionForegroundReason Reason() const;
    void Reason(Windows::ApplicationModel::ExtendedExecution::Foreground::ExtendedExecutionForegroundReason value) const;
};

struct IExtendedExecutionForegroundRevokedEventArgs :
    Windows::IInspectable,
    impl::consume<IExtendedExecutionForegroundRevokedEventArgs>
{
    IExtendedExecutionForegroundRevokedEventArgs(std::nullptr_t = nullptr) noexcept {}
    auto operator->() const noexcept { return ptr<IExtendedExecutionForegroundRevokedEventArgs>(m_ptr); }
};

struct IExtendedExecutionForegroundSession :
    Windows::IInspectable,
    impl::consume<IExtendedExecutionForegroundSession>,
    impl::require<IExtendedExecutionForegroundSession, Windows::Foundation::IClosable>
{
    IExtendedExecutionForegroundSession(std::nullptr_t = nullptr) noexcept {}
    auto operator->() const noexcept { return ptr<IExtendedExecutionForegroundSession>(m_ptr); }
};

}

}


text:
package com.vincent.template.rx;

import androidx.annotation.NonNull;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

import io.reactivex.Flowable;
import io.reactivex.processors.FlowableProcessor;
import io.reactivex.processors.PublishProcessor;

/**
 * projectName: 	    Template
 * packageName:	        com.vincent.template.rx
 * className:	        RxBus
 * author:	            Luoxiang
 * time:	            2017/7/18	9:00
 * desc:	            升级RXBUG
 *
 * svnVersion:	        $Rev
 * upDateAuthor:	    Vincent
 * upDate:	            2017/7/18
 * upDateDesc:	        TODO
 */
public class RxBus {
    private static RxBus mInstance;

    @SuppressWarnings("rawtypes")
    private ConcurrentHashMap<Object, List<FlowableProcessor>> mProcessorMapper = new ConcurrentHashMap<Object, List<FlowableProcessor>>();

    private RxBus() {}

    public static RxBus getInstance() {
        if (mInstance == null) {
            synchronized (RxBus.class) {
                if (mInstance == null) {
                    mInstance = new RxBus();
                }
            }
        }
        return mInstance;
    }

    public <T> Flowable<T> register(@NonNull Object tag) {
        List<FlowableProcessor> processors = mProcessorMapper.get(tag);
        if (null == processors) {
            processors = new ArrayList<FlowableProcessor>();
            mProcessorMapper.put(tag, processors);
        }
        FlowableProcessor<T> processor;
        processors.add(processor = PublishProcessor.create());
        return processor;
    }

    @SuppressWarnings("rawtypes")
    public void unregister(@NonNull Object tag) {
        List<FlowableProcessor> processors = mProcessorMapper.get(tag);
        if (null != processors) {
            mProcessorMapper.remove(tag);
        }
    }

    /**
     * 取消监听
     * @param tag
     * @param flowable
     * @return
     */
    @SuppressWarnings("rawtypes")
    public RxBus unregister(@NonNull Object tag,
                            @NonNull Flowable<?> flowable) {
        if (null == flowable)
            return getInstance();
        List<FlowableProcessor> processors = mProcessorMapper.get(tag);
        if (null != processors) {
            processors.remove((FlowableProcessor<?>) flowable);
            if (isEmpty(processors)) {
                mProcessorMapper.remove(tag);
            }
        }
        return getInstance();
    }

    public void post(@NonNull Object content) {
        post(content.getClass().getName(), content);
    }

    /**
     * 触发事件
     *
     * @param content
     */
    @SuppressWarnings({"unchecked", "rawtypes"})
    public void post(@NonNull Object tag, @NonNull Object content) {
        List<FlowableProcessor> processors = mProcessorMapper.get(tag);
        if (!isEmpty(processors)) {
            for (FlowableProcessor processor : processors) {
                processor.onNext(content);
            }
        }
    }

    @SuppressWarnings("rawtypes")
    public static boolean isEmpty(Collection<FlowableProcessor> collection) {
        return null == collection || collection.isEmpty();
    }
}


text:
__author__ = 'jmoffitt'

import requests
import threading #needed for any streaming HTTP connection
import json

#TODO: header details (differences in GET/POST/DELETE/STREAM)

'''
   A generic class for POSTing requests to Gnip APIs.
   These include adding/deleting Rules, submitting Historical jobs, etc.
'''
class ptHTTP():
    def __init__(self, url = None, auth = None, headers = None):
        if url is not None:
            self.url = url
        if auth is not None:
            self.auth = auth
        if headers is not None:
            self.headers = headers
        else:
            self.headers = {'content-type': 'application/json'}  #Reasonable default for PowerTrack?

    def setAuth(self, auth):
        self.auth = auth

    def setData(self, data):
        self.data = data

    def setURL(self, url):
        self.url = url

    def addHeader(self, header):
        #Grab header string and split with ":"
        headerParts = header.split(":")
        #self.headers is a dictionary, so now add this new header to dictionary
        self.headers[headerParts[0]]  = headerParts[1]

    def POST(self, data = None):
        if data is not None:
            self.data = data
        response = requests.post(self.url, auth=self.auth, data=self.data, headers=self.headers)
        return response

    def GET(self):
        response = requests.get(self.url, auth=self.auth, headers=self.headers)
        return response

    def DELETE(self, data = None):
        if data is not None:
            self.data = data
        response = requests.delete(self.url, auth=self.auth, data = self.data, headers=self.headers)
        return response

'''
   These Stream and Worker class were based on 'gnippy' classes provided at:
   gnippy - GNIP for Python

   Available here:
   http://pypi.python.org/pypi/gnippy/0.1.2

__title__ = 'gnippy'
__version__ = '0.1.2'
__author__ = 'Abhinav Ajgaonkar'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2012 Abhinav Ajgaonkar'
'''
class ptStream():
    """
         ptStream allows you to connect to the GNIP
         power track stream and fetch data
     """
    def __init__(self, url, auth, callback):
        self.url = url
        self.auth = auth
        self.callback = callback

    def connect(self):
        self.worker = ptWorker(self.url, self.auth, self.callback)
        self.worker.setDaemon(True)
        self.worker.start()

    def disconnect(self):
        self.worker.stop()
        self.worker.join()

class ptWorker(threading.Thread):
    """ Background worker to fetch data without blocking """
    def __init__(self, url, auth, callback):
        super(ptWorker, self).__init__()
        self.url = url
        self.auth = auth
        self.on_data = callback
        self._stop = threading.Event()

    def stop(self):
        self._stop.set()

    def stopped(self):
        return self._stop.isSet()

    def run(self):
        r = requests.get(self.url, auth=self.auth, prefetch=False)
        for line in r.iter_lines():
            if self.stopped():
                break
            elif line:
                self.on_data(line)


text:
package com.google.android.exoplayer.extractor;

import com.google.android.exoplayer.MediaFormat;
import com.google.android.exoplayer.SampleHolder;
import com.google.android.exoplayer.util.ParsableByteArray;

import java.io.IOException;

/**
 * Receives track level data extracted by an {@link Extractor}.
 */
public interface TrackOutput {

  /**
   * Invoked when the {@link MediaFormat} of the track has been extracted from the stream.
   *
   * @param format The extracted {@link MediaFormat}.
   */
  void format(MediaFormat format);

  /**
   * Invoked to write sample data to the output.
   *
   * @param input An {@link ExtractorInput} from which to read the sample data.
   * @param length The maximum length to read from the input.
   * @return The number of bytes appended.
   * @throws IOException If an error occurred reading from the input.
   * @throws InterruptedException If the thread was interrupted.
   */
  int sampleData(ExtractorInput input, int length) throws IOException, InterruptedException;

  /**
   * Invoked to write sample data to the output.
   *
   * @param data A {@link ParsableByteArray} from which to read the sample data.
   * @param length The number of bytes to read.
   */
  void sampleData(ParsableByteArray data, int length);

  /**
   * Invoked when metadata associated with a sample has been extracted from the stream.
   * <p>
   * The corresponding sample data will have already been passed to the output via calls to
   * {@link #sampleData(ExtractorInput, int)} or {@link #sampleData(ParsableByteArray, int)}.
   *
   * @param timeUs The media timestamp associated with the sample, in microseconds.
   * @param flags Flags associated with the sample. See {@link SampleHolder#flags}.
   * @param size The size of the sample data, in bytes.
   * @param offset The number of bytes that have been passed to
   *     {@link #sampleData(ExtractorInput, int)} or {@link #sampleData(ParsableByteArray, int)}
   *     since the last byte belonging to the sample whose metadata is being passed.
   * @param encryptionKey The encryption key associated with the sample. May be null.
   */
  void sampleMetadata(long timeUs, int flags, int size, int offset, byte[] encryptionKey);

}


text:
 Improve this Doc

$sanitize

  Here are the list of errors in the $sanitize namespace.

        Name
        Description

        noinert
        Can't create an inert html document

        uinput
        Failed to sanitize html because the input is unstable


text:
//
//  CRVVideoAssetTypedefs.h
//  Carrierwave
//
//  Copyright (c) 2015 Netguru Sp. z o.o. All rights reserved.
//

@class AVPlayerItem;

/**
 *  The completion block of load video action.
 *
 *  @param videoItem    Video item created from current asset.
 *  @param error        An error that occured, if any.
 */
typedef void (^CRVVideoLoadCompletionBlock)(AVPlayerItem *videoItem, NSError *error);


text:
// *************************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2018. All rights reserved.
//
// Web: http://www.scichart.com
//   Support: support@scichart.com
//   Sales:   sales@scichart.com
//
// CursorModifierExampleView.xaml.cs is part of the SCICHART® Examples. Permission is hereby granted
// to modify, create derivative works, distribute and publish any part of this source
// code whether for commercial, private or personal use.
//
// The SCICHART® examples are distributed in the hope that they will be useful, but
// without any warranty. It is provided "AS IS" without warranty of any kind, either
// expressed or implied.
// *************************************************************************************
using System.Windows.Controls;
using SciChart.Charting.Model.DataSeries;
using SciChart.Data.Model;
using SciChart.Examples.ExternalDependencies.Data;

namespace SciChart.Examples.Examples.InspectDatapoints
{
    /// <summary>
    /// Interaction logic for CursorModifierExampleView.xaml
    /// </summary>
    public partial class CursorModifierExampleView : UserControl
    {
        public CursorModifierExampleView()
        {
            InitializeComponent();

            var dataSeries0 = new XyDataSeries<double, double>() { SeriesName = "Green Series" };
            var dataSeries1 = new XyDataSeries<double, double>() { SeriesName = "Red Series" };
            var dataSeries2 = new XyDataSeries<double, double>() { SeriesName = "Gray Series" };
            var dataSeries3 = new XyDataSeries<double, double>() { SeriesName = "Yellow Series" };

            var data1 = DataManager.Instance.GetNoisySinewave(300, 1.0, 300, 0.25);
            var data2 = DataManager.Instance.GetSinewave(100, 2, 300);
            var data3 = DataManager.Instance.GetSinewave(200, 1.5, 300);
            var data4 = DataManager.Instance.GetSinewave(50, 0.1, 300);

            // Append data to series.
            dataSeries0.Append(data1.XData, data1.YData);
            dataSeries1.Append(data2.XData, data2.YData);
            dataSeries2.Append(data3.XData, data3.YData);
            dataSeries3.Append(data4.XData, data4.YData);

            // Assign DataSeries to RenderableSeries
            sciChartSurface.RenderableSeries[0].DataSeries = dataSeries0;
            sciChartSurface.RenderableSeries[1].DataSeries = dataSeries1;
            sciChartSurface.RenderableSeries[2].DataSeries = dataSeries2;
            sciChartSurface.RenderableSeries[3].DataSeries = dataSeries3;

            sciChartSurface.XAxis.VisibleRange = new DoubleRange(3, 6);
        }
    }
}


text:
{% extends "library/base.html" %}
{% load url from future %}

{% block content %}

{% for book in object_list %}

{{ book.title }}
{{ book.sortkey }}
{{ book.year_published|date:"Y" }}
{{ book.location }}

{% endfor %}

{% endblock content %}


text:
#include <aws/network-firewall/model/StatefulRuleGroupReference.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace NetworkFirewall
{
namespace Model
{

StatefulRuleGroupReference::StatefulRuleGroupReference() :
    m_resourceArnHasBeenSet(false),
    m_priority(0),
    m_priorityHasBeenSet(false),
    m_overrideHasBeenSet(false)
{
}

StatefulRuleGroupReference::StatefulRuleGroupReference(JsonView jsonValue) :
    m_resourceArnHasBeenSet(false),
    m_priority(0),
    m_priorityHasBeenSet(false),
    m_overrideHasBeenSet(false)
{
  *this = jsonValue;
}

StatefulRuleGroupReference& StatefulRuleGroupReference::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("ResourceArn"))
  {
    m_resourceArn = jsonValue.GetString("ResourceArn");

    m_resourceArnHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Priority"))
  {
    m_priority = jsonValue.GetInteger("Priority");

    m_priorityHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Override"))
  {
    m_override = jsonValue.GetObject("Override");

    m_overrideHasBeenSet = true;
  }

  return *this;
}

JsonValue StatefulRuleGroupReference::Jsonize() const
{
  JsonValue payload;

  if(m_resourceArnHasBeenSet)
  {
   payload.WithString("ResourceArn", m_resourceArn);

  }

  if(m_priorityHasBeenSet)
  {
   payload.WithInteger("Priority", m_priority);

  }

  if(m_overrideHasBeenSet)
  {
   payload.WithObject("Override", m_override.Jsonize());

  }

  return payload;
}

} // namespace Model
} // namespace NetworkFirewall
} // namespace Aws


text:
Changelog
=========

* 1.0.0-beta2 (2015-04-13)

 * Moved code to `Puli\SymfonyBridge` namespace

* 1.0.0-beta (2015-01-12)

 * Renamed `ChainableFileLocator` to `ChainableFileLocatorImpl`
 * Renamed `ChainableFileLocatorInterface` to `ChainableFileLocator`

* 1.0.0-alpha1 (2014-12-03)

 * first alpha release


text:
// Create null, undefined variables and try typeof on them.

var nullType = null;
console.log(typeof (nullType));
var undefinedType;
console.log(typeof (undefinedType));


text:
using namespace Manta;

ImageDisplay::ImageDisplay()
{
}

ImageDisplay::~ImageDisplay()
{
}


text:
require 'formula'

class RbenvGemRehash < Formula
  homepage 'https://github.com/sstephenson/rbenv-gem-rehash'
  url 'https://github.com/sstephenson/rbenv-gem-rehash/archive/v1.0.0.tar.gz'
  sha1 '40962ef5cda77ff46c0d0a3f262076b58088dd57'

  depends_on 'rbenv'

  # Fixes issues with Homebrew-managed git-etc alpha.
  patch do
    url "https://github.com/sstephenson/rbenv-gem-rehash/commit/0756890cfd9c7bbbdde38560fe81626a0c5769bd.diff"
    sha1 "17877b728eda6eaddc199bcd5935fcea757a1c63"
  end

  def install
    prefix.install Dir['*']
  end

  def caveats; <<-EOS.undent
    If the GEM_PATH environment variable is undefined, rbenv-gem-rehash must
    first execute the gem env gempath command to retrieve RubyGems' default path
    so that it can can append to the path rather than override it. This can take
    a while--from a few hundred milliseconds on MRI to several seconds on
    JRuby--so the default path for the current Ruby version is cached to the
    filesystem the first time it is retrieved.
    EOS
  end
end


text:
<?xml version="1.0"?>

<document>

 <properties>
  <title>Java date and time API - Hibernate - Home</title>
  <author>Stephen Colebourne</author>
 </properties>

Joda-Time provides a complete quality alternative
to the JDK date and time classes.
At some point however, many projects need to persist these classes to a database.
One popular tool for achieving this is Hibernate.

To ease the integration of Joda-Time and Hibernate, this sub-project was setup.
It aims to provide the classes necessary to persist Joda-Time objects.

Version 1.3 was released on 2011-05-16 -
Download now

Please note that version 1.3 is for Hibernate 3.6 and not Hibernate 4.0 (as the Hibernate team have
made another incompatible change).
The usertype project handles Hibernate 4.0.
It is also more up to date and more complete than this project in general.

Various documentation is available:

The user guide

The Javadoc

The GitHub source repository

Release 1.3
is the current latest release.
Please bear in mind that this project is separate from Joda-Time itself.

The dependencies are Joda-Time 1.5 or later and Hibernate 3.6 (plus associated dependencies).
The Maven POM defines the dependencies as "provided", so you must specify them independently of this project.
We recommend JDK 1.5 or later, and have performed no testing on earlier JDKs.

Available in Maven Central.

The Joda-Time-Hibernate library was contributed to Joda-Time by Mario Ivankovits and Gregory Joseph.

Support on bugs, library usage or enhancement requests is available on a best efforts basis.

To suggest enhancements or contribute, please fork the source code on GitHub.
Alternatively, use GitHub issues.

</document>


text:
require "sigar"

Ohai.plugin do
  provides "uptime", "uptime_seconds"

  collect_data do
    sigar = Sigar.new
    uptime = sigar.uptime.uptime
    uptime_seconds uptime.to_i * 1000
    uptime seconds_to_human(uptime.to_i)
  end
end