text:
package com.netflix.metacat.connector.cassandra;

import com.datastax.driver.core.Cluster;
import com.google.common.collect.Lists;
import com.netflix.metacat.common.server.connectors.DefaultConnectorFactory;
import lombok.NonNull;

import javax.annotation.Nonnull;
import java.util.Map;

/**
 * Cassandra implementation of a connector factory.
 *
 * @author tgianos
 * @since 1.0.0
 */
class CassandraConnectorFactory extends DefaultConnectorFactory {

    /**
     * Constructor.
     *
     * @param name              The catalog name
     * @param catalogShardName  The catalog shard name
     * @param configuration     The catalog configuration
     */
    CassandraConnectorFactory(
        @Nonnull @NonNull final String name,
        @Nonnull @NonNull final String catalogShardName,
        @Nonnull @NonNull final Map<String, String> configuration
    ) {
        super(name, catalogShardName,
            Lists.newArrayList(new CassandraConnectorModule(catalogShardName, configuration)));
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void stop() {
        super.stop();
        // Stop the cassandra cluster
        final Cluster cluster = this.getInjector().getInstance(Cluster.class);
        if (cluster != null) {
            cluster.close();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.dynmap.fabric_1_14_4;

import org.dynmap.DynmapCore;
import org.dynmap.Log;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class VersionCheck {
    private static final String VERSION_URL = "http://mikeprimm.com/dynmap/releases.php";

    public static void runCheck(final DynmapCore core) {
        new Thread(new Runnable() {
            public void run() {
                doCheck(core);
            }
        }).start();
    }

    private static int getReleaseVersion(String s) {
        int index = s.lastIndexOf('-');
        if (index < 0)
            index = s.lastIndexOf('.');
        if (index >= 0)
            s = s.substring(0, index);
        String[] split = s.split("\\.");
        int v = 0;
        try {
            for (int i = 0; (i < split.length) && (i < 3); i++) {
                v += Integer.parseInt(split[i]) << (8 * (2 - i));
            }
        } catch (NumberFormatException nfx) {
        }
        return v;
    }

    private static int getBuildNumber(String s) {
        int index = s.lastIndexOf('-');
        if (index < 0)
            index = s.lastIndexOf('.');
        if (index >= 0)
            s = s.substring(index + 1);
        try {
            return Integer.parseInt(s);
        } catch (NumberFormatException nfx) {
            return 99999999;
        }
    }

    private static void doCheck(DynmapCore core) {
        String pluginver = core.getDynmapPluginVersion();
        String platform = core.getDynmapPluginPlatform();
        String platver = core.getDynmapPluginPlatformVersion();
        if ((pluginver == null) || (platform == null) || (platver == null))
            return;
        HttpURLConnection conn = null;
        String loc = VERSION_URL;
        int cur_ver = getReleaseVersion(pluginver);
        int cur_bn = getBuildNumber(pluginver);
        try {
            while ((loc != null) && (!loc.isEmpty())) {
                URL url = new URL(loc);
                conn = (HttpURLConnection) url.openConnection();
                conn.setRequestProperty("User-Agent", "Dynmap (" + platform + "/" + platver + "/" + pluginver);
                conn.connect();
                loc = conn.getHeaderField("Location");
            }
            BufferedReader rdr = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String line = null;
            while ((line = rdr.readLine()) != null) {
                String[] split = line.split(":");
                if (split.length < 4) continue;
                /* If our platform and version, or wildcard platform version */
                if (split[0].equals(platform) && (split[1].equals("*") || split[1].equals(platver))) {
                    int recommended_ver = getReleaseVersion(split[2]);
                    int recommended_bn = getBuildNumber(split[2]);
                    if ((recommended_ver > cur_ver) || ((recommended_ver == cur_ver) && (recommended_bn > cur_bn))) { /* Newer recommended build */
                        Log.info("Version obsolete: new recommended version " + split[2] + " is available.");
                    } else if (cur_ver > recommended_ver) {    /* Running dev or prerelease? */
                        int prerel_ver = getReleaseVersion(split[3]);
                        int prerel_bn = getBuildNumber(split[3]);
                        if ((prerel_ver > cur_ver) || ((prerel_ver == cur_ver) && (prerel_bn > cur_bn))) {
                            Log.info("Version obsolete: new prerelease version " + split[3] + " is available.");
                        }
                    }
                }
            }
        } catch (Exception x) {
            Log.info("Error checking for latest version");
        } finally {
            if (conn != null) {
                conn.disconnect();
            }
        }
    }
}


text: package com.ibm.watson.developer_cloud;


text:
import { console } from "console";
import _ from "lodash";

const josh = {
  name: 'Josh',
  age: 35,
  greet: function (greeting: string) {
    console.log(`${this.name} says ${greeting}`);
  }
};

logMethodCalls(josh);

josh.greet("Hello");

function logMethodCalls<T extends Object>(obj: T) {
  for (let propName in obj) {
    if (!obj.hasOwnProperty(propName)) continue;

    const func = obj[propName];

    if (_.isFunction(func)) {
      obj[propName] = createLoggedMethod(func);
    }
  }

  return obj;
}

function createLoggedMethod<T extends Function>(func: T) {
  return new Proxy(func, {
    apply: function (target, thisArg, argumentList) {
      console.log(`[TRACE]: ${target.name}: ${argumentList}`);

      return target.apply(thisArg, argumentList);
    }
  });
}


text:
package be.ephec.nsjc.jws.controller;

import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;

import be.ephec.nsjc.jws.model.HTTPTrace;
import be.ephec.nsjc.jws.view.AbstractView;

public class JWSController {

	private AbstractView view;
	private HTTPTrace trace;

	public JWSController(HTTPTrace trace) {
		this.trace = trace;
	}

	public void logToView(String log){
		view.log(log);
	}

	public void handleInput(String reqLine) throws IOException{
		InetAddress locale = InetAddress.getByName("0:0:0:0:0:0:0:1");
		Socket s = new Socket(locale, 6587);
		String toSend = reqLine + "\r\nUser-Agent: JWS Client/1.0\r\n\r\n";
		s.getOutputStream().write(toSend.getBytes());
		s.close();
	}

	public void setView(AbstractView v){
		this.view = v;
	}

}


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

using BizHawk.Common;
using BizHawk.Emulation.Common;

namespace BizHawk.Client.Common
{
	public class Controller : IController
	{
		public Controller(ControllerDefinition definition)
		{
			_type = definition;
			for (int i = 0; i < _type.FloatControls.Count; i++)
			{
				_floatButtons[_type.FloatControls[i]] = _type.FloatRanges[i].Mid;
				_floatRanges[_type.FloatControls[i]] = _type.FloatRanges[i];
			}
		}

		public ControllerDefinition Definition => _type;

		public bool IsPressed(string button)
		{
			return _buttons[button];
		}

		public float GetFloat(string name)
		{
			return _floatButtons[name];
		}

		private readonly WorkingDictionary<string, List<string>> _bindings = new WorkingDictionary<string, List<string>>();
		private readonly WorkingDictionary<string, bool> _buttons = new WorkingDictionary<string, bool>();
		private readonly WorkingDictionary<string, float> _floatButtons = new WorkingDictionary<string, float>();
		private readonly Dictionary<string, ControllerDefinition.FloatRange> _floatRanges = new WorkingDictionary<string, ControllerDefinition.FloatRange>();
		private readonly Dictionary<string, Config.AnalogBind> _floatBinds = new Dictionary<string, Config.AnalogBind>();

		private ControllerDefinition _type;

		/// <summary>don't do this</summary>
		public void ForceType(ControllerDefinition newtype) { _type = newtype; }

		public bool this[string button] => IsPressed(button);

		public bool AnyPressed
		{
			get
			{
				if (_buttons.Any(b => b.Value))
				{
					return true;
				}

				return _floatButtons.Any(b => b.Value != 0);
			}
		}

		// Looks for bindings which are activated by the supplied physical button.
		public List<string> SearchBindings(string button)
		{
			return (from kvp in _bindings from boundButton in kvp.Value where boundButton == button select kvp.Key).ToList();
		}

		// Searches bindings for the controller and returns true if this binding is mapped somewhere in this controller
		public bool HasBinding(string button)
		{
			return _bindings.SelectMany(kvp => kvp.Value).Any(boundButton => boundButton == button);
		}

		public void NormalizeFloats(IController controller)
		{
			foreach (var kvp in _floatBinds)
			{
				var input = _floatButtons[kvp.Key];
				string outkey = kvp.Key;
				float multiplier = kvp.Value.Mult;
				float deadzone = kvp.Value.Deadzone;
				ControllerDefinition.FloatRange range;
				if (_floatRanges.TryGetValue(outkey, out range))
				{
					// input range is assumed to be -10000,0,10000

					// first, modify for deadzone
					{
						float absinput = Math.Abs(input);
						float zeropoint = deadzone * 10000.0f;
						if (absinput < zeropoint)
						{
							input = 0.0f;
						}
						else
						{
							absinput -= zeropoint;
							absinput *= 10000.0f;
							absinput /= 10000.0f - zeropoint;
							input = absinput * Math.Sign(input);
						}
					}

					// zero 09-mar-2015 - not sure if adding + 1 here is correct.. but... maybe?
					var output = (((input * multiplier) + 10000.0f) * (range.Max - range.Min + 1) / 20000.0f) + range.Min;

					// zero 09-mar-2015 - at this point, we should only have integers, since thats all 100% of consoles ever see
					// if this becomes a problem we can add flags to the range and update GUIs to be able to display floats
					output = (int)output;

					float lbound = Math.Min(range.Min, range.Max);
					float ubound = Math.Max(range.Min, range.Max);

					if (output < lbound)
					{
						output = lbound;
					}

					if (output > ubound)
					{
						output = ubound;
					}

					_floatButtons[outkey] = output;
				}
			}
		}

		/// <summary>
		/// uses the bindings to latch our own logical button state from the source controller's button state (which are assumed to be the physical side of the binding).
		/// this will clobber any existing data (use OR_* or other functions to layer in additional input sources)
		/// </summary>
		public void LatchFromPhysical(IController controller)
		{
			_buttons.Clear();

			foreach (var kvp in _bindings)
			{
				_buttons[kvp.Key] = false;
				foreach (var bound_button in kvp.Value)
				{
					if (controller.IsPressed(bound_button))
					{
						_buttons[kvp.Key] = true;
					}
				}
			}

			foreach (var kvp in _floatBinds)
			{
				var input = controller.GetFloat(kvp.Value.Value);
				string outkey = kvp.Key;
				if (_floatRanges.ContainsKey(outkey))
				{
					_floatButtons[outkey] = input;
				}
			}

			// it's not sure where this should happen, so for backwards compatibility.. do it every time
			NormalizeFloats(controller);
		}

		public void ApplyAxisConstraints(string constraintClass)
		{
			_type.ApplyAxisConstraints(constraintClass, _floatButtons);
		}

		/// <summary>
		/// merges pressed logical buttons from the supplied controller, effectively ORing it with the current state
		/// </summary>
		public void OR_FromLogical(IController controller)
		{
			// change: or from each button that the other input controller has
			// foreach (string button in type.BoolButtons)
			if (controller.Definition != null)
			{
				foreach (var button in controller.Definition.BoolButtons)
				{
					if (controller.IsPressed(button))
					{
						_buttons[button] = true;
					}
				}
			}
		}

		public void Overrides(OverrideAdaptor controller)
		{
			foreach (var button in controller.Overrides)
			{
				_buttons[button] = controller.IsPressed(button);
			}

			foreach (var button in controller.FloatOverrides)
			{
				_floatButtons[button] = controller.GetFloat(button);
			}

			foreach (var button in controller.InversedButtons)
			{
				_buttons[button] ^= true;
			}
		}

		public void BindButton(string button, string control)
		{
			_bindings[button].Add(control);
		}

		public void BindMulti(string button, string controlString)
		{
			if (string.IsNullOrEmpty(controlString))
			{
				return;
			}

			var controlbindings = controlString.Split(',');
			foreach (var control in controlbindings)
			{
				_bindings[button].Add(control.Trim());
			}
		}

		public void BindFloat(string button, Config.AnalogBind bind)
		{
			_floatBinds[button] = bind;
		}

		/// <summary>
		/// Returns a list of all keys mapped and the name of the button they are mapped to
		/// </summary>
		public List<KeyValuePair<string, string>> MappingList()
		{
			return (from key in _bindings from binding in key.Value select new KeyValuePair<string, string>(binding, key.Key)).ToList();
		}

		public List<string> PressedButtons => (from button in _buttons where button.Value select button.Key).ToList();
	}

	public class AutofireController : IController
	{
		public AutofireController(ControllerDefinition definition, IEmulator emulator)
		{
			On = Global.Config.AutofireOn < 1 ? 0 : Global.Config.AutofireOn;
			Off = Global.Config.AutofireOff < 1 ? 0 : Global.Config.AutofireOff;
			_type = definition;
			_emulator = emulator;
		}

		private readonly IEmulator _emulator;

		private readonly ControllerDefinition _type;
		private readonly WorkingDictionary<string, List<string>> _bindings = new WorkingDictionary<string, List<string>>();
		private readonly WorkingDictionary<string, bool> _buttons = new WorkingDictionary<string, bool>();
		private readonly WorkingDictionary<string, int> _buttonStarts = new WorkingDictionary<string, int>();

		private bool _autofire = true;

		public bool Autofire { get { return false; } set { _autofire = value; } }
		public int On { get; set; }
		public int Off { get; set; }

		public ControllerDefinition Definition => _type;

		public bool IsPressed(string button)
		{
			if (_autofire)
			{
				var a = (_emulator.Frame - _buttonStarts[button]) % (On + Off);
				return a < On && _buttons[button];
			}

			return _buttons[button];
		}

		public void ClearStarts()
		{
			_buttonStarts.Clear();
		}

		public float GetFloat(string name)
		{
			throw new NotImplementedException();
		}

		// look for bindings which are activated by the supplied physical button.
		public List<string> SearchBindings(string button)
		{
			return (from kvp in _bindings from bound_button in kvp.Value where bound_button == button select kvp.Key).ToList();
		}

		/// <summary>
		/// uses the bindings to latch our own logical button state from the source controller's button state (which are assumed to be the physical side of the binding).
		/// this will clobber any existing data (use OR_* or other functions to layer in additional input sources)
		/// </summary>
		public void LatchFromPhysical(IController controller)
		{
			foreach (var kvp in _bindings)
			{
				foreach (var boundBtn in kvp.Value)
				{
					if (_buttons[kvp.Key] == false && controller.IsPressed(boundBtn))
					{
						_buttonStarts[kvp.Key] = _emulator.Frame;
					}
				}
			}

			_buttons.Clear();
			foreach (var kvp in _bindings)
			{
				_buttons[kvp.Key] = false;
				foreach (var bound_button in kvp.Value)
				{
					if (controller.IsPressed(bound_button))
					{
						_buttons[kvp.Key] = true;
					}
				}
			}
		}

		/// <summary>
		/// merges pressed logical buttons from the supplied controller, effectively ORing it with the current state
		/// </summary>
		public void OR_FromLogical(IController controller)
		{
			foreach (var button in _type.BoolButtons.Where(controller.IsPressed))
			{
				_buttons[button] = true;
				Console.WriteLine(button);
			}
		}

		public void BindButton(string button, string control)
		{
			_bindings[button].Add(control);
		}

		public void BindMulti(string button, string controlString)
		{
			if (!string.IsNullOrEmpty(controlString))
			{
				var controlbindings = controlString.Split(',');
				foreach (var control in controlbindings)
				{
					_bindings[button].Add(control.Trim());
				}
			}
		}

		public void IncrementStarts()
		{
			foreach (var key in _buttonStarts.Keys.ToArray())
			{
				_buttonStarts[key]++;
			}
		}

		public List<string> PressedButtons => (from button in _buttons where button.Value select button.Key).ToList();
	}
}


text:
$set 2 #Basemenu

$ #BlackboxMenu
# Blackbox Menü


text:
namespace Microsoft.Azure.Management.DataShare.Models
{

    /// <summary>
    /// Defines values for DataSetType.
    /// </summary>
    public static class DataSetType
    {
        public const string Blob = "Blob";
        public const string Container = "Container";
        public const string BlobFolder = "BlobFolder";
        public const string AdlsGen2FileSystem = "AdlsGen2FileSystem";
        public const string AdlsGen2Folder = "AdlsGen2Folder";
        public const string AdlsGen2File = "AdlsGen2File";
        public const string AdlsGen1Folder = "AdlsGen1Folder";
        public const string AdlsGen1File = "AdlsGen1File";
        public const string KustoCluster = "KustoCluster";
        public const string KustoDatabase = "KustoDatabase";
        public const string SqlDBTable = "SqlDBTable";
        public const string SqlDWTable = "SqlDWTable";
    }
}


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

namespace ShaderEditor
{
    public sealed class SourceEditTimer
    {
        #region Fields
        private readonly int recompileAfterMillis;

        private readonly Stopwatch timer;
        #endregion

        #region Properties
        public bool ShouldRecompile
        {
            get;
            private set;
        }
        #endregion

        public SourceEditTimer(int recompileAfterMillis)
        {
            this.recompileAfterMillis = recompileAfterMillis;

            timer = new Stopwatch();
        }

        public void StartMeasuring()
        {
            if (!timer.IsRunning)
            {
                timer.Start();
            }
            else if (timer.ElapsedMilliseconds >= recompileAfterMillis)
            {
                ShouldRecompile = true;
                timer.Restart();
            }

            timer.Restart();
        }

        public void StopMeasuring()
        {
            timer.Reset();
        }
    }
}


text:
package org.kie.workbench.common.stunner.core.backend.service;

import java.beans.XMLDecoder;
import java.beans.XMLEncoder;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

import javax.enterprise.context.ApplicationScoped;

import org.kie.workbench.common.stunner.core.definition.service.DiagramMetadataMarshaller;
import org.kie.workbench.common.stunner.core.diagram.Metadata;

@ApplicationScoped
public class XMLEncoderDiagramMetadataMarshaller implements DiagramMetadataMarshaller<Metadata> {

    private static final String CHARSET = "UTF-8";

    @Override
    public Metadata unmarshall(final InputStream input) throws IOException {
        try (final XMLDecoder decoder = new XMLDecoder(input)) {
            return (Metadata) decoder.readObject();
        }
    }

    @Override
    public String marshall(final Metadata metadata) throws IOException {
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        XMLEncoder encoder = new XMLEncoder(os);
        encoder.writeObject(metadata);
        encoder.close();
        String raw = os.toString(CHARSET);
        return raw;
    }
}


text:
package net.sourceforge.plantuml.xmi;

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Stack;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.sequencediagram.Grouping;
import net.sourceforge.plantuml.sequencediagram.GroupingType;
import net.sourceforge.plantuml.sequencediagram.LifeEvent;
import net.sourceforge.plantuml.sequencediagram.LifeEventType;
import net.sourceforge.plantuml.sequencediagram.Message;
import net.sourceforge.plantuml.sequencediagram.MessageExo;
import net.sourceforge.plantuml.sequencediagram.Note;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.Participant;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;

public class XmiSequenceDiagramStandard extends XmiSequenceDiagram {

	private Stack<HashSet<String>> covered;
	private HashMap<Participant, Stack<Element>> activeParticipants;

	public XmiSequenceDiagramStandard(SequenceDiagram diagram, Document document) {
		super(diagram, document);

		covered = new Stack<>();
		covered.push(new HashSet<String>());

		activeParticipants = new HashMap<>();
	}

	@Override
	public void build() {
		Node packagedElement = document.appendChild(createElement("uml:Model", new String[][] {
			{"xmlns:uml", "http://www.omg.org/spec/UML/20110701"},
			{"xmlns:xmi", "http://schema.omg.org/spec/XMI/2.1"},
			{"xmi:version","2.1"},
			{"xmi:id",getXmiId("uml:Model", diagram)}
		})).appendChild(createUmlElement(diagram, "packagedElement", "Interaction"));
		packagedElement.appendChild(createUmlElement(diagram, "nestedClassifier", "Collaboration"));

		for (Participant participant : diagram.participants()) {
			packagedElement.appendChild(createElement(participant, "lifeline", new String[][] {
				{"name", getDisplayString(participant.getDisplay(false))}
			}));
		}

		Node currentFragment = packagedElement;
		for (Event event : diagram.events()) {
			if (event instanceof Note) {
				buildNoteEvent(packagedElement, (Note) event);
			} else if (event instanceof LifeEvent) {
				buildLifeEvent(packagedElement, (LifeEvent)event);
			} else if (event instanceof AbstractMessage) {
				buildMessage(packagedElement, currentFragment, (AbstractMessage) event);
			} else if (event instanceof Grouping) {
				currentFragment = buildGrouping(currentFragment, (Grouping) event);
			}
		}
	}

	private void buildLifeEvent(Node packagedElement, LifeEvent event) {
		if (event.getType() == LifeEventType.ACTIVATE) {
			Element execution = createUmlElement(event, "fragment", "BehaviorExecutionSpecification");
			execution.setAttribute("covered", getXmiId("lifeline", event.getParticipant()));
			execution.setAttribute("start", getLifeEventOccurrenceId(event));
			packagedElement.appendChild(execution);
			activeParticipants.putIfAbsent(event.getParticipant(), new Stack<Element>());
			activeParticipants.get(event.getParticipant()).push(execution);
		} else if (event.getType() == LifeEventType.DEACTIVATE) {
			activeParticipants.get(event.getParticipant()).pop().setAttribute("finish", getLifeEventOccurrenceId(event));
		}
	}

	private Participant getReceiver(AbstractMessage message) {
		if (message instanceof Message) {
			return message.getParticipant2();
		} else if (message instanceof MessageExo) {
			MessageExo exo = (MessageExo) message;
			if (exo.getType().toString().startsWith("FROM_")) {
				return message.getParticipant1();
			}
		}
		return null;
	}

	private String getLifeEventOccurrenceId(LifeEvent event) {
		if (event.getParticipant() == getReceiver(event.getMessage()))
		{
			return getXmiId("receiveEvent", event.getMessage());
		} else {
			return getXmiId("sendEvent", event.getMessage());
		}
	}

	private void buildMessage(Node packagedElement, Node currentFragment, AbstractMessage message) {
		if (message instanceof Message) {
			buildMessage(packagedElement, currentFragment, (Message) message);
		}
		else if (message instanceof MessageExo) {
			buildMessageExo(packagedElement, currentFragment, (MessageExo) message);
		}

		if (message.getParticipant1() != null) {
			covered.peek().add(getXmiId("lifeline", message.getParticipant1()));
		}
		if (message.getParticipant2() != null) {
			covered.peek().add(getXmiId("lifeline", message.getParticipant2()));
		}
	}

	private void buildNoteEvent(Node packagedElement, Note note) {
		HashSet<String> annotated = new HashSet<String>();

		if (note.getParticipant() != null) {
			annotated.add(getXmiId("lifeline", note.getParticipant()));
		}

		if (note.getParticipant2() != null) {
			annotated.add(getXmiId("lifeline", note.getParticipant2()));
		}

		buildNote(packagedElement, note, annotated);
	}

	private HashSet<String> getAnnotatedElements(Note note, Message message) {
		HashSet<String> annotated = new HashSet<String>();
		int p1 = getParticipantNumber(message.getParticipant1());
		int p2 = getParticipantNumber(message.getParticipant2());
		NotePosition senderPosition = p1 < p2 ? NotePosition.LEFT : NotePosition.RIGHT;

		if (note.getPosition() == senderPosition) {
			annotated.add(getXmiId("sendEvent", message));
			annotated.add(getXmiId("lifeline", message.getParticipant1()));
		} else {
			annotated.add(getXmiId("receiveEvent", message));
			annotated.add(getXmiId("lifeline", message.getParticipant2()));
		}
		return annotated;
	}

	private void buildNote(Node packagedElement, Note note, HashSet<String> annotated) {
		Element comment = createUmlElement(note, "ownedComment", "Comment");
		if (!annotated.isEmpty()) {
			comment.setAttribute("annotatedElement", String.join(" ", annotated));
		}
		comment.appendChild(document.createElement("body")).appendChild(
				document.createTextNode(getDisplayString(note.getStrings())));
		packagedElement.appendChild(comment);
	}

	private int getParticipantNumber(Participant participant) {
		return Arrays.asList(diagram.participants().toArray()).indexOf(participant);
	}

	private void buildMessageExo(Node packagedElement, Node currentFragment, MessageExo message) {
		String messageEvent = message.getType().toString().startsWith("TO_") ? "sendEvent" : "receiveEvent";
		String messageEventId = getXmiId(messageEvent, message);
		currentFragment.appendChild(createMessageOccurrence(message, messageEvent, message.getParticipant1()));
		packagedElement.appendChild(
				setAttributes(createUmlElement(message, "message", "Message"), new String[][]{
					{"name", getDisplayString(message.getLabel())},
					{messageEvent, messageEventId}}));

		HashSet<String> annotated = new HashSet<String>();
		annotated.add(messageEventId);
		annotated.add(getXmiId("lifeline", message.getParticipant1()));
		for (Note note : message.getNoteOnMessages()) {
			buildNote(packagedElement, note, annotated);
		}
	}

	private void buildMessage(Node packagedElement, Node currentFragment, Message message) {
		currentFragment.appendChild(createMessageOccurrence(message, "sendEvent", message.getParticipant1()));
		currentFragment.appendChild(createMessageOccurrence(message, "receiveEvent", message.getParticipant2()));
		packagedElement.appendChild(
				setAttributes(createUmlElement(message, "message", "Message"), new String[][]{
					{"name", getDisplayString(message.getLabel())},
					{"receiveEvent", getXmiId("receiveEvent", message)},
					{"sendEvent", getXmiId("sendEvent", message)}}));

		for (Note note : message.getNoteOnMessages()) {
			buildNote(packagedElement, note, getAnnotatedElements(note, message));
		}
	}

	private Node buildGrouping(Node currentFragment, Grouping grouping) {
		if (grouping.getType() == GroupingType.START)
		{
			Element group = createUmlElement(grouping, "fragment", "CombinedFragment");
			group.setAttribute("interactionOperator", grouping.getTitle());
			currentFragment.appendChild(group);

			currentFragment = group.appendChild(createElement(grouping, "operand"));
			currentFragment.appendChild(createGuardElement(grouping));
			covered.push(new HashSet<String>());
		}
		else if(grouping.getType() == GroupingType.ELSE) {
			currentFragment = currentFragment.getParentNode().appendChild(createElement(grouping, "operand"));
			currentFragment.appendChild(createGuardElement(grouping));
		}
		else if(grouping.getType() == GroupingType.END){
			Node coveredAttr = document.createAttribute("covered");
			HashSet<String> topCovered = covered.pop();
			coveredAttr.setTextContent(String.join(" ", topCovered));
			currentFragment.getParentNode().getAttributes().setNamedItem(coveredAttr);
			covered.peek().addAll(topCovered);
			currentFragment = currentFragment.getParentNode().getParentNode();
		}
		return currentFragment;
	}

	private Node createGuardElement(Grouping grouping) {
		Node guard =  createElement(grouping,"guard");
		guard.appendChild(setAttribute(createUmlElement(grouping, "specification", "LiteralString"),
						"value", grouping.getComment()));
		return guard;
	}

	private Element createElement(Object object, String tag) {
		return createElement(tag, new String[][]{{"xmi:id", getXmiId(tag, object)}});
	}

	private Element createElement(Object object, String tag, String[][] attributes) {
		return setAttributes(createElement(tag, new String[][]{
			{"xmi:id", getXmiId(tag, object)}
		}), attributes);
	}

	private Element createUmlElement(Object object, String tag, String type) {
		return createElement(tag, new String[][]{
			{"xmi:type", "uml:"+type},
			{"xmi:id", getXmiId(type, object)}
		});
	}

	private Node createMessageOccurrence(Object event, String type, Participant participant) {
		return setAttributes(createUmlElement(event, "fragment", "MessageOccurrenceSpecification"),
				new String[][] {
			{"xmi:id", getXmiId(type, event)},
			{"covered", getXmiId("lifeline", participant)},
			{"message", getXmiId("Message", event)},
		});
	}
}


text:
package org.scala_tools.time

import org.joda.time._

object StaticPartial extends StaticPartial

trait StaticPartial {
  type Property = Partial.Property
}


text:
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;

namespace ClouDeveloper.Hash.SHA384
{
    public static partial class SHA384HashExtensions
    {
        public static string ComputeSHA384(
            this Stream inputStream,
            bool isUpperCase = true)
        {
            return HashExtensions.ComputeHash<SHA384Managed>(inputStream, isUpperCase);
        }

        public static string ComputeSHA384(
            this byte[] buffer,
            int offset,
            int count,
            bool isUpperCase = true)
        {
            return HashExtensions.ComputeHash<SHA384Managed>(buffer, offset, count, isUpperCase);
        }

        public static string ComputeSHA384(
            this byte[] buffer,
            bool isUpperCase = true)
        {
            return HashExtensions.ComputeHash<SHA384Managed>(buffer, isUpperCase);
        }

        public static string ComputeSHA384(
            this IEnumerable<byte> buffer,
            int offset,
            int count,
            bool isUpperCase = true)
        {
            return HashExtensions.ComputeHash<SHA384Managed>(buffer, offset, count, isUpperCase);
        }

        public static string ComputeSHA384(
            this IEnumerable<byte> buffer,
            bool isUpperCase = true)
        {
            return HashExtensions.ComputeHash<SHA384Managed>(buffer, isUpperCase);
        }

        public static string ComputeSHA384(
            this char[] text,
            int index,
            int count,
            Encoding targetEncoding = default(Encoding),
            bool isUpperCase = true)
        {
            return HashExtensions.ComputeHash<SHA384Managed>(text, index, count, targetEncoding, isUpperCase);
        }

        public static string ComputeSHA384(
            this char[] text,
            Encoding targetEncoding = default(Encoding),
            bool isUpperCase = true)
        {
            return HashExtensions.ComputeHash<SHA384Managed>(text, targetEncoding, isUpperCase);
        }

        public static string ComputeSHA384(
            this IEnumerable<char> text,
            int index,
            int count,
            Encoding targetEncoding = default(Encoding),
            bool isUpperCase = true)
        {
            return HashExtensions.ComputeHash<SHA384Managed>(text, index, count, targetEncoding, isUpperCase);
        }

        public static string ComputeSHA384(
            this IEnumerable<char> text,
            Encoding targetEncoding = default(Encoding),
            bool isUpperCase = true)
        {
            return HashExtensions.ComputeHash<SHA384Managed>(text, targetEncoding, isUpperCase);
        }

        public static string ComputeSHA384(
            this string text,
            int index,
            int count,
            Encoding targetEncoding = default(Encoding),
            bool isUpperCase = true)
        {
            return HashExtensions.ComputeHash<SHA384Managed>(text, index, count, targetEncoding, isUpperCase);
        }

        public static string ComputeSHA384(
            this string text,
            Encoding targetEncoding = default(Encoding),
            bool isUpperCase = true)
        {
            return HashExtensions.ComputeHash<SHA384Managed>(text, targetEncoding, isUpperCase);
        }

        public static string ComputeSHA384(
            this StringBuilder text,
            int index,
            int count,
            Encoding targetEncoding = default(Encoding),
            bool isUpperCase = true)
        {
            return HashExtensions.ComputeHash<SHA384Managed>(text, index, count, targetEncoding, isUpperCase);
        }

        public static string ComputeSHA384(
            this StringBuilder text,
            Encoding targetEncoding = default(Encoding),
            bool isUpperCase = true)
        {
            return HashExtensions.ComputeHash<SHA384Managed>(text, targetEncoding, isUpperCase);
        }

        public static string ComputeSHA384(
            this TextReader reader,
            Encoding targetEncoding = default(Encoding),
            bool isUpperCase = true)
        {
            return HashExtensions.ComputeHash<SHA384Managed>(reader, targetEncoding, isUpperCase);
        }
    }
}


text:
#ifndef __MEMCACHED_GET_H__
#define __MEMCACHED_GET_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Public defines */
char *memcached_get(memcached_st *ptr,
                    const char *key, size_t key_length,
                    size_t *value_length,
                    uint32_t *flags,
                    memcached_return *error);

memcached_return memcached_mget(memcached_st *ptr,
                                char **keys, size_t *key_length,
                                unsigned int number_of_keys);

char *memcached_get_by_key(memcached_st *ptr,
                           const char *master_key, size_t master_key_length,
                           const char *key, size_t key_length,
                           size_t *value_length,
                           uint32_t *flags,
                           memcached_return *error);

memcached_return memcached_mget_by_key(memcached_st *ptr,
                                       const char *master_key, size_t
                                       master_key_length,
                                       char **keys,
                                       size_t *key_length,
                                       unsigned int number_of_keys);

char *memcached_fetch(memcached_st *ptr,
                      char *key, size_t *key_length,
                      size_t *value_length, uint32_t *flags,
                      memcached_return *error);

memcached_result_st *memcached_fetch_result(memcached_st *ptr,
                                            memcached_result_st *result,
                                            memcached_return *error);

#ifdef __cplusplus
}
#endif

#endif /* __MEMCACHED_GET_H__ */


text:
require('angular');

angular.module('riseApp').controller('secondPassphraseModalController', ["$scope", "secondPassphraseModal", "$http", "userService", "feeService", function ($scope, secondPassphraseModal, $http, userService, feeService) {

    $scope.sending = false;
    $scope.rememberedPassphrase = userService.rememberPassphrase ? userService.rememberedPassphrase : false;
    $scope.passmode = false;
    $scope.focus = 'secondPass';
    $scope.step = 1;

    $scope.goToStep = function (step) {
        $scope.passmode = false;
        $scope.repeatPassphrase = '';
        $scope.noMatch = false;
        $scope.step = step;
    }

    $scope.close = function () {
        if ($scope.destroy) {
            $scope.destroy();
        }
        secondPassphraseModal.deactivate();
    }

    $scope.generatePassphrase = function () {
        var code = new Mnemonic(Mnemonic.Words.ENGLISH);
        $scope.newPassphrase = code.toString();
    };

    $scope.generatePassphrase();

    $scope.savePassToFile = function (pass) {
        var blob = new Blob([pass], { type: "text/plain;charset=utf-8" });
        FS.saveAs(blob, "RiseSecondPassphrase.txt");
    }

    $scope.confirmNewPassphrase = function () {
        if (!Mnemonic.isValid($scope.repeatPassphrase) || ($scope.repeatPassphrase != $scope.newPassphrase)) {
            $scope.noMatch = true;
            return;
        } else {
            $scope.noMatch = false;
            $scope.passcheck();
        }
    }

    $scope.passcheck = function () {
        if ($scope.rememberedPassphrase) {
            $scope.addNewPassphrase($scope.rememberedPassphrase);
        } else {
            $scope.passmode = !$scope.passmode;
            if ($scope.passmode) {
                $scope.focus = 'pass';
            } else {
                $scope.focus = 'secondPass';
            }
            $scope.fromServer = '';
            $scope.pass = '';
        }
    }

    $scope.addNewPassphrase = function (pass) {
        if (!$scope.sending) {
            $scope.sending = true;

            $http.put("/api/signatures", {
                secret: pass,
                secondSecret: $scope.newPassphrase,
                publicKey: userService.publicKey
            }).then(function (resp) {
                $scope.sending = false;

                if (resp.data.error) {
                    Materialize.toast('Transaction error', 3000, 'red white-text');
                    $scope.fromServer = resp.data.error;
                } else {
                    if ($scope.destroy) {
                        $scope.destroy(true);
                    }

                    Materialize.toast('Transaction sent', 3000, 'green white-text');
                    secondPassphraseModal.deactivate();
                }
            });
        }
    }

    feeService(function (fees) {
        $scope.fee = fees.secondsignature;
    });

}]);


text:
#include "randomwalkbehavior.h"
//#include "random.h"

/******************************************************************************/
/******************************************************************************/

CRandomWalkBehavior::CRandomWalkBehavior(double f_change_direction_probability) :
    m_fChangeDirectionProbability(f_change_direction_probability)
{
}

/******************************************************************************/
/******************************************************************************/

bool CRandomWalkBehavior::TakeControl()
{
    return true;
}

/******************************************************************************/
/******************************************************************************/

void CRandomWalkBehavior::Action(Real &fLeftWheelSpeed, Real &fRightWheelSpeed)
{
    if (m_fChangeDirectionProbability >= m_sSensoryData.m_pcRNG->Uniform(CRange<Real>(0.0, 1.0)))
    {
        Real fSpeed;

        CRadians angle = m_sSensoryData.m_pcRNG->Uniform(CRange<CRadians>(CRadians::ZERO, CRadians::TWO_PI));
        angle = angle.SignedNormalize();

        fSpeed = angle.GetAbsoluteValue() * m_sRobotData.HALF_INTERWHEEL_DISTANCE / m_sRobotData.seconds_per_tick;
        fSpeed = fSpeed * 100.0; // converting to cm/s - as used in SetLinearVelocity
        fSpeed = Min<Real>(fSpeed, m_sRobotData.MaxSpeed);

        if(angle.GetValue() > 0.0f) //turn right
        {
            std::cout << " turn right " << angle.GetValue() << std::endl;
            fLeftWheelSpeed  = fSpeed;
            fRightWheelSpeed = -fSpeed;
        }
        else
        {
            std::cout << " turn left " << angle.GetValue() << std::endl;
            fLeftWheelSpeed  = -fSpeed;
            fRightWheelSpeed =  fSpeed;
        }

    }
    else
    {
        std::cout << " move straight " << std::endl;
        fLeftWheelSpeed = m_sRobotData.MaxSpeed;
        fRightWheelSpeed = m_sRobotData.MaxSpeed;
    }

}

/******************************************************************************/
/******************************************************************************/


text:
package io.mycat.manager.response;

import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;

import io.mycat.backend.mysql.PacketUtil;
import io.mycat.config.Fields;
import io.mycat.manager.ManagerConnection;
import io.mycat.net.mysql.EOFPacket;
import io.mycat.net.mysql.FieldPacket;
import io.mycat.net.mysql.ResultSetHeaderPacket;
import io.mycat.net.mysql.RowDataPacket;
import io.mycat.statistic.stat.UserSqlLargeStat;
import io.mycat.statistic.stat.UserStat;
import io.mycat.statistic.stat.UserStatAnalyzer;
import io.mycat.util.LongUtil;
import io.mycat.util.StringUtil;

/**
 *
 * 查询每个用户大集合返回的 SQL
 *
 * @author zhuam
 *
 */
public class ShowSQLLarge {

	 private static final int FIELD_COUNT = 5;
    private static final ResultSetHeaderPacket header = PacketUtil.getHeader(FIELD_COUNT);
    private static final FieldPacket[] fields = new FieldPacket[FIELD_COUNT];
    private static final EOFPacket eof = new EOFPacket();

    static {
        int i = 0;
        byte packetId = 0;
        header.packetId = ++packetId;

        fields[i] = PacketUtil.getField("USER", Fields.FIELD_TYPE_VAR_STRING);
        fields[i++].packetId = ++packetId;

        fields[i] = PacketUtil.getField("ROWS", Fields.FIELD_TYPE_LONGLONG);
        fields[i++].packetId = ++packetId;

        fields[i] = PacketUtil.getField("START_TIME", Fields.FIELD_TYPE_LONGLONG);
        fields[i++].packetId = ++packetId;

        fields[i] = PacketUtil.getField("EXECUTE_TIME", Fields.FIELD_TYPE_LONGLONG);
        fields[i++].packetId = ++packetId;

        fields[i] = PacketUtil.getField("SQL", Fields.FIELD_TYPE_VAR_STRING);
        fields[i++].packetId = ++packetId;

        eof.packetId = ++packetId;
    }

    public static void execute(ManagerConnection c, boolean isClear) {
        ByteBuffer buffer = c.allocate();

        // write header
        buffer = header.write(buffer, c,true);

        // write fields
        for (FieldPacket field : fields) {
            buffer = field.write(buffer, c,true);
        }

        // write eof
        buffer = eof.write(buffer, c,true);

        // write rows
        byte packetId = eof.packetId;
        Map<String, UserStat> statMap = UserStatAnalyzer.getInstance().getUserStatMap();
        for (UserStat userStat : statMap.values()) {
        	String user = userStat.getUser();

            List<UserSqlLargeStat.SqlLarge> sqls = userStat.getSqlLargeRowStat().getSqls();
            for (UserSqlLargeStat.SqlLarge sql : sqls) {
                if (sql != null) {
                    RowDataPacket row = getRow(user, sql, c.getCharset());
                    row.packetId = ++packetId;
                    buffer = row.write(buffer, c,true);
                }
            }

            if ( isClear ) {
            	userStat.getSqlLargeRowStat().clear();//读取大结果集SQL后,清理
            }
        }

        // write last eof
        EOFPacket lastEof = new EOFPacket();
        lastEof.packetId = ++packetId;
        buffer = lastEof.write(buffer, c,true);

        // write buffer
        c.write(buffer);
    }

    private static RowDataPacket getRow(String user, io.mycat.statistic.stat.UserSqlLargeStat.SqlLarge sql, String charset) {
        RowDataPacket row = new RowDataPacket(FIELD_COUNT);
        row.add( StringUtil.encode(user, charset) );
        row.add( LongUtil.toBytes( sql.getSqlRows() ) );
        row.add( LongUtil.toBytes(sql.getStartTime() ) );
        row.add( LongUtil.toBytes(sql.getExecuteTime() ) );
        row.add( StringUtil.encode(sql.getSql(), charset) );
        return row;
    }
}


text:
<BroadcastMonitor>
  <updated>2015-08-06T14:04:51</updated>
  <stationName>Radio 6</stationName>
  <Current>
    <startTime>2015-08-06T14:04:47</startTime>
    <itemId>1000080571:1242965</itemId>
    <titleId>216128463</titleId>
    <itemCode>09490</itemCode>
    <itemReference></itemReference>
    <titleName>My Love, My Love</titleName>
    <artistName>Nneka</artistName>
    <albumName></albumName>
    <CategoryCode>736</CategoryCode>
    <CategoryName>SOUL</CategoryName>
    <itemDuration>212</itemDuration>
    <MultiMedia1></MultiMedia1>
    <MultiMedia2></MultiMedia2>
    <MultiMedia3></MultiMedia3>
    <MultiMedia4></MultiMedia4>
  </Current>
  <Next>
    <startTime>2015-08-06T14:08:20</startTime>
    <itemId>1000080571:1242966</itemId>
    <titleId>216053477</titleId>
    <itemCode>NN263</itemCode>
    <itemReference></itemReference>
    <titleName>Elephants</titleName>
    <artistName>Ruben Hein</artistName>
    <albumName></albumName>
    <CategoryCode>737</CategoryCode>
    <CategoryName>JAZZ</CategoryName>
    <itemDuration>210</itemDuration>
    <MultiMedia1></MultiMedia1>
    <MultiMedia2></MultiMedia2>
    <MultiMedia3></MultiMedia3>
    <MultiMedia4></MultiMedia4>
  </Next>
</BroadcastMonitor>


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

namespace DDDSyd2016.IdentityServer.Models
{
    public partial class Client
    {
        public int Id { get; set; }
        public bool Enabled { get; set; }
        public string ClientId { get; set; }
        public string ClientName { get; set; }
        public string ClientUri { get; set; }
        public string LogoUri { get; set; }
        public bool RequireConsent { get; set; }
        public bool AllowRememberConsent { get; set; }
        public int Flow { get; set; }
        public bool AllowClientCredentialsOnly { get; set; }
        public string LogoutUri { get; set; }
        public bool LogoutSessionRequired { get; set; }
        public bool RequireSignOutPrompt { get; set; }
        public bool AllowAccessToAllScopes { get; set; }
        public int IdentityTokenLifetime { get; set; }
        public int AccessTokenLifetime { get; set; }
        public int AuthorizationCodeLifetime { get; set; }
        public int AbsoluteRefreshTokenLifetime { get; set; }
        public int SlidingRefreshTokenLifetime { get; set; }
        public int RefreshTokenUsage { get; set; }
        public bool UpdateAccessTokenOnRefresh { get; set; }
        public int RefreshTokenExpiration { get; set; }
        public int AccessTokenType { get; set; }
        public bool EnableLocalLogin { get; set; }
        public bool IncludeJwtId { get; set; }
        public bool AlwaysSendClientClaims { get; set; }
        public bool PrefixClientClaims { get; set; }
        public bool AllowAccessToAllGrantTypes { get; set; }

        public IEnumerable<ClientSecret> ClientSecrets { get; set; }
        public IEnumerable<ClientRedirectUri> ClientRedirectUris { get; set; }
        public IEnumerable<string> ClientScopes { get; set; }

    }
}


text:
#pragma once

#include <ddRpcServer.h>

namespace UberTrace
{

class IService
{
public:
    virtual ~IService() {}

    static const DDRpcServerRegisterServiceInfo kServiceInfo;

    // Attempts to enable tracing
    virtual DD_RESULT EnableTracing() = 0;

    // Queries the current set of trace parameters
    virtual DD_RESULT QueryTraceParams(
        const DDByteWriter& writer
    ) = 0;

    // Configures the current set of trace parameters
    virtual DD_RESULT ConfigureTraceParams(
        const void* pParamBuffer,
        size_t      paramBufferSize
    ) = 0;

    // Requests execution of a trace
    virtual DD_RESULT RequestTrace() = 0;

    // Cancels a previously requested trace before it starts or after it completes
    virtual DD_RESULT CancelTrace() = 0;

    // Collects the data created by a previously executed trace
    virtual DD_RESULT CollectTrace(
        const DDByteWriter& writer
    ) = 0;

protected:
    IService() {}
};

DD_RESULT RegisterService(DDRpcServer hServer, IService* pService);

} // namespace UberTrace


text:
package org.apache.hadoop.hive.ql.exec;

import java.util.concurrent.Callable;
import java.util.concurrent.Future;

import org.apache.hadoop.hive.ql.metadata.HiveException;

public class ObjectCacheWrapper implements ObjectCache {
  private final String queryId;
  private final ObjectCache globalCache;
  public ObjectCacheWrapper(ObjectCache globalCache, String queryId) {
    this.queryId = queryId;
    this.globalCache = globalCache;
  }

  @Override
  public void release(String key) {
    globalCache.release(makeKey(key));
  }

  @Override
  public <T> T retrieve(String key, Callable<T> fn) throws HiveException {
    return globalCache.retrieve(makeKey(key), fn);
  }

  @Override
  public <T> Future<T> retrieveAsync(String key, Callable<T> fn)
      throws HiveException {
    return globalCache.retrieveAsync(makeKey(key), fn);
  }

  @Override
  public void remove(String key) {
    globalCache.remove(makeKey(key));
  }

  private String makeKey(String key) {
    return queryId + "_" + key;
  }
}


text:
@interface QuickDialogTableView ()
@property(weak, nonatomic, readwrite) QuickDialogController *controller;
@end

@implementation QuickDialogTableView {
    BOOL _deselectRowWhenViewAppears;
}

@synthesize root = _root;
@synthesize deselectRowWhenViewAppears = _deselectRowWhenViewAppears;

- (QuickDialogController *)controller {
    return _controller;
}

- (QuickDialogTableView *)initWithController:(QuickDialogController *)controller {
    self = [super initWithFrame:CGRectMake(0, 0, 0, 0) style:controller.root.grouped ? UITableViewStyleGrouped : UITableViewStylePlain];
    if (self!=nil){
        self.controller = controller;
        self.root = _controller.root;
        self.deselectRowWhenViewAppears = YES;

        self.quickDialogDataSource = [[QuickDialogDataSource alloc] initForTableView:self];
        self.dataSource = self.quickDialogDataSource;

        self.quickDialogTableDelegate = [[QuickDialogTableDelegate alloc] initForTableView:self];
        self.delegate = self.quickDialogTableDelegate;

        self.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
    }
    return self;
}

-(void)setRoot:(QRootElement *)root{
    _root = root;
    for (QSection *section in _root.sections) {
        if (section.needsEditing){
            [self setEditing:YES animated:YES];
            self.allowsSelectionDuringEditing = YES;
        }
    }
    [self reloadData];
}

- (void)reloadData
{
    [self applyAppearanceForRoot:self.root];
    [super reloadData];
}

- (void)applyAppearanceForRoot:(QRootElement *)element {
    if (element.appearance.tableGroupedBackgroundColor !=nil){

        self.backgroundColor = element.grouped
                ? element.appearance.tableGroupedBackgroundColor
                : element.appearance.tableBackgroundColor;

        self.backgroundView = element.appearance.tableBackgroundView;
    }
    if (element.appearance.tableBackgroundView!=nil && !element.grouped)
        self.backgroundView = element.appearance.tableBackgroundView;

    if (element.appearance.tableGroupedBackgroundView!=nil && element.grouped)
        self.backgroundView = element.appearance.tableGroupedBackgroundView;

    if (element.appearance.tableSeparatorColor!=nil)
        self.separatorColor = element.appearance.tableSeparatorColor;

}

- (NSIndexPath *)indexForElement:(QElement *)element {
    for (int i=0; i< [_root.sections count]; i++){
        QSection * currSection = [_root.sections objectAtIndex:(NSUInteger) i];

        for (int j=0; j< [currSection.elements count]; j++){
            QElement *currElement = [currSection.elements objectAtIndex:(NSUInteger) j];
            if (currElement == element){
                return [NSIndexPath indexPathForRow:j inSection:i];
            }
        }
    }
    return NULL;
}

- (void)setContentInset:(UIEdgeInsets)contentInset
{
    super.contentInset = contentInset;
    self.scrollIndicatorInsets = contentInset;
}

- (UITableViewCell *)cellForElement:(QElement *)element {
    if (element.hidden)
        return nil;
    return [self cellForRowAtIndexPath:[element getIndexPath]];
}

- (void)deselectRows
{
    NSArray *selected = nil;
    if ([self indexPathForSelectedRow]!=nil && _deselectRowWhenViewAppears){
        NSIndexPath *selectedRowIndex = [self indexPathForSelectedRow];
        selected = [NSArray arrayWithObject:selectedRowIndex];
        [self reloadRowsAtIndexPaths:selected withRowAnimation:UITableViewRowAnimationNone];
        [self selectRowAtIndexPath:selectedRowIndex animated:NO scrollPosition:UITableViewScrollPositionNone];
        [self deselectRowAtIndexPath:selectedRowIndex animated:YES];
    };
}

- (void)reloadCellForElements:(QElement *)firstElement, ... {
    va_list args;
    va_start(args, firstElement);
    NSMutableArray *indexes = [[NSMutableArray alloc] init];
    QElement * element = firstElement;
    while (element != nil) {
        if (!element.hidden && !element.parentSection.hidden)
            [indexes addObject:element.getIndexPath];
        element = va_arg(args, QElement *);
    }
    [self reloadRowsAtIndexPaths:indexes withRowAnimation:UITableViewRowAnimationNone];

    va_end(args);
}

- (void)reloadRowHeights
{
    [self beginUpdates];
    [self endUpdates];
}

- (void)endEditingOnVisibleCells
{
    for (UITableViewCell *cell in self.visibleCells)
        if (cell.isEditing)
            [cell endEditing:YES];

}
@end


text:
var passport = require('passport');

module.exports = function(app){
	var errors; //if you don't declare errors here you will have issues with app.get('/')
	app.get('/',function(req,res){
		res.render('index',{errors:errors,message:req.flash('signupMessage')});
	});

	app.post('/register',function(req,res){
		req.check('username','A username is required').notEmpty();
		req.check('password','A password is required').notEmpty();
		errors = req.validationErrors();
		if(errors){
			res.render('index',{errors:errors,message:req.flash('signupMessage')});
			errors = []; // to clear the errors array
		}
		else{
			passport.authenticate('local-signup',{
			successRedirect: '/login',
			failureRedirect: '/',
			failureFlash: true
			})(req,res);
		}
	});

	app.get('/login',function(req,res){
		res.render('login',{errors:errors,message:req.flash('loginMessage')});
	});

	app.get('/success',isLoggedIn,function(req,res){
		res.render('success',{
			user:req.user
		});
	});

	app.post('/login', function(req,res){
		req.check('username','Please enter a username').notEmpty();
		req.check('password','Please enter your password').notEmpty();
		errors = req.validationErrors();
		if(errors){
			res.render('login',{errors:errors,message:req.flash('loginMessage')});
			errors = []; // to clear the errors array
		}
		else{
			passport.authenticate('local-login',{
			successRedirect: '/success',
		    failureRedirect: '/login',
		    failureFlash: true
			})(req,res);
		}
	});

	app.post('/logout',function(req,res){
			req.logout(); // this a built in function from passport.js
			res.redirect('login');
	});

	function isLoggedIn(req,res,next){
		if(req.isAuthenticated()){
			return next();
		}
		res.render('login');
	} // this function keeps anyone from accessing the '/success' page unless they are
	// logged in
}


text:
using System;

namespace DotMercy.Dynamic
{
    public partial class List : DotWeb.UI.ListPage
    {
    }
}


text:
package org.dynamicprogram.program.update;

public class UpdateListenerTest {

	// nothing to test

}


text:
namespace Tasker.Test.Core.Provider
{
    using System;
    using System.IO;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Tasker.Core.Provider;

    [TestClass]
    public class ConsoleLoggerTests
    {
        [TestMethod]
        public void Log_ShouldLogToConsole_WhenInvoked()
        {
            // Arrange
            var message = "Pesho";
            var consoleLogger = new ConsoleLogger();

            var outputStream = new StringWriter();
            var defaultStream = Console.Out;
            Console.SetOut(outputStream);

            // Act
            consoleLogger.Log(message);

            // Assert
            Assert.AreEqual(message + Environment.NewLine, outputStream.ToString());
            Console.SetOut(defaultStream);
        }
    }
}


text:
class Trip < ActiveRecord::Base
    attr_accessor :longitude, :latitude
    attr_accessible :longitude, :latitude, :description, :name, :zoom, :user_id

    belongs_to :user

    validates :longitude,presence: true, numericality: { greater_than_or_equal_to: -180, less_than_or_equal_to: 180 }
    validates :latitude, presence: true, numericality: { greater_than_or_equal_to: -90, less_than_or_equal_to: 90 }
    validates :user_id, presence: true
    validates :name, presence: true, length: { maximum: 32 }
    validates :zoom, allow_nil: false, numericality: { in: 1..12 }

    before_save :update_center

    default_scope -> { order('created_at DESC') }

    def self.from_trips_enrolled_by(user)
        opentrip_ids = "SELECT opentrip_id from enrollments where participant_id = :user_id"
        where("id IN (#{opentrip_ids})", user_id: user.id)
    end

#   private
    def update_center
        if longitude.present? || latitude.present?
            long = longitude || self.center.longitude
            lat = latitude || self.center.latitude
            self.center = RGeo::Geographic.spherical_factory(srid: 4326).point(long,lat)
        end
    end

end


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Dionne Petty | Personal Portfolio</title>

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">

  <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'>
<link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'>

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

  <title>Dionne Petty | Personal Portfolio</title>
  <meta content="width=device-width,initial-scale=1" name="viewport" />
  <meta charset="UTF-8">
  <meta name="author" content="Dionne Petty" />
  <link href="https://fonts.googleapis.com/css?family=Quicksand" rel="stylesheet">
  <link href="https://res.cloudinary.com/ddpetty/image/upload/v1496969469/Knoxville_pic_o2sufa.jpg" rel="stylesheet">
  <link href="https://res.cloudinary.com/ddpetty/image/upload/v1494888696/imageedit_2_4815441034_elnkcx.jpg" rel="stylesheet">
  <link href= "https://res.cloudinary.com/ddpetty/image/upload/v1494793834/port_thumb_vsf2fz.png" rel="stylesheet">
  <link href= "https://res.cloudinary.com/ddpetty/image/upload/v1494793947/placeholder_photo_pg5hiq.jpg" rel="stylesheet">

          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="true">
      Toggle navigation

    </button>
          Dionne Petty

Home

About

Portfolio

Let's Talk!

 Hello, I'm Dionne!

An aspiring web developer based out of Knoxville, Tennessee.
Please take a tour of my learning journey by perusing my personal portfolio!

About

        I'm currently self-studying anything I can learn about web development through Free Code Camp and other various online and printed resources. My goal is to first become a Front End Web Developer and then to eventually become a Full Stack Developer as
        I gain more experience. The phrase "Knowledge is power." has been my life-long mantra, and my passion is presenting information for my clients by crafting responsive, interactive, innovative, and functional websites.

Skills: HTML5 | CSS3 | Bootstrap | JavaScript | jQuery

Portfolio

 Here are my projects!

Random Quote Machine

Basic JavaScript Calculator

API Local Weather App

Tic Tac Toe Game

Wikipedia Viewer

Task List Application

Coming Soon...

Let's Talk!

Connect with me.

 Linkedin

 Github

Twitter

 Free Code Camp

 dionne.petty@gmail.com

Copyright © Dionne Petty 2018. All Rights Reserved.


text:
import GraphiteMetricConfigurer, { queryFinder } from './metricConfigurer';
import metricStoreConfigStore from '../metricStoreConfig.service';

metricStoreConfigStore.register({
  name: 'graphite',
  metricConfigurer: GraphiteMetricConfigurer,
  queryFinder,
});


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

import java.io.Serializable;
import com.amazonaws.AmazonWebServiceRequest;

/**
 *

 * This input determines which instance groups to retrieve.
 *

 */
public class ListInstanceGroupsRequest extends AmazonWebServiceRequest
        implements Serializable, Cloneable {

    /**
     *

     * The identifier of the cluster for which to list the instance groups.
     *

     */
    private String clusterId;
    /**
     *

     * The pagination token that indicates the next set of results to retrieve.
     *

     */
    private String marker;

    /**
     *

     * The identifier of the cluster for which to list the instance groups.
     *

     *
     * @param clusterId
     *        The identifier of the cluster for which to list the instance
     *        groups.
     */
    public void setClusterId(String clusterId) {
        this.clusterId = clusterId;
    }

    /**
     *

     * The identifier of the cluster for which to list the instance groups.
     *

     *
     * @return The identifier of the cluster for which to list the instance
     *         groups.
     */
    public String getClusterId() {
        return this.clusterId;
    }

    /**
     *

     * The identifier of the cluster for which to list the instance groups.
     *

     *
     * @param clusterId
     *        The identifier of the cluster for which to list the instance
     *        groups.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public ListInstanceGroupsRequest withClusterId(String clusterId) {
        setClusterId(clusterId);
        return this;
    }

    /**
     *

     * The pagination token that indicates the next set of results to retrieve.
     *

     *
     * @param marker
     *        The pagination token that indicates the next set of results to
     *        retrieve.
     */
    public void setMarker(String marker) {
        this.marker = marker;
    }

    /**
     *

     * The pagination token that indicates the next set of results to retrieve.
     *

     *
     * @return The pagination token that indicates the next set of results to
     *         retrieve.
     */
    public String getMarker() {
        return this.marker;
    }

    /**
     *

     * The pagination token that indicates the next set of results to retrieve.
     *

     *
     * @param marker
     *        The pagination token that indicates the next set of results to
     *        retrieve.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public ListInstanceGroupsRequest withMarker(String marker) {
        setMarker(marker);
        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getClusterId() != null)
            sb.append("ClusterId: " + getClusterId() + ",");
        if (getMarker() != null)
            sb.append("Marker: " + getMarker());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof ListInstanceGroupsRequest == false)
            return false;
        ListInstanceGroupsRequest other = (ListInstanceGroupsRequest) obj;
        if (other.getClusterId() == null ^ this.getClusterId() == null)
            return false;
        if (other.getClusterId() != null
                && other.getClusterId().equals(this.getClusterId()) == false)
            return false;
        if (other.getMarker() == null ^ this.getMarker() == null)
            return false;
        if (other.getMarker() != null
                && other.getMarker().equals(this.getMarker()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode
                + ((getClusterId() == null) ? 0 : getClusterId().hashCode());
        hashCode = prime * hashCode
                + ((getMarker() == null) ? 0 : getMarker().hashCode());
        return hashCode;
    }

    @Override
    public ListInstanceGroupsRequest clone() {
        return (ListInstanceGroupsRequest) super.clone();
    }
}


text:
package stemcell

import (
	"code.cloudfoundry.org/clock"
	"fmt"
	"time"

	bosherr "github.com/cloudfoundry/bosh-utils/errors"
	boshretry "github.com/cloudfoundry/bosh-utils/retrystrategy"

	bosl "bosh-softlayer-cpi/softlayer/client"

	"github.com/softlayer/softlayer-go/datatypes"
	"github.com/softlayer/softlayer-go/sl"
)

func (s SoftlayerStemcellService) Find(id int) (string, bool, error) {
	var vgbdtg datatypes.Virtual_Guest_Block_Device_Template_Group
	var err error
	execStmtRetryable := boshretry.NewRetryable(
		func() (bool, error) {
			vgbdtg, err = s.softlayerClient.GetImage(id, bosl.IMAGE_DEFAULT_MASK)
			if err != nil {
				apiErr := err.(sl.Error)
				if apiErr.Exception == "SoftLayer_Exception_ObjectNotFound" {
					return false, nil
				} else {
					return true, bosherr.WrapErrorf(err, fmt.Sprintf("Getting VirtualGuestBlockDeviceTemplateGroup with id '%d'", id))
				}
			}

			return false, nil
		})
	timeService := clock.NewClock()
	timeoutRetryStrategy := boshretry.NewTimeoutRetryStrategy(1*time.Minute, 5*time.Second, execStmtRetryable, timeService, s.logger)
	err = timeoutRetryStrategy.Try()
	if err != nil {
		return "", false, bosherr.Error(fmt.Sprintf("Getting VirtualGuestBlockDeviceTemplateGroup with id '%d'", id))
	}

	if vgbdtg.GlobalIdentifier == nil {
		return "", false, nil
	}

	return *vgbdtg.GlobalIdentifier, true, nil
}


text:
#import "CCTexture2D.h"
#import "CCSprite.h"
#import "Platforms/CCNS.h"

/** CCLabel is a subclass of CCTextureNode that knows how to render text labels
 *
 * All features from CCTextureNode are valid in CCLabel
 *
 * CCLabel objects are slow. Consider using CCLabelAtlas or CCLabelBMFont instead.
 */

@interface CCLabelTTF : CCSprite <CCLabelProtocol>
{
	CGSize dimensions_;
	CCTextAlignment			hAlignment_;
    CCVerticalTextAlignment vAlignment_;
	NSString * fontName_;
	CGFloat fontSize_;
	CCLineBreakMode lineBreakMode_;
	NSString	*string_;
}

/** Font name used in the label */
@property (nonatomic,retain) NSString* fontName;
/** Font size of the label */
@property (nonatomic,assign) float fontSize;
/** Dimensions of the label in Points */
@property (nonatomic,assign) CGSize dimensions;
/** The alignment of the label */
@property (nonatomic,assign) CCTextAlignment horizontalAlignment;
/** The vertical alignment of the label */
@property (nonatomic,assign) CCVerticalTextAlignment verticalAlignment;

/** creates a CCLabelTTF with a font name and font size in points*/
+ (id) labelWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size;

/** creates a CCLabelTTF from a fontname, horizontal alignment, dimension in points,  and font size in points.
 Supported lineBreakModes:
 - iOS: all UILineBreakMode supported modes
 - Mac: Only NSLineBreakByWordWrapping is supported.
 @since v1.0
 */
+ (id) labelWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment;

/** creates a CCLabelTTF from a fontname, horizontal alignment, dimension in points, line break mode, and font size in points.
 Supported lineBreakModes:
 - iOS: all UILineBreakMode supported modes
 - Mac: Only NSLineBreakByWordWrapping is supported.
 @since v1.0
 */
+ (id) labelWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment lineBreakMode:(CCLineBreakMode)lineBreakMode;

/** creates a CCLabelTTF from a fontname, horizontal alignment, vertical alignment, dimension in points, line break mode, and font size in points.
 Supported lineBreakModes:
 - iOS: all UILineBreakMode supported modes
 - Mac: Only NSLineBreakByWordWrapping is supported.
 @since v1.0
 */
+ (id) labelWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment vAlignment:(CCVerticalTextAlignment)vertAlignment lineBreakMode:(CCLineBreakMode)lineBreakMode ;

/** creates a CCLabel from a fontname, alignment, dimension in points and font size in points*/
+ (id) labelWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment vAlignment:(CCVerticalTextAlignment)vertAlignment;

/** initializes the CCLabelTTF with a font name and font size in points */
- (id) initWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size;

/** initializes the CCLabelTTF with a font name, horizontal alignment, dimension in points, and font size in points.
 Default verticalAlignment: kCCVerticalTextAlignmentTop
 Default lineBreakMode: CCLineBreakModeWordWrap
 @since v1.0
 */
- (id) initWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment;

/** initializes the CCLabelTTF with a font name, horizontal alignment, dimension in points, line break mode and font size in points.
 Default verticalAlignment: kCCVerticalTextAlignmentTop

 Supported lineBreakModes:
 - iOS: all UILineBreakMode supported modes
 - Mac: Only NSLineBreakByWordWrapping is supported.
 @since v1.0
 */
- (id) initWithString:(NSString*)str fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment lineBreakMode:(CCLineBreakMode)lineBreakMode;

/** initializes the CCLabelTTF with a font name, horizontal alignment, vertical alignment,  dimension in points and font size in points.
 Default lineBreakMode: CCLineBreakModeWordWrap
 */
- (id) initWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment vAlignment:(CCVerticalTextAlignment)vertAlignment;

/** initializes the CCLabelTTF with a font name, horizontal alignment, vertical alignment, dimension in points, line break mode and font size in points.
 Supported lineBreakModes:
 - iOS: all UILineBreakMode supported modes
 - Mac: Only NSLineBreakByWordWrapping is supported.
 @since v2.0
 */
- (id) initWithString:(NSString*)str fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment vAlignment:(CCVerticalTextAlignment)vAlignment lineBreakMode:(CCLineBreakMode)lineBreakMode ;

/** changes the string to render
 * @warning Changing the string is as expensive as creating a new CCLabelTTF. To obtain better performance use CCLabelAtlas or CCLabelBMFont.
 */
- (void) setString:(NSString*)str;

@end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

  <title>XMLDocument.Free</title>
  <link href="css/style.css" rel="stylesheet" type="text/css">
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >

    Concept Framework 2.2 documentation
  	Contents | Index

XMLDocument.Free

     Name
     Type
     Access
     Version
     Deprecated

     Free
     function
     public
     version 1.0
     no

Prototype:

public function Free()

Description:

Frees the memory used by the XML document. Is not necessary to call this function (this function being called by the finalizator function too). You may want to call it when you want to reuse the XML document (for memory economy)

Returns:

Returns 0.

Documented by Eduard Suica, generation time: Sun Jan 27 18:15:12 2013
 GMT	(c)2013 Devronium Applications


text:
#include <aws/mq/model/DeleteUserRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::MQ::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;

DeleteUserRequest::DeleteUserRequest() :
    m_brokerIdHasBeenSet(false),
    m_usernameHasBeenSet(false)
{
}

Aws::String DeleteUserRequest::SerializePayload() const
{
  return "";
}


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

namespace Dic.Xna.Framework
{
    public class Notification
    {

        #region Fields

        private object _sender;
        private Entity _entity;

        #endregion

        #region CONSTRUCTOR

        public Notification()
        {

        }

        #endregion

        #region Properties

        public object Sender { get { return _sender; } }
        public Entity Entity { get { return _entity; } }

        #endregion

        #region Methods

        internal void SetSender(object sender)
        {
            _sender = sender;
            if (sender is Entity)
                _entity = sender as Entity;
            else if (sender is IEntityComponent)
                _entity = (sender as IEntityComponent).Entity;
            else
                _entity = null;
        }

        #endregion

    }

}


text:
package org.axonframework.eventhandling;

import org.axonframework.common.Registration;
import org.axonframework.common.io.IOUtils;
import org.axonframework.messaging.SubscribableMessageSource;
import org.axonframework.messaging.unitofwork.RollbackConfiguration;
import org.axonframework.messaging.unitofwork.RollbackConfigurationType;
import org.axonframework.monitoring.MessageMonitor;
import org.axonframework.monitoring.NoOpMessageMonitor;

import java.util.List;
import java.util.function.Consumer;

/**
 * Event processor implementation that {@link EventBus#subscribe(Consumer) subscribes} to the {@link EventBus} for
 * events. Events published on the event bus are supplied to this processor in the publishing thread.
 *

 * Depending on the given {@link EventProcessingStrategy} the events are processed directly (in the publishing thread)
 * or asynchronously.
 *
 * @author Rene de Waele
 */
public class SubscribingEventProcessor extends AbstractEventProcessor {

    private final SubscribableMessageSource<? extends EventMessage<?>> messageSource;
    private final EventProcessingStrategy processingStrategy;
    private volatile Registration eventBusRegistration;

    /**
     * Initializes an EventProcessor with given {@code name} that subscribes to the given {@code messageSource} for
     * events. Actual handling of event messages is deferred to the given {@code eventHandlerInvoker}.
     *

     * The EventProcessor is initialized with a {@link DirectEventProcessingStrategy}, a {@link PropagatingErrorHandler} and a
     * {@link RollbackConfigurationType#ANY_THROWABLE}.
     *
     * @param name                The name of the event processor
     * @param eventHandlerInvoker The component that handles the individual events
     * @param messageSource       The EventBus to which this event processor will subscribe
     */
    public SubscribingEventProcessor(String name, EventHandlerInvoker eventHandlerInvoker,
                                     SubscribableMessageSource<EventMessage<?>> messageSource) {
        this(name, eventHandlerInvoker, messageSource,
             DirectEventProcessingStrategy.INSTANCE,
             PropagatingErrorHandler.INSTANCE);
    }

    /**
     * Initializes an EventProcessor with given {@code name} that subscribes to the given {@code messageSource} for
     * events. Actual handling of event messages is deferred to the given {@code eventHandlerInvoker}.
     *

     * The EventProcessor is initialized with a {@link DirectEventProcessingStrategy}, a {@link PropagatingErrorHandler} and a
     * {@link RollbackConfigurationType#ANY_THROWABLE}.
     *
     * @param name                The name of the event processor
     * @param eventHandlerInvoker The component that handles the individual events
     * @param messageSource       The EventBus to which this event processor will subscribe
     * @param processingStrategy  Strategy that determines whether events are processed directly or asynchronously
     */
    public SubscribingEventProcessor(String name, EventHandlerInvoker eventHandlerInvoker,
                                     SubscribableMessageSource<EventMessage<?>> messageSource,
                                     EventProcessingStrategy processingStrategy,
                                     ErrorHandler errorHandler) {
        this(name, eventHandlerInvoker, messageSource, processingStrategy, errorHandler, NoOpMessageMonitor.INSTANCE);
    }

    /**
     * Initializes an EventProcessor with given {@code name} that subscribes to the given {@code messageSource} for
     * events. Actual handling of event messages is deferred to the given {@code eventHandlerInvoker}.
     *

     * The EventProcessor is initialized with a {@link DirectEventProcessingStrategy}, a {@link PropagatingErrorHandler} and a
     * {@link RollbackConfigurationType#ANY_THROWABLE}.
     *
     * @param name                The name of the event processor
     * @param eventHandlerInvoker The component that handles the individual events
     * @param messageSource       The EventBus to which this event processor will subscribe
     * @param processingStrategy  Strategy that determines whether events are processed directly or asynchronously
     * @param messageMonitor      Monitor to be invoked before and after event processing
     */
    public SubscribingEventProcessor(String name, EventHandlerInvoker eventHandlerInvoker,
                                     SubscribableMessageSource<? extends EventMessage<?>> messageSource,
                                     EventProcessingStrategy processingStrategy,
                                     ErrorHandler errorHandler,
                                     MessageMonitor<? super EventMessage<?>> messageMonitor) {
        this(name, eventHandlerInvoker, RollbackConfigurationType.ANY_THROWABLE, messageSource, processingStrategy,
             errorHandler, messageMonitor);
    }

    /**
     * Initializes an EventProcessor with given {@code name} that subscribes to the given {@code messageSource} for
     * events. Actual handling of event messages is deferred to the given {@code eventHandlerInvoker}.
     *
     * @param name                  The name of the event processor
     * @param eventHandlerInvoker   The component that handles the individual events
     * @param rollbackConfiguration Determines rollback behavior of the UnitOfWork while processing a batch of events
     * @param messageSource         The EventBus to which this event processor will subscribe
     * @param processingStrategy    Strategy that determines whether events are processed directly or asynchronously
     * @param errorHandler          Invoked when a UnitOfWork is rolled back during processing
     * @param messageMonitor        Monitor to be invoked before and after event processing
     */
    public SubscribingEventProcessor(String name, EventHandlerInvoker eventHandlerInvoker,
                                     RollbackConfiguration rollbackConfiguration,
                                     SubscribableMessageSource<? extends EventMessage<?>> messageSource,
                                     EventProcessingStrategy processingStrategy, ErrorHandler errorHandler,
                                     MessageMonitor<? super EventMessage<?>> messageMonitor) {
        super(name, eventHandlerInvoker, rollbackConfiguration, errorHandler, messageMonitor);
        this.messageSource = messageSource;
        this.processingStrategy = processingStrategy;
    }

    /**
     * Start this processor. This will register the processor with the {@link EventBus}.
     */
    @Override
    public void start() {
        // prevent double registration
        if (eventBusRegistration == null) {
            eventBusRegistration =
                    messageSource.subscribe(eventMessages -> processingStrategy.handle(eventMessages, this::process));
        }
    }

    @Override
    protected void process(List<? extends EventMessage<?>> eventMessages) {
        try {
            super.process(eventMessages);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new EventProcessingException("Exception occurred while processing events", e);
        }
    }

    /**
     * Shut down this processor. This will deregister the processor with the {@link EventBus}.
     */
    @Override
    public void shutDown() {
        IOUtils.closeQuietly(eventBusRegistration);
    }
}


text:
fileSize=$1
blockSize=$2

experimentFile="teragen-$fileSize-GB-$blockSize-block"

./get_cpu_mem_usage_forJob.sh $experimentFile
./get_network_usage_forJob.sh $experimentFile

./teragen-job.sh $fileSize $blockSize

./copy-cpu-mem-usage-from-slaves.sh $experimentFile
./copy-network-usage-from-slaves.sh $experimentFile