text:
using System;
using System.Collections.Generic;
using System.Linq;
using GAIPS.Rage;
using SerializationUtilities;
using IntegratedAuthoringTool.DTOs;
using KnowledgeBase;
using RolePlayCharacter;
using WellFormedNames;
using Utilities;
using System.Text;
using System.Security.Cryptography;
using ActionLibrary;
using WorldModel;
using System.Text.RegularExpressions;
using Utilities.Json;

namespace IntegratedAuthoringTool
{
    /// <summary>
    /// This asset is responsible for managing the scenario, including its characters and respective dialogues
    /// </summary>
    [Serializable]
    public class IntegratedAuthoringToolAsset : ICustomSerialization
    {
        private DialogActionDictionary m_dialogues;

        public AssetStorage Assets { get; set; }

        public EventTriggers eventTriggers;

        public  WorldModelAsset WorldModel { get; private set; }

        public IEnumerable<RolePlayCharacterAsset> Characters { get; private set; }

        /// <summary>
        /// The name of the Scenario
        /// </summary>
        public string ScenarioName { get; set; }

		public string ScenarioDescription { get; set; }

	    public IntegratedAuthoringToolAsset()
        {
            m_dialogues = new DialogActionDictionary();
            Characters = new List<RolePlayCharacterAsset>();
            WorldModel =  new WorldModelAsset();
            eventTriggers = new EventTriggers();
        }

        public static IntegratedAuthoringToolAsset FromJson(string json, AssetStorage storage)
        {

            var aux = new JsonObject();

            var serializer = new JSONSerializer();
            try
            {
                aux = (JsonObject)JsonParser.Parse(json);

            }

            catch( Exception e)
            {
                throw new BadImageFormatException();
            }

            var iat = serializer.DeserializeFromJson<IntegratedAuthoringToolAsset>(aux);

                foreach (var c in iat.Characters)
                {
                    c.LoadAssociatedAssets(storage);
                    iat.BindToRegistry(c.DynamicPropertiesRegistry);
                }

            iat.Assets = storage;
            return iat;
        }

        public string ToJson()
        {
            var serializer = new JSONSerializer();
            return serializer.SerializeToJson(this).ToString(true);
        }

        public static string GenerateUtteranceId(string utterance)
        {
            utterance = utterance.RemoveWhiteSpace();
            utterance = utterance.ToLowerInvariant();
            var bytes = Encoding.UTF8.GetBytes(utterance);
            var utteranceId = BitConverter.ToString(MD5.Create().ComputeHash(bytes));
            utteranceId = utteranceId.Replace("-", string.Empty);
            return IATConsts.TTS_PREFIX + utteranceId;
        }

        public void AddNewCharacter(Name characterName)
        {
            if (this.Characters.Any(c => c.CharacterName == characterName))
                throw new Exception("A character with the given name already exists");

            var rpc = new RolePlayCharacterAsset();
            rpc.CharacterName = characterName;
            this.Characters = this.Characters.Concat(new[]{rpc});
        }

        /// <summary>
        /// Removes a list of characters from the scenario
        /// </summary>
        /// <param name="character">A list of character names</param>
        public void RemoveCharacters(IEnumerable<string> characterNames)
        {
            var newList = new List<RolePlayCharacterAsset>();
            foreach (var c in Characters)
            {
                if (!characterNames.Contains(c.CharacterName.ToString()))
                {
                    newList.Add(c);
                }
            }
            Characters = newList;
        }

		#region Dialog System

		/// <summary>
		/// Adds a new dialogue action
		/// </summary>
		/// <param name="dialogueStateActionDTO">The action to add.</param>
		public Guid AddDialogAction(DialogueStateActionDTO dialogueStateActionDTO)
		{
            var newDA = new DialogStateAction(dialogueStateActionDTO);
            m_dialogues.AddDialog(newDA);
            return newDA.Id;
		}

		/// <summary>
		/// Updates an existing dialogue action for the player
		/// </summary>
		/// <param name="dialogueStateActionToEdit">The action to be updated.</param>
		/// <param name="newDialogueAction">The updated action.</param>
		public Guid EditDialogAction(DialogueStateActionDTO dialogueStateActionToEdit, DialogueStateActionDTO newDialogueAction)
		{
			var id = this.AddDialogAction(newDialogueAction);
			this.RemoveDialogueActions(new[] { dialogueStateActionToEdit });
            return id;
		}

	    public DialogueStateActionDTO GetDialogActionById(Guid id)
	    {
		    return m_dialogues.GetDialogById(id).ToDTO();
	    }

        public Name BuildSpeakActionName(Guid id)
        {
            var dialogue = new DialogStateAction(GetDialogActionById(id));
            return dialogue.BuildSpeakAction();
        }

        public List<DialogueStateActionDTO> GetDialogueActions(Name currentState, Name nextState, Name meaning, Name style)
        {
            var actions = (IEnumerable<DialogStateAction>)m_dialogues.ToList();

            if (currentState.ToString() != Name.UNIVERSAL_STRING)
            {
                actions = actions.Where(d => d.CurrentState == currentState);
            }

            if (nextState.ToString() != Name.UNIVERSAL_STRING)
            {
                actions = actions.Where(d => d.NextState == nextState);
            }

            if (meaning.ToString() != Name.UNIVERSAL_STRING)
            {
                actions = actions.Where(d => d.Meaning == meaning);
            }

            if (style.ToString() != Name.UNIVERSAL_STRING)
            {
                actions = actions.Where(d => d.Style == style);
            }

            var retList = new List<DialogueStateActionDTO>();

            foreach (var action in actions)
            {
                retList.Add(action.ToDTO());
            }

            return retList;
        }

        // Get Dialogue Action and its Utterance taking into account Substitutions using the RPCs KB
        public List<DialogueStateActionDTO> GetDialogueActions(Name currentState, Name nextState, Name meaning, Name style, RolePlayCharacterAsset rpc)
        {
            var actions = (IEnumerable<DialogStateAction>)m_dialogues.ToList();
            var retList = new List<DialogueStateActionDTO>();

            if (currentState.ToString() != Name.UNIVERSAL_STRING)
            {
                actions = actions.Where(d => d.CurrentState == currentState);
            }

            if (nextState.ToString() != Name.UNIVERSAL_STRING)
            {
                actions = actions.Where(d => d.NextState == nextState);
            }

            if (meaning.ToString() != Name.UNIVERSAL_STRING)
            {
                actions = actions.Where(d => d.Meaning == meaning);
            }

            if (style.ToString() != Name.UNIVERSAL_STRING)
            {
                actions = actions.Where(d => d.Style == style);
            }

            if( meaning.ToString().Contains(IATConsts.VAR_PREFIX) || style.ToString().Contains(IATConsts.VAR_PREFIX)) {

                var beliefValues = new Dictionary<string, string>();

                var meaningString = meaning.ToString();
                var styleString = style.ToString();

                // Finding variables and their value in Meaning and Style using REGEX
                var meaningMatch = Regex.Match(meaningString.ToString(), @"(?<=" + IATConsts.VAR_PREFIX + ").*");  //@"\Var\((.*)");

                // Finding variables and their value in Meaning and Style using REGEX
                var styleMatch = Regex.Match(styleString.ToString(), @"(?<=" + IATConsts.VAR_PREFIX + ").*");  //@"\Var\((.*)");

                // Removing added parenthesis
                var meaningMatchClean = meaningMatch.ToString().Substring(1);
                meaningMatchClean = meaningMatchClean.Remove(meaningMatchClean.Length - 1);

                var styleMatchClean = styleMatch.ToString().Substring(1);
                styleMatchClean = styleMatchClean.Remove(styleMatchClean.Length - 1);

                var meaningBeliefList = meaningMatchClean.ToString().Split(',');
                var styleBeliefList = styleMatchClean.ToString().Split(',');

                var variableList = meaningBeliefList.Concat(styleBeliefList);

                foreach (var v in variableList)
                {
                    // Default value
                    var belief = Name.BuildName(" - ");
                    if (v.Contains("))"))
                    {
                        // Making sure everyone has their parenthesis
                        belief = Name.BuildName(v.Replace("))", ")"));
                    }
                    else
                    {
                        belief = Name.BuildName(v);
                    }

                    var result = rpc.m_kb.AskProperty(belief);
                    if (result.Value != Name.NIL_SYMBOL)
                    {
                        var value = rpc.GetBeliefValue(belief.ToString());
                        beliefValues.Add(belief.ToString(), value);
                    }
                }

                retList = new List<DialogueStateActionDTO>();

                foreach (var action in actions)
                {
                    var foundVars = Regex.Matches(action.Utterance, @"\[.*?\]");
                    int index = 0;
                    var dialogtoAdd = action.ToDTO();

                    if (foundVars.Count > 0)
                    {
                        foreach (var v in foundVars)
                        {
                            var utterance = dialogtoAdd.Utterance;
                            if (beliefValues.Keys.Count <= index)
                                break;
                            utterance = utterance.Replace(v.ToString(), beliefValues[beliefValues.Keys.ToList()[index]]);
                            dialogtoAdd.Utterance = utterance;

                            index += 1;
                        }
                    }
                    retList.Add(dialogtoAdd);
                }

                return retList;

            }

                retList = new List<DialogueStateActionDTO>();

                foreach (var action in actions)
                {
                    retList.Add(action.ToDTO());
                }

                return retList;

        }

        public List<DialogueStateActionDTO> GetDialogueActionsByState(string currentState)
        {
            return this.GetDialogueActions(Name.BuildName(currentState), Name.UNIVERSAL_SYMBOL, Name.UNIVERSAL_SYMBOL, Name.UNIVERSAL_SYMBOL);
        }

        public DialogueStateActionDTO GetDialogAction(IAction action, out string error)
        {
            error = null;

            if (action.Parameters.Count != 4)
            {
                error = "ERROR - Speak action does not have four parameters'" + action + "'\n";
            }

            var diag = this.GetDialogueActions(action.Parameters[0],
                                               action.Parameters[1],
                                               action.Parameters[2],
                                               action.Parameters[3]).Shuffle().FirstOrDefault();
            if (diag == null)
            {
                error = "ERROR - No dialogue defined for action '" + action + "'\n";
            }

            return diag;
        }

        public DialogueStateActionDTO GetDialogAction(IAction action, RolePlayCharacterAsset rpc , out string error)
        {
            error = null;

            if (action.Parameters.Count != 4)
            {
                error = "ERROR - Speak action does not have four parameters'" + action + "'\n";
            }

            var diag = this.GetDialogueActions(action.Parameters[0],
                                               action.Parameters[1],
                                               action.Parameters[2],
                                               action.Parameters[3], rpc).Shuffle().FirstOrDefault();
            if (diag == null)
            {
                error = "ERROR - No dialogue defined for action '" + action + "'\n";
            }

            return diag;
        }

        public IEnumerable<DialogueStateActionDTO> GetAllDialogueActions()
        {
            return this.m_dialogues.Select(d => d.ToDTO());
        }

        /// <summary>
        /// Removes a list of dialogue actions for either the player or the agent.
        /// </summary>
        /// <param name="speaker">Either "Player" or "Agent".</param>
        /// <param name="actionsToRemove">The list of dialogues that are to be removed.</param>
        public int RemoveDialogueActions(IEnumerable<DialogueStateActionDTO> actionsToRemove)
		{
			return RemoveDialogueActions(actionsToRemove.Select(d => d.Id));
		}

		public int RemoveDialogueActions(IEnumerable<Guid> actionsIdToRemove)
		{
			return actionsIdToRemove.Count(d => m_dialogues.RemoveDialog(d));
		}

		#endregion

		#region Dynamic Properties

	    public void BindToRegistry(IDynamicPropertiesRegistry registry)
	    {
			registry.RegistDynamicProperty(VALID_DIALOGUE_PROPERTY_TEMPLATE, "", ValidDialogPropertyCalculator);
		}

	    private static readonly Name VALID_DIALOGUE_PROPERTY_TEMPLATE = (Name)"ValidDialogue";
		private IEnumerable<DynamicPropertyResult> ValidDialogPropertyCalculator(IQueryContext context, Name currentState, Name nextState, Name meaning, Name style)
		{
		    if (!context.Perspective.Match(Name.SELF_SYMBOL))
		        yield break;

			var key = Name.BuildName(string.Format(IATConsts.DIALOG_ACTION_KEY + "({0},{1},{2},{3})",
                currentState, nextState, meaning, style));

		    foreach (var c in context.Constraints)
		    {
		        var dialogues = m_dialogues.GetAllDialogsForKey(key, c);

		        foreach (var d in dialogues)
		        {
		            yield return new DynamicPropertyResult(new ComplexValue(Name.BuildName(true)), d.Item2);
		        }
		    }

		}

		#endregion

		#region Serialization

		public void GetObjectData(ISerializationData dataHolder, ISerializationContext context)
        {
            dataHolder.SetValue("ScenarioName", ScenarioName);
			dataHolder.SetValue("Description", ScenarioDescription);

            // Save Dialogues
            if (m_dialogues.Count > 0)
            {
                var dialogues = m_dialogues.Select(d => d.ToDTO()).ToArray();

                //Generate the automatic TTS code except if there is already an UtterancId that does not
                //start with the generation prefix
                foreach (var d in dialogues)
                {
                    if(d.UtteranceId == null || d.UtteranceId.StartsWith(IATConsts.TTS_PREFIX))
                    {
                        d.UtteranceId = GenerateUtteranceId(d.Utterance);
                    }
                }
                dataHolder.SetValue("Dialogues", dialogues);
            }

            dataHolder.SetValue("Characters", Characters.ToArray());
            dataHolder.SetValue("WorldModel", WorldModel);
        }

        public void SetObjectData(ISerializationData dataHolder, ISerializationContext context)
        {

            ScenarioName = dataHolder.GetValue<string>("ScenarioName");

            ScenarioDescription = dataHolder.GetValue<string>("Description");

            //Load Agent Dialogues
            m_dialogues = new DialogActionDictionary();
			var agentDialogueArray = dataHolder.GetValue<DialogueStateActionDTO[]>("Dialogues");
            if (agentDialogueArray != null)
            {
	            foreach (var d in agentDialogueArray.Select(dto => new DialogStateAction(dto)))
	            {
                    m_dialogues.AddDialog(d);
	            }
            }
            Characters = dataHolder.GetValue<RolePlayCharacterAsset[]>("Characters");
            WorldModel = dataHolder.GetValue<WorldModelAsset>("WorldModel");
        }

        #endregion
    }
}


text:
class DataType(object):

    def blueprint(self):
        raise NotImplementedError

    def validate(self, value):
        raise NotImplementedError

class DataStructure(DataType):
    """
    Wrappers on Python types generally represented as structures e.g DateTime

    as_serializable methods signature for %DataStructure is different to that of DataCollection
    it requires a value to be passed in, this is because the python type of structures is
    difference to what gets serialized.

    E.g DateTime serializes itself as a ISO string
    """

    def blueprint(self):
        raise NotImplementedError

    def validate(self, value):
        raise NotImplementedError

    def as_serializable(self, value):
        raise NotImplementedError

class DataCollection(DataType):

    def blueprint(self):
        raise NotImplementedError

    def validate(self, value, attribute_filter=None, minified=False):
        raise NotImplementedError

    def as_serializable(self, attribute_filter=None):
        raise NotImplementedError

    def attribute_rewrite_map(self):
        raise NotImplementedError

    def attribute_rewrite_reverse_map(self):
        raise NotImplementedError

    def get_attribute_filter(self, default_value=False):
        raise NotImplementedError

redpajama_set_name: RedPajamaGithub


text:
require 'spec_helper'

describe "Lazy Loading" do

  class LazyLoadingTest
    include Identitee

    attr_accessor :successful

    add_identifiable_loader Identitee::Loader.new(identify_root_directory: File.expand_path("../loading_all_tests/", __FILE__))

    def initialize
      @successful = false
    end

    def successful?
      @successful
    end
  end

  it "lazy loads identifyables" do
    test = LazyLoadingTest.find_identifiable :autoload_test
    expect(test).to_not be_nil
    expect(test).to be_successful
  end
end


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

    <item android:id="@+id/action_add_subreddit"
          android:title="@string/action_add_subreddit"
          android:icon="@drawable/ic_add_white_24dp"
          app:icon="@drawable/ic_add_white_24dp"
          app:showAsAction="always"/>

    <item android:id="@+id/action_manage_subreddits"
          android:title="@string/action_manage_subreddits"
          android:icon="@drawable/ic_settings_white_24dp"
          app:icon="@drawable/ic_settings_white_24dp"
          app:showAsAction="ifRoom"/>

    <!--<item android:id="@+id/action_settings"-->
          <!--android:title="@string/action_settings"-->
          <!--android:orderInCategory="100"-->
          <!--app:showAsAction="never"/>-->

</menu>


text:
package com.xqbase.util.winrm.shell;

import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;

import com.xqbase.util.winrm.wsman.Signal;

@XmlRegistry
public class ObjectFactory {
	private final static QName _Code_QNAME = new QName("http://schemas.microsoft.com/wbem/wsman/1/windows/shell", "Code");
	private final static QName _CommandId_QNAME = new QName("http://schemas.microsoft.com/wbem/wsman/1/windows/shell", "CommandId");
	private final static QName _CommandLine_QNAME = new QName("http://schemas.microsoft.com/wbem/wsman/1/windows/shell", "CommandLine");
	private final static QName _Receive_QNAME = new QName("http://schemas.microsoft.com/wbem/wsman/1/windows/shell", "Receive");
	private final static QName _ReceiveResponse_QNAME = new QName("http://schemas.microsoft.com/wbem/wsman/1/windows/shell", "ReceiveResponse");
	private final static QName _Shell_QNAME = new QName("http://schemas.microsoft.com/wbem/wsman/1/windows/shell", "Shell");
	private final static QName _Signal_QNAME = new QName("http://schemas.microsoft.com/wbem/wsman/1/windows/shell", "Signal");

	public ObjectFactory() {/**/}

	public CommandLine createCommandLine() {
		return new CommandLine();
	}

	public Receive createReceive() {
		return new Receive();
	}

	public ReceiveResponse createReceiveResponse() {
		return new ReceiveResponse();
	}

	public Shell createShell() {
		return new Shell();
	}

	public DesiredStreamType createDesiredStreamType() {
		return new DesiredStreamType();
	}

	public StreamType createStreamType() {
		return new StreamType();
	}

	public CommandStateType createCommandStateType() {
		return new CommandStateType();
	}

	public EnvironmentVariableList createEnvironmentVariableList() {
		return new EnvironmentVariableList();
	}

	public EnvironmentVariable createEnvironmentVariable() {
		return new EnvironmentVariable();
	}

	@XmlElementDecl(namespace = "http://schemas.microsoft.com/wbem/wsman/1/windows/shell", name = "Code")
	public JAXBElement<String> createCode(String value) {
		return new JAXBElement<>(_Code_QNAME, String.class, null, value);
	}

	@XmlElementDecl(namespace = "http://schemas.microsoft.com/wbem/wsman/1/windows/shell", name = "CommandId")
	public JAXBElement<String> createCommandId(String value) {
		return new JAXBElement<>(_CommandId_QNAME, String.class, null, value);
	}

	@XmlElementDecl(namespace = "http://schemas.microsoft.com/wbem/wsman/1/windows/shell", name = "CommandLine")
	public JAXBElement<CommandLine> createCommandLine(CommandLine value) {
		return new JAXBElement<>(_CommandLine_QNAME, CommandLine.class, null, value);
	}

	@XmlElementDecl(namespace = "http://schemas.microsoft.com/wbem/wsman/1/windows/shell", name = "Receive")
	public JAXBElement<Receive> createReceive(Receive value) {
		return new JAXBElement<>(_Receive_QNAME, Receive.class, null, value);
	}

	@XmlElementDecl(namespace = "http://schemas.microsoft.com/wbem/wsman/1/windows/shell", name = "ReceiveResponse")
	public JAXBElement<ReceiveResponse> createReceiveResponse(ReceiveResponse value) {
		return new JAXBElement<>(_ReceiveResponse_QNAME, ReceiveResponse.class, null, value);
	}

	@XmlElementDecl(namespace = "http://schemas.microsoft.com/wbem/wsman/1/windows/shell", name = "Shell")
	public JAXBElement<Shell> createShell(Shell value) {
		return new JAXBElement<>(_Shell_QNAME, Shell.class, null, value);
	}

	@XmlElementDecl(namespace = "http://schemas.microsoft.com/wbem/wsman/1/windows/shell", name = "Signal")
	public JAXBElement<Signal> createSignal(Signal value) {
		return new JAXBElement<>(_Signal_QNAME, Signal.class, null, value);
	}
}


text:
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute, Params } from '@angular/router';
import { Location } from '@angular/common';
import { ProdutoService } from '../../produto.service';
import { PedidoService} from '../../pedido.service';
import { SuperDetalhes } from '../../comum/superdetalhes.component';

@Component({
  selector: 'app-detalhes',
  templateUrl: './detalhes.component.html',
  styleUrls: ['./detalhes.component.css']
})
export class DetalhesComponent extends SuperDetalhes implements OnInit {

  produtos = [];
  selecionado = {itens:[]};
  produto;

  constructor(service: PedidoService, router: Router, route: ActivatedRoute, private produtoService: ProdutoService) {
    super(service, router, route);
  }

  inserirProduto(){
     console.log(this.selecionado.itens,this.produto);
     if (!this.selecionado.itens){
       this.selecionado.itens=[];
     }
     let antigo=this.selecionado.itens;
     this.selecionado.itens=[];
     for (let i=0;i<antigo.length;i++){
        this.selecionado.itens.push(antigo[i]);
     }
     this.selecionado.itens.push({produto:this.produto,quantidade:1});
     this.produto=null;
  }

  ngOnInit() {
    super.ngOnInit();
    this.atualizaProdutos();

  }

  atualizaProdutos() {
    this.produtoService.getAll().then(response => {
      this.produtos = response.values;
    });
  }

  filtrarProdutos(event) {
    let query = event.query;
    this.produtoService.filtra(query).then(response => {
      this.produtos = response.values;
    });
  }

}


text:
<?php

namespace Nayjest\Querying\Row;

abstract class AbstractRow implements RowInterface
{
    protected $dynamicFields;

    abstract protected function hasInternal($fieldName);

    abstract protected function getInternal($fieldName);

    public function __construct(DynamicFieldsRegistry $dynamicFields)
    {
        $this->dynamicFields = $dynamicFields;
    }

    public function get($fieldName, $default = null)
    {
        return $this->hasInternal($fieldName) ? $this->getInternal($fieldName) : (
            $this->dynamicFields->has($fieldName) ? $this->dynamicFields->get($fieldName, $this) : $default
        );
    }

    public function has($fieldName)
    {
        return $this->hasInternal($fieldName) || $this->dynamicFields->has($fieldName);
    }

    public function dynamicFieldsRegistry()
    {
        return $this->dynamicFields;
    }

    public function toArray()
    {
        return array_merge((array)$this->getSrc(), $this->dynamicFieldsRegistry()->getAll($this));
    }

    public function toObject()
    {
        $src = $this->getSrc();
        if (!is_object($src)) {
            $src = (object)$src;
        }
        $dynamicFields = $this->dynamicFieldsRegistry()->getAll($this);
        foreach($dynamicFields as $key => $value) {
            $src->{$key} = $value;
        }
        return $src;
    }

    public function extract()
    {
        return is_array($this->getSrc()) ? $this->toArray() : $this->toObject();
    }
}


text:
using System;

namespace Epos.Utilities
{
    /// <summary> Provides helper methods to write values to the standard output stream in colors. </summary>
    public static class ColorConsole
    {
        /// <summary> Writes the specified string value to the standard output stream
        /// in hint colors. </summary>
        /// <param name="hint">The hint to write, or null.</param>
        public static void WriteHint(string hint) {
            ConsoleColor theOldBackgroundColor = Console.BackgroundColor;
            Console.BackgroundColor = ConsoleColor.DarkGreen;
            WriteWhite(hint);
            Console.BackgroundColor = theOldBackgroundColor;
        }

        /// <summary> Writes the specified string value to the standard output stream
        /// in warning colors. </summary>
        /// <param name="warning">The warning to write, or null.</param>
        public static void WriteWarning(string warning) {
            ConsoleColor theOldBackgroundColor = Console.BackgroundColor;
            Console.BackgroundColor = ConsoleColor.Yellow;
            WriteBlack(warning);
            Console.BackgroundColor = theOldBackgroundColor;
        }

        /// <summary> Writes the specified string value to the standard output stream
        /// in error colors. </summary>
        /// <param name="error">The error to write, or null.</param>
        public static void WriteError(string error) {
            ConsoleColor theOldBackgroundColor = Console.BackgroundColor;
            Console.BackgroundColor = ConsoleColor.Red;
            WriteWhite(error);
            Console.BackgroundColor = theOldBackgroundColor;
        }

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color black. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteBlack(object value) => WriteBlack(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color black. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteBlack(string value) => WriteBlack(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color black using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteBlack(string format, params object[] args) => Write(ConsoleColor.Black, format, args);

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color dark Blue. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteDarkBlue(object value) =>
            WriteDarkBlue(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color dark Blue. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteDarkBlue(string value) => WriteDarkBlue(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color dark Blue using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteDarkBlue(string format, params object[] args) =>
            Write(ConsoleColor.DarkBlue, format, args);

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color dark Green. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteDarkGreen(object value) =>
            WriteDarkGreen(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color dark Green. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteDarkGreen(string value) => WriteDarkGreen(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color dark Green using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteDarkGreen(string format, params object[] args) => Write(ConsoleColor.DarkGreen, format, args);

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color dark Cyan. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteDarkCyan(object value) => WriteDarkCyan(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color dark Cyan. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteDarkCyan(string value) => WriteDarkCyan(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color dark Cyan using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteDarkCyan(string format, params object[] args) => Write(ConsoleColor.DarkCyan, format, args);

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color dark Red. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteDarkRed(object value) => WriteDarkRed(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color dark Red. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteDarkRed(string value) => WriteDarkRed(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color dark Red using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteDarkRed(string format, params object[] args) => Write(ConsoleColor.DarkRed, format, args);

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color dark Magenta. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteDarkMagenta(object value) => WriteDarkMagenta(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color dark Magenta. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteDarkMagenta(string value) => WriteDarkMagenta(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color dark Magenta using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteDarkMagenta(string format, params object[] args) => Write(ConsoleColor.DarkMagenta, format, args);

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color dark Yellow. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteDarkYellow(object value) => WriteDarkYellow(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color dark Yellow. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteDarkYellow(string value) => WriteDarkYellow(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color dark Yellow using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteDarkYellow(string format, params object[] args) => Write(ConsoleColor.DarkYellow, format, args);

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color gray. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteGray(object value) => WriteGray(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color gray. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteGray(string value) => WriteGray(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color gray using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteGray(string format, params object[] args) => Write(ConsoleColor.Gray, format, args);

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color dark Gray. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteDarkGray(object value) => WriteDarkGray(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color dark Gray. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteDarkGray(string value) => WriteDarkGray(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color dark Gray using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteDarkGray(string format, params object[] args) => Write(ConsoleColor.DarkGray, format, args);

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color blue. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteBlue(object value) => WriteBlue(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color blue. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteBlue(string value) => WriteBlue(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color blue using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteBlue(string format, params object[] args) => Write(ConsoleColor.Blue, format, args);

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color green. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteGreen(object value) => WriteGreen(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color green. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteGreen(string value) => WriteGreen(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color green using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteGreen(string format, params object[] args) => Write(ConsoleColor.Green, format, args);

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color cyan. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteCyan(object value) => WriteCyan(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color cyan. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteCyan(string value) => WriteCyan(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color cyan using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteCyan(string format, params object[] args) => Write(ConsoleColor.Cyan, format, args);

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color red. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteRed(object value) => WriteRed(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color red. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteRed(string value) => WriteRed(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color red using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteRed(string format, params object[] args) => Write(ConsoleColor.Red, format, args);

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color magenta. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteMagenta(object value) => WriteMagenta(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color magenta. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteMagenta(string value) => WriteMagenta(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color magenta using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteMagenta(string format, params object[] args) => Write(ConsoleColor.Magenta, format, args);

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color yellow. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteYellow(object value) => WriteYellow(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color yellow. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteYellow(string value) => WriteYellow(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color yellow using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteYellow(string format, params object[] args) => Write(ConsoleColor.Yellow, format, args);

        /// <summary> Writes the text representation of the specified object to the standard output stream
        /// in the color white. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteWhite(object value) => WriteWhite(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value to the standard output stream
        /// in the color white. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteWhite(string value) => WriteWhite(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects
        /// to the standard output stream in the color white using the
        /// specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteWhite(string format, params object[] args) => Write(ConsoleColor.White, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color black. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineBlack(object value) => WriteLineBlack(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color black. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineBlack(string value) => WriteLineBlack(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color black using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineBlack(string format, params object[] args) => WriteLine(ConsoleColor.Black, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color dark Blue. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineDarkBlue(object value) => WriteLineDarkBlue(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color dark Blue. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineDarkBlue(string value) => WriteLineDarkBlue(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color dark Blue using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineDarkBlue(string format, params object[] args) => WriteLine(ConsoleColor.DarkBlue, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color dark Green. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineDarkGreen(object value) => WriteLineDarkGreen(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color dark Green. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineDarkGreen(string value) => WriteLineDarkGreen(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color dark Green using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineDarkGreen(string format, params object[] args) => WriteLine(ConsoleColor.DarkGreen, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color dark Cyan. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineDarkCyan(object value) => WriteLineDarkCyan(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color dark Cyan. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineDarkCyan(string value) => WriteLineDarkCyan(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color dark Cyan using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineDarkCyan(string format, params object[] args) => WriteLine(ConsoleColor.DarkCyan, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color dark Red. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineDarkRed(object value) => WriteLineDarkRed(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color dark Red. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineDarkRed(string value) => WriteLineDarkRed(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color dark Red using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineDarkRed(string format, params object[] args) => WriteLine(ConsoleColor.DarkRed, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color dark Magenta. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineDarkMagenta(object value) => WriteLineDarkMagenta(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color dark Magenta. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineDarkMagenta(string value) => WriteLineDarkMagenta(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color dark Magenta using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineDarkMagenta(string format, params object[] args) => WriteLine(ConsoleColor.DarkMagenta, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color dark Yellow. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineDarkYellow(object value) => WriteLineDarkYellow(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color dark Yellow. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineDarkYellow(string value) => WriteLineDarkYellow(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color dark Yellow using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineDarkYellow(string format, params object[] args) => WriteLine(ConsoleColor.DarkYellow, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color gray. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineGray(object value) => WriteLineGray(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color gray. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineGray(string value) => WriteLineGray(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color gray using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineGray(string format, params object[] args) =>
            WriteLine(ConsoleColor.Gray, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color dark Gray. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineDarkGray(object value) =>
            WriteLineDarkGray(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color dark Gray. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineDarkGray(string value) => WriteLineDarkGray(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color dark Gray using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineDarkGray(string format, params object[] args) =>
            WriteLine(ConsoleColor.DarkGray, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color blue. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineBlue(object value) =>
            WriteLineBlue(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color blue. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineBlue(string value) => WriteLineBlue(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color blue using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineBlue(string format, params object[] args) =>
            WriteLine(ConsoleColor.Blue, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color green. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineGreen(object value) =>
            WriteLineGreen(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color green. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineGreen(string value) => WriteLineGreen(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color green using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineGreen(string format, params object[] args) =>
            WriteLine(ConsoleColor.Green, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color cyan. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineCyan(object value) =>
            WriteLineCyan(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color cyan. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineCyan(string value) => WriteLineCyan(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color cyan using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineCyan(string format, params object[] args) =>
            WriteLine(ConsoleColor.Cyan, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color red. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineRed(object value) =>
            WriteLineRed(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color red. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineRed(string value) => WriteLineRed(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color red using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineRed(string format, params object[] args) =>
            WriteLine(ConsoleColor.Red, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color magenta. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineMagenta(object value) =>
            WriteLineMagenta(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color magenta. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineMagenta(string value) => WriteLineMagenta(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color magenta using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineMagenta(string format, params object[] args) =>
            WriteLine(ConsoleColor.Magenta, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color yellow. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineYellow(object value) =>
            WriteLineYellow(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color yellow. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineYellow(string value) => WriteLineYellow(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color yellow using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineYellow(string format, params object[] args) =>
            WriteLine(ConsoleColor.Yellow, format, args);

        /// <summary> Writes the text representation of the specified object, followed by
        /// the current line terminator, to the standard output stream in the color white. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineWhite(object value) =>
            WriteLineWhite(value != null ? value.ToString() : string.Empty);

        /// <summary> Writes the specified string value, followed by the current line terminator,
        /// to the standard output stream in the color white. </summary>
        /// <param name="value">The value to write, or null.</param>
        public static void WriteLineWhite(string value) => WriteLineWhite(value ?? string.Empty, null);

        /// <summary> Writes the text representation of the specified array of objects,
        /// followed by the current line terminator to the standard output stream in the
        /// color white using the specified format information. </summary>
        /// <param name="format">A composite format string.</param>
        /// <param name="args">An array of objects to write using format.</param>
        public static void WriteLineWhite(string format, params object[] args) =>
            WriteLine(ConsoleColor.White, format, args);

        // --- Hilfsmethoden ---

        private static void WriteCore(
            ConsoleColor color, string format, object[] args, Action<string, object[]> writeAction
        ) {
            ConsoleColor theOldConsoleForegroundColor = Console.ForegroundColor;
            Console.ForegroundColor = color;
            writeAction(format, args);
            Console.ForegroundColor = theOldConsoleForegroundColor;

        }

        private static void Write(ConsoleColor color, string format, params object[] args) =>
            WriteCore(color, format, args, Console.Write);

        private static void WriteLine(ConsoleColor color, string format, params object[] args) =>
            WriteCore(color, format, args, Console.WriteLine);
    }
}


text:
<?php

/**
 * Doctrine_Ticket_1821_TestCase
 *
 * @package     Doctrine
 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
 * @category    Object Relational Mapping
 * @link        www.doctrine-project.org
 * @since       1.0
 * @version     $Revision$
 * @author      Andrea Baron <andrea@bhweb.it>
 */
class Doctrine_Ticket_1821_TestCase extends Doctrine_UnitTestCase
{
    public function prepareTables()
    {
        $this->tables = array(
            'Doctrine_Ticket_1821_Record',
            'Doctrine_Ticket_1821_Record_ID_Aliased',
            'Doctrine_Ticket_1821_Record_Column_Aliased',
            'Doctrine_Ticket_1821_Record_Full_Aliased',
        );
        parent::prepareTables();
    }

    public function prepareData()
    {

    }

    public function execTest($klass)
    {
        //stores old validation setting
        $validation = Doctrine_Manager::getInstance()->getAttribute(Doctrine_Core::ATTR_VALIDATE);
        Doctrine_Manager::getInstance()->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_ALL);

        $record = new $klass();
		$record->name = 'test';
		try {
		    $record->save();
		}
		catch(Exception $e) {
		    $this->fail(
		        'Failed to execute validation with class = "' . $klass
		        . '". Exception message is: ' . $e->getMessage()
		    );
		}
		$this->pass();

		Doctrine_Manager::getInstance()->setAttribute(Doctrine_Core::ATTR_VALIDATE, $validation);
    }

    public function testShouldAllowNotUsingAliases()
    {
        $this->execTest('Doctrine_Ticket_1821_Record');
    }

    public function testShouldAllowUsingAliasesOnId()
    {
        $this->execTest('Doctrine_Ticket_1821_Record_ID_Aliased');
    }

    public function testShouldAllowUsingAliasesOnColumn()
    {
        $this->execTest('Doctrine_Ticket_1821_Record_Column_Aliased');
    }

    public function testShouldAllowUsingAliasesOnBoth()
    {
        $this->execTest('Doctrine_Ticket_1821_Record_Full_Aliased');
    }
}

class Doctrine_Ticket_1821_Record_Full_Aliased extends Doctrine_Record {
    public function setTableDefinition() {
        $this->hasColumn('user_id as id', 'integer', 4, array(
                'autoincrement' => true,
                'notnull' => true,
                'primary' => true
                ));
        $this->hasColumn('user_name as name', 'string', 255, array(
                'notnull' => true,
                'unique' => true
                ));
    }
}

class Doctrine_Ticket_1821_Record_ID_Aliased extends Doctrine_Record {
    public function setTableDefinition() {
        $this->hasColumn('user_id as id', 'integer', 4, array(
                'autoincrement' => true,
                'notnull' => true,
                'primary' => true
                ));
        $this->hasColumn('name', 'string', 255, array(
                'notnull' => true,
                'unique' => true
                ));
    }
}

class Doctrine_Ticket_1821_Record_Column_Aliased extends Doctrine_Record {
    public function setTableDefinition() {
        $this->hasColumn('id', 'integer', 4, array(
                'autoincrement' => true,
                'notnull' => true,
                'primary' => true
                ));
        $this->hasColumn('user_name as name', 'string', 255, array(
                'notnull' => true,
                'unique' => true
                ));
    }
}

class Doctrine_Ticket_1821_Record extends Doctrine_Record {
    public function setTableDefinition() {
        $this->hasColumn('id', 'integer', 4, array(
                'autoincrement' => true,
                'notnull' => true,
                'primary' => true
                ));
        $this->hasColumn('name', 'string', 255, array(
                'notnull' => true,
                'unique' => true
                ));
    }
}


text:
package com.gs.collections.impl.map.mutable.primitive;

import com.gs.collections.impl.test.Verify;
import org.junit.Test;

public class FloatIntHashMapSerializationTest
{
    @Test
    public void serializedForm()
    {
        Verify.assertSerializedForm(
                1L,
                "rO0ABXNyAD1jb20uZ3MuY29sbGVjdGlvbnMuaW1wbC5tYXAubXV0YWJsZS5wcmltaXRpdmUuRmxv\n"
                        + "YXRJbnRIYXNoTWFwAAAAAAAAAAEMAAB4cHcEAAAAAHg=",
                new FloatIntHashMap());
    }
}


text:
static NSArray *s_textExamples = nil;
static NSArray *s_fontNames = nil;

@interface LabelDemoViewController ()

@property (nonatomic, weak) IBOutlet HLSLabel *label;
@property (nonatomic, weak) IBOutlet UILabel *standardLabel;
@property (nonatomic, weak) IBOutlet UIPickerView *textPickerView;
@property (nonatomic, weak) IBOutlet UIPickerView *fontPickerView;
@property (nonatomic, weak) IBOutlet UISegmentedControl *baselineAdjustmentSegmentedControl;
@property (nonatomic, weak) IBOutlet UISlider *numberOfLinesSlider;
@property (nonatomic, weak) IBOutlet UILabel *numberOfLinesLabel;
@property (nonatomic, weak) IBOutlet UISlider *fontSizeSlider;
@property (nonatomic, weak) IBOutlet UILabel *fontSizeLabel;
@property (nonatomic, weak) IBOutlet UISegmentedControl *verticalAlignmentSegmentedControl;
@property (nonatomic, weak) IBOutlet UIPickerView *lineBreakModePickerView;

@end

@implementation LabelDemoViewController

#pragma mark Class methods

+ (void)initialize
{
    if (self != [LabelDemoViewController class]) {
        return;
    }

    s_textExamples = @[@"Lorem ipsum",
                       @"Lorem ipsum dolor sit amet, consetetur sadipscing elitr",
                       @"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
                       @"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz",
                       @"--------- -- --------- -------",
                       @"",
                       @"......... ... ......... .... ."];

    NSMutableArray *fontNames = [NSMutableArray array];
    NSArray *familyNames = [[UIFont familyNames] sortedArrayUsingSelector:@selector(localizedCompare:)];
    for (NSString *familyName in familyNames) {
        NSArray *familyFontNames = [[UIFont fontNamesForFamilyName:familyName] sortedArrayUsingSelector:@selector(localizedCompare:)];
        [fontNames addObjectsFromArray:familyFontNames];
    }
    s_fontNames = [NSArray arrayWithArray:fontNames];
}

#pragma mark View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.textPickerView.dataSource = self;
    self.textPickerView.delegate = self;

    self.fontPickerView.dataSource = self;
    self.fontPickerView.delegate = self;

    self.lineBreakModePickerView.dataSource = self;
    self.lineBreakModePickerView.delegate = self;

    [self reloadData];
}

#pragma mark Localization

- (void)localize
{
    [super localize];

    self.title = NSLocalizedString(@"Label", nil);

    [self.baselineAdjustmentSegmentedControl setTitle:NSLocalizedString(@"Baselines", nil) forSegmentAtIndex:0];
    [self.baselineAdjustmentSegmentedControl setTitle:NSLocalizedString(@"Centers", nil) forSegmentAtIndex:1];
    [self.baselineAdjustmentSegmentedControl setTitle:NSLocalizedString(@"None", nil) forSegmentAtIndex:2];

    [self.verticalAlignmentSegmentedControl setTitle:NSLocalizedString(@"Middle", nil) forSegmentAtIndex:0];
    [self.verticalAlignmentSegmentedControl setTitle:NSLocalizedString(@"Top", nil) forSegmentAtIndex:1];
    [self.verticalAlignmentSegmentedControl setTitle:NSLocalizedString(@"Bottom", nil) forSegmentAtIndex:2];

    [self reloadData];
}

#pragma mark UIPickerViewDataSource protocol implementation

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    return 1;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    if (pickerView == self.textPickerView) {
        return [s_textExamples count];
    }
    else if (pickerView == self.fontPickerView) {
        return [s_fontNames count];
    }
    else if (pickerView == self.lineBreakModePickerView) {
        return NSLineBreakByTruncatingMiddle + 1;
    }
    else {
        HLSLoggerError(@"Unknown picker view");
        return 0;
    }
}

#pragma mark UIPickerViewDelegate protocol implementation

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    if (pickerView == self.textPickerView) {
        return [s_textExamples objectAtIndex:row];
    }
    else if (pickerView == self.fontPickerView) {
        return [s_fontNames objectAtIndex:row];
    }
    else if (pickerView == self.lineBreakModePickerView) {
        switch (row) {
            case NSLineBreakByCharWrapping: {
                return @"NSLineBreakByCharWrapping";
                break;
            }

            case NSLineBreakByClipping: {
                return @"NSLineBreakByClipping";
                break;
            }

            case NSLineBreakByTruncatingHead: {
                return @"NSLineBreakByTruncatingHead";
                break;
            }

            case NSLineBreakByTruncatingTail: {
                return @"NSLineBreakByTruncatingTail";
                break;
            }

            case NSLineBreakByTruncatingMiddle: {
                return @"NSLineBreakByTruncatingMiddle";
                break;
            }

            case NSLineBreakByWordWrapping:
            default: {
                return @"NSLineBreakByWordWrapping";
                break;
            }
        }
    }
    else {
        HLSLoggerError(@"Unknown picker view");
        return nil;
    }
}

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
    [self reloadData];
}

#pragma mark Updating the view

- (void)reloadData
{
    NSString *text = [s_textExamples objectAtIndex:[self.textPickerView selectedRowInComponent:0]];
    NSString *fontName = [s_fontNames objectAtIndex:[self.fontPickerView selectedRowInComponent:0]];
    NSLineBreakMode lineBreakMode = [self.lineBreakModePickerView selectedRowInComponent:0];
    UIBaselineAdjustment baselineAdjustment = [self.baselineAdjustmentSegmentedControl selectedSegmentIndex];

    self.label.font = [UIFont fontWithName:fontName size:self.fontSizeSlider.value];
    self.label.numberOfLines = (NSInteger)self.numberOfLinesSlider.value;
    self.label.verticalAlignment = self.verticalAlignmentSegmentedControl.selectedSegmentIndex;
    self.label.baselineAdjustment = baselineAdjustment;
    self.label.lineBreakMode = lineBreakMode;
    self.label.text = text;

    self.standardLabel.font = [UIFont fontWithName:fontName size:self.fontSizeSlider.value];
    self.standardLabel.numberOfLines = (NSInteger)self.numberOfLinesSlider.value;
    self.standardLabel.baselineAdjustment = baselineAdjustment;
    self.standardLabel.lineBreakMode = lineBreakMode;
    self.standardLabel.text = text;

    self.numberOfLinesLabel.text = [NSString stringWithFormat:@"%@", @(self.label.numberOfLines)];
    self.fontSizeLabel.text = [NSString stringWithFormat:@"%.0f", self.fontSizeSlider.value];
}

#pragma mark Event callbacks

- (IBAction)updateLabels:(id)sender
{
    [self reloadData];
}

@end


text:
<?php

declare(strict_types = 1);

namespace fphp;

/**
 * Return an array without duplicates using a comparator function
 *
 * @param Callable $comparator comparator function
 * @param array $collection collection
 * @return array
 * @author Rémy Peru <peru.remy@gmail.com>
 */
function uniqWith($comparator = null, $collection = null) {
	$uniqWith = curry2(function (callable $comparator, array $collection) {
		$uniqArray = [];

		foreach ($collection as $item) {
			$isUnique = true;

			for ($i = 0; $i < count($uniqArray); $i++) {
				if ($comparator($item, $uniqArray[$i])) {
					$isUnique = false;
					break;
				}
			}

			if ($isUnique) {
				$uniqArray[] = $item;
			}
		}

		return $uniqArray;
	});

	return $uniqWith(...func_get_args());
}


text:
var assert = require('assert');
var rooms = require('./lib/rooms');
var scrape = require('../src/scrape');
var sinon = require('sinon');
var util = require('./lib/test-util');

var jsdom = require('jsdom').jsdom;
var testWindow = jsdom().createWindow();
var $ = require('jQuery').create(testWindow);
var _ = require('underscore');

function assertEmpty(o1) {
  assert.deepEqual(o1, {});
}

function assertNotEmpty(o1) {
  assert.notDeepEqual(o1, {});
}

suite('Scrape', function ScrapeSuite () {

  suite('baseline', function getStatusSuite () {

    test('test suite compiles', function(){
      assert.ok(true);
    });

    test('jQuery load', function () {
      $('body').html('
Hello world
');
    });

    test('rooms load', function () {
      assert.equal(typeof(rooms.rooms2HTML), "function");
      assert.equal(typeof(rooms.emptyRooms), "function");
    });

  });

  suite('loginPopupShown()', function getStatusSuite () {

    test('is a function', function () {
      assert.ok(scrape);
      assert.equal(typeof(scrape.loginPopupShown), "function");
    });

    test('returns false for no login popup in html', function () {
      $('body').html('
 No login popup shown
');
      assert.equal(scrape.loginPopupShown($), false);
    });

    test('returns true when login popup is in html', function () {
      $('body').html('

×<form method="post" id="login-form" class="login-form">Username:<input type="text" id="username" name="username"><input type="hidden" id="username" name="username" value="conference.xleap.apmoller.net"><input type="submit" class="button" value="Login"></form>

');
      assert.equal(scrape.loginPopupShown($), true);
    });

  });

  suite('getStatus()', function getStatusSuite () {

    test('is a function', function () {
      assert.ok(scrape);
      assert.equal(typeof(scrape.getStatus), "function");
    });

    test('returns {} for no rooms in html', function () {
      $('body').html('
 No rooms shown
');
      assertEmpty(scrape.getStatus($));
    });

    test('returns unread as 0 for all empty rooms', function () {
      $('body').html(rooms.rooms2HTML(rooms.emptyRooms()));
      assert.ok(_.all(scrape.getStatus($), function (v) { return v === 0; }));
    });

    test('returns something when unread in room(s)', function () {
      $('body').html(rooms.rooms2HTML(rooms.withUnread(5).rooms));
      assertNotEmpty(scrape.getStatus($));
    });

    test('returns correct number of unreads', function () {
      $('body').html(rooms.rooms2HTML(rooms.withUnread(8).rooms));
      var unread = _.reduce(scrape.getStatus($),
        function (memo, x) { return memo + x; },
        0);
      assert.strictEqual(unread, 8);
    });

  });

  suite('getChanges()', function getChangesSuite () {

    test('returns {} when given empty states', function () {
      assertEmpty(scrape.getChanges({},{}));
    });

    test('returns {} when given states with 0 unreads', function () {
      assertEmpty(scrape.getChanges({},{'1': 0, '2': 0}));
    });

    test('returns {} when given identical states', function () {
      assertEmpty(scrape.getChanges({'1':1},{'1':1}));
      assertEmpty(scrape.getChanges(
            {'1':1,'2':1, '3':5},
            {'1':1,'2':1, '3':5}));
    });

    test('returns non-empty when given combinations of {} and {non-empty}', function () {
      assertNotEmpty(scrape.getChanges({},{'1':1}));
      assertNotEmpty(scrape.getChanges({'1':1},{}));
      assertNotEmpty(scrape.getChanges({'1':1},{'2':1}));
      assertNotEmpty(scrape.getChanges({'1':1},{'1':1,'2':1}));
      assertNotEmpty(scrape.getChanges({'1':1},{'1':0}));
    });

    test('returns correct change', function () {
      assert.deepEqual(scrape.getChanges({},{'1':1}), {'1': 1});
      assert.deepEqual(scrape.getChanges({'2':0,'1':1},{'1':1,'2':3}), {'2':3});
      assert.deepEqual(scrape.getChanges({'2':3,'1':1},{'1':1,'2':0}), {'2':-3});
      assert.deepEqual(scrape.getChanges({'2':3,'1':1},{'1':2,'2':0}), {'1':1,'2':-3});
    });

  });

  suite('totalUnread()', function totalUnreadSuite () {

    test('is a function', function () {
      assert.equal(typeof(scrape.totalUnread), "function");
    });

    test('return 0 when given {}', function () {
      assert.equal(scrape.totalUnread({}), 0);
    });

    test('return correct sum for given {non-empty}', function () {
      assert.equal(scrape.totalUnread({'1': 0, '2': 0, '3': 0}), 0);
      assert.equal(scrape.totalUnread({'1': 0, '2': 1, '3': 0}), 1);
      assert.equal(scrape.totalUnread({'1': 4, '2': 2, '3': 0}), 6);
    });

  });

  suite('notifyTotalIfChanged()', function totalUnreadSuite () {

    var notifier = null;

    setup(function () {
      notifier = sinon.stub();
    });

    test('is a function', function () {
      assert.equal(typeof(scrape.notifyTotalIfChanged), "function");
    });

    test('no change => no message sent', function () {
      scrape.notifyTotalIfChanged(0, 0, notifier);
      assert.equal(notifier.callCount, 0);
      scrape.notifyTotalIfChanged(4, 4, notifier);
      assert.equal(notifier.callCount, 0);
    });

    test('1 change => 1 message sent', function () {
      scrape.notifyTotalIfChanged(0, 1, notifier);
      assert.equal(notifier.callCount, 1);
    });

    test('>1 change => 1 message sent', function () {
      scrape.notifyTotalIfChanged(0, 6, notifier);
      assert.equal(notifier.callCount, 1);
      assert.equal(notifier.getCall(0).args[0].message, 'TotalUnreadChanged');
      assert.equal(notifier.getCall(0).args[0].values.total, 6);
    });

  });

  suite('notifyUnreadIfChanged()', function totalUnreadSuite () {

    var notifier = null;

    setup(function () {
      notifier = sinon.stub();
    });

    test('is a function', function () {
      assert.equal(typeof(scrape.notifyUnreadIfChanged), "function");
    });

    test('all unreads 0 => no message sent', function () {
      scrape.notifyUnreadIfChanged({}, {'1': 0, '2': 0}, notifier);
      assert.equal(notifier.callCount, 0);
    });

    test('no change => no message sent', function () {
      scrape.notifyUnreadIfChanged({}, {}, notifier);
      assert.equal(notifier.callCount, 0);
    });

    test('1 change => 1 message sent', function () {
      scrape.notifyUnreadIfChanged({}, {'1': 1}, notifier);
      assert.equal(notifier.callCount, 1);
    });

    test('>1 change => 1 message sent', function () {
      scrape.notifyUnreadIfChanged({}, {'1': 1, '2': 4, '5': 1}, notifier);
      assert.equal(notifier.callCount, 1);
    });

    test('given new unreads message contains correct content', function () {
      scrape.notifyUnreadIfChanged({}, {'1': 1, '2': 4, '5': 1}, notifier);
      assert.equal(notifier.getCall(0).args[0].message, 'UnreadMessages');
      assert.deepEqual(notifier.getCall(0).args[0].values.changed, {'1': 1, '2': 4, '5': 1});
    });

    test('given new unreads message contains correct content', function () {
      scrape.notifyUnreadIfChanged({'1': 1, '2': 4, '5': 1},{'1': 2, '2': 4, '5': 3}, notifier);
      assert.equal(notifier.getCall(0).args[0].message, 'UnreadMessages');
      assert.deepEqual(notifier.getCall(0).args[0].values.changed, {'1': 1, '5': 2});
    });

    test('given less unreads no messages is sent', function () {
      scrape.notifyUnreadIfChanged({'1': 1, '2': 4, '5': 1},{'1': 0, '2': 4, '5': 1}, notifier);
      assert.equal(notifier.callCount, 0);
    });

  });

});


text:
webhard-script
==============

* Install phantomJS and casperJS correctly and add them into your PATH (for windows)
* Only tested on windows platform

```
casperjs webhard.coffee http://webhard-address userid password command arguments
```

Commands
--------

1. test : test
1. list : list all uploaded files
1. upload : ```upload file```
1. deleteall : delete all uploaded files
1. ddall : download and delete all files


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package erp.cfd.utils;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConnection; import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import org.bouncycastle.util.encoders.Base64;

public class SoapCancel {
    /**
     *
     */
    public static void main(String args[]) {
        try {
            // Creación de la conexión SoapStamp
            SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
            SOAPConnection soapConnection = soapConnectionFactory.createConnection();

            // Enviar mensaje SOAP al servidor SOAP
            //String url = "https://demo-facturacion.finkok.com/servicios/soap/cancel.wsdl";
            String url = "https://facturacion.finkok.com/servicios/soap/cancel.wsdl";
            SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(), url);

            // Procesar la respuesta SOAP
            printSOAPResponse(soapResponse);

            soapConnection.close();
        } catch (Exception e) {
            System.err.println("Error al conectarse al ws");
            e.printStackTrace();
        }
    }

    private static SOAPMessage createSOAPRequest() throws Exception {
        MessageFactory messageFactory = MessageFactory.newInstance();
        SOAPMessage soapMessage = messageFactory.createMessage();
        SOAPPart soapPart = soapMessage.getSOAPPart();

        String serverURI = "http://facturacion.finkok.com/cancel";
        String otherServer = "apps.services.soap.core.views";
        String serverCancellation = "http://facturacion.finkok.com/cancellation";

        // Cifrar el certificado a base64
        /* Original Finkok source code:
        Base64 base64 = new Base64();
        */

        //File cer = new File("aad990814bp7_1210261233s.cer.pem");
        File cer = new File("C:\\Temp\\csd.cer.pem");
        byte[] CerArray = new byte[(int) cer.length()];

        String encodedCer = "";
        try {
            InputStream inputStream;
            inputStream = new FileInputStream(cer);
            inputStream.read(CerArray);
            /* Original Finkok source code:
            encodedCer = base64.encodeToString(CerArray);
            */
            byte[] bytesSignatureEncoded = Base64.encode(CerArray);     // Sergio Flores, 2018-11-06: my code!
            encodedCer = new String(bytesSignatureEncoded, "UTF-8");    // Sergio Flores, 2018-11-06: my code!
        } catch (Exception e) {
            System.err.println("Error al cifrar el certificado a base64");
        }

        // Cifrar la key a base64
        //File key = new File("aad990814bp7_1210261233s.key.pem");
        File key = new File("C:\\Temp\\csd.key.pem.enc");
        byte[] KeyArray = new byte[(int) key.length()];

        String encodedKey = "";
        try {
            InputStream inputStream;
            inputStream = new FileInputStream(key);
            inputStream.read(KeyArray);
            /* Original Finkok source code:
            encodedKey = base64.encodeToString(KeyArray);
            */
            byte[] bytesSignatureEncoded = Base64.encode(KeyArray);     // Sergio Flores, 2018-11-06: my code!
            encodedKey = new String(bytesSignatureEncoded, "UTF-8");    // Sergio Flores, 2018-11-06: my code!
        } catch (Exception e) {
            System.err.println("Error al cifrar la key a base64");
        }

        // SOAP Envelope
        SOAPEnvelope envelope = soapPart.getEnvelope();
        envelope.addNamespaceDeclaration("can", serverURI);
        envelope.addNamespaceDeclaration("apps", otherServer);
        envelope.addNamespaceDeclaration("can1", serverCancellation);

        // SOAP Body
        SOAPBody soapBody = envelope.getBody();
        SOAPElement soapBodyElem = soapBody.addChildElement("cancel", "can");
        SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("UUIDS", "can");
        SOAPElement soapBodyElem2 = soapBodyElem1.addChildElement("uuids", "apps");
        SOAPElement soapBodyElem3 = soapBodyElem2.addChildElement("string", "can1");
        soapBodyElem3.addTextNode("C719D560-A03D-4677-80AB-69CE6C6B18BB");
        SOAPElement soapBodyElem4 = soapBodyElem.addChildElement("username", "can");
        soapBodyElem4.addTextNode("cfd@swaplicado.com.mx");
        SOAPElement soapBodyElem5 = soapBodyElem.addChildElement("password", "can");
        soapBodyElem5.addTextNode("sWaP*2014!q5R7u9I2");
        SOAPElement soapBodyElem6 = soapBodyElem.addChildElement("taxpayer_id", "can");
        soapBodyElem6.addTextNode("AET131112RQ2");
        SOAPElement soapBodyElem7 = soapBodyElem.addChildElement("cer", "can");
        soapBodyElem7.addTextNode(encodedCer);
        SOAPElement soapBodyElem8 = soapBodyElem.addChildElement("key", "can");
        soapBodyElem8.addTextNode(encodedKey);

        MimeHeaders headers = soapMessage.getMimeHeaders();
        headers.addHeader("SOAPAction", serverURI + "can");

        soapMessage.saveChanges();

        /* Imprimir el Request */
        System.out.print("Request SOAP  : ");
        soapMessage.writeTo(System.out);
        System.out.println();

        return soapMessage;
    }

    /**
     * Método para imprimir el Response
     */
    private static void printSOAPResponse(SOAPMessage soapResponse) throws Exception {
        TransformerFactory transformerFactory = TransformerFactory.newInstance();
        Transformer transformer = transformerFactory.newTransformer();
        Source sourceContent = soapResponse.getSOAPPart().getContent();
        System.out.print("\nResponse SOAP : ");
        StreamResult result = new StreamResult(System.out);
        transformer.transform(sourceContent, result);
    }
}


text:
#include "Physical.h"
#include <iostream>

/*
TODO:
  - Add names to particles??

  - Forces and particles as a (doubly) linked list ????

  - Structs to Classes -- performance?? (ParticleFactory to Particle and
	  ParticleSystem objects)

  - Initial position functions -> (hollow solid) square, circle, triangle

  - Accept array of positions and velocites as parameters

  - Memory Management

  - Inverse square forces

  - Inheritance among forces

  - Additional step functions (1/2 step method etc)

  - Save data to file for MATLAB

  - Simplify parameters to be simple file, to be loaded and run

  - Add Colormap

*/

Physical::Physical(System s) {
  int i;
  ScreenWidth = 600;
  ScreenHeight = 600;

  thisTime = 0.0;
  lastTime = 0.0;
  deltaTime = 0.0;

  done = false;

  SDL_Init(SDL_INIT_EVERYTHING);
  SDL_ShowCursor(0);

  // Set up SDL Window to have an OpenGL 3.3 context

  SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK,
    SDL_GL_CONTEXT_PROFILE_CORE);
  SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
  SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
  window = SDL_CreateWindow("Physical, let's get it", SDL_WINDOWPOS_CENTERED,
    SDL_WINDOWPOS_CENTERED, ScreenWidth, ScreenHeight,
    SDL_WINDOW_OPENGL);

  screen = SDL_GetWindowSurface(window);

  // OpenGL

  // System Data
  this->system = s;
  // setupFor2();
  // setupFor100();
  // setupForSpringBox(10, 100000, 0.1, 0.1);
  // setupForFoldedSpringChain(5, 0.02, 100000, 1000, 0.02);

  // OpenGL Data
  glClearColor(0.0f, 0.5f, 1.0f, 1.0f);
  glPointSize(5);

  ParticleSystem *ps = system.getParticleSystem();

  float positions[ps->n*3];
  for (i = 0; i < ps->n*3; i++)
    positions[i] = ps->p[i/3]->x[i % 3];

  glGenVertexArrays(1, uiVAO);
  glGenBuffers(1, uiVBO);

  glBindVertexArray(uiVAO[0]);
  glBindBuffer(GL_ARRAY_BUFFER, uiVBO[0]);
  glBufferData(GL_ARRAY_BUFFER, sizeof(positions), positions, GL_STREAM_DRAW);
  glEnableVertexAttribArray(0);
  glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);

  // Shaders

  vertexShader.load("./Shaders/SimpleVertexShader.vertexshader",
    GL_VERTEX_SHADER);
  fragmentShader.load("./Shaders/SimpleFragmentShader.fragmentshader",
    GL_FRAGMENT_SHADER);

  program.createProgram();
  assert(program.addShader(&vertexShader) == true);
  assert(program.addShader(&fragmentShader) == true);
  assert(program.linkProgram() == true);
  program.useProgram();
}

Physical::~Physical() {
  SDL_Quit();
}

void Physical::MainLoop() {
  while (!done) {
    Poll();
    Update();
    Render();
  }
}

void Physical::Poll() {
    while (SDL_PollEvent(&event)) {
        if (event.type == SDL_QUIT)
            done = true;
        if (event.type == SDL_KEYDOWN)
            if (event.key.keysym.sym == SDLK_ESCAPE)
                done = true;
    }
}

void Physical::Update() {
  int i;

  // Calculate deltaTime
  lastTime = thisTime;
  thisTime = SDL_GetTicks();
  deltaTime = (thisTime - lastTime) / 100000.0;

  ParticleSystem *ps = system.getParticleSystem();

  // System step
  system.eulerStep(deltaTime);

  // Update OpenGL Data
  float positions[ps->n*3];
  for (i = 0; i < ps->n*3; i++)
      positions[i] = ps->p[i/3]->x[i % 3];

  glBindVertexArray(uiVAO[0]);
  glBindBuffer(GL_ARRAY_BUFFER, uiVBO[0]);
  glBufferData(GL_ARRAY_BUFFER, sizeof(positions), positions, GL_STATIC_DRAW);
  glEnableVertexAttribArray(0);
  glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
}

void Physical::Render() {
  // We just clear color
  glClear(GL_COLOR_BUFFER_BIT);

  glBindVertexArray(uiVAO[0]);
  glDrawArrays(GL_POINTS, 0, system.getParticleSystem()->n);

  SDL_GL_SwapWindow(window);
}