text:
package android.support.v7.app;

import java.lang.ref.WeakReference;
import java.util.ArrayList;

import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.widget.SpinnerAdapter;

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
class ActionBarImplCompatICS extends ActionBar {

    final Activity mActivity;
    final Callback mCallback;
    final android.app.ActionBar mActionBar;

    private ArrayList<WeakReference<OnMenuVisibilityListenerWrapper>> mAddedMenuVisWrappers =
            new ArrayList<WeakReference<OnMenuVisibilityListenerWrapper>>();

    public ActionBarImplCompatICS(Activity activity, Callback callback) {
        mActivity = activity;
        mCallback = callback;
        mActionBar = activity.getActionBar();
    }

    private OnMenuVisibilityListenerWrapper findAndRemoveMenuVisWrapper(
            OnMenuVisibilityListener compatListener) {
        for (int i = 0; i < mAddedMenuVisWrappers.size(); i++) {
            OnMenuVisibilityListenerWrapper wrapper = mAddedMenuVisWrappers.get(i).get();
            if (wrapper == null) {
                mAddedMenuVisWrappers.remove(i--);
            } else if (wrapper.mWrappedListener == compatListener) {
                mAddedMenuVisWrappers.remove(i);
                return wrapper;
            }
        }
        return null;
    }

    @Override
    public void setCustomView(View view) {
        mActionBar.setCustomView(view);
    }

    @Override
    public void setCustomView(View view, LayoutParams layoutParams) {
        android.app.ActionBar.LayoutParams lp =
                new android.app.ActionBar.LayoutParams(layoutParams);
        lp.gravity = layoutParams.gravity;

        mActionBar.setCustomView(view, lp);
    }

    @Override
    public void setCustomView(int resId) {
        mActionBar.setCustomView(resId);
    }

    @Override
    public void setIcon(int resId) {
        mActionBar.setIcon(resId);
    }

    @Override
    public void setIcon(Drawable icon) {
        mActionBar.setIcon(icon);
    }

    @Override
    public void setLogo(int resId) {
        mActionBar.setLogo(resId);
    }

    @Override
    public void setLogo(Drawable logo) {
        mActionBar.setLogo(logo);
    }

    @Override
    public void setListNavigationCallbacks(SpinnerAdapter adapter, OnNavigationListener callback) {
        mActionBar.setListNavigationCallbacks(adapter,
                callback != null ? new OnNavigationListenerWrapper(callback) : null);
    }

    @Override
    public void setSelectedNavigationItem(int position) {
        mActionBar.setSelectedNavigationItem(position);
    }

    @Override
    public int getSelectedNavigationIndex() {
        return mActionBar.getSelectedNavigationIndex();
    }

    @Override
    public int getNavigationItemCount() {
        return mActionBar.getNavigationItemCount();
    }

    @Override
    public void setTitle(CharSequence title) {
        mActionBar.setTitle(title);
    }

    @Override
    public void setTitle(int resId) {
        mActionBar.setTitle(resId);
    }

    @Override
    public void setSubtitle(CharSequence subtitle) {
        mActionBar.setSubtitle(subtitle);
    }

    @Override
    public void setSubtitle(int resId) {
        mActionBar.setSubtitle(resId);
    }

    @Override
    public void setDisplayOptions(int options) {
        mActionBar.setDisplayOptions(options);
    }

    @Override
    public void setDisplayOptions(int options, int mask) {
        mActionBar.setDisplayOptions(options, mask);
    }

    @Override
    public void setDisplayUseLogoEnabled(boolean useLogo) {
        mActionBar.setDisplayUseLogoEnabled(useLogo);
    }

    @Override
    public void setDisplayShowHomeEnabled(boolean showHome) {
        mActionBar.setDisplayShowHomeEnabled(showHome);
    }

    @Override
    public void setDisplayHomeAsUpEnabled(boolean showHomeAsUp) {
        mActionBar.setDisplayHomeAsUpEnabled(showHomeAsUp);
    }

    @Override
    public void setDisplayShowTitleEnabled(boolean showTitle) {
        mActionBar.setDisplayShowTitleEnabled(showTitle);
    }

    @Override
    public void setDisplayShowCustomEnabled(boolean showCustom) {
        mActionBar.setDisplayShowCustomEnabled(showCustom);
    }

    @Override
    public void setBackgroundDrawable(Drawable d) {
        mActionBar.setBackgroundDrawable(d);
    }

    @Override
    public View getCustomView() {
        return mActionBar.getCustomView();
    }

    @Override
    public CharSequence getTitle() {
        return mActionBar.getTitle();
    }

    @Override
    public CharSequence getSubtitle() {
        return mActionBar.getSubtitle();
    }

    @Override
    public int getNavigationMode() {
        return mActionBar.getNavigationMode();
    }

    @Override
    public void setNavigationMode(int mode) {
        mActionBar.setNavigationMode(mode);
    }

    @Override
    public int getDisplayOptions() {
        return mActionBar.getDisplayOptions();
    }

    @Override
    public Tab newTab() {
        final android.app.ActionBar.Tab realTab = mActionBar.newTab();
        final TabWrapper result = new TabWrapper(realTab);
        realTab.setTag(result);
        return result;
    }

    @Override
    public void addTab(Tab tab) {
        mActionBar.addTab(((TabWrapper) tab).mWrappedTab);
    }

    @Override
    public void addTab(Tab tab, boolean setSelected) {
        mActionBar.addTab(((TabWrapper) tab).mWrappedTab, setSelected);
    }

    @Override
    public void addTab(Tab tab, int position) {
        mActionBar.addTab(((TabWrapper) tab).mWrappedTab, position);
    }

    @Override
    public void addTab(Tab tab, int position, boolean setSelected) {
        mActionBar.addTab(((TabWrapper) tab).mWrappedTab, position, setSelected);
    }

    @Override
    public void removeTab(Tab tab) {
        mActionBar.removeTab(((TabWrapper) tab).mWrappedTab);
    }

    @Override
    public void removeTabAt(int position) {
        mActionBar.removeTabAt(position);
    }

    @Override
    public void removeAllTabs() {
        mActionBar.removeAllTabs();
    }

    @Override
    public void selectTab(Tab tab) {
        mActionBar.selectTab(((TabWrapper) tab).mWrappedTab);
    }

    @Override
    public Tab getSelectedTab() {
        return (Tab) mActionBar.getSelectedTab().getTag();
    }

    @Override
    public Tab getTabAt(int index) {
        return (Tab) mActionBar.getTabAt(index).getTag();
    }

    @Override
    public int getTabCount() {
        return mActionBar.getTabCount();
    }

    @Override
    public Context getThemedContext() {
        return mActionBar.getThemedContext();
    }

    @Override
    public int getHeight() {
        return mActionBar.getHeight();
    }

    @Override
    public void show() {
        mActionBar.show();
    }

    @Override
    public void hide() {
        mActionBar.hide();
    }

    @Override
    public boolean isShowing() {
        return mActionBar.isShowing();
    }

    @Override
    public void addOnMenuVisibilityListener(OnMenuVisibilityListener listener) {
        if (listener != null) {
            OnMenuVisibilityListenerWrapper w = new OnMenuVisibilityListenerWrapper(listener);
            mAddedMenuVisWrappers.add(new WeakReference<OnMenuVisibilityListenerWrapper>(w));
            mActionBar.addOnMenuVisibilityListener(w);
        }
    }

    @Override
    public void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener) {
        OnMenuVisibilityListenerWrapper l = findAndRemoveMenuVisWrapper(listener);
        mActionBar.removeOnMenuVisibilityListener(l);
    }

    static class OnNavigationListenerWrapper implements android.app.ActionBar.OnNavigationListener {

        private final OnNavigationListener mWrappedListener;

        public OnNavigationListenerWrapper(OnNavigationListener l) {
            mWrappedListener = l;
        }

        @Override
        public boolean onNavigationItemSelected(int itemPosition, long itemId) {
            return mWrappedListener.onNavigationItemSelected(itemPosition, itemId);
        }

    }

    static class OnMenuVisibilityListenerWrapper implements
            android.app.ActionBar.OnMenuVisibilityListener {

        final OnMenuVisibilityListener mWrappedListener;

        public OnMenuVisibilityListenerWrapper(OnMenuVisibilityListener l) {
            mWrappedListener = l;
        }

        @Override
        public void onMenuVisibilityChanged(boolean isVisible) {
            mWrappedListener.onMenuVisibilityChanged(isVisible);
        }

    }

    class TabWrapper extends Tab implements android.app.ActionBar.TabListener {

        final android.app.ActionBar.Tab mWrappedTab;
        private Object mTag;
        private FragmentTransaction mActiveTransaction;
        private CharSequence mContentDescription;
        private TabListener mTabListener;

        public TabWrapper(android.app.ActionBar.Tab tab) {
            mWrappedTab = tab;
        }

        @Override
        public int getPosition() {
            return mWrappedTab.getPosition();
        }

        @Override
        public Drawable getIcon() {
            return mWrappedTab.getIcon();
        }

        @Override
        public CharSequence getText() {
            return mWrappedTab.getText();
        }

        @Override
        public Tab setIcon(Drawable icon) {
            mWrappedTab.setIcon(icon);
            return this;
        }

        @Override
        public Tab setIcon(int resId) {
            mWrappedTab.setIcon(resId);
            return this;
        }

        @Override
        public Tab setText(CharSequence text) {
            mWrappedTab.setText(text);
            return this;
        }

        @Override
        public Tab setText(int resId) {
            mWrappedTab.setText(resId);
            return this;
        }

        @Override
        public Tab setCustomView(View view) {
            mWrappedTab.setCustomView(view);
            return this;
        }

        @Override
        public Tab setCustomView(int layoutResId) {
            mWrappedTab.setCustomView(layoutResId);
            return this;
        }

        @Override
        public View getCustomView() {
            return mWrappedTab.getCustomView();
        }

        @Override
        public Tab setTag(Object obj) {
            mTag = obj;
            return this;
        }

        @Override
        public Object getTag() {
            return mTag;
        }

        @Override
        public Tab setTabListener(TabListener listener) {
            mTabListener = listener;
            mWrappedTab.setTabListener(listener != null ? this : null);
            return this;
        }

        @Override
        public void select() {
            mWrappedTab.select();
        }

        @Override
        public Tab setContentDescription(int resId) {
            mContentDescription = mActivity.getText(resId);
            return this;
        }

        @Override
        public Tab setContentDescription(CharSequence contentDesc) {
            mContentDescription = contentDesc;
            return this;
        }

        @Override
        public CharSequence getContentDescription() {
            return mContentDescription;
        }

        @Override
        public void onTabSelected(android.app.ActionBar.Tab tab,
                android.app.FragmentTransaction ft) {
            mTabListener.onTabSelected(this, ft != null ? getActiveTransaction() : null);
            commitActiveTransaction();
        }

        @Override
        public void onTabUnselected(android.app.ActionBar.Tab tab,
                android.app.FragmentTransaction ft) {
            mTabListener.onTabUnselected(this, ft != null ? getActiveTransaction() : null);
        }

        @Override
        public void onTabReselected(android.app.ActionBar.Tab tab,
                android.app.FragmentTransaction ft) {
            mTabListener.onTabReselected(this, ft != null ? getActiveTransaction() : null);
            commitActiveTransaction();
        }

        private FragmentTransaction getActiveTransaction() {
            if (mActiveTransaction == null) {
                mActiveTransaction = mCallback.getSupportFragmentManager().beginTransaction()
                        .disallowAddToBackStack();
            }
            return mActiveTransaction;
        }

        private void commitActiveTransaction() {
            if (mActiveTransaction != null && !mActiveTransaction.isEmpty()) {
                mActiveTransaction.commit();
            }
            mActiveTransaction = null;
        }
    }
}


text:
package com.bbn.openmap.layer.terrain;

import com.bbn.openmap.util.stateMachine.State;
import com.bbn.openmap.util.stateMachine.StateMachine;

class LOSStateMachine extends StateMachine {

    public LOSGenerator losg;
    public static final int TOOL_DO_NOTHING = 0;
    public static final int TOOL_DRAW = 1;
    public static final int TOOL_DEFINED = 2;
    public static final int TOOL_VIEW = 3;

    public LOSStateMachine(LOSGenerator generator) {
        losg = generator;
        State[] losStates = init();
        setStates(losStates);

        // set reset state
        setResetState(TOOL_DO_NOTHING);
        reset();
        setMapMouseListenerResponses(true);
    }

    protected State[] init() {
        State[] LOSStates = new State[4];

        LOSStates[TOOL_DO_NOTHING] = new LOSDoNothingState(losg);
        LOSStates[TOOL_DRAW] = new LOSDrawState(losg);
        LOSStates[TOOL_DEFINED] = new LOSDefinedState(losg);
        LOSStates[TOOL_VIEW] = new LOSViewState(losg);

        return LOSStates;
    }
}

redpajama_set_name: RedPajamaGithub


text:
layout: page
title: Terminal.com Tutorial
permalink: /terminal-tutorial/
---
For the assignments, we offer an option to use [Terminal.com](https://www.terminal.com) for developing and testing your implementations. [Terminal](https://www.terminal.com) is an online computing platform that allows us to access pre-configured command line environments. Note that, it's not required to use [Terminal](https://www.terminal.com) for your assignments; however, it might make life easier with all the required dependencies and development toolkits configured for you.

This tutorial lists the necessary steps of working on the assignments using Terminal. First of all, [sign up your own account](https://www.terminal.com/signup). Log in [Terminal](https://www.terminal.com) with the account that you have just created.

For each assignment, we will provide you a link to a shared terminal snapshot. These snapshots are pre-configured command line environments with the starter code, where you can write your implementations and execute the code. Let's take Assignment #1 as an example:

The snapshot of Assignment #1 can be found [here](https://www.terminal.com/tiny/C9uqWtabDt). Let's go to this link:

Click the "Start" button on the lower right corner. This will clone the shared snapshot to your own account. Now you should be able to find the terminal (**zyk09021** in my case) under the [My Terminals](https://www.terminal.com/terminals) tab.

You are all set! To work on the assignments, click the link (shown in the red box) to the terminal. It leads you to the development environment (see below).

We have set up the [IPython Notebook](http://ipython.org/notebook.html) and other dependencies in the terminal. You can find these notebooks and skeleton codes in the folder **assignment1-master**. Follow the detailed assignment descriptions to complete and submit your work. For submission, go to [Coursework](https://coursework.stanford.edu/portal/) using the browser in terminal (see below). You should be able to upload your work to Coursework.

For more information about [Terminal](https://www.terminal.com/terminals), check out the [FAQ](https://www.terminal.com/faq) page.

**Important Note:** the usage of Terminal is charged on an hourly rate based on the instance type. A medium type instance costs $0.124 per hour. You will be granted $5 for free once the account is created. We are happy to sponsor each student roughly $10 extra fund for the assignments. Please contact [Yuke Zhu](mailto:yukez@cs.stanford.edu) for more information about the fund. It is **your responsibility** to keep the charge in mind and to budget it carefully :)


text:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      tools:context="com.mbcdev.folkets.MainActivity">

    <item android:id="@+id/main_search"
          android:title="@string/main_search_title"
          app:showAsAction="ifRoom"
          app:actionViewClass="android.widget.SearchView" />

    <item
        android:id="@+id/action_help"
        android:orderInCategory="101"
        android:title="@string/action_help"
        app:showAsAction="never"/>
</menu>


text:
@implementation Employee

- (NSString*)fullname {
    return [NSString stringWithFormat:@"%@ %@", self.name, self.surname];
}

+ (NSSet *)keyPathsForValuesAffectingFullname {
    return [NSSet setWithObjects:@"name", @"surname", nil];
}

- (void)addAccount:(NSString*)account {
    [[self mutableArrayValueForKey:@"accounts"] addObject:account];
}

@end


text:
<?php

namespace Bjorvack\ImageStacker\Tests;

use Bjorvack\ImageStacker\Image;
use Bjorvack\ImageStacker\Stacker;

class StackerUnitTest extends BaseTest
{
    private $fileName;

    private $storagePath;

    public function __construct($name = null, array $data = [], $dataName = '')
    {
        parent::__construct($name, $data, $dataName);

        $this->fileName = dirname(__FILE__) .'/bjorvack.png';
        $this->storagePath = dirname(__FILE__);
    }

    public function testStackerCreation()
    {
        $stacker = new Stacker('unitTest', 450, 400);

        $this->assertInstanceOf(Stacker::class, $stacker);
        $this->assertEquals(450, $stacker->getMaxWidth());
        $this->assertEquals(400, $stacker->getMaxHeight());
        $this->assertTrue($stacker->canGrowHorizontaly());
        $this->assertTrue($stacker->canGrowVerticaly());
        $this->assertEquals('unitTest', $stacker->getName());

        $stacker = new Stacker('unitTest', null, null, false, false);

        $this->assertInstanceOf(Stacker::class, $stacker);
        $this->assertNull($stacker->getMaxWidth());
        $this->assertNull($stacker->getMaxHeight());
        $this->assertFalse($stacker->canGrowHorizontaly());
        $this->assertFalse($stacker->canGrowVerticaly());
        $this->assertEquals('unitTest', $stacker->getName());

        $this->assertInternalType('array', $stacker->getImages());
        $this->assertEquals(0, count($stacker->getImages()));

        $this->assertInternalType('array', $stacker->getFreeSpaces());
        $this->assertEquals(0, count($stacker->getFreeSpaces()));
    }

    public function testStackerUpdate()
    {
        $stacker = new Stacker('unitTest', 8000, 8000);
        $image = new Image($this->fileName, 'unitTest');
        $stacker->addImage($image);

        $image = new Image($this->fileName, 'unitTest', 40, 20);
        $stacker->addImage($image);

        $image = new Image($this->fileName, 'unitTest', 20, 20);
        $stacker->addImage($image);

        $this->assertEquals(3, count($stacker->getImages()));
    }

    public function testStackerSize()
    {
        $stacker = new Stacker('unitTest', 8000, 8000);
        $image = new Image($this->fileName, 'unitTest');
        $stacker->addImage($image);

        $this->assertInternalType('array', $stacker->getSize());
        $this->assertEquals(180, $stacker->getSize()['width']);
        $this->assertEquals(180, $stacker->getSize()['height']);
    }

    public function testJsonData()
    {
        $stacker = new Stacker('unitTest', 8000, 8000);
        $image = new Image($this->fileName, 'unitTest');
        $stacker->addImage($image);
        $json = json_encode($stacker);

        $filename = str_replace('/', '\/', $this->fileName);

        $this->assertEquals('{"name":"unitTest","size":{"width":180,"height":180},"images":[{"name":"unitTest","path":"' . $filename . '","size":{"width":180,"height":180},"position":{"x":0,"y":0}}]}', $json);
    }
}


text:
package Dynace;

import java.io.PrintWriter;
import java.io.FileWriter;

public class DynaceBase {
	public static native int callToDynace(int obj, int addr, short sArgCount, Object vArgs[]);
	public static native double callToDynaceReturnDouble(int obj, int addr, short sArgCount, Object vArgs[]);
	public static native int superCallToDynace(int obj, int cls, int addr, short sArgCount, Object vArgs[]);
	public static native double superCallToDynaceReturnDouble(int obj, int cls, int addr, short sArgCount, Object vArgs[]);
	public static native String getStringFromCharBuff(int addr);
	public static native void setSuperCallAddr(int addr);

	protected static IObjectFactory g_ObjFactory;
	public static Class g_ClassOf_object;
	protected static int genericAddresses[];

	private boolean m_bSuperCall = false;
	private DynaceClass m_SuperCallCls;
	protected int m_nAddress;
	protected boolean m_bDispose = false;
	String m_szClassName;

	static {
		try {
			System.loadLibrary("JavaDynace");
		} catch (java.lang.UnsatisfiedLinkError excp) {
			javax.swing.JOptionPane.showMessageDialog(null, "Error Loading JavaDynace.dll:  {java.library.path}=" + System.getProperty("java.library.path")
								  + " - Message=" + excp.getMessage());
			throw excp;
		}
	}

	public DynaceBase(){}

	public DynaceBase(String szClassName, int nAddress) {
		m_nAddress = nAddress;
		m_szClassName = szClassName;
	}

	protected DynaceBase(DynaceBase inObj) {
		copy(inObj);
		String szName = getClass().getName();
		if (!szName.equals(g_ClassOf_object.getName())) {
			short sArgCnt = 2;
			Object vParms[] = new Object[sArgCnt*2];
			vParms[0] = this;
			vParms[1] = new Integer(getAddress());
			InsertTypes(vParms, sArgCnt);
			callToDynace(DynaceClass.getDynaceClass("Java").getAddress(),
				     DynaceGeneric.getAddress("gAttachJavaObj"), sArgCnt, vParms);
		} else
			m_bDispose = true;
	}

	protected void finalize() {
		if (m_bDispose)
			callToDynace(getAddress(), DynaceGeneric.getAddress("gDispose"), (short)0, null);
	}

	public static void InsertTypes(Object vParms[], short sArgCnt) {
		for (short ndx = sArgCnt; ndx < sArgCnt * 2; ndx++)
			vParms[ndx] = new String(vParms[ndx-sArgCnt].getClass().getName());
	}

	public static void setObjectFactory(IObjectFactory objFactory) {
		g_ObjFactory = objFactory;
	}

	protected boolean getSuperCall() {
		return m_bSuperCall;
	}

	public int getAddress() {
		return m_nAddress;
	}

	protected DynaceClass getSuperCallCls() {
		return m_SuperCallCls;
	}

	protected DynaceBase getReturnObj(int nAddr) {
		if (nAddr == 0)
			return null;
		if (nAddr != getAddress())
			return DynaceBase.g_ObjFactory.addDynaceObject(toString(), nAddr);
		else
			return (DynaceBase)this;
	}

	public String toString() {
		return new String(m_szClassName);
	}

	protected void copy(DynaceBase inObj) {
		m_nAddress = inObj.getAddress();
		m_szClassName = inObj.m_szClassName;
	}

	public static DynaceBase attachDynaceBase(String szClassName, int nAddress) {
		return DynaceBase.g_ObjFactory.addDynaceObject(szClassName, nAddress);
	}

	public static DynaceBase attachDynaceBase(int nClassAddr, int nAddress) {
		return attachDynaceBase(DynaceClass.getClassNameFromAddr(nClassAddr), nAddress);
	}

	private DynaceBase setSuperCall(DynaceClass cls) {
		m_bSuperCall = true;
		m_SuperCallCls = cls;
		return this;
	}

	public DynaceBase getSuperObj() {
		return DynaceBase.g_ObjFactory.addDynaceObject(toString(), getAddress()).setSuperCall((DynaceClass)this);
	}

	public DynaceBase getSuperObj(DynaceBase obj) {
		return DynaceBase.g_ObjFactory.addDynaceObject(obj.toString(), obj.getAddress()).setSuperCall((DynaceClass)this);
	}

	public DynaceBase igDispose() {
		return null;
	}

	public DynaceBase gCheckFunction(Object objContext, String funcname) {
		short sArgCnt = 1;
		Object vParms[] = new Object[sArgCnt*2];
		vParms[0] = new Integer(getCallbackObj(objContext, funcname, "(L" + getClass().getName()
						       + ";L" + getClass().getName() + ";)Ljava/lang/String;").getAddress());
		InsertTypes(vParms, sArgCnt);
		return getReturnObj(callToDynace(getAddress(), DynaceGeneric.getAddress("gCheckFunction"), sArgCnt, vParms));
	}

	public int gSetFunction(Object objContext, String funcname) {
		short sArgCnt = 1;
		Object vParms[] = new Object[sArgCnt*2];
		vParms[0] = new Integer(getCallbackObj(objContext, funcname, "(L" + getClass().getName() + ";L" + getClass().getName() + ";)I").getAddress());
		InsertTypes(vParms, sArgCnt);
		return callToDynace(getAddress(), DynaceGeneric.getAddress("gSetFunction"), sArgCnt, vParms);
	}

	public int gSetChgFunction(Object objContext, String funcname) {
		short sArgCnt = 1;
		Object vParms[] = new Object[sArgCnt*2];
		vParms[0] = new Integer(getCallbackObj(objContext, funcname, "(L" + getClass().getName() + ";)I").getAddress());
		InsertTypes(vParms, sArgCnt);
		return callToDynace(getAddress(), DynaceGeneric.getAddress("gSetChgFunction"), sArgCnt, vParms);
	}

	public DynaceBase gAssociate(Object objContext, int nID, String funcname) {
		short sArgCnt = 2;
		Object vParms[] = new Object[sArgCnt*2];
		vParms[0] = new Integer(nID);
		vParms[1] = new Integer(getCallbackObj(objContext, funcname, "(L" + getClass().getName() + ";I)I").getAddress());
		InsertTypes(vParms, sArgCnt);
		return getReturnObj(callToDynace(getAddress(), DynaceGeneric.getAddress("gAssociate"), sArgCnt, vParms));
	}

	private DynaceBase getCallbackObj(Object objContext, String funcname, String methodsig) {
		DynaceClass cls = DynaceClass.getDynaceClass("JavaCallback");
		return cls.gNewJavaCallback(objContext, funcname, methodsig);
	}

	public DynaceBase gNewJavaCallback(Object obj, String parm3, String parm4) {
		short sArgCnt = 4;
		Object vParms[] = new Object[sArgCnt*2];
		vParms[0] = obj;
		vParms[1] = new String(obj.getClass().getName());
		vParms[2] = new String(parm3);
		vParms[3] = new String(parm4);
		InsertTypes(vParms, sArgCnt);
		return getReturnObj(callToDynace(getAddress(), DynaceGeneric.getAddress("gNewJavaCallback"), sArgCnt, vParms));
	}

	public static void logError(Throwable t, String fileName, String msg)	{
		FileWriter writer = null;
		PrintWriter printer = null;

		try {
			writer = new FileWriter(fileName, true);
			printer = new PrintWriter(writer);

			if (msg != null) {
				printer.println(msg);
				printer.println();
			}

			if (t != null) {
				t.printStackTrace(printer);
				printer.println();
			}

			printer.close();
			writer.close();
		}
		catch (Throwable t2) {
		}
		finally	{
			if (printer != null)
				printer.close();
			try {
				if (writer != null)
					writer.close();
			}
			catch (Throwable t3) {
			}
		}
	}

}


text:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace gatherteamproject
{
   public class DateGroup : ObservableCollection<object>
    {
        public DateGroup(IEnumerable<object> items)
            : base(items)
        {
        }

        public string Date { get; set; }

    }
}


text:
#ifndef _PCL_IO_BOOST_H_
#define _PCL_IO_BOOST_H_

#if defined __GNUC__
#  pragma GCC system_header
#endif

#include <boost/numeric/conversion/cast.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/thread.hpp>
#include <boost/thread/thread.hpp>
#include <boost/filesystem.hpp>
#include <boost/bind.hpp>
#include <boost/cstdint.hpp>
#include <boost/function.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/mpl/fold.hpp>
#include <boost/mpl/inherit.hpp>
#include <boost/mpl/inherit_linearly.hpp>
#include <boost/mpl/joint_view.hpp>
#include <boost/mpl/transform.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/tokenizer.hpp>
#include <boost/foreach.hpp>
#include <boost/shared_array.hpp>
#include <boost/interprocess/sync/file_lock.hpp>
#if BOOST_VERSION >= 104900
#include <boost/interprocess/permissions.hpp>
#endif
#define BOOST_PARAMETER_MAX_ARITY 7
#include <boost/signals2.hpp>
#include <boost/signals2/slot.hpp>

#endif    // _PCL_IO_BOOST_H_


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using ProcessGremlin.Core.Processes;
using ProcessGremlin.Logging;
using ProcessGremlin.Logging.Events;

namespace ProcessGremlin.Implementations.Finders
{
    /// <summary>
    /// Find only busy processes that match the supplied finder
    /// </summary>
    public class BusyFinder : IProcessFinder
    {
        private const int SampleTime = 1000;
        private readonly int _busyThreshold;
        private readonly IProcessFinder _finder;
        private readonly IEventLogger _logger;
        private static readonly Type Type = typeof(BusyFinder);

        // _busyThreshold in % of core being used, ie up to 400 on a 4-core
        public BusyFinder(IProcessFinder finder, int busyThreshold, IEventLogger logger)
        {
            _finder = finder;
            _busyThreshold = busyThreshold;
            _logger = logger;
        }

        // Expensive operations here, evaluates lazily
        public IEnumerable<Process> Find()
        {
            var data = _finder.Find();
            return data.Where(process => GetCpuUsage(process) > _busyThreshold);
        }

        private int GetCpuUsage(Process process)
        {
            var cpuCounter = new PerformanceCounter("Process", "% Processor Time", GetInstanceName(process), true);
            _logger.Log(new IntervalStartingEvent("Beginning to measure CPU usage", BusyFinder.Type));
            cpuCounter.NextValue();
            Thread.Sleep(BusyFinder.SampleTime);
            var usage = (int)cpuCounter.NextValue();
            _logger.Log(new MeasuredCpuEvent(process, usage, BusyFinder.SampleTime, Type));
            _logger.Log(new IntervalStartingEvent("Ending measure of CPU usage", BusyFinder.Type));
            return usage;
        }

        private string GetInstanceName(Process process)
        {
            var category = new PerformanceCounterCategory("Process");
            var instances = category.GetInstanceNames();

            string instanceName = null;
            foreach (var instance in instances)
            {
                using (var counter = new PerformanceCounter("Process",
                    "ID Process", instance, true))
                {
                    try
                    {
                        if ((int) counter.RawValue == process.Id)
                        {
                            instanceName = instance;
                            break;
                        }
                    }
                    catch(Exception exception)
                    {
                        // Suppress errors from instances without counters
                        _logger.Log(new WarningEvent(exception, BusyFinder.Type));
                    }
                }
            }

            if (instanceName == null) throw new Exception("Process Instance PerformanceCounter not found for this Pid");

            return instanceName;
        }
    }
}


text:
#include "irccommand.h"
#include "ircmessage.h"
#include "ircconnection.h"
#include <QtTest/QtTest>
#include <QtCore/QRegExp>
#include <QtCore/QTextCodec>
#include <QtCore/QScopedPointer>

class tst_IrcCommand : public QObject
{
    Q_OBJECT

private slots:
    void testDefaults();

    void testEncoding_data();
    void testEncoding();

    void testConversion();

    void testConnection();

    void testAdmin();
    void testAway();
    void testCapability();
    void testCtcpAction();
    void testCtcpReply();
    void testCtcpRequest();
    void testInfo();
    void testInvite();
    void testJoin();
    void testKick();
    void testKnock();
    void testList();
    void testMessage();
    void testMode();
    void testMonitor();
    void testMotd();
    void testNames();
    void testNick();
    void testNotice();
    void testPart();
    void testPing();
    void testPong();
    void testQuit();
    void testQuote();
    void testStats();
    void testTime();
    void testTopic();
    void testTrace();
    void testUsers();
    void testVersion();
    void testWho();
    void testWhois();
    void testWhowas();

    void testDebug();
};

void tst_IrcCommand::testDefaults()
{
    IrcCommand cmd;
    QVERIFY(cmd.parameters().isEmpty());
    QCOMPARE(cmd.type(), IrcCommand::Custom);
    QCOMPARE(cmd.encoding(), QByteArray("UTF-8"));
    QVERIFY(!cmd.connection());
    QVERIFY(!cmd.network());

    QTest::ignoreMessage(QtWarningMsg, "Reimplement IrcCommand::toString() for IrcCommand::Custom");
    QVERIFY(cmd.toString().isEmpty());
}

void tst_IrcCommand::testEncoding_data()
{
    QTest::addColumn<QByteArray>("encoding");
    QTest::addColumn<QByteArray>("actual");
    QTest::addColumn<bool>("supported");

    QTest::newRow("null") << QByteArray() << QByteArray("UTF-8") << false;
    QTest::newRow("empty") << QByteArray("") << QByteArray("UTF-8") << false;
    QTest::newRow("space") << QByteArray(" ") << QByteArray("UTF-8") << false;
    QTest::newRow("invalid") << QByteArray("invalid") << QByteArray("UTF-8") << false;
    foreach (const QByteArray& codec, QTextCodec::availableCodecs())
        QTest::newRow(codec) << codec << codec << true;
}

void tst_IrcCommand::testEncoding()
{
    QFETCH(QByteArray, encoding);
    QFETCH(QByteArray, actual);
    QFETCH(bool, supported);

    if (!supported)
        QTest::ignoreMessage(QtWarningMsg, "IrcCommand::setEncoding(): unsupported encoding \"" + encoding + "\" ");

    IrcCommand cmd;
    cmd.setEncoding(encoding);
    QCOMPARE(cmd.encoding(), actual);
}

void tst_IrcCommand::testConversion()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createMessage("target", "foo bar"));
    QVERIFY(cmd.data());
    QCOMPARE(cmd->type(), IrcCommand::Message);

    IrcConnection conn;
    QScopedPointer<IrcMessage> msg(cmd->toMessage("prefix", &conn));
    QVERIFY(msg.data());

    QCOMPARE(msg->type(), IrcMessage::Private);
    QCOMPARE(msg->connection(), &conn);
    QCOMPARE(msg->prefix(), QString("prefix"));
    QCOMPARE(msg->property("target").toString(), QString("target"));
    QCOMPARE(msg->property("content").toString(), QString("foo bar"));
}

void tst_IrcCommand::testConnection()
{
    IrcConnection* connection = new IrcConnection(this);
    IrcCommand command(connection);
    QVERIFY(!command.connection());
    QVERIFY(!command.network());

    connection->sendCommand(&command);
    QCOMPARE(command.connection(), connection);
    QCOMPARE(command.network(), connection->network());

    command.setParent(nullptr);
    delete connection;
    QVERIFY(!command.connection());
    QVERIFY(!command.network());
}

void tst_IrcCommand::testAdmin()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createAdmin("server"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Admin);
    QVERIFY(cmd->toString().contains(QRegExp("\\bADMIN\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bserver\\b")));
}

void tst_IrcCommand::testAway()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createAway("reason"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Away);
    QVERIFY(cmd->toString().contains(QRegExp("\\bAWAY\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\breason\\b")));
}

void tst_IrcCommand::testCapability()
{
    QScopedPointer<IrcCommand> cmd1(IrcCommand::createCapability("sub", QString("cap")));
    QVERIFY(cmd1.data());

    QCOMPARE(cmd1->type(), IrcCommand::Capability);
    QVERIFY(cmd1->toString().contains(QRegExp("\\bCAP\\b")));
    QVERIFY(cmd1->toString().contains(QRegExp("\\bsub\\b")));
    QVERIFY(cmd1->toString().contains(QRegExp("\\bcap\\b")));

    QScopedPointer<IrcCommand> cmd2(IrcCommand::createCapability("sub", QStringList() << "cap1" << "cap2"));
    QVERIFY(cmd2.data());

    QCOMPARE(cmd2->type(), IrcCommand::Capability);
    QVERIFY(cmd2->toString().contains(QRegExp("\\bCAP\\b")));
    QVERIFY(cmd2->toString().contains(QRegExp("\\bsub\\b")));
    QVERIFY(cmd2->toString().contains(QRegExp("\\bcap1\\b")));
    QVERIFY(cmd2->toString().contains(QRegExp("\\bcap2\\b")));
}

void tst_IrcCommand::testCtcpAction()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createCtcpAction("tgt", "act"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::CtcpAction);
    QVERIFY(cmd->toString().contains(QRegExp("\\bPRIVMSG\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\btgt\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bact\\b")));
    QCOMPARE(cmd->toString().count("\01"), 2);
}

void tst_IrcCommand::testCtcpReply()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createCtcpReply("tgt", "rpl"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::CtcpReply);
    QVERIFY(cmd->toString().contains(QRegExp("\\bNOTICE\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\btgt\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\brpl\\b")));
    QCOMPARE(cmd->toString().count("\01"), 2);
}

void tst_IrcCommand::testCtcpRequest()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createCtcpRequest("tgt", "req"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::CtcpRequest);
    QVERIFY(cmd->toString().contains(QRegExp("\\bPRIVMSG\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\btgt\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\breq\\b")));
    QCOMPARE(cmd->toString().count("\01"), 2);
}

void tst_IrcCommand::testInfo()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createInfo("server"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Info);
    QVERIFY(cmd->toString().contains(QRegExp("\\bINFO\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bserver\\b")));
}

void tst_IrcCommand::testInvite()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createInvite("usr", "chan"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Invite);
    QVERIFY(cmd->toString().contains(QRegExp("\\bINVITE\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\busr\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bchan\\b")));
}

void tst_IrcCommand::testJoin()
{
    QScopedPointer<IrcCommand> cmd1(IrcCommand::createJoin("chan"));
    QVERIFY(cmd1.data());

    QCOMPARE(cmd1->type(), IrcCommand::Join);
    QVERIFY(cmd1->toString().contains(QRegExp("\\bJOIN\\b")));
    QVERIFY(cmd1->toString().contains(QRegExp("\\bchan\\b")));

    QScopedPointer<IrcCommand> cmd2(IrcCommand::createJoin(QStringList() << "chan1" << "chan2"));
    QVERIFY(cmd2.data());

    QCOMPARE(cmd2->type(), IrcCommand::Join);
    QVERIFY(cmd2->toString().contains(QRegExp("\\bJOIN\\b")));
    QVERIFY(cmd2->toString().contains(QRegExp("\\bchan1\\b")));
    QVERIFY(cmd2->toString().contains(QRegExp("\\bchan2\\b")));

    QScopedPointer<IrcCommand> cmd3(IrcCommand::createJoin(QStringList() << "chan1" << "chan2", QStringList() << "key1" << "key2"));
    QVERIFY(cmd3.data());

    QCOMPARE(cmd3->type(), IrcCommand::Join);
    QVERIFY(cmd3->toString().contains(QRegExp("\\bJOIN\\b")));
    QVERIFY(cmd3->toString().contains(QRegExp("\\bchan1,chan2\\b")));
    QVERIFY(cmd3->toString().contains(QRegExp("\\bkey1,key2\\b")));
}

void tst_IrcCommand::testKick()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createKick("chan", "usr"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Kick);
    QVERIFY(cmd->toString().contains(QRegExp("\\bKICK\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bchan\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\busr\\b")));
}

void tst_IrcCommand::testKnock()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createKnock("chan"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Knock);
    QVERIFY(cmd->toString().contains(QRegExp("\\bKNOCK\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bchan\\b")));
}

void tst_IrcCommand::testList()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createList(QStringList() << "chan1" << "chan2", "server"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::List);
    QVERIFY(cmd->toString().contains(QRegExp("\\bLIST\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bchan1\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bchan2\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bserver\\b")));
}

void tst_IrcCommand::testMessage()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createMessage("tgt", "msg"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Message);
    QVERIFY(cmd->toString().contains(QRegExp("\\bPRIVMSG\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\btgt\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bmsg\\b")));
}

void tst_IrcCommand::testMode()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createMode("tgt", "mode"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Mode);
    QVERIFY(cmd->toString().contains(QRegExp("\\bMODE\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\btgt\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bmode\\b")));
}

void tst_IrcCommand::testMonitor()
{
    QScopedPointer<IrcCommand> cmd1(IrcCommand::createMonitor("+", "foo"));
    QVERIFY(cmd1.data());

    QCOMPARE(cmd1->type(), IrcCommand::Monitor);
    QVERIFY(cmd1->toString().contains(QRegExp("\\bMONITOR\\b")));
    QVERIFY(cmd1->toString().contains(QRegExp("\\bfoo\\b")));

    QScopedPointer<IrcCommand> cmd2(IrcCommand::createMonitor("+", QStringList() << "foo" << "bar"));
    QVERIFY(cmd2.data());

    QCOMPARE(cmd2->type(), IrcCommand::Monitor);
    QVERIFY(cmd2->toString().contains(QRegExp("\\bMONITOR\\b")));
    QVERIFY(cmd2->toString().contains(QRegExp("\\bfoo\\b")));
    QVERIFY(cmd2->toString().contains(QRegExp("\\bbar\\b")));
}

void tst_IrcCommand::testMotd()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createMotd("server"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Motd);
    QVERIFY(cmd->toString().contains(QRegExp("\\bMOTD\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bserver\\b")));
}

void tst_IrcCommand::testNames()
{
    QScopedPointer<IrcCommand> cmd1(IrcCommand::createNames("chan"));
    QVERIFY(cmd1.data());

    QCOMPARE(cmd1->type(), IrcCommand::Names);
    QVERIFY(cmd1->toString().contains(QRegExp("\\bNAMES\\b")));
    QVERIFY(cmd1->toString().contains(QRegExp("\\bchan\\b")));

    QScopedPointer<IrcCommand> cmd2(IrcCommand::createNames(QStringList() << "chan1" << "chan2"));
    QVERIFY(cmd2.data());

    QCOMPARE(cmd2->type(), IrcCommand::Names);
    QVERIFY(cmd2->toString().contains(QRegExp("\\bNAMES\\b")));
    QVERIFY(cmd2->toString().contains(QRegExp("\\bchan1\\b")));
    QVERIFY(cmd2->toString().contains(QRegExp("\\bchan2\\b")));
}

void tst_IrcCommand::testNick()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createNick("nick"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Nick);
    QVERIFY(cmd->toString().contains(QRegExp("\\bNICK\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bnick\\b")));
}

void tst_IrcCommand::testNotice()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createNotice("tgt", "msg"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Notice);
    QVERIFY(cmd->toString().contains(QRegExp("\\bNOTICE\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\btgt\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bmsg\\b")));
}

void tst_IrcCommand::testPart()
{
    QScopedPointer<IrcCommand> cmd1(IrcCommand::createPart("chan"));
    QVERIFY(cmd1.data());

    QCOMPARE(cmd1->type(), IrcCommand::Part);
    QVERIFY(cmd1->toString().contains(QRegExp("\\bPART\\b")));
    QVERIFY(cmd1->toString().contains(QRegExp("\\bchan\\b")));

    QScopedPointer<IrcCommand> cmd2(IrcCommand::createPart(QStringList() << "chan1" << "chan2"));
    QVERIFY(cmd2.data());

    QCOMPARE(cmd2->type(), IrcCommand::Part);
    QVERIFY(cmd2->toString().contains(QRegExp("\\bPART\\b")));
    QVERIFY(cmd2->toString().contains(QRegExp("\\bchan1\\b")));
    QVERIFY(cmd2->toString().contains(QRegExp("\\bchan2\\b")));
}

void tst_IrcCommand::testPing()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createPing("arg"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Ping);
    QVERIFY(cmd->toString().contains(QRegExp("\\bPING\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\barg\\b")));
}

void tst_IrcCommand::testPong()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createPong("arg"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Pong);
    QVERIFY(cmd->toString().contains(QRegExp("\\bPONG\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\barg\\b")));
}

void tst_IrcCommand::testQuit()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createQuit("reason"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Quit);
    QVERIFY(cmd->toString().contains(QRegExp("\\bQUIT\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\breason\\b")));
}

void tst_IrcCommand::testQuote()
{
    QScopedPointer<IrcCommand> cmd1(IrcCommand::createQuote("CUSTOM"));
    QVERIFY(cmd1.data());

    QCOMPARE(cmd1->type(), IrcCommand::Quote);
    QVERIFY(cmd1->toString().contains(QRegExp("\\bCUSTOM\\b")));

    QScopedPointer<IrcCommand> cmd2(IrcCommand::createQuote(QStringList() << "FOO" << "BAR"));
    QVERIFY(cmd2.data());

    QCOMPARE(cmd2->type(), IrcCommand::Quote);
    QVERIFY(cmd2->toString().contains(QRegExp("\\bFOO\\b")));
    QVERIFY(cmd2->toString().contains(QRegExp("\\bBAR\\b")));
}

void tst_IrcCommand::testStats()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createStats("query", "server"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Stats);
    QVERIFY(cmd->toString().contains(QRegExp("\\bSTATS\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bquery\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bserver\\b")));
}

void tst_IrcCommand::testTime()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createTime("server"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Time);
    QVERIFY(cmd->toString().contains(QRegExp("\\bTIME\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bserver\\b")));
}

void tst_IrcCommand::testTopic()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createTopic("chan", "topic"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Topic);
    QVERIFY(cmd->toString().contains(QRegExp("\\bTOPIC\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bchan\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\btopic\\b")));
}

void tst_IrcCommand::testTrace()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createTrace("target"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Trace);
    QVERIFY(cmd->toString().contains(QRegExp("\\bTRACE\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\btarget\\b")));
}

void tst_IrcCommand::testUsers()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createUsers("server"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Users);
    QVERIFY(cmd->toString().contains(QRegExp("\\bUSERS\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bserver\\b")));
}

void tst_IrcCommand::testVersion()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createVersion("user"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Version);
    QVERIFY(cmd->toString().contains(QRegExp("\\bVERSION\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\buser\\b")));
}

void tst_IrcCommand::testWho()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createWho("mask"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Who);
    QVERIFY(cmd->toString().contains(QRegExp("\\bWHO\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bmask\\b")));
}

void tst_IrcCommand::testWhois()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createWhois("mask"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Whois);
    QVERIFY(cmd->toString().contains(QRegExp("\\bWHOIS\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bmask\\b")));
}

void tst_IrcCommand::testWhowas()
{
    QScopedPointer<IrcCommand> cmd(IrcCommand::createWhowas("mask"));
    QVERIFY(cmd.data());

    QCOMPARE(cmd->type(), IrcCommand::Whowas);
    QVERIFY(cmd->toString().contains(QRegExp("\\bWHOWAS\\b")));
    QVERIFY(cmd->toString().contains(QRegExp("\\bmask\\b")));
}

void tst_IrcCommand::testDebug()
{
    QString str;
    QDebug dbg(&str);

    dbg << static_cast<IrcCommand*>(nullptr);
    QCOMPARE(str.trimmed(), QString::fromLatin1("IrcCommand(0x0)"));
    str.clear();

    IrcCommand command;
    QTest::ignoreMessage(QtWarningMsg, "Reimplement IrcCommand::toString() for IrcCommand::Custom");
    dbg << &command;
    QVERIFY(QRegExp("IrcCommand\\(0x[0-9A-Fa-f]+, type=Custom\\) ").exactMatch(str));
    str.clear();

    command.setType(IrcCommand::Quit);
    dbg << &command;
    QVERIFY(QRegExp("IrcCommand\\(0x[0-9A-Fa-f]+, type=Quit, \"QUIT :\"\\) ").exactMatch(str));
    str.clear();

    command.setObjectName("foo");
    dbg << &command;
    QVERIFY(QRegExp("IrcCommand\\(0x[0-9A-Fa-f]+, name=foo, type=Quit, \"QUIT :\"\\) ").exactMatch(str));
    str.clear();

    dbg << IrcCommand::Join;
    QCOMPARE(str.trimmed(), QString::fromLatin1("Join"));
    str.clear();
}

QTEST_MAIN(tst_IrcCommand)

#include "tst_irccommand.moc"


text:
layout: post
author: JayYang95
title: "Jay's Midsemester Reflection"
---

Since most of my experience in coding has been in Java, I chose thise class hoping to expand my knowledge of coding to include Python, and
I have not been disappointed. Although I am familiar with most of the concepts we covered over the semester, I have still learned quite a
few things about Python that differ from Java such as the transition from static typing in Java to dynamic typing in Python, something
that I highly appreciate because it requries me to type less. Additionally, it has been somewhat difficult getting used to the syntax used
in Python. Often times while coding, I find myself accidentally coding in Java syntax, mainly when it comes to for loops.

for(int i = 0; i < n; i++){...}
vs
for i in range(0, n) ...

Another cool thing about Python is that brackets aren't required to indicate if a chunk of code is inside a loop or function. Instead,
only indents are required. This simplified method makes it easier to read for me and again, requires less typing, which is appreciated.

I took COMP 110 some semesters ago and although it was simple enough, I felt I had learned almost nothing about coding. Whereas in this
class, I felt as if I have already learned more about Python than I learned about Java in COMP110. I believe that the approach of
slowly moving up in concepts is an effective way to learn. For example, we first begin this class with very messy and lengthy code which
got the job done, like our first turtle exercise:

Then we learned new concepts such as loops and functions that helped us to shorten and clean up code.

I believe that I have done well in most of the exercises as I am already familiar with the concepts we have covered so far. However, I
am confident and that we will definitely cover things that I don't know and am excited to learn them.

Something that frustrated me was the Clicky Turtle Exercise.

Though my code was functioning as it was supposed to, there were a couple things that I wanted to do which I was not able to. The
first would be to have all user actions including clicks have no effect on the program until whatever action that was going on was
completed. This pesky bug was evident in everyone's programs as the user could never spam click the mouse or the turtle would go
haywire. The other thing I could not figure out was how to get the program to completely halt if the user clicked on a certain
quadrant. However, I recently looked back at this problem and thought of a solution that might possibly work, which was to set a boolean
variable at the top to True. If the user clicked on the 4th quadrant, the bool variable would be set to False. Then at the very bottom,
instead of this:

def clicky(x, y):
  tina.goto(x,y)
  checkquad(x, y)

myscreen.onclick(clicky)

we could have something like this:
def clicky(x, y):
  tina.goto(x,y)
  checkquad(x, y)

if boolvar == True:
  myscreen.onclick(clicky)
else:
  print("Program Ended")

Since I have not had the time to actually try to implement this, this is only something that theoretically works in my head.

My problem solving attitude is to keep working at the code until it works. In other classes, I often coded my assignments in one or two
long sessions that may have lasted up to 5-6 hours each. There have also been times where I was completely stuck and went to bed, only
to have an epiphany and jump straight back to coding.

My problem solving strategy is to look at each small individual problem to the larger problem. I will work on one function of one class
(or module or whatever we call it in Python) at a time and make sure that they each function correctly by testing them. When I run into
bugs, I always check my code for logical errors first, which is sometimes my downfall when it comes to large coding assignments. There
have been times where I have scaled through all of my code for hours looking for some logical error only to realize I left out a
bracket, mistyped a variable name, or some other stupid mistake.

Going off this, I feel like that one benefit of partner pairing is that other people can sometimes see your errors better than you can.

In this poetry slam, me and my partner had but one obstacle left, and according to the logic I used, I could not understand why the
code was not working. However, my partner was able to locate the error to be me accidentally declaring two variables inside a while
loop instead of outside of it, so that through each run of the loop, the variables would reset to whatever value I had set it to.


text:
package version

import (
	"fmt"
	"strings"

	"github.com/coreos/go-semver/semver"
)

var (
	Version = "0.0.0+wasnotbuiltproperly"
	SemVersion semver.Version
)

func init() {
	sv, err := semver.NewVersion(strings.TrimPrefix(Version, "v"))
	if err != nil {
		panic(fmt.Sprintf("bad version string: %v", err))
	}
	SemVersion = *sv
}


text:
package org.apache.flink.runtime.rpc.akka.exceptions;

import org.apache.flink.runtime.rpc.exceptions.RpcException;

/**
 * Base class for Akka RPC related exceptions.
 */
public class AkkaRpcException extends RpcException {

	private static final long serialVersionUID = -3796329968494146418L;

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

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

	public AkkaRpcException(Throwable cause) {
		super(cause);
	}
}


text:
tmp=$$
xls=*.xls
get_files.py $xls | sort > /tmp/${tmp}photos.txt
ls *.jpg | sort > /tmp/${tmp}files.txt
diff /tmp/${tmp}photos.txt /tmp/${tmp}files.txt # return code 0 if files match
photos_ok=$?

# this bit only needed when we upload files with skink ids
#for i in *L.jpg
#do
#	echo $(basename $i L.jpg) >> /tmp/${tmp}skinkfiles.txt
#done
#for i in *R.jpg
#do
#	echo $(basename $i R.jpg) >> /tmp/${tmp}skinkfiles.txt
#done
#sort /tmp/${tmp}skinkfiles.txt | uniq > /tmp/${tmp}skinkfiles1.txt
#get_skinks.py $xls | sort > /tmp/${tmp}skinks.txt
#diff /tmp/${tmp}skinks.txt /tmp/${tmp}skinkfiles1.txt # return code 0 if files match
#skinks_ok=$? 	# doesn't test for this on archive generation

# end of skink id only

archive=$(basename $xls .xls)
if [ $photos_ok -eq 0 ]
	then zip $archive *.jpg > /dev/null
	else echo $archive >&2	# put failure message on stderr, should appear on console even if traversing script is redirecting detailed error lists
fi

# tidy up temp files
#rm /tmp/${tmp}photos.txt /tmp/${tmp}files.txt /tmp/${tmp}skinkfiles.txt /tmp/${tmp}skinkfiles1.txt /tmp/${tmp}skinks.txt
rm /tmp/${tmp}photos.txt /tmp/${tmp}files.txt


text:
<?php

namespace RoyallTheFourth\QuickList\Action\Message\Edit;

use Psr\Http\Message\ResponseInterface;
use RoyallTheFourth\QuickList\Action\ActionInterface;
use function RoyallTheFourth\QuickList\Db\Message\oneById as message;
use RoyallTheFourth\QuickList\Layout\Message\Form;
use RoyallTheFourth\SmoothPdo\DataObject;
use Zend\Diactoros\Response\HtmlResponse;

final class Get implements ActionInterface
{
    private $db;
    private $messageId;
    private $webPrefix;

    public function __construct(DataObject $db, int $messageId, string $webPrefix)
    {
        $this->db = $db;
        $this->messageId = $messageId;
        $this->webPrefix = $webPrefix;
    }

    public function execute(): ResponseInterface
    {
        return new HtmlResponse(
            (new Form($this->webPrefix, message($this->db, $this->messageId)))
                ->render()
        );
    }
}


text:
from __future__ import unicode_literals

from django.db import models, migrations
import timer.models

class Migration(migrations.Migration):

    dependencies = [("timer", "0002_only_1_running_constraint_20150127_1512")]

    operations = [
        migrations.AlterField(
            model_name="timer",
            name="created",
            field=timer.models.CurrentTimestampDateTimeField(
                default=timer.models.postgres_now, verbose_name="created", editable=False
            ),
            preserve_default=True,
        ),
        migrations.AlterField(
            model_name="timer",
            name="modified",
            field=models.DateTimeField(auto_now=True, verbose_name="modified"),
            preserve_default=True,
        ),
        migrations.AlterField(
            model_name="timer",
            name="stopped",
            field=timer.models.CurrentTimestampDateTimeField(null=True, blank=True),
            preserve_default=True,
        ),
    ]


text:
/// <reference path='../../../third_party/typings/es6-promise/es6-promise.d.ts' />
/// <reference path='../../../third_party/freedom-typings/freedom-common.d.ts' />
/// <reference path='../../../third_party/freedom-typings/udp-socket.d.ts' />
/// <reference path='../../../third_party/freedom-typings/port-control.d.ts' />
/// <reference path='../../../third_party/ipaddrjs/ipaddrjs.d.ts' />

// TODO(ldixon): reorganize the utransformers and rename uproxy-obfuscators.
// Ideal:
//  import Transformer = require('uproxy-obfuscators/transformer');
// Current:
/// <reference path='../../../third_party/uTransformers/utransformers.d.ts' />

// TODO(ldixon): re-enable FTE and regex2dfa. But this time, start with a pre-
// computed set of DFAs because the regex2dfa.js library is 4MB in size. Also
// experiment with uglify and zip to see if that size drops significantly.
//
// import regex2dfa = require('regex2dfa');

// TODO(bwiley): Remove hardcoded caesar parameter flow

import arraybuffers = require('../arraybuffers/arraybuffers');
import candidate = require('./candidate');
import churn_pipe_types = require('../churn-pipe/freedom-module.interface');
import churn_types = require('./churn.types');
import handler = require('../handler/queue');
import ipaddr = require('ipaddr.js');
import logging = require('../logging/logging');
import net = require('../net/net.types');
import peerconnection = require('../webrtc/peerconnection');
import random = require('../crypto/random');
import signals = require('../webrtc/signals');

import ChurnSignallingMessage = churn_types.ChurnSignallingMessage;
import ChurnPipe = churn_pipe_types.freedom_ChurnPipe;
import MirrorMapping = churn_pipe_types.MirrorMapping;

import Candidate = candidate.Candidate;
import RTCIceCandidate = freedom_RTCPeerConnection.RTCIceCandidate;

var log :logging.Log = new logging.Log('churn');

export var filterCandidatesFromSdp = (sdp:string) : string => {
  return sdp.split('\n').filter((s) => {
    return s.indexOf('a=candidate') !== 0;
  }).join('\n');
}

  export interface NatPair {
    internal: net.Endpoint;
    external: net.Endpoint;
  }

  // This function implements a heuristic to select the single candidate
  // that is most likely to work for this connection.  The heuristic
  // expresses a preference ordering:
  // Most preferred: public IP address bound as a host candidate
  //  - rare outside of servers, but offers the very best connectivity
  // Next best: server-reflexive IP address
  //  - most common
  // Worst: private IP address in a host candidate
  //  - indicates that STUN has failed.  Connection is still possible
  //    if the other side is directly routable.
  // If none of these are present, the function will throw an exception.
  // This function is used only for legacy compatibility with older
  // CHURN endpoints.
  // TODO: remove this function once those CHURN endpoints are deprecated.
  export var selectBestPublicAddress = (candidates:Candidate[])
      : NatPair => {
    var score = (c:Candidate) : boolean[] => {
      var addr = ipaddr.process(c.ip);
      // List of selection criteria, from most important to least.
      return [
        c.protocol === 'udp',
        addr.kind() === 'ipv4',
        c.type === 'host' && addr.range() === 'unicast',
        c.type === 'srflx'
      ];
    };
    candidates.sort((a, b) : number => {
      var scoreA = score(a), scoreB = score(b);
      for (var i = 0; i < scoreA.length; ++i) {
        if (scoreA[i] && !scoreB[i]) {
          return -1;
        } else if (scoreB[i] && !scoreA[i]) {
          return 1;
        }
      }
      return 0;
    });

    var best = candidates[0];
    if (best.type === 'srflx') {
      return {
        internal: {
          address: best.relatedAddress,
          port: best.relatedPort
        },
        external: {
          address: best.ip,
          port: best.port
        }
      };
    } else if (best.type === 'host') {
      var endpoint = {
          address: best.ip,
          port: best.port
      };
      return {
        internal: endpoint,
        external: endpoint
      };
    }
    throw new Error('no srflx or host candidate found');
  };

  // Generates a key suitable for use with CaesarCipher, viz. 1-255.
  var generateCaesarKey_ = (): number => {
    try {
      return (random.randomUint32() % 255) + 1;
    } catch (e) {
      // https://github.com/uProxy/uproxy/issues/1593
      log.warn('crypto unavailable, using Math.random');
      return Math.floor((Math.random() * 255)) + 1;
    }
  }

  /**
   * A PeerConnection implementation that establishes obfuscated connections.
   *
   * DTLS packets are intercepted by pointing WebRTC at a local "forwarding"
   * port; connectivity to the remote host is achieved with the help of
   * the browser's STUN implementation.
   *
   * This is mostly a thin wrapper over PeerConnection except for the
   * magic required during setup.
   *
   * Right now, CaesarCipher is used with a key which is randomly generated
   * each time a new connection is negotiated.
   */
  export class Connection implements peerconnection.PeerConnection<ChurnSignallingMessage> {

    public peerOpenedChannelQueue :handler.QueueHandler<peerconnection.DataChannel, void>;
    public signalForPeerQueue :handler.Queue<ChurnSignallingMessage, void>;
    public peerName :string;

    public onceConnected :Promise<void>;
    public onceClosed :Promise<void>;

    // A short-lived connection used to determine network addresses on which
    // we might be able to communicate with the remote host.
    private probeConnection_
        :peerconnection.PeerConnection<signals.Message>;

    // The obfuscated connection.
    private obfuscatedConnection_
        :peerconnection.PeerConnection<signals.Message>;

    // All candidates received from the remote peer, organized by their
    // connection address.
    private remoteCandidates_ :{
      [address:string]: {
        [port:number]: Candidate
      }
    } = {};

    // Fulfills once we know the obfuscation key for caesar cipher.
    private haveCaesarKey_ :(key:number) => void;
    private onceHaveCaesarKey_ = new Promise((F, R) => {
      this.haveCaesarKey_ = F;
    });

    private pipe_ :ChurnPipe;
    private havePipe_ :() => void;
    private onceHavePipe_ = new Promise((F,R) => {
      this.havePipe_ = F;
    });

    private portControl_ :freedom_PortControl.PortControl;

    private static internalConnectionId_ = 0;

    constructor(probeRtcPc:freedom_RTCPeerConnection.RTCPeerConnection,
                peerName?:string,
                private skipPublicEndpoint_?:boolean) {
      this.peerName = peerName || 'churn-connection-' +
          (++Connection.internalConnectionId_);

      this.signalForPeerQueue = new handler.Queue<ChurnSignallingMessage,void>();

      this.portControl_ = freedom['portControl']();

      this.configureObfuscatedConnection_();
      this.configureProbeConnection_(probeRtcPc);
      this.onceHaveCaesarKey_.then(this.configurePipe_);

      // Forward onceXxx promises.
      this.onceConnected = this.obfuscatedConnection_.onceConnected;
      this.onceClosed = this.obfuscatedConnection_.onceClosed;

      // Debugging.
      this.onceHaveCaesarKey_.then((key: number) => {
        log.info('%1: caesar key is %2', this.peerName, key);
      });
    }

    private configureProbeConnection_ = (
        freedomPc:freedom_RTCPeerConnection.RTCPeerConnection) => {
      var probePeerName = this.peerName + '-probe';

      // The list of all candidates returned by the probe connection.
      var candidates :Candidate[] = [];

      this.probeConnection_ = new peerconnection.PeerConnectionClass(
          freedomPc, probePeerName);
      this.probeConnection_.signalForPeerQueue.setSyncHandler(
          (message:signals.Message) => {
        if (message.type === signals.Type.CANDIDATE) {
          var c = Candidate.fromRTCIceCandidate(message.candidate);
          if (c.protocol === 'udp') {
            // Try to make port mappings for all srflx candidates
            var MAP_LIFETIME = 24 * 60 * 60;  // 24 hours in seconds
            if (c.type === 'srflx') {
              this.portControl_.addMapping(c.relatedPort, c.port, MAP_LIFETIME).
                  then((mapping:freedom_PortControl.Mapping) => {
                    if (mapping.externalPort === -1) {
                      log.debug("addMapping() failed.");
                    } else {
                      log.debug("addMapping() success: ", mapping);
                    }
                  });
            }

            // It's immediately safe to send each candidate to the remote peer,
            // because the remote peer will retry for several seconds, and the
            // probe connection will not respond to any pings because it doesn't
            // have a remote description.
            this.signalForPeerQueue.handle({
              webrtcMessage: message
            });

            // We cannot rebind any local ports until the probe connection has
            // released them, so we have to store them and wait until probing is
            // complete.
            candidates.push(c);
          }
        } else if (message.type === signals.Type.NO_MORE_CANDIDATES) {
          this.probeConnection_.close().then(() => {
            this.processProbeCandidates_(candidates);
          });
        }
      });
      this.probeConnection_.negotiateConnection();
    }

    private processProbeCandidates_ = (candidates:Candidate[]) => {
      this.onceHavePipe_.then(() => {
        candidates.forEach((c) => {
          this.pipe_.bindLocal(c.getLocalEndpoint());
        });

        // For backwards compatibility.
        if (!this.skipPublicEndpoint_) {
          var bestEndpointPair = selectBestPublicAddress(candidates);
          this.signalForPeerQueue.handle({
            publicEndpoint: bestEndpointPair.external
          });
        }
      });
    }

    private configurePipe_ = (key:number) : void => {
      this.pipe_ = freedom['churnPipe'](this.peerName);
      this.pipe_.on('mappingAdded', this.onMappingAdded_);
      /*this.pipe_.setTransformer('none',
          new Uint8Array([key]).buffer,
          '{}');*/
      /*this.pipe_.setTransformer('caesar',
          new Uint8Array([key]).buffer,
          '{}');*/
      /*this.pipe_.setTransformer('packetLengthExtender',
          new Uint8Array([key]).buffer,
          '{"fragmentation": true}');*/
      /*this.pipe_.setTransformer('packetLengthShortener',
          new Uint8Array([key]).buffer,
          '{"fragmentation": true}');*/
      /*this.pipe_.setTransformer('packetLengthNormalizer',
          new Uint8Array([key]).buffer,
          '{"targetLength": 1440}');*/
      /*this.pipe_.setTransformer('packetLengthNormalizer',
          new Uint8Array([key]).buffer,
          '{"targetLength": 1440, "fragmentation": true}');*/
      this.pipe_.setTransformer('packetLengthUniformRandomizer',
          new Uint8Array([key]).buffer,
          '{"targetMinimum": 37, "targetMaximum": 1440, "fragmentation": true}');
      /*this.pipe_.setTransformer('packetLengthPassthrough',
          new Uint8Array([key]).buffer,
          '{"fragmentation": true}');*/
      /*var targetDistribution=this.makeSampleTargetLengthDistribution_();
      this.pipe_.setTransformer('packetLengthMultinomialRandomizer',
          new Uint8Array([key]).buffer,
          JSON.stringify({"targetDistribution": targetDistribution}));*/
      // TODO(ldixon): re-enable FTE support instead of caesar cipher.
      //     'fte',
      //     arraybuffers.stringToArrayBuffer('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'),
      //     JSON.stringify({
      //       'plaintext_dfa': regex2dfa('^.*$'),
      //       'plaintext_max_len': 1400,
      //       // This is equivalent to Rabbit cipher.
      //       'ciphertext_dfa': regex2dfa('^.*$'),
      //       'ciphertext_max_len': 1450
      //     }

      this.havePipe_();
    }

    private makeSampleTargetLengthDistribution_ = () : Array<number> => {
      var result : Array<number> =[];
      var prob = 1 / 1440;
      var index=0;
      while(index<1440) {
        result.push(prob);
      }

      return result;
    }

    private addRemoteCandidate_ = (iceCandidate:RTCIceCandidate) => {
      var c = Candidate.fromRTCIceCandidate(iceCandidate);
      var remoteEndpoint = {
        address: c.ip,
        port: c.port
      };
      if (!this.remoteCandidates_[remoteEndpoint.address]) {
        this.remoteCandidates_[remoteEndpoint.address] = {};
      }
      this.remoteCandidates_[remoteEndpoint.address][remoteEndpoint.port] = c;
      this.onceHavePipe_.then(() => {
        this.pipe_.bindRemote(remoteEndpoint).catch(log.error);
      });
    }

    // Returns the remote side Candidate that advertises this endpoint.
    // This is used to recover the entire candidate when a new mapping is
    // added, in order to convey the right candidate metadata (priority,
    // generation, etc.) to the obfuscated connection.
    private getRemoteCandidate_ = (endpoint:net.Endpoint) : Candidate => {
      return this.remoteCandidates_[endpoint.address] &&
          this.remoteCandidates_[endpoint.address][endpoint.port];
    }

    // A new mirror socket has been created.  (Each call to churn-pipe's
    // bindLocal and bindRemote methods may trigger the creation of one
    // or more mirror sockets.)  Wrap it into a virtual remote ICE candidate
    // and signal it to the obfuscated connection.
    private onMappingAdded_ = (mapping:MirrorMapping) => {
      var original = this.getRemoteCandidate_(mapping.remote);
      if (original) {
        var copy = original.clone();
        copy.ip = mapping.local.address;
        copy.port = mapping.local.port;
        this.obfuscatedConnection_.handleSignalMessage({
          type: signals.Type.CANDIDATE,
          candidate: copy.toRTCIceCandidate()
        });
      } else {
        log.error('Got a mapping for a nonexistent candidate');
      }
    }

    private configureObfuscatedConnection_ = () => {
      // We use an empty configuration to ensure that no STUN servers are pinged.
      var obfConfig :freedom_RTCPeerConnection.RTCConfiguration = {
        iceServers: []
      };
      var obfPeerName = this.peerName + '-obfuscated';
      var freedomPc = freedom['core.rtcpeerconnection'](obfConfig);
      this.obfuscatedConnection_ = new peerconnection.PeerConnectionClass(
          freedomPc, obfPeerName);
      this.obfuscatedConnection_.signalForPeerQueue.setSyncHandler(
          (message:signals.Message) => {
        if (message.type === signals.Type.OFFER ||
            message.type === signals.Type.ANSWER) {
          // Super-paranoid check: remove candidates from SDP messages.
          // This can happen if a connection is re-negotiated.
          // TODO: We can safely remove this once we can reliably interrogate
          //       peerconnection endpoints.
          message.description.sdp =
              filterCandidatesFromSdp(message.description.sdp);
          var churnSignal :ChurnSignallingMessage = {
            webrtcMessage: message
          };
          this.signalForPeerQueue.handle(churnSignal);
        } else if (message.type === signals.Type.CANDIDATE) {
          // This will tell us on which port webrtc is operating.
          // There's no need to send this to the peer because it can
          // trivially formulate a candidate line with the address of
          // its pipe.
          try {
            if (!message.candidate || !message.candidate.candidate) {
              throw new Error('no candidate line');
            }
            var c = Candidate.fromRTCIceCandidate(message.candidate);
            if (c.protocol !== 'udp') {
              throw new Error('Wrong transport: ' + c.protocol);
            }
            var browserEndpoint = c.getLocalEndpoint();
            this.onceHavePipe_.then(() => {
              this.pipe_.addBrowserEndpoint(browserEndpoint);
            });
          } catch (e) {
            log.debug('%1: ignoring candidate line %2: %3',
                this.peerName,
                JSON.stringify(message),
                e.message);
          }
        }
      });
      this.peerOpenedChannelQueue =
          this.obfuscatedConnection_.peerOpenedChannelQueue;
    }

    public negotiateConnection = () : Promise<void> => {
      // Generate a key and send it to the remote party.
      // Once they've received it, they'll be able to establish
      // a matching pipe.
      var key = generateCaesarKey_();
      this.haveCaesarKey_(key);
      this.signalForPeerQueue.handle({
        caesar: key
      });
      return this.obfuscatedConnection_.negotiateConnection();
    }

    private static rtcIceCandidateFromPublicEndpoint_ =
        (endpoint:net.Endpoint) : RTCIceCandidate => {
      var c = Candidate.fromRTCIceCandidate({
        candidate: 'candidate:0 1 UDP 2130379007 0.0.0.0 0 typ host',
        sdpMid: '',
        sdpMLineIndex: 0
      });
      c.ip = endpoint.address;
      c.port = endpoint.port;
      return c.toRTCIceCandidate();
    }

    // Forward the message to the relevant stage: churn-pipe or obfuscated.
    // In the case of obfuscated signalling channel messages, we inject our
    // local forwarding socket's endpoint.
    public handleSignalMessage = (
        churnMessage:ChurnSignallingMessage) : void => {
      if (churnMessage.publicEndpoint !== undefined) {
        var fakeRTCIceCandidate = Connection.rtcIceCandidateFromPublicEndpoint_(
            churnMessage.publicEndpoint);
        this.addRemoteCandidate_(fakeRTCIceCandidate);
      }
      if (churnMessage.caesar !== undefined) {
        this.haveCaesarKey_(churnMessage.caesar);
      }
      if (churnMessage.webrtcMessage) {
        var message = churnMessage.webrtcMessage;
        if (message.type == signals.Type.OFFER ||
            message.type == signals.Type.ANSWER) {
          // Remove candidates from the SDP.  This is redundant, but ensures
          // that a bug in the remote client won't cause us to send
          // unobfuscated traffic.
          message.description.sdp = filterCandidatesFromSdp(
              message.description.sdp);
          this.obfuscatedConnection_.handleSignalMessage(message);
        } else if (message.type === signals.Type.CANDIDATE) {
          this.addRemoteCandidate_(message.candidate);
        }
      }
    }

    public openDataChannel = (channelLabel:string,
        options?:freedom_RTCPeerConnection.RTCDataChannelInit)
        : Promise<peerconnection.DataChannel> => {
      return this.obfuscatedConnection_.openDataChannel(channelLabel);
    }

    public close = () : Promise<void> => {
      return this.obfuscatedConnection_.close();
    }

    public toString = () : string => {
      return this.obfuscatedConnection_.toString();
    };
  }


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

package net.codemirror.lib;

import com.google.gwt.core.client.JavaScriptObject;

/**
 * Simple map-like structure to pass configuration to CodeMirror.
 *
 * @see CodeMirror config
 * @see CodeMirror#create(com.google.gwt.dom.client.Element, Configuration)
 */
public class Configuration extends JavaScriptObject {
  public static Configuration create() {
    return createObject().cast();
  }

  public final native Configuration set(String name, String val)
      /*-{ this[name] = val; return this; }-*/ ;

  public final native Configuration set(String name, int val)
      /*-{ this[name] = val; return this; }-*/ ;

  public final native Configuration set(String name, double val)
      /*-{ this[name] = val; return this; }-*/ ;

  public final native Configuration set(String name, boolean val)
      /*-{ this[name] = val; return this; }-*/ ;

  public final native Configuration set(String name, JavaScriptObject val)
      /*-{ this[name] = val; return this; }-*/ ;

  protected Configuration() {}
}


text:
Ext.define('Jarvus.util.DAVClient', {
    requires: [
        'Jarvus.util.API'
    ],
    mixins: [
        'Ext.mixin.Observable'
    ],

    config: {
        /**
         * @cfg The {Ext.data.Connection} instance that will process requests
         * @required
         */
        connection: 'Jarvus.util.API',

        /**
         * @cfg Optional base URI to prepend DAV paths with
         */
        baseUri: null
    },

    /**
     * Automatically inject "connection" class into requires
     */
    onClassExtended: function(cls, data, hooks) {
        var connection = data.connection || data.config && data.config.connection,
            onBeforeClassCreated;

        if (typeof connection === 'string') {
            onBeforeClassCreated = hooks.onBeforeCreated;

            hooks.onBeforeCreated = function() {
                var me = this,
                    args = arguments;

                Ext.require(connection, function() {
                    onBeforeClassCreated.apply(me, args);
                });
            };
        }
    },

    constructor: function(config) {
        var me = this;

        me.mixins.observable.constructor.call(me, config);
    },

    /**
     * Convert "connection" class into constructor reference
     */
    applyConnection: function(connection) {
        if (typeof connection == 'string') {
            Ext.syncRequire(connection);
            connection = Ext.ClassManager.get(connection);
        }

        return connection;
    },

    applyBaseUri: function(baseUri) {
        return baseUri ? baseUri.replace(/\/*$/, '') : null;
    },

    buildUrl: function(url) {
        var baseUri = this.getBaseUri();

        if (baseUri) {
            url = baseUri + '/' + url.replace(/^\/*/, '');
        }

        return url;
    },

    request: function(options) {
        options.url = this.buildUrl(options.url);

        return this.getConnection().request(options);
    },

    // DAV operations
    downloadFile: function(url, callback, scope) {
        var options = Ext.isString(url) ? { url: url } : url,
            headers = options.headers || (options.headers = {});

        if (options.revision) {
            headers['X-Revision-ID'] = options.revision;
        }

        if (!headers.Accept) {
            headers.Accept = '*/*';
        }

        return this.request(Ext.applyIf({
            method: 'GET',
            callback: callback,
            scope: scope
        }, options));
    },

    uploadFile: function(url, content, callback, scope) {
        var options = Ext.isString(url) ? { url: url } : url,
            headers = options.headers || (options.headers = {});

        if (options.ancestor) {
            headers['X-Ancestor-ID'] = options.ancestor;
        }

        return this.request(Ext.applyIf({
            method: 'PUT',
            rawData: content,
            callback: callback,
            scope: scope
        }, options));
    },

    move: function(url, toUrl, callback, scope) {
        var options = Ext.isString(url) ? { url: url } : url,
            headers = options.headers || (options.headers = {});

        headers.Destination = this.buildUrl(toUrl);

        return this.request(Ext.applyIf({
            method: 'MOVE',
            callback: callback,
            scope: scope
        }, options));
    },

    delete: function(url, callback, scope) {
        var options = Ext.isString(url) ? { url: url } : url;

        return this.request(Ext.applyIf({
            method: 'DELETE',
            callback: callback,
            scope: scope
        }, options));
    },

    createCollection: function(url, callback, scope) {
        var options = Ext.isString(url) ? { url: url } : url;

        return this.request(Ext.applyIf({
            method: 'MKCOL',
            callback: callback,
            scope: scope
        }, options));
    }
});


text:
package net.padaf.preflight;

import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;

import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;

public class IsartorTargetFileInformation {

  protected File targetFile = null;

  protected String expectedError = null;

  public IsartorTargetFileInformation(File targetFile, String expectedError) {
    this.targetFile = targetFile;
    this.expectedError = expectedError;
  }

  public File getTargetFile() {
    return targetFile;
  }

  public String getExpectedError() {
    return expectedError;
  }

  public static List<IsartorTargetFileInformation> loadConfiguration(File root)
      throws Exception {
    // load config
    InputStream expected = IsartorTargetFileInformation.class
        .getResourceAsStream("/expected_errors.txt");
    Properties props = new Properties();
    props.load(expected);
    // list files
    List<IsartorTargetFileInformation> result = new ArrayList<IsartorTargetFileInformation>();
    if (root.isDirectory()) {
      Collection<?> col = FileUtils.listFiles(root, new String[] { "pdf" },
          true);
      for (Object o : col) {
        File file = (File) o;
        IsartorTargetFileInformation info = getInformation(file, props);
        if (info == null) {
          continue;
        }
        result.add(info);
      }
    } else if (root.isFile()) {
      result.add(getInformation(root, props));
    }
    return result;
  }

  protected static IsartorTargetFileInformation getInformation(File file,
      Properties props) {
    Logger logger = Logger.getLogger("test.isartor");
    String key = file.getName();
    String line = props.getProperty(key);
    if (line != null) {
      // only one parameter for the moment
      String error = new StringTokenizer(line, "//").nextToken().trim();
      return new IsartorTargetFileInformation(file, error);
    } else {
      logger.error("There is no expected error for " + key);
      return null;
    }

  }

}


text:
package mx.infotec.dads.kukulkan.engine.repository;

import org.springframework.data.mongodb.repository.MongoRepository;

import mx.infotec.dads.kukulkan.engine.domain.core.DataStore;

/**
 * DataStoreRepository
 *
 * @author Daniel Cortes Pichardo
 *
 */
public interface DataStoreRepository extends MongoRepository<DataStore, String> {

}


text:
require 'rails_helper'

def login_and_assign_reviewer(user, assignment_id, student_num, submission_num)
  login_as(user)
  visit "/assignments/#{assignment_id}/edit"
  find_link('ReviewStrategy').click
  select "Instructor-Selected", from: 'assignment_form_assignment_review_assignment_strategy'
  fill_in 'num_reviews_per_student', with: student_num
  choose 'num_reviews_submission'
  fill_in 'num_reviews_per_submission', with: submission_num
  click_on('Assign reviewers')
end

def add_reviewer(student_name)
  fill_in 'user_name', with: student_name
  click_on 'Add Reviewer'
  expect(page).to have_content student_name
end

def add_matareviewer(student_name)
  fill_in 'user_name', with: student_name
  click_on 'Add Metareviewer'
  expect(page).to have_content student_name
end

describe "review mapping", js: true do
  before(:each) do
    @assignment = create(:assignment, name: "automatic review mapping test", max_team_size: 4)
    create(:assignment_node)
    create(:deadline_type, name: "submission")
    create(:deadline_type, name: "review")
    create(:deadline_type, name: "metareview")
    create(:deadline_type, name: "drop_topic")
    create(:deadline_type, name: "signup")
    create(:deadline_type, name: "team_formation")
    create(:deadline_right)
    create(:deadline_right, name: 'Late')
    create(:deadline_right, name: 'OK')

    (1..10).each do |i|
      student = create :student, name: 'student' + i.to_s
      create :participant, assignment: @assignment, user: student
      if i % 3 == 1 and i != 10
        instance_variable_set('@team' + (i / 3 + 1).to_s, create(:assignment_team, name: 'team' + i.to_s))
        @team = instance_variable_get('@team' + (i / 3 + 1).to_s)
      end
      create :team_user, user: student, team: @team
    end
  end

  it "can add reviewer then delete it" do
    @student_reviewer = create :student, name: 'student_reviewer'
    @participant_reviewer = create :participant, assignment: @assignment, user: @student_reviewer
    @student_reviewer2 = create :student, name: 'student_reviewer2'
    @participant_reviewer2 = create :participant, assignment: @assignment, user: @student_reviewer2
    login_and_assign_reviewer("instructor6", @assignment.id, 0, 0)

    # add_reviewer
    first(:link, 'add reviewer').click
    add_reviewer(@student_reviewer.name)
    expect(page).to have_content @student_reviewer.name
    click_link('delete')
    expect(page).to have_content "The review mapping for \"#{@team1.name}\" and \"#{@student_reviewer.name}\" has been deleted"

    # add_meta_reviewer
    first(:link, 'add reviewer').click
    add_reviewer(@student_reviewer.name)
    click_link('add metareviewer')
    add_matareviewer(@student_reviewer2.name)
    expect(page).to have_content @student_reviewer2.name
    # delete_meta_reviewer
    find(:xpath, "//a[@href='/review_mapping/delete_metareviewer?id=3']").click
    expect(page).to have_content "The metareview mapping for #{@student_reviewer.name} and #{@student_reviewer2.name} has been deleted"

    click_link('add metareviewer')
    add_matareviewer(@student_reviewer2.name)
    # delete_all_meta_reviewer
    click_link('delete all metareviewers')
    expect(page).to have_content "All metareview mappings for contributor \"#{@team1.name}\" and reviewer \"#{@student_reviewer.name}\" have been deleted"

    first(:link, 'delete outstanding reviewers').click
    expect(page).to have_content "All review mappings for \"#{@team1.name}\" have been deleted"
  end

  it "show error when assign both 2" do
    login_and_assign_reviewer("instructor6", @assignment.id, 2, 2)
    expect(page).to have_content('Please choose either the number of reviews per student or the number of reviewers per team (student), not both')
  end

  it "show error when assign both 0" do
    login_and_assign_reviewer("instructor6", @assignment.id, 0, 0)
    expect(page).to have_content('Please choose either the number of reviews per student or the number of reviewers per team (student)')
  end

  it "calculate review mapping from given review number per student" do
    skip('skip test on automated review mapping, too time consuming')
    login_and_assign_reviewer("instructor6", @assignment.id, 2, 0)
    num = ReviewResponseMap.where(reviewee_id: 1, reviewed_object_id: 1).count
    expect(num).to eq(7)
  end

  it "calculate reviewmapping from given review number per submission" do
    login_and_assign_reviewer("instructor6", @assignment.id, 0, 7)
    num = ReviewResponseMap.where(reviewer_id: 1, reviewed_object_id: 1).count
    expect(num).to eq(2)
  end
end


text:
/* SPDX-License-Identifier: MIT */

#include "syscall.h"
#include <liburing.h>

int io_uring_enter(unsigned int fd, unsigned int to_submit,
		   unsigned int min_complete, unsigned int flags, sigset_t *sig)
{
	return __sys_io_uring_enter(fd, to_submit, min_complete, flags, sig);
}

int io_uring_enter2(unsigned int fd, unsigned int to_submit,
		    unsigned int min_complete, unsigned int flags,
		    sigset_t *sig, size_t sz)
{
	return __sys_io_uring_enter2(fd, to_submit, min_complete, flags, sig,
				     sz);
}

int io_uring_setup(unsigned int entries, struct io_uring_params *p)
{
	return __sys_io_uring_setup(entries, p);
}

int io_uring_register(unsigned int fd, unsigned int opcode, const void *arg,
		      unsigned int nr_args)
{
	return __sys_io_uring_register(fd, opcode, arg, nr_args);
}


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

namespace NMF.Expressions
{
    [AttributeUsage(AttributeTargets.Method)]
    public class ParameterDependencyAttribute : Attribute
    {
        public string Parameter { get; private set; }

        public string Member { get; set; }
        public bool IsNestedMember { get; private set; }

        public ParameterDependencyAttribute(string parameter, string member) : this(parameter, member, false) { }

        public ParameterDependencyAttribute(string parameter, string member, bool isNested)
        {
            Parameter = parameter;
            Member = member;
            IsNestedMember = isNested;
        }
    }
}


text:
<!DOCTYPE html>

							BioSamples

						<form id="local-search" name="local-search" th:action="@{/samples}" method="get">
							<fieldset>

									<input type="text" name="text" id="local-searchbox" placeholder="Search" class="input-group-field" th:value="${param.text}" />

<input type="submit" class="button icon icon-functional" value="1" >

									leukaemia,
									viridiplantae,
									sheep liver

							</fieldset>
						</form>

Home

Search

Upload

Graph Search

Submit

Documentation

About


text:
<?php

namespace ZendTest\Db\Adapter;

use Zend\ServiceManager\ServiceManager;
use Zend\Mvc\Service\ServiceManagerConfig;

class AdapterAbstractServiceFactoryTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \Zend\ServiceManager\ServiceLocatorInterface
     */
    private $serviceManager;

    /**
     * Set up service manager and database configuration.
     *
     * @see PHPUnit_Framework_TestCase::setUp()
     */
    protected function setUp()
    {
        $this->serviceManager = new ServiceManager(new ServiceManagerConfig(array(
            'abstract_factories' => array('Zend\Db\Adapter\AdapterAbstractServiceFactory'),
        )));

        $this->serviceManager->setService('Config', array(
            'db' => array(
                'adapters' => array(
                    'Zend\Db\Adapter\Writer' => array(
                        'driver' => 'mysqli',
                    ),
                    'Zend\Db\Adapter\Reader' => array(
                        'driver' => 'mysqli',
                    ),
                ),
            ),
        ));
    }

    /**
     * @return array
     */
    public function providerValidService()
    {
        return array(
            array('Zend\Db\Adapter\Writer'),
            array('Zend\Db\Adapter\Reader'),
        );
    }

    /**
     * @return array
     */
    public function providerInvalidService()
    {
        return array(
            array('Zend\Db\Adapter\Unknown'),
        );
    }

    /**
     * @param string $service
     * @dataProvider providerValidService
     */
    public function testValidService($service)
    {
        $actual = $this->serviceManager->get($service);
        $this->assertInstanceOf('Zend\Db\Adapter\Adapter', $actual);
    }

    /**
     * @param string $service
     * @dataProvider providerInvalidService
     * @expectedException \Zend\ServiceManager\Exception\ServiceNotFoundException
     */
    public function testInvalidService($service)
    {
        $actual = $this->serviceManager->get($service);
    }
}


text:
from . import common
import os

class test_status(common.basetest):
    def test_empty(self):
        self.assertEquals(self.client.status(), [])

    def test_one_of_each(self):
        self.append('.hgignore', 'ignored')
        self.append('ignored', 'a')
        self.append('clean', 'a')
        self.append('modified', 'a')
        self.append('removed', 'a')
        self.append('missing', 'a')
        self.client.commit('first', addremove=True)
        self.append('modified', 'a')
        self.append('added', 'a')
        self.client.add(['added'])
        os.remove('missing')
        self.client.remove(['removed'])
        self.append('untracked')

        l = [('M', 'modified'),
             ('A', 'added'),
             ('R', 'removed'),
             ('C', '.hgignore'),
             ('C', 'clean'),
             ('!', 'missing'),
             ('?', 'untracked'),
             ('I', 'ignored')]

        st = self.client.status(all=True)

        for i in l:
            self.assertTrue(i in st)

    def test_copy(self):
        self.append('source', 'a')
        self.client.commit('first', addremove=True)
        self.client.copy('source', 'dest')
        l = [('A', 'dest'), (' ', 'source')]
        self.assertEquals(self.client.status(copies=True), l)

    def test_copy_origin_space(self):
        self.append('s ource', 'a')
        self.client.commit('first', addremove=True)
        self.client.copy('s ource', 'dest')
        l = [('A', 'dest'), (' ', 's ource')]
        self.assertEquals(self.client.status(copies=True), l)


text:
package controller

import (
	"sigs.k8s.io/controller-runtime/pkg/manager"

	"istio.io/operator/pkg/controller/istiocontrolplane"
)

// AddToManager adds all Controllers to the Manager
func AddToManager(m manager.Manager) error {
	return istiocontrolplane.Add(m)
}


text:
package org.apache.isis.viewer.bdd.common.fixtures.perform.checkthat.collections;

import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.consent.Consent;
import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
import org.apache.isis.viewer.bdd.common.fixtures.perform.PerformContext;
import org.apache.isis.viewer.bdd.common.fixtures.perform.checkthat.AssertsValidity;
import org.apache.isis.viewer.bdd.common.fixtures.perform.checkthat.ProposedArgumentValidityAbstract;

public class ProposedAddTo extends ProposedArgumentValidityAbstract {

    public ProposedAddTo(final AssertsValidity assertion) {
        super(assertion);
    }

    @Override
    protected Consent determineConsent(final PerformContext performContext, final ObjectAdapter toValidateAdapter) {

        final ObjectAdapter onAdapter = performContext.getOnAdapter();
        final OneToManyAssociation otma = (OneToManyAssociation) performContext.getObjectMember();

        return otma.isValidToAdd(onAdapter, toValidateAdapter);
    }

}


text:
The following certificates are used within the cucumber-tests-platform project

- test-org.pfx
  Copied from github.com/OSGP/Config/certificates/osgp-ca/certs
  Used to be added to a request when sending that request to a platform.
  This is a test certificate which is selfsigned. Used for development/testing purposes only.

- oslp_sim_ecda_private.der
  Copied from github.com/OSGP/Config/certificates/osgp/
  Used within the OSLP MockServer when running the tests

- oslp_test_ecda_private.der
  Copied from github.com/OSGP/Config/certificates/osgp/
  Used within the OSLP MockServer when running the tests