text:
import React from 'react';

export function useShallowEqual(WrappedComponent) {
    class ShallowEqualEnhancer extends WrappedComponent {
        shouldComponentUpdate(nextProps, nextState) {
            let shouldUpdate = false;
            if (!super.shouldComponentUpdate || super.shouldComponentUpdate(nextProps, nextState)) {
                shouldUpdate = shallowEqual(this.props, nextProps, this.state, nextState);
            }
            return shouldUpdate;
        }
    }
    ShallowEqualEnhancer.displayName = `ShallowEqualEnhanced${WrappedComponent.displayName || WrappedComponent.name || 'Component'}`;

    return ShallowEqualEnhancer;
}

/**
 * Use this function with your "this" in its context.
 * @example
 * return shouldComponentUpdate.call(this, nextProps, nextState);
 * @example
 * return shouldComponentUpdate.apply(this, [nextProps, nextState]);
 * @example
 * return shouldComponentUpdate.bind(this)(nextProps, nextState);
 * @param {Object} nextProps
 * @param {Object} nextState
 */
export function shouldComponentUpdate(nextProps, nextState) {
    return shallowEqual(this.props, nextProps, this.state, nextState);
}

/**
 * @param {Object} thisProps
 * @param {Object} nextProps
 * @param {Object} thisState
 * @param {Object} nextState
 */
export function shallowEqual(thisProps, nextProps, thisState, nextState) {
    return !shallowEqualState(thisState, nextState) || !shallowEqualWithoutReactElements(thisProps, nextProps);
}

/**
 * @param {Object} thisState
 * @param {Object} nextState
 * @returns {Boolean}
 */
export function shallowEqualState(thisState, nextState) {
    return thisState === nextState
}

/**
 * Perform a shallow equal to every prop that is not a React Element
 * This will return true for unchanged props (where the only changes are the react elements props like 'children')
 * @param {Object} thisProps
 * @param {Object} nextProps
 * @returns {Boolean}
 */
export function shallowEqualWithoutReactElements(thisProps, nextProps) {
    let equals = false;
    if (thisProps === nextProps) {
        equals = true;
    } else if (typeof thisProps === 'object' && typeof nextProps === 'object') {
        equals = true;
        const propNames = new Set(Object.keys(thisProps), Object.keys(nextProps));
        for (const propName of propNames) {
            if (thisProps[propName] !== nextProps[propName] && !isReactElement(thisProps[propName])) {
                // No need to check nextProps[propName] as well, as we know they are not equal
                equals = false;
                break;
            }
        }
    }
    return equals;
}

/**
 * If the provided argument is a valid react element or an array that contains at least
 * one valid react element in it
 * @param {*} suspectedElement
 * @returns {Boolean}
 */
function isReactElement(suspectedElement) {
    let isElem = false;
    if (React.isValidElement(suspectedElement)) {
        isElem = true;
    } else if (Array.isArray(suspectedElement)) {
        for (let i = 0, l = suspectedElement.length; i < l; i++) {
            if (React.isValidElement(suspectedElement[i])) {
                isElem = true;
                break;
            }
        }
    }
    return isElem;
}

redpajama_set_name: RedPajamaGithub


text:
<?php declare(strict_types=1);

namespace DrdPlus\Tests\Codes;

use Granam\Tests\ExceptionsHierarchy\Exceptions\AbstractExceptionsHierarchyTest;

class CodesExceptionsHierarchyTest extends AbstractExceptionsHierarchyTest
{
    /**
     * @return string
     */
    protected function getTestedNamespace(): string
    {
        return str_replace('\Tests', '', __NAMESPACE__);
    }

    /**
     * @return string
     */
    protected function getRootNamespace(): string
    {
        return $this->getTestedNamespace();
    }

}


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

using tk2dEditor.SpriteCollectionEditor;

namespace tk2dEditor.SpriteCollectionEditor
{
	public interface IEditorHost
	{
		void OnSpriteCollectionChanged(bool retainSelection);
		void OnSpriteCollectionSortChanged();

		Texture2D GetTextureForSprite(int spriteId);

		SpriteCollectionProxy SpriteCollection { get; }

		int InspectorWidth { get; }
		SpriteView SpriteView { get; }
		void SelectSpritesFromList(int[] indices);
		void SelectSpritesInSpriteSheet(int spriteSheetId, int[] spriteIds);

		void Commit();
	}

	public class SpriteCollectionEditorEntry
	{
		public enum Type
		{
			None,
			Sprite,
			SpriteSheet,
			Font,

			MaxValue
		}

		public string name;
		public int index;
		public Type type;
		public bool selected = false;

		// list management
		public int listIndex; // index into the currently active list
		public int selectionKey; // a timestamp of when the entry was selected, to decide the last selected one
	}
}

public class tk2dSpriteCollectionEditorPopup : EditorWindow, IEditorHost
{
	tk2dSpriteCollection _spriteCollection; // internal tmp var
	SpriteView spriteView;
	SettingsView settingsView;
	FontView fontView;
	SpriteSheetView spriteSheetView;

	// sprite collection we're editing
	SpriteCollectionProxy spriteCollectionProxy = null;
	public SpriteCollectionProxy SpriteCollection { get { return spriteCollectionProxy; } }
	public SpriteView SpriteView { get { return spriteView; } }

	// This lists all entries
	List<SpriteCollectionEditorEntry> entries = new List<SpriteCollectionEditorEntry>();
	// This lists all selected entries
	List<SpriteCollectionEditorEntry> selectedEntries = new List<SpriteCollectionEditorEntry>();

	// Callback when a sprite collection is changed and the selection needs to be refreshed
	public void OnSpriteCollectionChanged(bool retainSelection)
	{
		var oldSelection = selectedEntries.ToArray();

		PopulateEntries();

		if (retainSelection)
		{
			searchFilter = ""; // name may have changed
			foreach (var selection in oldSelection)
			{
				foreach (var entry in entries)
				{
					if (entry.type == selection.type && entry.index == selection.index)
					{
						entry.selected = true;
						break;
					}
				}
			}
			UpdateSelection();
		}
	}

	public void SelectSpritesFromList(int[] indices)
	{
		OnSpriteCollectionChanged(true); // clear filter
		selectedEntries = new List<SpriteCollectionEditorEntry>();
		// Clear selection
		foreach (var entry in entries)
			entry.selected = false;
		// Create new selection
		foreach (var index in indices)
		{
			foreach (var entry in entries)
			{
				if (entry.type == SpriteCollectionEditorEntry.Type.Sprite && entry.index == index)
				{
					entry.selected = true;
					selectedEntries.Add(entry);
					break;
				}
			}
		}
	}

	public void SelectSpritesInSpriteSheet(int spriteSheetId, int[] spriteIds)
	{
		OnSpriteCollectionChanged(true); // clear filter
		selectedEntries = new List<SpriteCollectionEditorEntry>();
		foreach (var entry in entries)
		{
			entry.selected = (entry.type == SpriteCollectionEditorEntry.Type.SpriteSheet && entry.index == spriteSheetId);
			if (entry.selected)
			{
				spriteSheetView.Select(spriteCollectionProxy.spriteSheets[spriteSheetId], spriteIds);
			}
		}
		UpdateSelection();
	}

	void UpdateSelection()
	{
		// clear settings view if its selected
		settingsView.show = false;

		selectedEntries = (from entry in entries where entry.selected == true orderby entry.selectionKey select entry).ToList();
	}

	void ClearSelection()
	{
		entries.ForEach((a) => a.selected = false);
		UpdateSelection();
	}

	// Callback when a sprite collection needs resorting
	public static bool Contains(string s, string text)
	{
		return s.ToLower().IndexOf(text.ToLower()) != -1;
	}

	// Callback when a sort criteria is changed
	public void OnSpriteCollectionSortChanged()
	{
		if (searchFilter.Length > 0)
		{
			// re-sort list
			entries = (from entry in entries where Contains(entry.name, searchFilter) select entry)
						.OrderBy( e => e.type )
						.ThenBy( e => e.name, new tk2dEditor.Shared.NaturalComparer() )
						.ToList();
		}
		else
		{
			// re-sort list
			entries = (from entry in entries select entry)
						.OrderBy( e => e.type )
						.ThenBy( e => e.name, new tk2dEditor.Shared.NaturalComparer() )
						.ToList();
		}
		for (int i = 0; i < entries.Count; ++i)
			entries[i].listIndex = i;
	}

	public int InspectorWidth { get { return tk2dPreferences.inst.spriteCollectionInspectorWidth; } }

	// populate the entries struct for display in the listbox
	void PopulateEntries()
	{
		entries = new List<SpriteCollectionEditorEntry>();
		selectedEntries = new List<SpriteCollectionEditorEntry>();
		if (spriteCollectionProxy == null)
			return;

		for (int spriteIndex = 0; spriteIndex < spriteCollectionProxy.textureParams.Count; ++spriteIndex)
		{
			var sprite = spriteCollectionProxy.textureParams[spriteIndex];
			var spriteSourceTexture = sprite.texture;
			if (spriteSourceTexture == null && sprite.name.Length == 0) continue;

			var newEntry = new SpriteCollectionEditorEntry();
			newEntry.name = sprite.name;

			if (sprite.texture == null) {
				newEntry.name += " (missing)";
			}

			newEntry.index = spriteIndex;
			newEntry.type = SpriteCollectionEditorEntry.Type.Sprite;
			entries.Add(newEntry);
		}

		for (int i = 0; i < spriteCollectionProxy.spriteSheets.Count; ++i)
		{
			var spriteSheet = spriteCollectionProxy.spriteSheets[i];
			if (!spriteSheet.active) continue;

			var newEntry = new SpriteCollectionEditorEntry();
			newEntry.name = spriteSheet.Name;
			newEntry.index = i;
			newEntry.type = SpriteCollectionEditorEntry.Type.SpriteSheet;
			entries.Add(newEntry);
		}

		for (int i = 0; i < spriteCollectionProxy.fonts.Count; ++i)
		{
			var font = spriteCollectionProxy.fonts[i];
			if (!font.active) continue;

			var newEntry = new SpriteCollectionEditorEntry();
			newEntry.name = font.Name;
			newEntry.index = i;
			newEntry.type = SpriteCollectionEditorEntry.Type.Font;
			entries.Add(newEntry);
		}

		OnSpriteCollectionSortChanged();
		selectedEntries = new List<SpriteCollectionEditorEntry>();
	}

	public void SetGenerator(tk2dSpriteCollection spriteCollection)
	{
		this._spriteCollection = spriteCollection;
		this.firstRun = true;
		spriteCollectionProxy = new SpriteCollectionProxy(spriteCollection);
		PopulateEntries();
	}

	public void SetGeneratorAndSelectedSprite(tk2dSpriteCollection spriteCollection, int selectedSprite)
	{
		searchFilter = "";
		SetGenerator(spriteCollection);
		foreach (var entry in entries)
		{
			if (entry.type == SpriteCollectionEditorEntry.Type.Sprite && entry.index == selectedSprite)
			{
				entry.selected = true;
				break;
			}
		}
		UpdateSelection();
	}

	int cachedSpriteId = -1;
	Texture2D cachedSpriteTexture = null;

	// Returns a texture for a given sprite, if the sprite is a region sprite, a new texture is returned
	public Texture2D GetTextureForSprite(int spriteId)
	{
		var param = spriteCollectionProxy.textureParams[spriteId];
		if (spriteId != cachedSpriteId)
		{
			ClearTextureCache();
			cachedSpriteId = spriteId;
		}

		if (param.extractRegion)
		{
			if (cachedSpriteTexture == null)
			{
				var tex = param.texture;
				cachedSpriteTexture = new Texture2D(param.regionW, param.regionH);
				for (int y = 0; y < param.regionH; ++y)
				{
					for (int x = 0; x < param.regionW; ++x)
					{
						cachedSpriteTexture.SetPixel(x, y, tex.GetPixel(param.regionX + x, param.regionY + y));
					}
				}
				cachedSpriteTexture.Apply();
			}

			return cachedSpriteTexture;
		}
		else
		{
			return param.texture;
		}
	}

	void ClearTextureCache()
	{
		if (cachedSpriteId != -1)
			cachedSpriteId = -1;

		if (cachedSpriteTexture != null)
		{
			DestroyImmediate(cachedSpriteTexture);
			cachedSpriteTexture = null;
		}
	}

	void OnEnable()
	{
		if (_spriteCollection != null)
		{
			SetGenerator(_spriteCollection);
		}

		spriteView = new SpriteView(this);
		settingsView = new SettingsView(this);
		fontView = new FontView(this);
		spriteSheetView = new SpriteSheetView(this);
	}

	void OnDisable()
	{
		ClearTextureCache();

		_spriteCollection = null;
		tk2dEditorUtility.CollectAndUnloadUnusedAssets();
	}

	void OnDestroy() {
		tk2dEditorSkin.Done();
	}

	string searchFilter = "";
	void DrawToolbar()
	{
		GUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true));

		// LHS
		GUILayout.BeginHorizontal(GUILayout.Width(leftBarWidth - 6));

		// Create Button
		GUIContent createButton = new GUIContent("Create");
		Rect createButtonRect = GUILayoutUtility.GetRect(createButton, EditorStyles.toolbarDropDown, GUILayout.ExpandWidth(false));
		if (GUI.Button(createButtonRect, createButton, EditorStyles.toolbarDropDown))
		{
			GUIUtility.hotControl = 0;
			GUIContent[] menuItems = new GUIContent[] {
				new GUIContent("Sprite Sheet"),
				new GUIContent("Font")
			};

			EditorUtility.DisplayCustomMenu(createButtonRect, menuItems, -1,
				delegate(object userData, string[] options, int selected) {
					switch (selected)
					{
						case 0:
							int addedSpriteSheetIndex = spriteCollectionProxy.FindOrCreateEmptySpriteSheetSlot();
							searchFilter = "";
							PopulateEntries();
							foreach (var entry in entries)
							{
								if (entry.type == SpriteCollectionEditorEntry.Type.SpriteSheet && entry.index == addedSpriteSheetIndex)
									entry.selected = true;
							}
							UpdateSelection();
							break;
						case 1:
							if (SpriteCollection.allowMultipleAtlases)
							{
								EditorUtility.DisplayDialog("Create Font",
											"Adding fonts to sprite collections isn't allowed when multi atlas spanning is enabled. " +
											"Please disable it and try again.", "Ok");
							}
							else
							{
								int addedFontIndex = spriteCollectionProxy.FindOrCreateEmptyFontSlot();
								searchFilter = "";
								PopulateEntries();
								foreach (var entry in entries)
								{
									if (entry.type == SpriteCollectionEditorEntry.Type.Font && entry.index == addedFontIndex)
										entry.selected = true;
								}
								UpdateSelection();
							}
							break;
					}
				}
				, null);
		}

		// Filter box
		GUILayout.Space(8);
		string newSearchFilter = GUILayout.TextField(searchFilter, tk2dEditorSkin.ToolbarSearch, GUILayout.ExpandWidth(true));
		if (newSearchFilter != searchFilter)
		{
			searchFilter = newSearchFilter;
			PopulateEntries();
		}
		if (searchFilter.Length > 0)
		{
			if (GUILayout.Button("", tk2dEditorSkin.ToolbarSearchClear, GUILayout.ExpandWidth(false)))
			{
				searchFilter = "";
				PopulateEntries();
			}
		}
		else
		{
			GUILayout.Label("", tk2dEditorSkin.ToolbarSearchRightCap);
		}
		GUILayout.EndHorizontal();

		// Label
		if (_spriteCollection != null)
			GUILayout.Label(_spriteCollection.name);

		// RHS
		GUILayout.FlexibleSpace();

		// Always in settings view when empty
		if (spriteCollectionProxy != null && spriteCollectionProxy.Empty)
		{
			GUILayout.Toggle(true, "Settings", EditorStyles.toolbarButton);
		}
		else
		{
			bool newSettingsView = GUILayout.Toggle(settingsView.show, "Settings", EditorStyles.toolbarButton);
			if (newSettingsView != settingsView.show)
			{
				ClearSelection();
				settingsView.show = newSettingsView;
			}
		}

		if (GUILayout.Button("Revert", EditorStyles.toolbarButton) && spriteCollectionProxy != null)
		{
			spriteCollectionProxy.CopyFromSource();
			OnSpriteCollectionChanged(false);
		}

		if (GUILayout.Button("Commit", EditorStyles.toolbarButton) && spriteCollectionProxy != null)
			Commit();

		GUILayout.EndHorizontal();
	}

	public void Commit()
	{
		spriteCollectionProxy.DeleteUnusedData();
		spriteCollectionProxy.CopyToTarget();
		tk2dSpriteCollectionBuilder.ResetCurrentBuild();
		if (!tk2dSpriteCollectionBuilder.Rebuild(_spriteCollection)) {
			EditorUtility.DisplayDialog("Failed to commit sprite collection",
				"Please check the console for more details.", "Ok");
		}
		spriteCollectionProxy.CopyFromSource();
	}

	void HandleListKeyboardShortcuts(int controlId)
	{
		Event ev = Event.current;
		if (ev.type == EventType.KeyDown
			&& (GUIUtility.keyboardControl == controlId || GUIUtility.keyboardControl == 0)
			&& entries != null && entries.Count > 0)
		{
			int selectedIndex = 0;
			foreach (var e in entries)
			{
				if (e.selected) break;
				selectedIndex++;
			}
			int newSelectedIndex = selectedIndex;
			switch (ev.keyCode)
			{
				case KeyCode.Home: newSelectedIndex = 0; break;
				case KeyCode.End: newSelectedIndex = entries.Count - 1; break;
				case KeyCode.UpArrow: newSelectedIndex = Mathf.Max(selectedIndex - 1, 0); break;
				case KeyCode.DownArrow: newSelectedIndex = Mathf.Min(selectedIndex + 1, entries.Count - 1); break;
				case KeyCode.PageUp: newSelectedIndex = Mathf.Max(selectedIndex - 10, 0); break;
				case KeyCode.PageDown: newSelectedIndex = Mathf.Min(selectedIndex + 10, entries.Count - 1); break;
			}
			if (newSelectedIndex != selectedIndex)
			{
				for (int i = 0; i < entries.Count; ++i)
					entries[i].selected = (i == newSelectedIndex);
				UpdateSelection();
				Repaint();
				ev.Use();
			}
		}
	}

	Vector2 spriteListScroll = Vector2.zero;
	int spriteListSelectionKey = 0;
	void DrawSpriteList()
	{
		if (spriteCollectionProxy != null && spriteCollectionProxy.Empty)
		{
			DrawDropZone();
			return;
		}

		int spriteListControlId = GUIUtility.GetControlID("tk2d.SpriteList".GetHashCode(), FocusType.Keyboard);
		HandleListKeyboardShortcuts(spriteListControlId);

		spriteListScroll = GUILayout.BeginScrollView(spriteListScroll, GUILayout.Width(leftBarWidth));
		GUILayout.BeginVertical(tk2dEditorSkin.SC_ListBoxBG, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

		bool multiSelectKey = (Application.platform == RuntimePlatform.OSXEditor)?Event.current.command:Event.current.control;
		bool shiftSelectKey = Event.current.shift;

		bool selectionChanged = false;
		SpriteCollectionEditorEntry.Type lastType = SpriteCollectionEditorEntry.Type.None;
		foreach (var entry in entries)
		{
			if (lastType != entry.type)
			{
				if (lastType != SpriteCollectionEditorEntry.Type.None)
					GUILayout.Space(8);
				else
					GUI.SetNextControlName("firstLabel");

				GUILayout.Label(GetEntryTypeString(entry.type), tk2dEditorSkin.SC_ListBoxSectionHeader, GUILayout.ExpandWidth(true));
				lastType = entry.type;
			}

			bool newSelected = GUILayout.Toggle(entry.selected, entry.name, tk2dEditorSkin.SC_ListBoxItem, GUILayout.ExpandWidth(true));
			if (newSelected != entry.selected)
			{
				GUI.FocusControl("firstLabel");

				entry.selectionKey = spriteListSelectionKey++;
				if (multiSelectKey)
				{
					// Only allow multiselection with sprites
					bool selectionAllowed = entry.type == SpriteCollectionEditorEntry.Type.Sprite;
					foreach (var e in entries)
					{
						if (e != entry && e.selected && e.type != entry.type)
						{
							selectionAllowed = false;
							break;
						}
					}

					if (selectionAllowed)
					{
						entry.selected = newSelected;
						selectionChanged = true;
					}
					else
					{
						foreach (var e in entries)
						{
							e.selected = false;
						}
						entry.selected = true;
						selectionChanged = true;
					}
				}
				else if (shiftSelectKey)
				{
					// find first selected entry in list
					int firstSelection = int.MaxValue;
					foreach (var e in entries)
					{
						if (e.selected && e.listIndex < firstSelection)
						{
							firstSelection = e.listIndex;
						}
					}
					int lastSelection = entry.listIndex;
					if (lastSelection < firstSelection)
					{
						lastSelection = firstSelection;
						firstSelection = entry.listIndex;
					}
					// Filter for multiselection
					if (entry.type == SpriteCollectionEditorEntry.Type.Sprite)
					{
						for (int i = firstSelection; i <= lastSelection; ++i)
						{
							if (entries[i].type != entry.type)
							{
								firstSelection = entry.listIndex;
								lastSelection = entry.listIndex;
							}
						}
					}
					else
					{
						firstSelection = lastSelection = entry.listIndex;
					}
					foreach (var e in entries)
					{
						e.selected = (e.listIndex >= firstSelection && e.listIndex <= lastSelection);
					}
					selectionChanged = true;
				}
				else
				{
					foreach (var e in entries)
					{
						e.selected = false;
					}
					entry.selected = true;
					selectionChanged = true;
				}
			}
		}

		if (selectionChanged)
		{
			GUIUtility.keyboardControl = spriteListControlId;
			UpdateSelection();
			Repaint();
		}

		GUILayout.EndVertical();
		GUILayout.EndScrollView();

		Rect viewRect = GUILayoutUtility.GetLastRect();
		tk2dPreferences.inst.spriteCollectionListWidth = (int)tk2dGuiUtility.DragableHandle(4819283,
			viewRect, tk2dPreferences.inst.spriteCollectionListWidth,
			tk2dGuiUtility.DragDirection.Horizontal);
	}

	bool IsValidDragPayload()
	{
		int idx = 0;
		foreach (var v in DragAndDrop.objectReferences)
		{
			var type = v.GetType();
			if (type == typeof(Texture2D))
				return true;
			else if (type == typeof(Object) && System.IO.Directory.Exists(DragAndDrop.paths[idx]))
				return true;
			++idx;
		}
		return false;
	}

	string GetEntryTypeString(SpriteCollectionEditorEntry.Type kind)
	{
		switch (kind)
		{
			case SpriteCollectionEditorEntry.Type.Sprite: return "Sprites";
			case SpriteCollectionEditorEntry.Type.SpriteSheet: return "Sprite Sheets";
			case SpriteCollectionEditorEntry.Type.Font: return "Fonts";
		}

		Debug.LogError("Unhandled type");
		return "";
	}

	void HandleDroppedPayload(Object[] objects)
	{
		List<int> addedIndices = new List<int>();
		foreach (var obj in objects)
		{
			Texture2D tex = obj as Texture2D;
			string name = spriteCollectionProxy.FindUniqueTextureName(tex.name);
			int slot = spriteCollectionProxy.FindOrCreateEmptySpriteSlot();
			spriteCollectionProxy.textureParams[slot].name = name;
			spriteCollectionProxy.textureParams[slot].colliderType = tk2dSpriteCollectionDefinition.ColliderType.UserDefined;
			spriteCollectionProxy.textureParams[slot].texture = (Texture2D)obj;
			addedIndices.Add(slot);
		}
		// And now select them
		searchFilter = "";
		PopulateEntries();
		foreach (var entry in entries)
		{
			if (entry.type == SpriteCollectionEditorEntry.Type.Sprite &&
				addedIndices.IndexOf(entry.index) != -1)
				entry.selected = true;
		}

		UpdateSelection();
	}

	// recursively find textures in path
	List<Object> AddTexturesInPath(string path)
	{
		List<Object> localObjects = new List<Object>();
		foreach (var q in System.IO.Directory.GetFiles(path))
		{
			string f = q.Replace('\\', '/');
			System.IO.FileInfo fi = new System.IO.FileInfo(f);
			if (fi.Extension.ToLower() == ".meta")
				continue;

			Object obj = AssetDatabase.LoadAssetAtPath(f, typeof(Texture2D));
			if (obj != null) localObjects.Add(obj);
		}
		foreach (var q in System.IO.Directory.GetDirectories(path))
		{
			string d = q.Replace('\\', '/');
			localObjects.AddRange(AddTexturesInPath(d));
		}

		return localObjects;
	}

	int leftBarWidth { get { return tk2dPreferences.inst.spriteCollectionListWidth; } }

	Object[] deferredDroppedObjects;
	void DrawDropZone()
	{
		GUILayout.BeginVertical(tk2dEditorSkin.SC_ListBoxBG, GUILayout.Width(leftBarWidth), GUILayout.ExpandHeight(true));
		GUILayout.FlexibleSpace();
		GUILayout.BeginHorizontal();
		GUILayout.FlexibleSpace();
		if (DragAndDrop.objectReferences.Length == 0 && !SpriteCollection.Empty)
			GUILayout.Label("Drop sprite here", tk2dEditorSkin.SC_DropBox);
		else
			GUILayout.Label("Drop sprites here", tk2dEditorSkin.SC_DropBox);
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();
		GUILayout.FlexibleSpace();
		GUILayout.EndVertical();

		Rect rect = new Rect(0, 0, leftBarWidth, Screen.height);
		if (rect.Contains(Event.current.mousePosition))
		{
			switch (Event.current.type)
			{
			case EventType.DragUpdated:
				if (IsValidDragPayload())
					DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
				else
					DragAndDrop.visualMode = DragAndDropVisualMode.None;
				break;

			case EventType.DragPerform:
				var droppedObjectsList = new List<Object>();
				for (int i = 0; i < DragAndDrop.objectReferences.Length; ++i)
				{
					var type = DragAndDrop.objectReferences[i].GetType();
					if (type == typeof(Texture2D))
						droppedObjectsList.Add(DragAndDrop.objectReferences[i]);
					else if (type == typeof(Object) && System.IO.Directory.Exists(DragAndDrop.paths[i]))
						droppedObjectsList.AddRange(AddTexturesInPath(DragAndDrop.paths[i]));
				}
				deferredDroppedObjects = droppedObjectsList.ToArray();
				Repaint();
				break;
			}
		}
	}

	bool dragging = false;
	bool currentDraggingValue = false;

	bool firstRun = true;
	List<UnityEngine.Object> assetsInResources = new List<UnityEngine.Object>();

	bool InResources(UnityEngine.Object obj)
	{
		return AssetDatabase.GetAssetPath(obj).ToLower().IndexOf("/resources/") != -1;
	}

	void CheckForAssetsInResources()
	{
		assetsInResources.Clear();
		foreach (tk2dSpriteCollectionDefinition tex in SpriteCollection.textureParams)
		{
			if (tex.texture == null) continue;
			if (InResources(tex.texture) && assetsInResources.IndexOf(tex.texture) == -1) assetsInResources.Add(tex.texture);
		}
		foreach (tk2dSpriteCollectionFont font in SpriteCollection.fonts)
		{
			if (font.texture != null && InResources(font.texture) && assetsInResources.IndexOf(font.texture) == -1) assetsInResources.Add(font.texture);
			if (font.bmFont != null && InResources(font.bmFont) && assetsInResources.IndexOf(font.bmFont) == -1) assetsInResources.Add(font.bmFont);
		}
	}

	Vector2 assetWarningScroll = Vector2.zero;
	bool HandleAssetsInResources()
	{
		if (firstRun && SpriteCollection != null)
		{
			CheckForAssetsInResources();
			firstRun = false;
		}
		if (assetsInResources.Count > 0)
		{
			tk2dGuiUtility.InfoBox("Warning: The following assets are in one or more resources directories.\n" +
				"These files will be included in the build.",
				tk2dGuiUtility.WarningLevel.Warning);
			assetWarningScroll = GUILayout.BeginScrollView(assetWarningScroll, GUILayout.ExpandWidth(true));
			foreach (UnityEngine.Object obj in assetsInResources)
			{
				EditorGUILayout.ObjectField(obj, typeof(UnityEngine.Object), false);
			}
			GUILayout.EndScrollView();
			GUILayout.Space(8);
			GUILayout.BeginHorizontal();
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Ok", GUILayout.MinWidth(100)))
			{
				assetsInResources.Clear();
				Repaint();
			}
			GUILayout.EndHorizontal();
			return true;
		}
		return false;
	}

    void OnGUI()
	{
		if (Event.current.type == EventType.DragUpdated)
		{
			if (IsValidDragPayload())
				dragging = true;
		}
		else if (Event.current.type == EventType.DragExited)
		{
			dragging = false;
			Repaint();
		}
		else
		{
			if (currentDraggingValue != dragging)
			{
				currentDraggingValue = dragging;
			}
		}

		if (Event.current.type == EventType.Layout && deferredDroppedObjects != null)
		{
			HandleDroppedPayload(deferredDroppedObjects);
			deferredDroppedObjects = null;
		}

		if (HandleAssetsInResources()) return;

		GUILayout.BeginVertical();

		DrawToolbar();

		GUILayout.BeginHorizontal();

		if (currentDraggingValue)
			DrawDropZone();
		else
			DrawSpriteList();

		if (settingsView.show || (spriteCollectionProxy != null && spriteCollectionProxy.Empty)) settingsView.Draw();
		else if (fontView.Draw(selectedEntries)) { }
		else if (spriteSheetView.Draw(selectedEntries)) { }
		else spriteView.Draw(selectedEntries);

		GUILayout.EndHorizontal();
		GUILayout.EndVertical();
    }
}


text:
module.exports = {
  get: (controller) => {
    controller.finish(controller.req.url());
  },
};


text:
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** @author  John Miller
 *  @version 1.3
 *  @date    Wed Jul 31 20:51:48 EDT 2013
 *  @see     LICENSE (MIT style license file).
 */

package scalation

import java.io._

import collection.mutable.ArrayBuffer
import scala.io._

//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** The `UpVersion` object is used to update the version number in the source code.
 */
object UpVersion
{
    private val DEBUG      = true                      // debug flag
    private val pat1       = "@version 1.3"            // pattern to find (change as needed)
    private val pat2       = "@version 1.3"            // replacement pattern (change as needed)
    private val SKIP       = "old"                     // do not process files in this directory
    private val sep        = File.separator            // file separator ('/' for UNIX, '\' for Windows)
    private val SRC_DIR    = "."                       // source directory
    private val EXT        = ".scala"
    private val currentDir = SRC_DIR
//  private val currentDir = SRC_DIR + sep + "main" + sep + "scala"

    //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    /** Update the version number for the given source (.scala) file.
     *  @param f   the file to update
     *  @param fn  the file's name
     */
    def update (f: File, fn: String)
    {
        if (fn.endsWith (EXT)) {
            if (DEBUG) println (s"update $fn")
            val source = Source.fromFile (f)
            val lines  = source.getLines ()
            val slines = ArrayBuffer [String] ()
            for (l <- lines) slines += l.toString
            source.close ()
            val pw = new PrintWriter (f)
            for (l <- slines) {
//              println (l.toString.replace (pat1, pat2))
                pw.println (l.toString.replace (pat1, pat2))
            } // for
            pw.close ()
        } // if
    } // update

    //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    /** Update the version number for all source (.scala) files.
     */
    def updateAll ()
    {
        println ("Update version number in source code files starting from currentDir = " + currentDir)
        updater (new File (currentDir))
    } // updateAll

    //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    /** Recursively update the version number for each source (.scala) file.
     *  @param f  the root file/directory to examine
     */
    private def updater (f: File)
    {
        val dirs = new ArrayBuffer [File] ()

        try {
            for (fi <- f.listFiles ()) {
                val fn = fi.getName ()
                if (! fi.isDirectory ()) update (fi, fn)          // file and file-name
                else if (fn != SKIP) dirs += fi
            } // for

            for (fi <- dirs if fi.isDirectory ()) updater (fi)    // recurse into each directory
        } catch { case _ : Throwable => }
    } // updater

} // UpVersion object

//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** The `UpVersionFile` object updates the version number of a single source
 *  (.scala) file.
 *  > run-main scalation.UpVersionFile
 */
object UpVersionFile extends App
{
    val fn = "Test2.scala"
    UpVersion.update (new File (fn), fn)

} // UpVersionFile

//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** The `UpVersionAll` object updates the version number of all source (.scala)
 *  files at or below the 'currentDir' (see `UpVersion`).
 *  > run-main scalation.UpVersionAll
 */
object UpVersionAll extends App
{
    UpVersion.updateAll ()

} // UpVersionAll


text:
API
===

.. warning::
   The documentations assumes you know the risks of using cryptography.
   This library is low level with all benefits and dangers.

   Here be dragons!

The *new* constructor
---------------------

.. autofunction:: camellia.new

Modes of operation
------------------

.. autodata:: camellia.MODE_ECB
.. autodata:: camellia.MODE_CBC
.. autodata:: camellia.MODE_CFB
.. autodata:: camellia.MODE_OFB
.. autodata:: camellia.MODE_CTR

The *CamelliaCipher* class
--------------------------

.. autoclass:: camellia.CamelliaCipher
    :members:

    .. automethod:: camellia.CamelliaCipher.encrypt
    .. automethod:: camellia.CamelliaCipher.decrypt

Low-level camellia functions
----------------------------

.. autofunction:: camellia.Camellia_Ekeygen
.. autofunction:: camellia.Camellia_Encrypt
.. autofunction:: camellia.Camellia_Decrypt


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

namespace Microsoft.Azure.Commands.Scheduler.Utilities
{
    using System;
    using System.Management.Automation;
    using Microsoft.Azure.Commands.Scheduler.Models;
    using SchedulerModels = Microsoft.Azure.Management.Scheduler.Models;

    public class JobBaseCmdlet : SchedulerBaseCmdlet
    {
        /// <summary>
        /// Dynamic PowerShell parameters for creating a job.
        /// </summary>
        internal JobDynamicParameters JobDynamicParameters = new JobDynamicParameters();

        /// <summary>
        /// Gets service bus error action authentication.
        /// </summary>
        /// <returns></returns>
        private PSServiceBusAuthenticationParams GetServiceBusErrorActionAuthentication()
        {
            return new PSServiceBusAuthenticationParams()
            {
                SasKey = this.JobDynamicParameters.ErrorActionServiceBusSasKeyValue,
                SasKeyName = this.JobDynamicParameters.ErrorActionServiceBusSasKeyName,
                Type = Constants.SharedAccessKey
            };
        }

        /// <summary>
        /// Gets service bus error action parameters.
        /// </summary>
        /// <returns></returns>
        private PSServiceBusParams GetServiceBusErrorActionParams()
        {
            return new PSServiceBusParams()
            {
                Authentication = this.GetServiceBusErrorActionAuthentication(),
                Message = this.JobDynamicParameters.ErrorActionServiceBusMessage,
                NamespaceProperty = this.JobDynamicParameters.ErrorActionServiceBusNamespace,
                TransportType = this.JobDynamicParameters.ErrorActionServiceBusTransportType
            };
        }

        /// <summary>
        /// Populates error action paramenter values to PSJobActionParams.
        /// </summary>
        /// <param name="errorActionType">Error action type e.g. http, https, storage etc</param>
        /// <returns>PSJobActionParams.</returns>
        internal PSJobActionParams GetErrorActionParamsValue(string errorActionType)
        {
            if (!string.IsNullOrWhiteSpace(errorActionType))
            {
                var jobErrorActionType = (SchedulerModels.JobActionType)Enum.Parse(typeof(SchedulerModels.JobActionType), errorActionType, ignoreCase: true);

                var jobErrorAction = new PSJobActionParams()
                {
                    JobActionType = jobErrorActionType,
                };

                switch(jobErrorActionType)
                {
                    case SchedulerModels.JobActionType.Http:
                    case SchedulerModels.JobActionType.Https:
                        var jobErrorActionAuthentication = new PSHttpJobAuthenticationParams()
                        {
                            HttpAuthType = this.JobDynamicParameters.ErrorActionHttpAuthenticationType,
                            ClientCertPfx = string.IsNullOrWhiteSpace(JobDynamicParameters.ErrorActionClientCertificatePfx) ? null : SchedulerUtility.GetCertData(this.ResolvePath(JobDynamicParameters.ErrorActionClientCertificatePfx), JobDynamicParameters.ErrorActionClientCertificatePassword),
                            ClientCertPassword = this.JobDynamicParameters.ErrorActionClientCertificatePassword,
                            Username = this.JobDynamicParameters.ErrorActionBasicUsername,
                            Password = this.JobDynamicParameters.ErrorActionBasicPassword,
                            Secret = this.JobDynamicParameters.ErrorActionOAuthSecret,
                            Tenant = this.JobDynamicParameters.ErrorActionOAuthTenant,
                            Audience = this.JobDynamicParameters.ErrorActionOAuthAudience,
                            ClientId = this.JobDynamicParameters.ErrorActionOAuthClientId
                        };

                        var httpJobErrorAction = new PSHttpJobActionParams()
                        {
                            RequestMethod = this.JobDynamicParameters.ErrorActionMethod,
                            Uri = this.JobDynamicParameters.ErrorActionUri,
                            RequestBody = this.JobDynamicParameters.ErrorActionRequestBody,
                            RequestHeaders = this.JobDynamicParameters.ErrorActionHeaders,
                            RequestAuthentication = jobErrorActionAuthentication
                        };

                        jobErrorAction.HttpJobAction = httpJobErrorAction;
                        break;

                    case SchedulerModels.JobActionType.StorageQueue:
                        var storageQueueErrorAction = new PSStorageJobActionParams()
                        {
                            StorageAccount = this.JobDynamicParameters.ErrorActionStorageAccount,
                            StorageQueueName = this.JobDynamicParameters.ErrorActionStorageQueue,
                            StorageSasToken = this.JobDynamicParameters.ErrorActionStorageSASToken,
                            StorageQueueMessage = this.JobDynamicParameters.ErrorActionQueueMessageBody,
                        };

                        jobErrorAction.StorageJobAction = storageQueueErrorAction;
                        break;

                    case SchedulerModels.JobActionType.ServiceBusQueue:
                        var serviceBusQueueErrorAction = GetServiceBusErrorActionParams();
                        serviceBusQueueErrorAction.QueueName = this.JobDynamicParameters.ErrorActionServiceBusQueueName;
                        jobErrorAction.ServiceBusAction = serviceBusQueueErrorAction;
                        break;

                    case SchedulerModels.JobActionType.ServiceBusTopic:
                        var serviceBusTopicErrorAction = GetServiceBusErrorActionParams();
                        serviceBusTopicErrorAction.TopicPath = this.JobDynamicParameters.ErrorActionServiceBusTopicPath;
                        jobErrorAction.ServiceBusAction = serviceBusTopicErrorAction;
                        break;
                }

                return jobErrorAction;
            }

            return null;
        }

        /// <summary>
        /// Adds error action Powershell Parameters.
        /// </summary>
        /// <param name="errorActionType">Error action type.</param>
        /// <param name="create">true</param>
        /// <returns>PowerShell parameters.</returns>
        public RuntimeDefinedParameterDictionary AddErrorActionParameters(string errorActionType, bool create)
        {
            var runtimeDefinedParameterDictionary = new RuntimeDefinedParameterDictionary();

            if (!string.IsNullOrWhiteSpace(errorActionType))
            {
                if (errorActionType.Equals(Constants.HttpAction, StringComparison.InvariantCultureIgnoreCase))
                {
                    runtimeDefinedParameterDictionary.AddRange(this.JobDynamicParameters.AddHttpErrorActionParameters(create));
                }
                else if (errorActionType.Equals(Constants.StorageQueueAction, StringComparison.InvariantCultureIgnoreCase))
                {
                    runtimeDefinedParameterDictionary.AddRange(this.JobDynamicParameters.AddStorageQueueErrorActionParameters(create));
                }
                else if (errorActionType.Equals(Constants.ServiceBusQueueAction, StringComparison.InvariantCultureIgnoreCase))
                {
                    runtimeDefinedParameterDictionary.AddRange(this.JobDynamicParameters.AddServiceBusQueueErrorActionParameters(create));
                }
                else if (errorActionType.Equals(Constants.ServiceBusTopicAction, StringComparison.InvariantCultureIgnoreCase))
                {
                    runtimeDefinedParameterDictionary.AddRange(this.JobDynamicParameters.AddServiceBusTopicErrorActionParameters(create));
                }
            }

            return runtimeDefinedParameterDictionary;
        }
    }
}


text:
package net.phalanxx.cdiext.util;

import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.InjectionTarget;
import javax.inject.Inject;

/**
 * Bean manager related util methods. They should be used rarely.
 *
 * @author rbachlec
 */
@ApplicationScoped
public class BeanManagerUtil {

    @Inject private BeanManager beanManager;

    /**
     * Get a single CDI managed instance of a specific class. Return only the first result if multiple beans are
     * available.
     *
     * @param <T> type of the contextual instance to return
     * @param type The class for which to return an instance.
     * @param qualifiers List of qualifier annotations
     * @return The managed instance, or null if none could be provided.
     */
    public <T> T getContextualInstance(final Class<T> type, final Annotation... qualifiers) {
        return getContextualInstance(beanManager, type, qualifiers);
    }

    /**
     * Get a single CDI managed instance of a specific class. Return only the first result if multiple beans are
     * available.
     *

     * NOTE: Using this method should be avoided if container provided injection is available.
     *
     * @param <T> type of the contextual instance to return
     * @param beanManager The bean manager with which to perform the lookup.
     * @param type The class for which to return an instance.
     * @param qualifiers List of qualifier annotations
     * @return The managed instance, or null if none could be provided.
     */
    @SuppressWarnings("unchecked")
    public static <T> T getContextualInstance(final BeanManager beanManager, final Class<T> type,
                                              final Annotation... qualifiers) {
        T result = null;
        Bean<T> bean = (Bean<T>) beanManager.resolve(beanManager.getBeans(type, qualifiers));
        if (bean != null) {
            CreationalContext<T> context = beanManager.createCreationalContext(bean);
            result = (T) beanManager.getReference(bean, type, context);
        }
        return result;
    }

    /**
     * Get all CDI managed instances of a specific class. Return results in a
     * {@link List} in no specific order.
     *
     * @param <T> type of the contextual instance to return
     * @param type The class for which to return instances.
     * @param qualifiers List of qualifier annotations
     * @return list of contextual instances matching the parameters
     */
    @SuppressWarnings("unchecked")
    public <T> List<T> getContextualInstances(final Class<T> type, final Annotation... qualifiers) {
        List<T> result = new ArrayList<>();
        for (Bean<?> bean : beanManager.getBeans(type, qualifiers)) {
            CreationalContext<T> context = (CreationalContext<T>) beanManager.createCreationalContext(bean);
            result.add((T) beanManager.getReference(bean, type, context));
        }
        return result;
    }

    /**
     * Does injection magic on the given object.
     *
     * @param <T> type of object to do injection for
     * @param object  object to do injection for
     */
    public <T> void doInjectionsForUnmanagedObject(final T object) {
        doInjectionsForUnmanagedObject(beanManager, object);
    }

    /**
     * Does injection magic on the given object.
     *
     * @param <T> type of object to do injection for
     * @param beanManager The bean manager with which to perform the lookup.
     * @param object  object to do injection for
     */
    @SuppressWarnings("unchecked")
    public static <T> void doInjectionsForUnmanagedObject(final BeanManager beanManager, final T object) {
        AnnotatedType<T> type = (AnnotatedType<T>) beanManager.createAnnotatedType(object.getClass());
        InjectionTarget<T> target = beanManager.createInjectionTarget(type);
        CreationalContext<T> creationalContext = beanManager.createCreationalContext(null);
        target.inject(object, creationalContext);
    }

}


text:
package com.google.inject.internal;

import com.google.common.collect.ImmutableSet;
import com.google.inject.Key;
import com.google.inject.Provider;
import com.google.inject.internal.ProvisionListenerStackCallback.ProvisionCallback;
import com.google.inject.spi.Dependency;
import com.google.inject.spi.HasDependencies;
import com.google.inject.spi.InjectionPoint;
import com.google.inject.spi.ProviderWithExtensionVisitor;

/**
 * A {@link ProviderInstanceBindingImpl} for implementing 'native' guice extensions.
 *
 *
Beyond the normal binding contract that is mostly handled by our baseclass, this also
 * implements {@link DelayedInitialize} in order to initialize factory state.
 */
final class InternalProviderInstanceBindingImpl<T> extends ProviderInstanceBindingImpl<T>
    implements DelayedInitialize {
  enum InitializationTiming {
    /** This factory can be initialized eagerly. This should be the case for most things. */
    EAGER,

    /**
     * Initialization of this factory should be delayed until after all other static initialization
     * completes. This will be useful for factories that need to call {@link
     * InjectorImpl#getExistingBinding(Key)} to not create jit bindings, but also want to be able to
     * conditionally consume jit bindings created by other other bindings.
     */
    DELAYED;
  }

  private final Factory<T> originalFactory;

  InternalProviderInstanceBindingImpl(
      InjectorImpl injector,
      Key<T> key,
      Object source,
      Factory<T> originalFactory,
      InternalFactory<? extends T> scopedFactory,
      Scoping scoping) {
    super(
        injector,
        key,
        source,
        scopedFactory,
        scoping,
        originalFactory,
        ImmutableSet.<InjectionPoint>of());
    this.originalFactory = originalFactory;
  }

  InitializationTiming getInitializationTiming() {
    return originalFactory.initializationTiming;
  }

  @Override
  public void initialize(final InjectorImpl injector, final Errors errors) throws ErrorsException {
    originalFactory.source = getSource();
    originalFactory.provisionCallback = injector.provisionListenerStore.get(this);
    // For these kinds of providers, the 'user supplied provider' is really 'guice supplied'
    // So make our user supplied provider just delegate to the guice supplied one.
    originalFactory.delegateProvider = getProvider();
    originalFactory.initialize(injector, errors);
  }

  /**
   * A base factory implementation. Any Factories that delegate to other bindings should use the
   * {@code CyclicFactory} subclass, but trivial factories can use this one.
   */
  abstract static class Factory<T> implements InternalFactory<T>, Provider<T>, HasDependencies {
    private final InitializationTiming initializationTiming;
    private Object source;
    private Provider<T> delegateProvider;
    ProvisionListenerStackCallback<T> provisionCallback;

    Factory(InitializationTiming initializationTiming) {
      this.initializationTiming = initializationTiming;
    }
    /**
     * The binding source.
     *
     *
May be useful for augmenting runtime error messages.
     *
     *
Note: this will return {#code null} until {@link #initialize(InjectorImpl, Errors)} has
     * already been called.
     */
    final Object getSource() {
      return source;
    }

    /**
     * A callback that allows for implementations to fetch dependencies on other bindings.
     *
     *
Will be called exactly once, prior to any call to {@link #doProvision}.
     */
    abstract void initialize(InjectorImpl injector, Errors errors) throws ErrorsException;

    @Override
    public final T get() {
      Provider<T> local = delegateProvider;
      if (local == null) {
        throw new IllegalStateException(
            "This Provider cannot be used until the Injector has been created.");
      }
      return local.get();
    }

    @Override
    public T get(final InternalContext context, final Dependency<?> dependency, boolean linked)
        throws InternalProvisionException {
      if (provisionCallback == null) {
        return doProvision(context, dependency);
      } else {
        return provisionCallback.provision(
            context,
            new ProvisionCallback<T>() {
              @Override
              public T call() throws InternalProvisionException {
                return doProvision(context, dependency);
              }
            });
      }
    }
    /**
     * Creates an object to be injected.
     *
     * @throws com.google.inject.internal.InternalProvisionException if a value cannot be provided
     * @return instance to be injected
     */
    protected abstract T doProvision(InternalContext context, Dependency<?> dependency)
        throws InternalProvisionException;
  }

  /**
   * An base factory implementation that can be extended to provide a specialized implementation of
   * a {@link ProviderWithExtensionVisitor} and also implements {@link InternalFactory}
   */
  abstract static class CyclicFactory<T> extends Factory<T> {

    CyclicFactory(InitializationTiming initializationTiming) {
      super(initializationTiming);
    }

    @Override
    public final T get(
        final InternalContext context, final Dependency<?> dependency, boolean linked)
        throws InternalProvisionException {
      final ConstructionContext<T> constructionContext = context.getConstructionContext(this);
      // We have a circular reference between bindings. Return a proxy.
      if (constructionContext.isConstructing()) {
        Class<?> expectedType = dependency.getKey().getTypeLiteral().getRawType();
        @SuppressWarnings("unchecked")
        T proxyType =
            (T) constructionContext.createProxy(context.getInjectorOptions(), expectedType);
        return proxyType;
      }
      // Optimization: Don't go through the callback stack if no one's listening.
      constructionContext.startConstruction();
      try {
        if (provisionCallback == null) {
          return provision(dependency, context, constructionContext);
        } else {
          return provisionCallback.provision(
              context,
              new ProvisionCallback<T>() {
                @Override
                public T call() throws InternalProvisionException {
                  return provision(dependency, context, constructionContext);
                }
              });
        }
      } finally {
        constructionContext.removeCurrentReference();
        constructionContext.finishConstruction();
      }
    }

    private T provision(
        Dependency<?> dependency,
        InternalContext context,
        ConstructionContext<T> constructionContext)
        throws InternalProvisionException {
      try {
        T t = doProvision(context, dependency);
        constructionContext.setProxyDelegates(t);
        return t;
      } catch (InternalProvisionException ipe) {
        throw ipe.addSource(getSource());
      } catch (Throwable t) {
        throw InternalProvisionException.errorInProvider(t).addSource(getSource());
      }
    }
  }
}


text:
<?php
function afficheHeader($chemin)
{
	echo '

					<button type="button" class="navbar-toggle ico-menu" data-toggle="offcanvas" data-recalc="false" data-target=".navmenu" data-canvas=".canvas">

					</button>
					'.$chemin.'

						<button type="button" class="btn btn-xs btn-danger">4</button>
						<button type="button" class="btn btn-xs btn-user">Augereau Mickaël</button>
						<button type="button" class="btn btn-xs btn-user dropdown-toggle" data-toggle="dropdown" aria-expanded="false">

							Toggle Dropdown
						</button>

Notifications 4

Deconnexion

	';
}

function afficheMenu()
{
	// ajout fixed nav
	echo'

							<legend>

								MENU PRINCIPAL
							</legend>

Accueil

Agenda

Doctorants encadrés

Doctorants du laboratoire

Statistiques

Historique doctorants

						<legend>

							MENU ADMINISTRATION
						</legend>

Dossier de suivis

	';
}

function importCSS(){
	echo'
		<link href="http://localhost:8888/doctorama/src/DT/UserBundle/Resources/views/User/css/jasny-bootstrap.min.css" rel="stylesheet">
		<link href="http://localhost:8888/doctorama/src/DT/UserBundle/Resources/views/User/css/bootstrap.css" rel="stylesheet">
	    <link href="http://localhost:8888/doctorama/src/DT/UserBundle/Resources/views/User/css/style.css" rel="stylesheet">';
}

function importJS(){
	echo'

	   ';
}

function afficheStructureDeb($chemin)
{
	echo '<!DOCTYPE html>

		    <meta charset="utf-8">
		    <meta name="viewport" content="width=device-width, initial-scale=1.0">
		    <meta name="description" content="">
    		<title>'.$chemin.'</title>';
    importCSS();
    echo '
		';
	afficheMenu();
	echo '
';
	afficheHeader($chemin);
	echo '
';
}

function afficheStructureFin()
{
	echo'

';
    importJS();
    echo'
    	';
}


text:
package com.ocdsoft.bacta.swg.server.data;

import com.esotericsoftware.kryo.Kryo;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.Singleton;
import com.ocdsoft.bacta.engine.serialize.KryoSerializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by Kyle on 8/14/2014.
 */
@Singleton
public final class ChatObjectSerializer extends KryoSerializer {

    private static final Logger LOGGER = LoggerFactory.getLogger(ChatObjectSerializer.class);

    @Inject
    public ChatObjectSerializer(Injector injector) {
        super(injector);
    }

    @Override
    public void registerTypes(Kryo kryo, Injector injector) {

    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>GovernorFactory (JasperReports 5.6.0 API)</title>
<meta name="date" content="2014-05-27">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

net.sf.jasperreports.governors

Class GovernorFactory

java.lang.Object

net.sf.jasperreports.governors.GovernorFactory

All Implemented Interfaces:

ScriptletFactory

public final class GovernorFactory
extends java.lang.Object
implements ScriptletFactory

Version:

$Id: GovernorFactory.java 6704 2013-11-08 12:29:32Z teodord $

Author:

Teodor Danciu (teodord@users.sourceforge.net)

Method Summary

Methods

Modifier and Type
Method and Description

static GovernorFactory
getInstance()

java.util.List<JRAbstractScriptlet>
getScriplets(ScriptletFactoryContext context)

Returns a list of scriptlet instances to be used during report filling.

protected JRAbstractScriptlet
getScriptlet(java.lang.String scriptletClassName)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

getInstance

public static GovernorFactory getInstance()

getScriplets

public java.util.List<JRAbstractScriptlet> getScriplets(ScriptletFactoryContext context)
                                                 throws JRException

Description copied from interface: ScriptletFactory

Returns a list of scriptlet instances to be used during report filling.
 This method can return null if no scriplet is to be used.

Specified by:

getScriplets in interface ScriptletFactory

Throws:

JRException

getScriptlet

protected JRAbstractScriptlet getScriptlet(java.lang.String scriptletClassName)
                                    throws JRException

Throws:

JRException

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com


text:
package org.semanticweb.clipper.util;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class LUBMAnswerFileParser {

	private HashSet<List<String>> predictedAnswers;

	public LUBMAnswerFileParser() {
	}

	public Set<List<String>> getAnswers() {
		return predictedAnswers;
	}

	public Set<List<String>> readAnswers(String answerFile) {
		predictedAnswers = new HashSet<>();

		try {
			// Open the file that is the first
			// command line parameter
			FileInputStream fstream = new FileInputStream(answerFile);
			// Get the object of DataInputStream
			DataInputStream in = new DataInputStream(fstream);
			BufferedReader br = new BufferedReader(new InputStreamReader(in));
			String strLine;
			// read the first line
			String firstLine = br.readLine();
			if (!firstLine.contains("NO ANSWERS.")) {
				// String[] numberOfVar = firstLine.split(" ");

				// Read File Line By Line
				while ((strLine = br.readLine()) != null) {
					// Print the content on the console
					List<String> answerTuple = new ArrayList<>();
					String[] answers = strLine.split("\\s+");
					for (String s : answers) {
						//answerTuple.add("<" + s + ">");
						answerTuple.add("\""+s+"\"");
					}

					predictedAnswers.add(answerTuple);
				}
			}
			in.close();

		} catch (Exception e) {// Catch exception if any
			System.err.println("Error: " + e.getMessage());
		}

		return predictedAnswers;
	}
	// public static void main (String[] args){
	// CheckLUBMAnswer c = new CheckLUBMAnswer();
	// c.readAnswers("TestData/lubm/answers_query4.txt");
	// System.out.println(c.getPredictedAnswers());
	// }
}


text:
<?php

/* @var $this \yii\web\View */
/* @var $content string */

use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use frontend\assets\AppAsset;
use common\widgets\Alert;

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">

    <meta charset="<?= Yii::$app->charset ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    <link rel='stylesheet' type='text/css' href='https://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css'>
    <link rel="stylesheet" type="text/css" href="http://flwebsites.biz/jAlert/src/jAlert-v3.css">

    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>

<?php $this->beginBody() ?>

    <?php
    NavBar::begin([
        'brandLabel' => 'PPGI',
        'brandUrl' => Yii::$app->homeUrl,
        'options' => [
            'class' => 'navbar-inverse navbar-fixed-top',
        ],
    ]);
    $menuItems = [
        ['label' => 'Início', 'url' => ['/site/index']],
    ];

    $session = Yii::$app->session;
    if ($session->get('candidato')) {
        $menuItems[] = [
            'label' => 'Sair',
            'url' => ['/site/logout'],
            'linkOptions' => ['data-method' => 'post']
        ];
    }
    echo Nav::widget([
        'options' => ['class' => 'navbar-nav navbar-right'],
        'items' => $menuItems,
    ]);
    NavBar::end();
    ?>

        <?= Breadcrumbs::widget([
            'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
        ]) ?>

        <?= Yii::$app->view->renderFile('@app/views/layouts/mensagemFlash.php') ?>
        <input id="timesession" type="hidden" value= <?= ini_get('session.gc_maxlifetime');?> />

        <?= $content ?>

ICOMP <?= date('Y') ?>

PPGI

<?php $this->endBody() ?>

<?php $this->endPage() ?>


text:
//
//  LoadingSaving.cpp
//  PointPairFeatures
//
//  Created by Adrian Haarbach on 27.06.14.
//  Copyright (c) 2014 Adrian Haarbach. All rights reserved.
//

#include "LoadingSaving.h"
#include <fstream>
#include <numeric>
#include <iostream>
#include <iomanip>

#include <opencv2/opencv.hpp>

#include "OpenCVHelpers.h"

#include "PointCloudManipulation.h"

namespace LoadingSaving{

//pair<vector<Vector3f>,vector<Vector3f>> loadMatrixPointsWithNormals(std::string filename){
//    std::ifstream f(filename,std::ifstream::in);
//    if( f.fail() == true )
//    {
//        cerr << filename << " could not be opened" << endl;
//    }

//    vector<Vector3f> pts;
//    vector<Vector3f> nor;

//    Vector3f pt;
//    Vector3f no;

//    int n=0;
//    while( f >> pt(0) && f >> pt(1) && f >> pt(2) && f >> no(0) && f >> no(1) && f >> no(2)){
//        pts.push_back(pt);
//        nor.push_back(no);
//        n++;
//    }

//    cout<<"Loaded "<<n<< " pts + nor from "<<filename<<endl;

//    return make_pair(pts,nor);
//}

void loadPointCloudFromDepthMap(const std::string& filename, const Matrix3f& K, vector<Vector3f>& pts, string maskname, bool show){
    std::ifstream ifs(filename.c_str());
    if (!ifs.is_open()) cout<<"Cannot open file:"<<filename<<endl;

    cout<<"LoadingSaving::loadPointCloudFromDepthMap before cv::imread "<<filename<<endl;
    cv::Mat depth = cv::imread(filename,cv::IMREAD_UNCHANGED);
    int type=depth.type();
    int nc=depth.channels();
    cout<<"LoadingSaving::loadPointCloudFromDepthMap after cv::imread "<<filename<<" \t type: "<<OpenCVHelpers::getImageType(type)<<" channels:"<<nc<<endl;

    cv::Mat mask; //is 1 at the object, 0 outside

    bool maskGiven = false;

    if(maskname!=""){
        mask = cv::imread(maskname,cv::IMREAD_UNCHANGED);
        //cout<<"LoadingSaving read mask: "<<maskname<<" "<< mask.rows <<","<<mask.cols<<endl;
        maskGiven = true;
    }

    float fx = K(0,0);
    float fy = K(1,1);
    float cx = K(0,2);
    float cy = K(1,2);

    //todo add possibility to add segmentation mask
    if(type==CV_16U && nc==1){ //depth_0.png from kinect cam, 0 means no measure, depth in mm (470 means 0.47m);
        if(!maskGiven) mask = (depth > 0.001f);
        depth.convertTo( depth, CV_32FC1, 0.001); // convert to meters
    }else if(type==CV_32FC3 && nc==3){ //depth_000000.exr made from blender, inf means no measure, depth in mm
        cv::cvtColor(depth,depth,cv::COLOR_BGR2GRAY);
        if(!maskGiven) mask = (depth != std::numeric_limits<float>::infinity());
        depth.convertTo( depth, CV_32FC1, 0.001); // convert to meters
    }else if(type==CV_8UC3 && nc==3){ //Siemens steamturbine
        cout<<"ATTENTTION DOWNSAMPLIG INPUT IMAGE"<<endl;
        std::vector<cv::Mat> depth_channels;
        cv::split( depth, depth_channels );
        cv::Mat r_channel, g_channel, b_channel;
        depth_channels[2].convertTo( r_channel, CV_32SC1 ); depth_channels[1].convertTo( g_channel, CV_32SC1 ); depth_channels[0].convertTo( b_channel, CV_32SC1 );
        cv::Mat depthMap;
        depthMap.create( depth.rows, depth.cols, CV_32FC1 );
        //mask.create( depth.rows, depth.cols, CV_8UC1 );
        for (int r = 0; r < depthMap.rows; ++r)
            for (int c = 0; c < depthMap.cols; ++c) {
                float val = 1e-6f * ( ( r_channel.at<int>(r,c) << 16 ) | ( g_channel.at<int>(r,c) << 8 ) | b_channel.at<int>(r,c) );
                depthMap.at<float>(r,c) = val;
                //mask.at<uchar>(r,c) = ( val > 0.f );
            }
        if(!maskGiven) mask = (depthMap > 0.f);

        depth=depthMap;

        //cout<<"mask type: "<<OpenCVHelpers::getImageType(mask.type())<<" channels:"<<mask.channels()<<endl;

        float factor=0.2f;

        resize(depth, depth, cv::Size(), factor, factor);
        resize(mask, mask, cv::Size(), factor, factor);
        //cout<<"mask type after resize: "<<OpenCVHelpers::getImageType(mask.type())<<" channels:"<<mask.channels()<<endl;

        cx *= factor;
        cy *= factor;
        fx *= factor;
        fy *= factor;
    }else{
        cout<<"unsupported depth image type"<<endl;
    }

    if(show){
//        if(depth.rows>500){
//            cv::Mat depthSmall, maskSmall;
//            resize(depth, depthSmall, cv::Size(), 0.25, 0.25);
//            resize(mask, maskSmall, cv::Size(), 0.25, 0.25);
//            OpenCVHelpers::showDepthImage("showDepthImage",depthSmall,maskSmall,true);
//       }else{
            OpenCVHelpers::showDepthImage("depth",depth);
            OpenCVHelpers::showDepthImage("depthWithMask",depth,mask);
            //OpenCVHelpers::showImage("mask",mask);

 //      }
        cv::waitKey(2);
    }

    //PointCloudManipulation::fromDepthImage(depth,mask,pts,K);
    //void PointCloudManipulation::fromDepthImage(const cv::Mat& depth, const cv::Mat& mask, vector<Vector3f>& pts, const Matrix3f& K){
        int m=depth.rows; //Y
        int n=depth.cols; //X

        //int x=n,y=m,xM=0,yM=0;

        for (int i = 0; i < m; ++i) {
            for (int j = 0; j < n; ++j) {
                if(mask.at<unsigned char>(i,j)){ //values lower than 255 were achieved by non-border preserving smoothing before subsampling
                    float Z = depth.at<float>(i,j);
                    if(Z<=0.0001 || Z > 999999) continue;
                    float X = (j-cx)*Z*(1/fx);
                    float Y = (i-cy)*Z*(1/fy);
                    pts.push_back(Vector3f(X,Y,Z));
                    //if(j<x) x=j;if(j>xM) xM=j;if(i<y) y=i;if(i>yM) yM=i;
                }
            }
        }
    //}
}

PointCloud loadPLY(const std::string filename, bool withNormals)
{
  PointCloud cloud;
  int numVertices=0;

  std::ifstream ifs(filename.c_str());

  if (!ifs.is_open())
  {
    printf("Cannot open file...\n");
    return cloud;
  }

  std::string str;
  while (str.substr(0, 10) !="end_header")
  {
    std::string entry = str.substr(0, 14);
    if (entry == "element vertex")
    {
      numVertices = atoi(str.substr(15, str.size()-15).c_str());
    }
    std::getline(ifs, str);
  }

  cloud.pts = vector<Vector3f>(numVertices);
  if (withNormals) cloud.nor=vector<Vector3f>(numVertices);

  for (int i = 0; i < numVertices; i++)
  {
    float* data1 = (float*)(&cloud.pts[i]);
    ifs >> data1[0] >> data1[1] >> data1[2];

    if (withNormals)
    {
      float* data = (float*)(&cloud.nor[i]);
      ifs >> data[0] >> data[1] >> data[2];

      // normalize to unit norm
      double norm = sqrt(data[0]*data[0] + data[1]*data[1] + data[2]*data[2]);
      if (norm>0.00001)
      {
        data[0]/=(float)norm;
        data[1]/=(float)norm;
        data[2]/=(float)norm;
      }
    }
    else
    {
    }
  }

  //cloud *= 5.0f;
  return cloud;
}

void savePLY(const std::string filename, PointCloud PC)
{
  std::ofstream outFile( filename.c_str() );

  if ( !outFile )
  {
    //cerr << "Error opening output file: " << FileName << "!" << endl;
    printf("Error opening output file: %s!\n", filename.c_str());
    exit( 1 );
  }

  ////
  // Header
  ////

  const int pointNum = ( int ) PC.pts.size();
  //const int vertNum  = ( int ) PC.cols;

  outFile << "ply" << std::endl;
  outFile << "format ascii 1.0" << std::endl;
  outFile << "element vertex " << pointNum << std::endl;
  outFile << "property float x" << std::endl;
  outFile << "property float y" << std::endl;
  outFile << "property float z" << std::endl;
  if (PC.nor.size()>0)
  {
    outFile << "property float nx" << std::endl;
    outFile << "property float ny" << std::endl;
    outFile << "property float nz" << std::endl;
  }
  outFile << "end_header" << std::endl;

  ////
  // Points
  ////

  for ( int i = 0; i < pointNum; ++i )
  {
    float* point = (float*)(&PC.pts[i]);

    outFile << point[0] << " "<<point[1]<<" "<<point[2];

    if (PC.nor.size()>0)
    {
      outFile<<" " << PC.nor[i].x() << " "<<PC.nor[i].y()<<" "<<PC.nor[i].z();
    }

    outFile << std::endl;
  }

  return;
}

PointCloud loadPointCloud(std::string filename, int ptLimit){
    std::ifstream file(filename.c_str(),std::ifstream::in);
    if( file.fail() == true )
    {
        cerr << filename << " could not be opened" << endl;
    }

    vector<Vector3f> pts,nor;

    while(file && (ptLimit==-1 || (ptLimit--) > 0)){
        Vector3f pt,no;
        file >> pt.x() >> pt.y() >> pt.z() >> no.x() >> no.y() >> no.z();
        pts.push_back(pt);
        nor.push_back(no);
    }

    PointCloud C;
    C.pts=pts;
    C.nor=nor;

    return C;
}

void writePointCloud(std::string filename, PointCloud C){
    Matrix3Xf A = C.ptsMat();
    MatrixXf D;

    if(C.nor.size()>0){
        Matrix3Xf B = C.norMat();

        D = MatrixXf(A.rows()+B.rows(), A.cols());
        D << A,
             B;
    }else{
        D = A;
    }

    MatrixXf DD = D.transpose();

    saveMatrixXf(filename,DD);
}

template<typename Number>
Matrix<Number,Dynamic,Dynamic> loadMatrix(std::string filename, std::string type){
    std::ifstream file(filename,std::ifstream::in);
    if( file.fail() == true )
    {
        cerr << filename << " could not be opened" << endl;
        return Matrix<Number,Dynamic,Dynamic>::Zero(1, 1);

    }

    std::string line;
    std::getline(file,line);
    std::stringstream lineStream(line);

    int cols=0;
    Number n;
    while(lineStream >> n)
    {
        cols++;
    }
    if(cols==0){
        return Matrix<Number,Dynamic,Dynamic>::Zero(1, 1);
    }

    vector< Matrix<Number,1,Dynamic> > vec;

    int rows=0;

    do{
        rows++;
        std::stringstream lineStream2(line);
        Matrix<Number,1,Dynamic> row(cols);
        int col = 0;
        while(lineStream2 >> n)
        {
            row(col)=n;
            col++;
        }

        vec.push_back(row);
    }while(std::getline(file,line));

    Matrix<Number,Dynamic,Dynamic> mat(rows,cols);
    int j=0;
    for (auto it : vec) {
        //cout<<it<<endl;
        mat.row(j++)=it;
    }

    //cout<<"Loaded MatrixX"<<type<<"("<<rows<<","<<cols<<") from "<<filename<<endl;

    return mat;
}

vector<Isometry3f> loadPosesFromFile(std::string filename){
    std::ifstream file(filename,std::ifstream::in);
    if( file.fail() == true )
    {
        cerr << filename << " could not be opened" << endl;
    }

    vector<Isometry3f> vec;

    std::string line;

    int j=0;

    int row=0;

    Matrix4f pose;

    while(std::getline(file,line)){
        std::stringstream lineStream(line);
        //cout<<"line: "<<line<<endl;
        if(line.length()<6){
            lineStream >> j;
            //cout<<"pose "<<j<<":"<<endl;
        }else{
            int col=0;
            float elem;
            while(lineStream >> elem){
                pose(row,col)=elem;
                //cout<<pose(row,col)<<endl;
                col++;
            }
            row++;
            if(row==4){
                row=0;
                //cout<<pose<<endl;
                vec.push_back(Isometry3f(pose));
            }
        }
    }

    return vec;

}

vector<Isometry3f> loadPosesFromDir(std::string dir, std::string prefix){
    vector<string> poses = getAllTextFilesFromFolder(dir,prefix);
    vector<Isometry3f> vec;

    for(auto it : poses){
        vec.push_back(Isometry3f(LoadingSaving::loadMatrix4f(it)));
    }

//    cout<<"posesfromdir"<<endl;
//    for(auto it : vec){
//        cout<<endl<<it.matrix()<<endl;
//    }

    cout<<"loaded "<<vec.size()<<" poses from file "<<poses[0]<<endl;

    return vec;
}

vector<Isometry3f> loadPoses(string dir, string prefix){
    vector<string> poses = getAllTextFilesFromFolder(dir,prefix);
    vector<Isometry3f> vec;
    if(poses.size() == 1){
        return loadPosesFromFile(poses[0]);
    }else if(poses.size()>1){
        for(auto it : poses){
            vec.push_back(Isometry3f(LoadingSaving::loadMatrix4f(it)));
        }
        cout<<"loaded "<<vec.size()<<" poses from dir "<<dir<<" with prefix "<<prefix<<endl;
    }else{
        cerr<<"no poses provided"<<endl;
    }
    return vec;
}

Matrix4f loadMatrix4f(std::string filename){
    std::ifstream file(filename,std::ifstream::in);
    if( file.fail() == true )
    {
        cerr << filename << " could not be opened" << endl;
        return Matrix4f::Zero();

    }
    float array[16]={0};
    array[15]=1;
    int i=0;
    while(file >> array[i++]){}

    //cout<<"Loaded Matrix4f from "<<filename<<endl;
    return Map< Matrix<float,4,4,RowMajor> > (array);
}

Matrix3f loadMatrix3f(std::string filename){
    std::ifstream file(filename,std::ifstream::in);
    if( file.fail() == true )
    {
        cerr << filename << " could not be opened" << endl;
        return Matrix3f::Zero();

    }
    float array[9];
    int i=0;
    while(file >> array[i++]){}

    //cout<<"Loaded Matrix4f from "<<filename<<endl;
    return Map< Matrix<float,3,3,RowMajor> > (array);
}

Vector3f loadVector3f(std::string filename){
    std::ifstream file(filename,std::ifstream::in);
    if( file.fail() == true )
    {
        cerr << filename << " could not be opened" << endl;
        return Vector3f::Zero();

    }
    float array[3];
    int i=0;
    while(file >> array[i++]){}

    //cout<<"Loaded Matrix4f from "<<filename<<endl;
    return Map< Vector3f > (array);
}

MatrixXd loadMatrixXd(std::string filename){
    return loadMatrix<double>(filename,"d");
}

MatrixXf loadMatrixXf(std::string filename){
    return loadMatrix<float>(filename,"f");
}

MatrixXi loadMatrixXi(std::string filename){
    return loadMatrix<int>(filename,"i");
}

template<typename Number>
void saveMatrix(std::string filename, Matrix<Number,Dynamic,Dynamic> mat, string type){
    std::ofstream outputFile(filename, std::ofstream::out) ;
    if(type=="f"){
        //std::cout.precision(8);
        outputFile << mat.format(8);//StreamPrecision);  #TODO: somehow 0.10793996f cant be saved correctly otherwise
    }else{
        outputFile << mat.format(FullPrecision);
    }
    outputFile.close();

    //cout<<"Saved MatrixX"<<type<<"("<<mat.rows()<<","<<mat.cols()<<") to "<<filename<<endl;

}

void saveMatrix4f(std::string filename, Matrix4f mat){
    std::ofstream outputFile(filename, std::ofstream::out) ;
    outputFile << mat.format(FullPrecision);
    outputFile.close();
}

void saveMatrix3f(std::string filename, Matrix3f mat){
    std::ofstream outputFile(filename, std::ofstream::out) ;
    outputFile << mat.format(FullPrecision);
    outputFile.close();
}

void saveMatrixXd(std::string filename, MatrixXd mat){return saveMatrix<double>(filename,mat,"d");}
void saveMatrixXf(std::string filename, MatrixXf mat){return saveMatrix<float>(filename,mat,"f");}
void saveMatrixXi(std::string filename, MatrixXi mat){return saveMatrix<int>(filename,mat,"i");}

template<typename Number>
void saveVector(std::string filename, vector<Number> vec){

    std::ofstream outputFile(filename, std::ofstream::out) ;

    for (auto it : vec){
        outputFile << it <<endl;
    }

    outputFile.close( );

    cout<<"Wrote "<<vec.size()<<" numbers to "<<filename<<endl;
}
void saveVector(std::string filename, vector<bool> vec){saveVector<bool>(filename,vec);}
void saveVectorf(std::string filename, vector<float> vec){saveVector<float>(filename,vec);}

void savePosesEvalutationGroundTruth(vector<Isometry3f>& poses){
    std::stringstream ss;
    ss<<Params::getInstance()->dir<<"/"<<"evaluationQ.txt";
    //<<setfill('0')<< setw(6)<<cloud.imgSequenceIdx<<Params::getInstance()->est_poses_suffix;
    string filename = ss.str();
    std::ofstream outputFile(filename, std::ofstream::out) ;

    //std::ostream& o = std::cout;

    for (int i = 0; i< poses.size(); i++){
        std::stringstream timestampss;
        timestampss<<setfill('0')<< setw(6)<<i; //cloud.imgSequenceIdx<<Params::getInstance()->est_poses_suffix;

        outputFile<<timestampss.str()<<" ";

        outputFile<<std::setprecision(8);

        Isometry3f pose = poses[i];
        outputFile<<pose.translation().transpose()<<" ";
        Quaternionf q(pose.linear());
        outputFile<<q.coeffs().transpose()<<endl;
        //o<<q.x()<< " "<<q.y()<<" "<<q.z() << " "<<q.w();

        //outputFile << timestampss.str() << " " <<   endl;
    }

   outputFile.close( );

    cout<<"Wrote "<<poses.size()<<" poses to "<<filename<<endl;
}

void savePosesEvalutation(const vector<std::shared_ptr<PointCloud> >& frames){
    std::stringstream ss,ss2;
    string suffix="";
    ss<<Params::getInstance()->dir<<"/"<<"P"<<suffix<<".txt";
    ss2<<Params::getInstance()->dir<<"/"<<"Q"<<suffix<<".txt";

    string filename = ss.str();
    std::ofstream outputFile(filename, std::ofstream::out) ;
    string filename2 = ss2.str();
    std::ofstream outputFile2(filename2, std::ofstream::out) ;

    //std::ostream& o = std::cout;

    for (int i = 0; i< frames.size(); i++){
        std::stringstream timestampss;
        timestampss<<setfill('0')<< setw(6)<<frames[i]->imgSequenceIdx;//<<Params::getInstance()->est_poses_suffix;

        //P
        {
            outputFile<<timestampss.str()<<" ";

            outputFile<<std::setprecision(12);

            Isometry3d pose = frames[i]->pose.cast<double>();
            outputFile<<pose.translation().transpose()<<" ";
            Quaterniond q(pose.linear());
            outputFile<<q.coeffs().transpose()<<endl;
        }

        //Q
        {
            outputFile2<<timestampss.str()<<" ";

            outputFile2<<std::setprecision(12);

            Isometry3d pose2 = frames[i]->poseGroundTruth.cast<double>();
            outputFile2<<pose2.translation().transpose()<<" ";
            Quaterniond q2(pose2.linear());
            outputFile2<<q2.coeffs().transpose()<<endl;
        }
    }

     outputFile.close( );
     outputFile2.close();

    cout<<"Wrote "<<frames.size()<<" poses to "<<filename<< " and "<<filename2<<endl;
}

void savePosesEvalutationEstimates(const vector<std::shared_ptr<PointCloud> >& frames,string suffix){
    std::stringstream ss;
    ss<<Params::getInstance()->dir<<"/"<<"evaluationP_"<<suffix<<".txt";
    //<<setfill('0')<< setw(6)<<cloud.imgSequenceIdx<<Params::getInstance()->est_poses_suffix;
    string filename = ss.str();
    std::ofstream outputFile(filename, std::ofstream::out) ;

    //std::ostream& o = std::cout;

    for (int i = 0; i< frames.size(); i++){
        std::stringstream timestampss;
        timestampss<<setfill('0')<< setw(6)<<frames[i]->imgSequenceIdx;//<<Params::getInstance()->est_poses_suffix;

        outputFile<<timestampss.str()<<" ";

        outputFile<<std::setprecision(12);

        Isometry3d pose = frames[i]->pose.cast<double>();
        outputFile<<pose.translation().transpose()<<" ";
        Quaterniond q(pose.linear());
        outputFile<<q.coeffs().transpose()<<endl;
        //o<<q.x()<< " "<<q.y()<<" "<<q.z() << " "<<q.w();

        //outputFile << timestampss.str() << " " <<   endl;
    }

   outputFile.close( );

    cout<<"Wrote "<<frames.size()<<" poses to "<<filename<<endl;
}

template<typename Number>
vector<Number> loadVector(std::string filename){

    vector<Number> vec;

    std::ifstream file(filename,std::ifstream::in);
    if( file.fail() == true )
    {
        cerr << filename << " could not be opened" << endl;
        return vec;
    }

    Number elem;
    while(file >> elem){
        vec.push_back(elem);
    }

    return vec;
}

vector<bool> loadVector(std::string filename){return loadVector<bool>(filename);}
vector<float> loadVectorf(std::string filename){return loadVector<float>(filename);}

string getOSSeparator() {
#ifdef _WIN32
  return "\\";
#else
  return "/";
#endif
}

#include <dirent.h>
#include <vector>

bool isPrefixAndSuffix(const char* file, uint16_t filename_length, string prefix, string suffix){

   const char* startSuffix=strstr(file,suffix.c_str());
   bool isSuffix = (startSuffix-file) == filename_length - suffix.length();
   if(!isSuffix) return false;

   if(prefix[0]=='*'){
        string contains = prefix.substr (1);
        const char* startContains=strstr(file,contains.c_str());
        bool isContains = (startContains-file >= 0); //contains
        return isContains;
   }

    const char* startPrefix=strstr(file,prefix.c_str());
    bool isPrefix = (startPrefix-file == 0);

    //cout<<"start: "<<isPrefix<<" end:"<<isSuffix<<endl;

    return isPrefix;
}
#include <algorithm>    // std::any_of
//#include <array>        // std::array

const vector<string> SUFFIX_IMAGE = {".png", ".jpg",".tif",".exr",".bmp"};
const vector<string> SUFFIX_TEXT  = {".txt",".xyz"};
//const std::array<string,1> SUFFIX_PLY   = {".ply"};

bool hasPrefixAndSuffixes(const char* file, uint16_t filename_length, string prefix,std::vector<string> suffixes){
  return std::any_of(suffixes.begin(), suffixes.end(),
         [&](string suffix){return isPrefixAndSuffix(file,filename_length,prefix,suffix);
  });
}

//http://stackoverflow.com/questions/9277906/stdvector-to-string-with-custom-delimiter
string join(vector<string>& v, const string& delim) {
    ostringstream s;
    for (const auto& i : v) {
        if (&i != &v[0]) {
            s << delim;
        }
        s << i;
    }
    return s.str();
}

vector<string> getAllFilesFromFolder(string dirStr, string prefix, vector<string> suffixes) {
  DIR *dir = NULL;
  struct dirent *entry;
  vector<string> allImages;

  dir = opendir(dirStr.c_str());

  if (!dir) {
    cerr << "Could not open directory " << dirStr <<endl;//<< ". Exiting..." << endl;
    return allImages;
    //exit(1);
  }

  const string sep = getOSSeparator();

  while((entry = (readdir(dir)))) {
      string fileName(entry->d_name);
    if (hasPrefixAndSuffixes(entry->d_name,/*entry->d_namlen*/fileName.size(),prefix,suffixes)){
      string fileName(entry->d_name);
      string fullPath = dirStr + sep + fileName;
      allImages.push_back(fullPath);
    }
  }
  closedir(dir);

  std::sort(allImages.begin(), allImages.end(), [](const std::string &left, const std::string &right) {
      int lengthdiff=left.size()-right.size();
      if(lengthdiff==0){
          return left < right;
      }
      return lengthdiff<0;
  });

  string joined = join(suffixes,"|");

  cout<<"Found "<<allImages.size()<<" files in "<<dirStr << " that match the pattern: "<<prefix<<"*"<<joined<<" .";
  if(allImages.size()>0){
      cout<<" first is: "<<allImages[0];
  }
  cout<<endl;
  return allImages;
}

vector<string> getAllImagesFromFolder(string dirStr, string prefix){
    return getAllFilesFromFolder(dirStr,prefix,SUFFIX_IMAGE);
}

vector<string> getAllTextFilesFromFolder(string dirStr, string prefix){
    return getAllFilesFromFolder(dirStr,prefix,SUFFIX_TEXT);
}

} // end ns


text:
<?php

namespace App\Respond\Libraries;

// respond libraries
use App\Respond\Models\Site;
use App\Respond\Models\User;
use App\Respond\Models\Page;
use App\Respond\Models\Form;
use App\Respond\Models\Menu;
use App\Respond\Models\Gallery;
use App\Respond\Libraries\Utilities;
use App\Respond\Models\Setting;

// DOM parser
use Sunra\PhpSimple\HtmlDomParser;

// Twig Extensions
use App\Respond\Extensions\BetterSortTwigExtension;

class Publish
{

    /**
     * Pubishes the theme to the site
     *
     * @param {Site} $site
     */
    public static function publishTheme($theme, $site)
    {

        // publish theme files
        $src = app()->basePath() . '/public/themes/' . $theme;
        $dest = app()->basePath() . '/public/sites/' . $site->id;

        // copy the directory
        Utilities::copyDirectory($src, $dest);

        // copy the private files
        $src = app()->basePath() . '/public/themes/' . $theme . '/private';
        $dest = app()->basePath() . '/resources/sites/' . $site->id;

        // copy the directory
        Utilities::copyDirectory($src, $dest);

        /*

        echo('remove settings and plugins');

        // remove settings and plugins
        if(file_exists($dest.'/private/plugins.js')) {
          unlink($dest.'/private/plugins.js');
        }

        if(file_exists($dest.'/private/settings.json')) {
          unlink($dest.'/private/settings.json');
        }

        // remove the directory
        if(file_exists($dest.'/private')) {
          rmdir($dest.'/private');
        }*/

    }

    /**
     * Publishes a sitemap for the site
     *
     * @param {Site} $site
     */
    public static function publishSiteMap($user, $site)
    {

      // get all pages
      $pages = Page::listAll($user, $site);

      // xml file
      $file = app()->basePath() . '/public/sites/' . $site->id . '/sitemap.xml';

      // get domain from settings
      $domain = Setting::getById('domain', $site->id);

      // get generated domain
      if($domain === NULL) {
        $domain = Utilities::retrieveSiteURL();
        $domain = str_replace('{{siteId}}', $site->id, $domain);
      }

      // trim trailing /
      $domain = rtrim($domain, '/');

      // setup xml
      $xml = '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';

      // get pages
      foreach($pages as $page) {

        $u = strtotime($page['lastModifiedDate']);

        $xml = $xml.'<url>'.
                '<loc>'.$domain.'/'.$page['url'].'</loc>'.
                '<lastmod>'.date('Y-m-d', $u).'</lastmod>'.
                '<priority>1.0</priority>'.
                '</url>';

      }

      // close urlset
      $xml = $xml.'</urlset>';

      // add xml data
      file_put_contents($file, $xml);

      return TRUE;

    }

    /**
     * Publishes plugins for the site
     *
     * @param {Site} $site
     */
    public static function publishPlugins($user, $site)
    {
        // get plugins for the site
        $dir = app()->basePath().'/public/sites/'.$site->id.'/plugins/';
        $exts = array('html');

        $files = Utilities::listFiles($dir, $site->id, $exts);
        $plugins = array();

        foreach($files as $file) {

          $path = app()->basePath().'/public/sites/'.$site->id.'/'.$file;

          if(file_exists($path)) {

            $html = file_get_contents($path);
            $id = basename($path);
            $id = str_replace('.html', '', $id);

            // push plugin to array
            array_push($plugins, $id);

          }

        }

        // location where twig should look for templates (local to site, then global)
        $template_dirs = array(
          app()->basePath().'/public/sites/'.$site->id.'/plugins'
        );

        $global_plugin_dir = app()->basePath().'/resources/plugins';

        if(file_exists($global_plugin_dir)) {
          array_push($template_dirs, $global_plugin_dir);
        }

        // setup twig
        $loader = new \Twig_Loader_Filesystem($template_dirs);

        $twig = new \Twig_Environment($loader);
        $twig->addExtension(new BetterSortTwigExtension());

        // get all pages
        $pages = Page::listAll($user, $site);

        // list all forms, menus, galleries
        $forms = Form::listExtended($site->id);
        $menus = Menu::listExtended($site->id);
        $galleries = Gallery::listExtended($site->id);

        $i = 0;

        // get html of pages
        foreach($pages as $page) {

          // stript html
          $url = $page['url'];
          $url = preg_replace('/\\.[^.\\s]{3,4}$/', '', $url);

          // get html of page
          $file = app()->basePath() . '/public/sites/' . $site->id . '/' . $url . '.html';

          if(file_exists($file)) {
            $html = file_get_contents($file);

            // set parser
            $dom = HtmlDomParser::str_get_html($html, $lowercase=true, $forceTagsClosed=false, $target_charset=DEFAULT_TARGET_CHARSET, $stripRN=false, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT);

            // find main content
            $el = $dom->find('[role=main]');
            $main_content = '';

            // get the fragment content
            if(isset($el[0])) {
              $main_content = $el[0]->innertext;
            }

            // set html
            $pages[$i]['html'] = $main_content;
          }

          $i++;

        }

        $i = 0;

        // public plugin for pages
        foreach($pages as $item) {

          // get page
          $page = new Page($item);

          // setup current page
          $current_page = array(
            'url' => $page->url,
            'title' => $page->title,
            'description' => $page->description,
            'keywords' => $page->keywords,
            'callout' => $page->callout,
            'photo' => $page->photo,
            'thumb' => $page->thumb,
            'language' => $page->language,
            'direction' => $page->direction,
            'firstName' => $page->firstName,
            'lastName' => $page->lastName,
            'lastModifiedBy' => $page->lastModifiedBy,
            'lastModifiedDate' => $page->lastModifiedDate
          );

          // setup whether the site is using friendly urls
          $useFriendlyURLs = false;

          if(env('FRIENDLY_URLS') === true || env('FRIENDLY_URLS') === 'true') {
            $useFriendlyURLs = true;
          }

          // setup current site
          $current_site = array(
            'id' => $site->id,
            'name' => $site->name,
            'email' => $site->email,
            'api' => Utilities::retrieveAppUrl() . '/api',
            'useFriendlyURLs' => $useFriendlyURLs
          );

          // set url
          $url = $page->url;
          $url = preg_replace('/\\.[^.\\s]{3,4}$/', '', $url);

          $location = app()->basePath().'/public/sites/'.$site->id.'/'.$url.'.html';

          // check for valid location
          if(file_exists($location)) {

            // get html from page
            $html = file_get_contents($location);

            // walk through plugins
            foreach($plugins as $plugin) {

              // insert into respond-plugin comments
              $start = '<!-- respond-plugin:'.$plugin.' -->';
              $end = '<!-- /respond-plugin:'.$plugin.' -->';

              // check for start and end
              if(strpos($html, $start) !== FALSE && strpos($html, $end) !== FALSE) {

                // load the template
                $template = $twig->loadTemplate($plugin.'.html');

                // render the template
                $plugin_html = $template->render(array('pages' => $pages));

                // replace content
                $html = Utilities::replaceBetween($html, $start, $end, $plugin_html);
              }

            }

            // make sure the html is not empty
            if(!empty($html)) {

              // load the parser
              $dom = HtmlDomParser::str_get_html($html, $lowercase=true, $forceTagsClosed=false, $target_charset=DEFAULT_TARGET_CHARSET, $stripRN=false, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT);

              // insert into [respond-plugin] elements
              foreach($dom->find('[respond-plugin]') as $el) {

                if(isset($el->type)) {

                  if(array_search($el->type, $plugins) !== FALSE) {

                    // load the template
                    $template = $twig->loadTemplate($el->type.'.html');

                    $render_arr = array('page' => $current_page,
                                          'site' => $current_site,
                                          'pages' => $pages,
                                          'forms' => $forms,
                                          'galleries' => $galleries,
                                          'menus' => $menus,
                                          'attributes' => $el->attr);

                    // render the template
                    $plugin_html = $template->render($render_arr);

                    // set the inner text
                    $el->innertext = $plugin_html;

                  }

                }

              }

            }

            // find main content
            $el = $dom->find('[role=main]');
            $main_content = '';

            // get the fragment content
            if(isset($el[0])) {
              $main_content = $el[0]->innertext;
            }

            // put html back
            file_put_contents($location, $dom);

            // update html in the array
            $pages[$i]['html'] = $main_content;

            // increment
            $i++;

          }

        }

    }

}


text:
package example16;

public class Company extends Identity {
    public String name;
    public String taxId;
}


text:
{{> header}}

## scsynth features

`scsynth` is SuperCollider's synthesis server.

- High quality accurate and efficient audio engine
- Fully adjustable sample rate (192k+) and block size
- 32-bit float signal chain
- Sampling buffers use 64-bit float
- Fast and fluid control rate modulation
- Communicates via Open Sound Control - TCP/UDP network communication
- Hundreds of UGens (unit generators)
- Simple ANSI C plugin API
- Hundreds more community contributed UGens
- Supports any number of input and output channels, ideal for large multichannel setups

## @supercollider/server Features

This package supports all the core functionality for working with `scsynth`:

- Spawns the synthesis server, `scsynth` as a subprocess
- Send and receive OSC messages
- Comprehensive support for constructing and sending all commands the server understands
- Call async commands on the server and receive results as Promises
- Synth/Group/Bus/Buffer allocators with clean immutable state implementation
- Immutable server state and synth/group tracking
- Just-in-time OSC scheduler

**You can install this lib separately from supercolliderjs, but currently to compile SynthDefs you need to write them in SuperCollider code and use `@supercollider/lang` to compile those.**

# Examples

Server low level API

```js
const sc = require('supercolliderjs');

sc.server.boot().then(async server => {

  // Really low level, using explicit hard coded node ids
  // and manually building the message.
  // You don't want to do this.
  server.send.msg('/g_new', [ 9999 ] );

  // Use node id allocator and OSC message constructors.
  // Still tedidous and error prone.
  // No notification of when the group is created on the server.
  const groupNodeID = server.state.nextNodeID();
  server.send.msg(sc.server.msg.groupNew(groupNodeID));

  // @supercollider/server-plus adds these methods:
  // Create a group and wait for confirmation. Nice and simple
  const group = await server.group();

});
```

The `@supercollider/server-plus` package extends the `Server` class, adding extra methods. It is one way of working. `@supercollider/dryads` are another higher level api for working.

You can also build your own way of working if you like—all the packages expose low level functions so you can reuse them in different projects.

## API

- {{#typedocLink}}boot:/packages/server/docs/modules/_server_.html#boot{{/typedocLink}}
    Start the server process and connect to it.
    ```js
      // options: ServerArgs
     sc.server.boot({device: 'Soundflower (2ch)'});
    ```

- {{#typedocLink}}ServerArgs:/packages/server/docs/modules/_options_.html#serverargs{{/typedocLink}}
    This is the union of {{#typedocLink}}ServerSettings:/packages/server/docs/interfaces/_options_.serversettings.html{{/typedocLink}} and {{#typedocLink}}ScsynthArgs:/packages/server/docs/interfaces/_options_.scsynthargs.html{{/typedocLink}}

- {{#typedocLink}}Server:/packages/server/docs/classes/_server_.server.html{{/typedocLink}}
  ```js
  // options: ServerArgs
  const server = new sc.server.Server(options);
  ```

  - {{#typedocLink}}boot:/packages/server/docs/classes/_server_.server.html#boot{{/typedocLink}}
    Starts the server process scsynth and establish a pipe connection to receive stdout and stderr.
    Does not connect, so UDP is not yet ready for OSC communication.

  - {{#typedocLink}}connect:/packages/server/docs/classes/_server_.server.html#connect{{/typedocLink}}
    Establish connection to scsynth via OSC socket
  - {{#typedocLink}}send:/packages/server/docs/classes/_internals_sendosc_.sendosc.html{{/typedocLink}}
    ```js
    server.send.msg('/s_new', ['defName', 440]);
    server.send.bundle(0.05, [
      ['/s_new', 'defName', 440],
      ['/s_new', 'defName', 880],
    ]);
    ```
  - receive
    A subscribeable stream of OSC events received.
    ```js
    server.receive.subscribe(function(msg) {
      console.log(msg);
    });
    ```
  - callAndResponse

    Send an OSC command that expects a reply from the server, returning a Promise that resolves with the response.

    This is for getting responses async from the server. The first part of the message matches the expected args, and the rest of the message contains the response.

    ```js
      await server.callAndResponse(sc.server.msg.defLoadDir("./synthdefs/"));
    ```
  - stdout
    A subscribeable stream of STDOUT printed by the scsynth process.
    ```js
    server.stdout.subscribe(function(msg) {
      console.log(msg);
    });
    ```
  - quit
    ```js
    await server.quit();
    ```

- {{#typedocLink}}msg:/packages/server/docs/modules/_osc_msg_.html{{/typedocLink}}
    Functions for building all OSC messages for `scsynth`.
- {{#typedocLink}}mapping:/packages/server/docs/modules/_mapping_.html{{/typedocLink}}
  Frequently used musical mapping functions ported from SuperCollider.
- {{#typedocLink}}ServerState:/packages/server/docs/classes/_serverstate_.serverstate.html{{/typedocLink}}
  Holds internal state for a Server such as node/bus/buffer allocators, node status and SynthDefs that have been compiled and sent.
  Server has this has as the property: server.state

  Many of these functions are low-level accessors and allocators useful for building higher-level applications that are easier to use.

  Each server is stored by its unique address, so multiple Servers can store state in the same global Store object.

  This is where all state is stored for node, buffer and bus allocators, as well
  as node state tracking (is a Synth playing or not). The nice thing about this design is that the new state is only committed if no Exception is thrown.

{{> footer }}