text:
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Rename;
using System.Text;

namespace DiacriticRemover
{
    [ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(DiacriticRemoverCodeFixProvider)), Shared]
    public class DiacriticRemoverCodeFixProvider : CodeFixProvider
    {
        private const string title = "Remove diacritics";

        public sealed override ImmutableArray<string> FixableDiagnosticIds
        {
            get { return ImmutableArray.Create(DiacriticRemoverAnalyzer.DiagnosticId); }
        }

        public sealed override FixAllProvider GetFixAllProvider()
        {
            return WellKnownFixAllProviders.BatchFixer;
        }

        public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
        {
            var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
            var diagnostic = context.Diagnostics.First();
            var diagnosticSpan = diagnostic.Location.SourceSpan;
            var node = root.FindNode(diagnosticSpan);

            context.RegisterCodeFix(
                CodeAction.Create(
                    title: title,
                    createChangedSolution: c => Rename(context.Document, node, c),
                    equivalenceKey: title),
                diagnostic);
        }

        private async Task<Solution> Rename(Document document, SyntaxNode node, CancellationToken cancellationToken)
        {
            var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
            var symbol = semanticModel.GetDeclaredSymbol(node, cancellationToken);
            var newName = CleanUpText(symbol.Name);

            var newSolution = await Renamer.RenameSymbolAsync(document.Project.Solution, symbol, newName, document.Project.Solution.Workspace.Options, cancellationToken).ConfigureAwait(false);
            return newSolution;
        }

        // stackoverflow http://stackoverflow.com/questions/1271567/how-do-i-replace-accents-german-in-net
        private static string CleanUpText(string germanText)
        {
            var map = new Dictionary<char, string>() {
              { 'ä', "ae" },
              { 'ö', "oe" },
              { 'ü', "ue" },
              { 'Ä', "Ae" },
              { 'Ö', "Oe" },
              { 'Ü', "Ue" },
              { 'ß', "ss" }
            };

            return germanText.ToCharArray().Aggregate(new StringBuilder(),
                          (sb, c) =>
                          {
                              if (map.TryGetValue(c, out string r))
                                  return sb.Append(r);
                              else
                                  return sb.Append(c);
                          }).ToString();
        }
    }
}


text:
/**
 * \file
 *         A brief description of what this file is.
 * \author
 *         Adam Dunkels <adam@sics.se>
 */

#ifndef UART1_H_
#define UART1_H_

#include "contiki.h"

#define UART1_BAUD2UBR(baud) ((MSP430_CPU_SPEED)/(baud))

void uart1_set_input(int (*input)(unsigned char c));
void uart1_writeb(unsigned char c);
void uart1_init(unsigned long ubr);
uint8_t uart1_active(void);

#endif /* UART1_H_ */

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
  <entry key="permission.denied.write.dir">Verzeichnis '{0}' muss beschreibbar sein!</entry>
  <entry key="site.is.down">Diese Seite wird gerade gewartet. Bitte versuche es in einigen Minuten noch einmal.</entry>
  <entry key="datasecurity.accept">Datenschutzbestimmungen akzeptieren</entry>
  <entry key="datasecurity.accept.thanks">Danke für das Akzeptieren der Datenschutzbestimmungen!</entry>
  <entry key="no.permission.for">Keine Berechtigung für '{0}'</entry>
  <entry key="mapping.not.found">'{0}' wurde nicht gefunden in churchtools.mapping!</entry>
  <entry key="fields.with.asterisk.has.to.be.filled">Felder mit * müssen ausgefüllt werden.</entry>
  <entry key="please.complete.this.field">Bitte das Feld ausfüllen!</entry>
  <entry key="please.enter.valid.email">Bitte eine gültige Email-Adresse angeben!</entry>
  <entry key="getting.help">Hilfe aufrufen</entry>

  <!-- HEADER -->
  <entry key="exit.simulation">Simulation beenden</entry>
  <entry key="change.password">Passwort ändern</entry>
  <entry key="set.password">Passwort einrichten</entry>
  <entry key="sent.messages">Gesendete Nachrichten</entry>
  <entry key="admin.settings">Admin Einstellungen</entry>
  <entry key="admin.permissions">Rechteverwaltung</entry>
  <entry key="start.cronjob">Geplante Aufgaben ausführen</entry>
  <entry key="logviewer">Log ansehen</entry>
  <entry key="about">Über</entry>
  <entry key="logout">Abmelden</entry>
  <entry key="change.to">Wechseln zu...</entry>
  <entry key="offline.mode.is.active">Achtung, Offline-Modus ist aktiv!</entry>
  <entry key="person">Person</entry>
  <entry key="persons">Personen</entry>
  <entry key="simulate.user">Benutzer simulieren</entry>
  <entry key="now.user.x.will.be.simulated">Ab sofort wird der Benutzer {0} simuliert. Um zum vorigen Benutzer zurückzukehren, bitte im Benutzer-Menü 'Simulieren beenden' anklicken.</entry>
  <entry key="simulate.information.text">Hiermith kann ein Administrator die Berechtigungen eines anderen Benutzer testen, in dem dieser simuliert wird.</entry>
  <entry key="name.of.person">Personenname eingeben</entry>
  <entry key="write.email.to.admin">Email an den Administrator schreiben</entry>

  <!-- HOME -->
  <entry key="there.are.more.users.with.the.same.email">Es sind mehrere Benutzer mit der gleichen Email-Adresse vorhanden. Diese können im Menü oben rechts gewechselt werden.</entry>
  <entry key="chose.your.possibilities">Was willst du tun?</entry>
  <entry key="open.help">Hilfe aufrufen</entry>
  <entry key="salutation">Anrede</entry>
  <entry key="name">Name</entry>
  <entry key="address">Adresse</entry>
  <entry key="age">Alter</entry>
  <entry key="birthday">Geburtsdatum</entry>
  <entry key="DOB">Geb.</entry>
  <entry key="contact.information">Kontaktinfos</entry>
  <entry key="mobile">Handy</entry>
  <entry key="page">Seite</entry>
  <entry key="general">Allgemein</entry>
  <entry key="note">Bemerkung</entry>

  <!-- AUTH -->
  <entry key="not.existent">Nicht vorhanden!</entry>
  <entry key="no.sufficient.permission">Keine ausreichende Berechtigung. Das Recht '{0}' ist notwendig.</entry>

  <!-- ABOUT -->
  <entry key="permissions">Berechtigungen</entry>
  <entry key="current.permissions">Aktuelle Berechtigungen</entry>
  <entry key="current.config">Aktuelle Konfiguration</entry>
  <entry key="consistence.check">Integritätsprüfung</entry>
  <entry key="churchtools.claim">ChurchTools bietet exzellente Software für CRM-Aufgaben im Gemeinde- und Vereinskontext.</entry>
  <entry key="read.more">Mehr Infos</entry>
  <entry key="logged.in.as">Angemeldet als {0}</entry>
  <entry key="current.db.consistence.check">Aktuelle Prüfung der Datenbankintegrität</entry>
  <entry key="found.no.problem">Kein Problem gefunden</entry>
  <entry key="found.problem.with.tables">Es gibt Problem(e) betreffend Tabelle(n) {0}.</entry>
  <entry key="detailed.report">Ausführlicher Bericht</entry>

  <!-- PROFILE -->
  <entry key="to.change.password.complete.following.fields">Zum Ändern des Passwortes bitte die folgenden Felder ausfüllen</entry>
  <entry key="old.password">Altes Passwort</entry>
  <entry key="new.password">Neues Passwort</entry>
  <entry key="repeat.new.password">Neues Passwort wiederholen</entry>
  <entry key="welcome">Herzlich willkommen!</entry>
  <entry key="to.login.later.set.own.password">Damit Du Dich weiterhin anmelden kannst, wähle ein sicheres Passwort und trage es in beide Felder ein:</entry>
  <entry key="password.does.not.match.the.previous">Die Passwörter stimmt nicht überein!</entry>
  <entry key="please.take.new.password">Das ist das alte Passwort. Bitte benutze ein neues!</entry>
  <entry key="password.is.incorrect">Das Passwort stimmt nicht.</entry>
  <entry key="password.changes.successfully">Das Passwort wurde erfolgreich geändert.</entry>
  <entry key="set.password">Passwort festlegen</entry>

  <!-- LOGIN -->
  <entry key="login.headline">Anmeldung</entry>
  <entry key="please.fill.following.fields">Bitte folgende Felder ausfüllen:</entry>
  <entry key="user">Benutzer</entry>
  <entry key="users">Benutzer</entry>
  <entry key="email.or.username">Email-Adresse oder Benutzername</entry>
  <entry key="password">Passwort</entry>
  <entry key="remember.me">Zukünftig an mich erinnern</entry>
  <entry key="remember.me.info">nur auf persönlichen Geräten setzen</entry>
  <entry key="login">Anmelden</entry>
  <entry key="email.or.username.unknown">Email-Adresse oder Benutzername ist nicht bekannt!</entry>
  <entry key="forgot.password">Passwort vergessen?</entry>
  <entry key="want.to.receive.new.password">Willst du wirklich neues Passwort anfordern?</entry>
  <entry key="wrong.password">Das Passwort ist nicht korrekt.</entry>
  <entry key="account.was.locked">Der Zugang wurde gesperrt!</entry>
  <entry key="account.was.locked.cause.of.to.many.trials">Der Zugang ist kurzzeitig gesperrt, da es zu viele fehlerhafte Anmeldeversuche gab! Bitte später noch einmal versuchen.</entry>

  <!-- MAIL -->
  <entry key="archive.of.sent.messages">Archiv der gesendeten Emails/SMS</entry>
  <entry key="filter">Filtern</entry>
  <entry key="back">Zurück</entry>
  <entry key="status">Status</entry>
  <entry key="date">Datum</entry>
  <entry key="time">Uhrzeit</entry>
  <entry key="receiver">Empfänger</entry>
  <entry key="sender">Sender</entry>
  <entry key="subject">Betreff</entry>
  <entry key="content">Inhalt</entry>
  <entry key="read">Gelesen</entry>
  <entry key="send">Senden</entry>
  <entry key="cancel">Abbruch</entry>
  <entry key="email.was.sent">Email wurde erfolgreich gesendet</entry>
  <entry key="email.not.found">Email-Adresse nicht vorhanden</entry>
  <entry key="following.persons.have.no.email.address">An folgende Personen konnte wegen fehlender Email-Adresse keine Email gesendet werden: </entry>

  <!--  GENERAL MENU ENTRIES -->
  <entry key="menu">Menü</entry>
  <entry key="back.to.main.menu">Zurück zum Hauptmenü</entry>
  <entry key="back.to.login">Zurück zur Anmeldung</entry>
  <entry key="settings">Einstellungen</entry>
  <entry key="maintain.masterdata">Stammdatenpflege</entry>
  <entry key="printview">Druckansicht</entry>
  <entry key="help">Hilfe</entry>
  <entry key="more">Weitere</entry>
  <entry key="more.information">Weitere Infos</entry>
  <entry key="show.all">Alle anzeigen</entry>
  <entry key="search">Suche</entry>

  <!-- ADMIN -->
  <entry key="settings.for">Einstellungen für {0}</entry>
  <entry key="site.name">Name der Website</entry>
  <entry key="site.logo">Logo der Website (max. 32x32px)</entry>
  <entry key="welcome.message">Willkommensnachricht</entry>
  <entry key="subtitle.welcome.message">Untertitel der Willkommensnachricht</entry>
  <entry key="welcome.message.before.login">Willkommensnachricht vor dem Login</entry>
  <entry key="text.of.invitation.email">Text der Einladungs-Email (max. 255 Zeichen!)</entry>
  <entry key="admin.message.on.home.and.login.pages.for.planned.downtimes">Admin-Nachricht auf Login- und Startseite, z.B. für geplante Downtimes</entry>
  <entry key="startpage.for.siteX.standard.is.y">Startseite beim Aufrufen von {0} (Standard ist {1}, möglich ist z.B. churchwiki, churchcal)</entry>
  <entry key="emailaddress.for.site.as.sender.for.emails">Email-Adresse der Website (Emails kommen von diesem Absender)</entry>
  <entry key="admin.emails.for.user.requests">Emailadressen der Admins für Anfragen von Benutzern (Kommasepariert)</entry>
  <entry key="name.for.moduleX.keep.empty.to.deactivate">Name for {0} (Feld leerlassen, um das Modul zu deaktivieren)</entry>
  <entry key="max.upload.size.in.kb">Maximale Upload-Dateigrösse in Kilobytes (z.B. 10000 = ca. 10MB)</entry>
  <entry key="time.in.seconds.beetwen.cronjobs.with.explanation">Zeit in Sekunden zwischen automatischen Cronjobs (0 = kein automatischer Cron, ein sinnvoller Wert ist z.B. 3600)</entry>
  <entry key="standard.timezone.like.europe.berlin">Standard-Zeitzone. Z.b. Europe/Berlin</entry>
  <entry key="show.remember.me.on.login.page">Anzeige von {0} auf der Login-Seite</entry>
  <entry key="enable.sending.emails">Senden von Emails aktivieren</entry>
  <entry key="disable.site">Seite offline schalten</entry>
  <entry key="admin.settings.info.text">Hier kannst du Systemeinstellungen vornehmen. Diese gelten für alle Benutzer, bitte vorsichtig anpassen!</entry>

  <!-- MODULES -->
  <entry key="service">Dienst</entry>
  <entry key="birthdays">Geburtstage</entry>
  <entry key="more.birthdays">Weitere Geburtstage</entry>
  <entry key="list.of.members">Mitgliederliste</entry>
  <entry key="yesterday">Gestern</entry>
  <entry key="today">Heute</entry>
  <entry key="tomorrow">Morgen</entry>
  <entry key="confirm">Zusagen</entry>
  <entry key="confirmed.on">Zugesagt am {0}</entry>
  <entry key="deny">Absagen</entry>
  <entry key="perhaps">Vielleicht</entry>
  <entry key="thank.you.for.confirmation">Danke für die Zusage.</entry>
  <entry key="undo.my.confirmation">Zusage widerrufen</entry>
  <entry key="service.was.denied">Der Dienst wurde abgesagt.</entry>
  <entry key="undo.my.denial">Absage widerrufen</entry>
  <entry key="entry.message.here">Hier Nachricht eingeben...</entry>
  <entry key="request.from">Anfrage von</entry>
  <entry key="confirm.with.reservation">Zusage mit Vorbehalt!</entry>
  <entry key="great.no.request.pending.anymore">Super, es ist keine Anfrage mehr offen!</entry>
  <entry key="you.have.denied.the.request">Du hast die Anfrage abgesagt.</entry>
  <entry key="your.confirmation.in.reservation.was.saved">Deine vorläufige Zusage wurde gespeichert.</entry>
  <entry key="mr.">Herr</entry>
  <entry key="mrs.">Frau</entry>
  <entry key="who.is.online">Wer ist online?</entry>
  <entry key="no.entry.found">Keinen Eintrag gefunden.</entry>
  <entry key="manage.my.membership">Meine Teilnahme verwalten</entry>
  <entry key="todos.in">Aufgaben in {0}</entry>
  <entry key="apply.for.group.membership">Hier kannst Du eine Teilnahme beantragen</entry>
  <entry key="quit.group.membership">Hier kannst Du eine Teilnahme beenden</entry>
  <entry key="error.requesting.group.membership">Gruppenteilnahme konnte nicht beantragt werden.</entry>
  <entry key="last.x.days">In den letzten {0} Tagen</entry>
  <entry key="next.x.days">In den nächsten {0} Tagen</entry>
  <entry key="your.pending.service.requests">Deine offenen Dienstanfragen</entry>
  <entry key="your.next.services">Deine nächsten Dienste</entry>
  <entry key="your.current.event.staff">Deine aktuelle Eventbesetzung</entry>
  <entry key="absence.of.next.x.days">Abwesenheiten der nächsten {0} Tage</entry>
  <entry key="facts.of.last.days">Fakten der letzten Tage</entry>
  <entry key="your.open.meeting.requests">Deine offenen Terminanfragen</entry>
  <entry key="your.next.meetings">Deine nächsten Termine</entry>
  <entry key="pending.booking.requests">Offene Buchungsanfragen</entry>
  <entry key="current.bookings">Aktuelle Buchungen</entry>

  <!-- 17.7.2014 -->
  <entry key="reload">Neu laden</entry>
  <entry key="session.expired.please.login">Session ist abgelaufen, bitte neu anmelden!</entry>
  <entry key="more.filter">Weitere Filter</entry>
  <entry key="filter.functions">Filterfunktionen</entry>
  <entry key="administration">Admin Einstellungen</entry>
  <entry key="administrator">Administrator</entry>
  <entry key="thank.you">Vielen Dank!</entry>
  <entry key="group">Gruppe</entry>
  <entry key="groups">Gruppen</entry>
  <entry key="none.selected">keine ausgewählt</entry>
  <entry key="all.selected">alle ausgewählt</entry>
  <entry key="select.all">Alle auswählen</entry>
  <entry key="deselect.all">Alle abwählen</entry>
  <entry key="selected">markierte</entry>
  <entry key="chosen">ausgewählt</entry>
  <entry key="masterdata">Stammdaten</entry>
  <entry key="list.of.masterdata">Stammdaten</entry>
  <entry key="row.count">Anzahl Zeilen</entry>
  <entry key="show">zeige</entry>
  <entry key="show.x.entries">Zeige {0} gefundene Einträge</entry>
  <entry key="show.x.from.y.entries">Zeige {0} von {1} Einträgen</entry>
  <entry key="paging">Blättern</entry>
  <entry key="number.of.rows">Einträge je Seite</entry>
  <entry key="open.all">alle öffnen</entry>
  <entry key="close.all">alle schließen</entry>
  <entry key="add">Hinzufügen</entry>
  <entry key="add.new.request">Neue Anfrage erstellen</entry>
  <entry key="add.new.person">Neue Person anlegen</entry>
  <entry key="add.new.entry">Neuen Eintrag erstellen</entry>
  <entry key="copy">Kopieren</entry>
  <entry key="delete">Löschen</entry>
  <entry key="all">Alle</entry>
  <entry key="important.from">Wichtige Einträge von {0}</entry>
  <entry key="news.from">Neuigkeiten von {0}</entry>
  <entry key="to.the.top">Nach oben</entry>
  <entry key="main.page">Hauptseite</entry>
  <entry key="upload.file">Datei hochladen</entry>
  <entry key="drop.file.for.uploading.here">Hier Dateien zum Hochladen fallen lassen</entry>
  <entry key="error.occured">Fehler aufgetreten</entry>
  <entry key="create">Erstellen</entry>
  <entry key="resource">Ressource</entry>
  <entry key="resources">Ressourcen</entry>
  <entry key="embed">{0} einbetten</entry>
  <entry key="subscribe.to.ical">abonnieren iCal</entry>
  <entry key="caption">Titel</entry>
  <entry key="description">Beschreibung</entry>
  <entry key="location">Ort</entry>
  <entry key="save">Speichern</entry>
  <entry key="save.data">Speichere Daten...</entry>
  <entry key="load.data">Lade Daten...</entry>
  <entry key="saved">gespeichert</entry>
  <entry key="no.changes">Keine Änderungen vorhanden</entry>
  <entry key="save.changes">Änderungen speichern</entry>
  <entry key="undo.changes">Änderungen verwerfen</entry>
  <entry key="edit.permissions">Berechtigungen anpassen</entry>
  <entry key="copy.permissions">Berechtigungen kopieren</entry>
  <entry key="paste.permissions">Berechtigungen einsetzen</entry>
  <entry key="please.first.save.or.undo.current.changes">Bitte erst die aktuellen Anpassungen Speichern oder verwerfen!</entry>
  <entry key="really.past.permissions">Sollen die Berechtigungen wirklich hier hinzugefügt werden? Vorhandene Berechtigungen werden dadurch nicht geändert.</entry> <!-- unklare Bedeutung, vorhandene werden evtl. überschrieben, der Rest bleibt wie es ist? -->
  <entry key="only.show.user.with.permissions">nur autorisierte zeigen</entry>
  <entry key="creator">Ersteller</entry>
  <entry key="change.of.dataset">Änderungen im Datensatz</entry>
  <entry key="personal.calendar">Persönlicher Kalender</entry>
  <entry key="group.calendar">Gruppenkalender</entry>
  <entry key="first.day.in.week">Erster Tag der Woche (0=Sonntag, 1=Montag, 2=Dienstag, ..)</entry>
  <entry key="by.order.of">Im Auftrag von</entry>
  <entry key="updated">aktualisiert</entry>
  <entry key="deleted">gelöscht</entry>
  <entry key="january">Januar</entry>
  <entry key="february">Februar</entry>
  <entry key="march">März</entry>
  <entry key="april">April</entry>
  <entry key="mai">Mai</entry>
  <entry key="june">Juni</entry>
  <entry key="july">Juli</entry>
  <entry key="august">August</entry>
  <entry key="september">September</entry>
  <entry key="october">Oktober</entry>
  <entry key="november">November</entry>
  <entry key="december">Dezember</entry>

  <entry key="minutes">Minuten</entry>
  <entry key="hour">Stunde</entry>
  <entry key="hours">Stunden</entry>
  <entry key="day">Tag</entry>

  <entry key="start.date">Startzeit</entry>
  <entry key="end.date">Endzeit</entry>
  <entry key="repeats">Wiederholungen</entry>
  <entry key="all.day">Ganztägig</entry>
  <entry key="from">Von</entry>
  <entry key="until">Bis</entry>
  <entry key="reason">Grund</entry>
  <entry key="comment">Kommentar</entry>
  <entry key="comments">Kommentare</entry>
  <entry key="please.comment">Kommentar hinzufügen</entry>
  <entry key="change">wechseln</entry>
  <entry key="rename">Umbenennen</entry>
  <entry key="download">Herunterladen</entry>
  <entry key="sum">Summe</entry>
  <entry key="id">ID</entry>
  <entry key="sortkey">Sortierung</entry>
  <entry key="bezeichnung">Bezeichnung</entry> <!-- not used -->
  <entry key="really.delete.dataset.x.be.careful">SOll der Datensatz {0} wirklich gelöscht werden? Bitte sicherstellen, dass keine Daten mehr auf diesen Datensatz verweisen, sonst kann es zu Problemen kommen!</entry>
  <entry key="really.delete.file">Soll die Datei wirklich gelöscht werden?</entry>
  <entry key="send.bcc.copy.to.myself">eine BCC-Kopie an mich senden.</entry>
  <entry key="send.email.to.x">Email an {0} senden</entry>
  <entry key="caution.that.email.will.be.send.to.x.persons">Soll wirklich eine Email an {0} Empfänger gesendet werden?</entry>
  <entry key="please.fillin.name">Bitte Namen angeben</entry> <!-- not used -->
  <entry key="looking.for.visible.persons.in.all.your.departments">Gesucht wird nach den für Dich sichtbaren Personen sowie allen Personen aus Deinen Bereichen.</entry>
  <entry key="looking.for.a.person">Auswahl einer Person</entry> <!-- look or select? -->
  <entry key="public.user">Öffentlicher Benutzer</entry>
  <entry key="important.logs">Wichtige Meldungen</entry>
  <entry key="last.accesses">Letzte Zugriffe</entry>
  <entry key="top.accesses">Häufigste Zugriffe</entry>
  <entry key="show.more.rows">Mehr Zeilen anzeigen</entry>
  <entry key="count.accesses">Anzahl Zugriffe</entry>
  <entry key="cronjob.succeed">Cron-Job ausgeführt!</entry>

  <!-- 2014-07-23 -->
  <entry key="query">Abfrage</entry>
  <entry key="report">Bericht</entry>
  <entry key="select.language">Sprache auswählen</entry>
  <entry key="please.select.your.language">Bitte wähle Deine Sprache</entry>
  <entry key="close">Schliessen</entry>

  <!-- file upload -->
  <entry key="uploaddircetdory.not.writable">Serverfehler: Das upload Verzeichnis ist nicht beschreibbar.</entry>
  <entry key="no.uploaded.files">Es wurden keine Dateien hochgeladen.</entry>
  <entry key="file.is.empty">Die Datei ist leer.</entry>
  <entry key="file.is.to.large">Die Datei ist zu groß.</entry>
  <entry key="invalid.fileextension.should.be.one.of.this">Die Datei hat eine ungültige Erweiterung. Erlaubt sind folgende: {0}'</entry>
  <entry key="could.not.save.file.upload.canceled.or.server.error">Die hochgeladene Datei konnte nicht gespeichert werden (das Hochladen wurde abgebrochen oder es trat ein Serverfehler auf).</entry>

  <!-- churchdb -->
  <entry key="request.to.group">Anfrage zur Gruppe {0}</entry>
  <entry key="surname">Vorname</entry>
  <entry key="name">Name</entry>
  <entry key="email">Email</entry>
  <entry key="phone">Telefon</entry>
  <entry key="comment">Kommentar</entry>
  <entry key="form.request.to.group">Formular-Anfrage zur Gruppe {0}</entry>
  <entry key="could.not.find.group.leader.please.try.other.ways">Leider konnte kein Gruppenleiter gefunden werden. Bitte versuchen Sie es auf einem anderen Weg!</entry>
  <entry key="email.send.to">Es wurde eine Email an {0} gesendet!</entry>
  <entry key="unknown.call">Unbekannter Aufruf: {0}</entry>
  <entry key="hello">Hallo!</entry>
  <entry key="hello.name">Hallo {0}!</entry>
  <entry key="request.by.external.mapview">Anfrage über externe MapView</entry>
  <entry key="request.changed.by.external.mapview">Anfrage über externe MapView</entry>
  <entry key="person.found.and.request.sent">Person wurde gefunden und Anfrage gesendet!</entry>
  <entry key="request.by.form">Anfrage über Formular</entry>
  <entry key="request.quit.membership.by.form">Austritt beantragt über Formular</entry>
  <entry key="membership.requested.by.form.leader.will.be.informed">Die Teilnahme an {0} ist nun beantragt, der Leiter wird informiert. Vielen Dank!</entry>
  <entry key="membership.marked.for.deleting">Die Teilnahme an {0} wurde zum Löschen markiert.</entry>
  <entry key="error.quitting.membership">Gruppenteilnahme konnte nicht beendet werden.</entry>
  <entry key="username.not.available.ask.admin">Der Username {0} ist schon vergeben, bitte wende Dich an den Administrator!</entry> <!-- TODO:lieber "wähle einen anderen" statt fragen? -->
  <entry key="id.not.defined">Es wurde keine ID angegeben!</entry>
  <entry key="username.not.defined">Es wurde kein Benutzername angegeben!</entry>
  <entry key="id.x.or.username.y.not.defined">ID {0} oder Benutzername {1} wurde nicht angegeben!</entry>
  <entry key="person.already.has.an.username.ask.admin">Diese Person hat schon einen Usernamen! Bitte wende Dich an einen Administrator!</entry>
  <entry key="invitation.email.standard.text">Du wurdest zur Nutzung von {0} eingeladen.<p>Klicke auf die folgende Schaltfläche, um Dich direkt dort anzumelden und um Dein Passwort zu wählen:</p></entry>
  <entry key="no.sms.sent.person.has.no.mobile.number">Keine SMS gesendet, für die Person ist keine Handynummer gespeichert!</entry>
  <entry key="email.already.used.you.need.more.rights.to.change.this">Die Email-Adresse ist schon vergeben. Um eine vergebene Email-Adresse zu setzen werden mehr Rechte gebraucht.</entry>
  <entry key="template.x.not.found">Die Vorlage '{0}' wurde nicht gefunden!</entry>
  <entry key="show.more.rows">Mehr Zeilen anzeigen</entry>
  <entry key="salutation.man.1">Herrn</entry>
  <entry key="salutation.man.2">Lieber</entry>
  <entry key="salutation.woman.1">Frau</entry>
  <entry key="salutation.woman.2">Liebe</entry>
  <entry key="in.group.x">In Gruppe {0}</entry>
  <entry key="membership.request.to.group.x">Teilnahmeantrag zur Gruppe {0}</entry>
  <entry key="change.in.group.x">Änderung in Gruppe {0}</entry>
  <entry key="new.persons.in.your.groups">Neue Personen in Deinen Gruppen</entry>
  <entry key="please.look.at.this.persons">Folgende Personen bitte einmal anschauen</entry>
  <entry key="birthdays.of.your.persons.in.next.31.days">Geburtstage Deiner Leute in den nächsten 31 Tagen</entry>
  <entry key="new.comments.to.your.persons">Neue Kommentare zu Deinen Leuten</entry>
  <entry key="personal.information.for.x">Persönliche Infos für {0}</entry>
  <entry key="station">Station</entry>
  <entry key="department">Bereich</entry>

  <!-- churchservice -->
  <entry key="no.rights.to.add.or.remove.service">Not enough rights in addOrRemoveServiceToEvent: </entry> <!-- needed? -->
  <entry key="surname.name.has.confirmed.service.x.on.date.event">{0} {1} hat den Dienst {2} für die Veranstaltung {4} am {3} zugesagt.</entry>
  <entry key="surname.name.has.confirmed.request">{0} {1} hat eine Anfrage zugesagt</entry>
  <entry key="surname.name.has.proposed.x.for.service.y.on.date.event">{0} {1} hat für den Dienst {3} für die Veranstaltung {5} am {4} {2} vorgeschlagen.</entry>
  <entry key="surname.name.has.proposed.someone">{0} {1} hat jemanden vorgeschlagen</entry>
  <entry key="surname.name.has.canceled.service.x.on.date.event">{0} {1} hat den Dienst {2} für die Veranstaltung {4} am {3} abgesagt.</entry>
  <entry key="surname.name.has.canceled.request">{0} {1} hat eine Anfrage abgesagt</entry>
  <entry key="please.specify.id">Bitte ID angeben.</entry>
  <entry key="file.not.found.in.DB">Datei nicht in der Datenbank gefunden!</entry>
  <entry key="file.could.not.be.copied.to.x">Datei konnte nicht nach '{0}' kopiert werden!</entry>
  <entry key="pending.service.requests">Offene Dienstanfragen: </entry>
  <entry key="there.are.pending.services">Es sind noch Dienste offen</entry>
  <entry key="open.services">Offene Dienste</entry>

  <!-- churchcore auth -->
  <entry key="edit.masterdata">Stammdaten editieren</entry>

  <!-- churchservice auth -->
  <entry key="view.servicegroup.churchservice.cs_servicegroup">Dienste einzelner Service-Gruppe einsehen</entry>
  <entry key="edit.servicegroup.churchservice.cs_servicegroup">Dienste einzelner Service-Gruppe editieren</entry>
  <entry key="view.history.churchservice">Historie der Anfragen anschauen</entry>
  <entry key="edit.events.churchservice">Events erstellen, bearbeiten, löschen</entry>
  <entry key="edit.template.churchservice">Event-Vorlagen editieren</entry>
  <entry key="manage.absent.churchservice">Abwesenheiten für alle Personen einsehen und pflegen</entry>
  <entry key="view.facts.churchservice">Fakten sehen</entry>
  <entry key="edit.facts.churchservice">Fakten editieren</entry>
  <entry key="export.facts.churchservice">Fakten exportieren</entry>
  <entry key="view.agenda.churchservice.cc_calcategory">Ablaufpläne für einzelne Kalender sehen</entry>
  <entry key="edit.agenda.churchservice.cc_calcategory">Ablaufpläne für einzelne Kalender editieren</entry>
  <entry key="edit.agenda.templates.churchservice.cc_calcategory">Ablaufplan-Vorlagen für einzelne Kalender editieren</entry>
  <entry key="view.songcategory.churchservice.cs_songcategory">Einzelne Song-Kategorien einsehen</entry>
  <entry key="view.song.churchservice">Songs anschauen und Dateien herunterladen</entry>
  <entry key="edit.song.churchservice">Songs editieren und Dateien hochladen</entry>
  <entry key="edit.masterdata.churchservice">Stammdaten von ChurchService editieren</entry>
  <entry key="no.permisson.to.export.facts">Keine Berechtigung zum Exportieren von Faktendaten (edit facts)</entry>

  <!-- churchdb auth -->
  <entry key="view.birthdaylist">Geburtagsliste einsehen</entry>
  <entry key="view.memberliste">Mitgliederliste einsehen</entry>
  <entry key="view.statistics">Gesamtstatistik einsehen</entry>
  <entry key="view.tags">Tags einsehen</entry>
  <entry key="view.history">Historie eines Datensatzes ansehen</entry>
  <entry key="view.comments">Kommentare einsehen</entry>
  <entry key="view.address">Zusätzlich Adressdaten der sichtbaren Personen einsehen (Strasse)</entry>
  <entry key="view.alldetails">Alle Informationen der sichtbaren Person sehen, inkl. Adressdaten, Gruppenzuordnung, etc.</entry>
  <entry key="view.archive">Personen-Archiv einsehen</entry>
  <entry key="use.complex.filters">'Weitere Filter' darf verwendet werden</entry>
  <entry key="archivate.persons">Personen ins Archiv verschieben und zurückholen</entry>
  <entry key="edit.relations">Beziehungen der sichtbaren Personen editieren</entry>
  <entry key="edit.groups">Alle Gruppenzuordnungen der sichtbaren Personen editieren</entry>
  <entry key="create.persons">Darf Personen erstellen</entry>
  <entry key="create.persons.without.agreement">Darf Personen auch ohne Einverständnis erstellen.</entry>
  <entry key="write.access.persons">Schreibzugriff auf alle sichtbaren Personen</entry>
  <entry key="view.alldata">Alle Personen des jeweiligen Bereiches sichtbar machen</entry>
  <entry key="send.sms">SMS-Schnittstelle verwenden</entry>
  <entry key="export.data">Die Daten aller(!) Personen exportieren</entry>
  <entry key="view.group">Einzelne Gruppen einsehen - inklusive versteckte Gruppen</entry>
  <entry key="view.group.statistics">Gruppenstatistik aller Gruppen einsehen</entry>
  <entry key="administer.groups">Gruppen administrieren, d.h. erstellen, löschen, etc.</entry>

  <!-- churchresource -->
  <entry key="view.x">{0} sehen</entry> <!-- TODO: use it for all similar texts -->
  <entry key="create.own.bookings">Eigene Buchungsanfragen erstellen</entry>
  <entry key="create.virtual.bookings">Eigene virtuelle Buchungsanfragen erstellen</entry>
  <entry key="administer.bookings">Alle Anfragen editieren, ablehnen, etc.</entry>
  <entry key="assistant.mode">Im Auftrag eines anderen Buchungen durchführen</entry>
  <entry key="here.are.all.ressources.listed">Hier sind alle Buchungsinformationen zusammengefasst</entry>
  <entry key="purpose">Zweck</entry>
  <entry key="start">Beginn</entry>
  <entry key="end">Ende</entry>
  <entry key="repeat.type">Wiederholungstyp</entry>
  <entry key="repeat.to">Wiederholung bis</entry>
  <entry key="conflicts">Konflikte</entry>
  <entry key="exceptions">Ausnahmen</entry>
  <entry key="additions">Weitere Termine</entry>
  <entry key="new.booking.request">Neue Buchungsanfrage</entry>
  <entry key="updated.booking.request">Aktualisierung der Buchungsanfrage</entry>
  <entry key="bookingX.for.resource.on.datetime">'{1}' für {0}, Start: {2}, Notiz:{3}</entry>
  <entry key="booking.in"> in {0}</entry>
  <entry key="user.was.deleted">Der Benutzer wurde gelöscht.</entry>
  <entry key="booking.request.updated">Buchungsanfrage bearbeitet</entry>
  <entry key="booking.request.approved">Buchungsanfrage bestätigt</entry>
  <entry key="booking.request.canceled">Buchungsanfrage abgelehnt</entry>
  <entry key="booking.request.deleted">Buchungsanfrage gelöscht</entry>
  <entry key="booking.deleted">Buchung wurde gelöscht</entry>
  <entry key="booking.before">Vorlauf</entry>
  <entry key="booking.after">Nachlauf</entry>

  <!-- churchwiki -->
  <entry key="view.wiki.category">Einzelne Wiki-Kategorien sehen</entry>
  <entry key="edit.wiki.category">Einzelne Wiki-Kategorien editieren</entry>
  <entry key="edit.help.entry">Editieren eines Hilfeeintrages</entry>
  <entry key="edit.help.entry.subtitle">Hier kann die Hilfe editiert werden.</entry>

  <!-- login -->
  <entry key="new.password.requested.for.x.is.y">Für die Email-Adresse {0} wurde ein neues Passwort angefordert: {1}</entry>
  <entry key="email.unknown">Die Email-Adresse ist nicht bekannt!</entry>
  <entry key="login.string.too.old">Fehler: Der verwendete Login-Link ist nicht mehr aktuell und kann deshalb nicht mehr verwendet werden. Bitte mit Email-Adresse oder Nutzername und Passwort anmelden!</entry>
  <entry key="login.error.no.id.given">Fehler beim Login, keine Nutzer-Id vorhanden!</entry>
  <entry key="login.error.longtext">Bitte eine gültige Email-Adresse angeben, an die das neue Passwort gesendet werden kann! Diese Adresse muss im System schon eingerichtet sein. <p>Falls die Email-Adresse schon eingerichtet ist, wende Dich bitte an {0}.</entry>
  <entry key="new.password.was.sent.to.x">Hinweis: Ein neues Passwort wurde an {0} gesendet.</entry>
  <entry key="user.succesfully.changed.now.you.work.with.permissions.of.x">Der Benutzer wurde erfolgreich gewechselt! Du arbeitest nun mit der Berechtigung von {0}.</entry>
  <entry key="user.change.to.familyX.failed.session.is.empty">Das Wechseln zu Id {0} hat nicht funktioniert, Session ist leer!</entry>
  <entry key="you.are.logged.in.as.x.click.y.to.continue">Du bist angemeldet als {0}, hier geht es weiter: {1}</entry>

  <!-- forms -->
  <entry key="again.please">Nochmal bitte...</entry> <!-- unnötig? -->

  <!-- Admin preferences TODO: needed for js -->
  <entry key="add.to.menu">{0} im Menu aufführen</entry>
  <entry key="show.as.button.on.home">{0} auf der Startseite als Button anzeigen</entry>
  <entry key="sortorder.in.menu">Sortiernummer im Menu (sortcode)</entry>
  <entry key="data.from.x.how.many.days.in.the.past.to.load">Für wieviel Tage zurück sollen Daten in {0} geladen werden?</entry>
  <!-- Admin preferences member list -->
  <entry key="preferences.for.memberlist">Einstellungen für die Mitgliederliste</entry>
  <entry key="admin.could.change.preferences.here">Welche Daten sollen ausgegeben werden?</entry>
  <!-- Admin preferences churchcal -->
  <entry key="name.of.main.calendar">Name des Hauptkalenders</entry>
  <entry key="css.for.embedded.cal">CSS für das Einbetten des Kalenders</entry>
  <!-- Admin preferences churchdb -->
  <entry key="max.allowed.rows.to.export">Wieviel Datensätze dürfen maximal exportiert werden?</entry>
  <entry key="center.coordinates.latitude">Latitude des Koordinaten-Mittelpunkts (am besten durch Google Maps herauszufinden)</entry>
  <entry key="center.coordinates.longitude">Longitude des Koordination-Mittelpunkts  (am besten durch Google Maps herauszufinden)</entry>
  <entry key="email.default.separator">Standardtrennzeichen für mehrere Empfänger beim ChurchDB-Emailer</entry>
  <entry key="days.to.show.terminated.groups">Wie viele Tage nach dem Abschlussdatum soll die Gruppe noch unter Meine Gruppen präsent sein?</entry>
  <entry key="xxx.ids.for.birthdaylist.comma.separated">{0}-Ids für die Geburtstagsliste (kommasepariert)</entry>
  <entry key="api.key.mailchimp.if.used">API-Key von Mailchimp.com (nur angeben, wenn die Integration von MailChimp.com genutzt werden soll).</entry>
  <entry key="api.key.smspromote.if.used">API-Key von SMSpromote.de (nur angeben, wenn die Integration von smspromote.de genutzt werden soll).</entry>
  <entry key="send.groupchanges.to.leaders">Sende Änderungen in Gruppen an Leiter, Co-Leiter und Supervisore</entry>
  <entry key="user.is.allowed.to.change.own.address">Jeder Benutzer darf seine eigenen Stammdaten anpassen</entry>
  <entry key="delete.history.when.moving.to.archive">Lösche die Personen-Historie wenn eine Person in das Archiv verschoben wird</entry>

  <!-- Admin preferences churchservice -->
  <entry key="after.how.many.days.service.requests.should.be.repeated">Nach wieviel Tagen soll die Email mit der Dienstanfrage erneute gesendet werden, wenn noch nicht zugesagt oder abgelehnt wurde?</entry>
  <entry key="how.many.hours.before.service.send.remember.email">Wieviele Stunden vor einem Dienst soll die Erinnerung daran erfolgen?</entry>
  <entry key="use.category.as.folder.for.beamersoftware.export">Die Songkategorie soll beim Export für Beamersoftware als Verzeichnis benutzt werden.</entry>

  <!-- Admin preferences churchresource -->

  <!-- home -->
  <entry key="home">Startseite</entry>
  <entry key="directory.x.has.to.be.writable">Das Verzeichnis '{0}' muss beschreibbar sein. Bitte passe die Dateiberechtigungen an!</entry>
  <entry key="welcome.back.x">Willkommen zurück, {0}!</entry>
  <entry key="message.from.x">Nachricht von {0}</entry>
  <entry key="error.config.file.not.found">Fehler: Konfigurationsdatei nicht gefunden</entry>
  <entry key="show.fon.number">Anzeige der privaten Telefonnummer</entry>
  <entry key="show.business.fon.number">Anzeige der geschäftlichen Telefonnummer</entry>
  <entry key="show.mobile.number">Anzeige der mobilen Telefonnummer</entry>
  <entry key="show.fax.number">Anzeige der Faxnummer</entry>
  <entry key="show.email">Anzeige der Email-Adresse</entry>
  <entry key="show.complete.birthday.including.year">Anzeige des Geburtsdatums inkl. Geburtsjahr</entry>

  <!-- core db -->
  <entry key="previously">vorher</entry>
  <entry key="logout.successful">Logout erfolgreich</entry>

  <!-- churchcal -->
  <entry key="meeting.requests">Terminanfragen</entry>
  <entry key="new.meeting.request">Neue Terminanfrage</entry>
  <entry key="no.create.right.for.cal.id.x">Du hast kein Recht zum Erstellen von Terminen im Kalender mit der Id {0}</entry>
  <entry key="no.agenda.found.for.event">Der Ablaufplan für die Veranstaltung {0} wurde nicht gefunden!</entry>
  <entry key="x.not.found">{0} ist nicht vorhanden!</entry> <!-- TODO: let all sorts of not found errors use this -->
  <entry key="item">Position</entry>
  <entry key="agenda">Ablaufplan</entry>
  <entry key="event">Event</entry> <!-- maybe its better to use Veranstaltung for events -->
  <entry key="event.could.not.be.copied">Die Veranstaltung in {0} konnte nicht kopiert werden!</entry>
  <entry key="template.can.not.be.added.to.existing.service">Zu einem bestehenden Service kann keine Vorlage hinzugefügt werden!</entry>
  <entry key="remove.event">Entferne Event!</entry>
  <entry key="cancelation.of.event.date">Absage von {0} am {1}</entry>
  <entry key="thank.you.for.feedback">Danke für deine Rückmeldung!</entry>
  <entry key="category">Kalender</entry>
  <entry key="information.for.your.event">Informationen zu deinem Event</entry>
  <entry key="link">Link</entry>
  <entry key="only.intern.visible">Nur für angemeldete Personen sichtbar</entry>
  <entry key="modified.date">Letzte Änderung</entry>
  <entry key="meeting.requests.made.by.you">Deine erstellten Besprechungsanfragen</entry>
  <entry key="upcoming.dates.of.your.group.calendars">Anstehende Termine aus Deinen Gruppenkalendern</entry>

  <!-- churchcal auth -->
  <entry key="view.single.calendar">Einzelnen Kalender sehen</entry>
  <entry key="edit.single.calendar">In einzelnen Kalendern Termine erstellen, editieren etc.</entry>
  <entry key="create.group.calendar">Gruppenkalender erstellen</entry>
  <entry key="administer.group.calendar">Gruppenkalender administrieren</entry>
  <entry key="administer.church.calendar">Gemeindekalender administrieren</entry>
  <entry key="manual.event.not.found">Manuellen Termin '{0}' nicht gefunden!</entry>
  <entry key="event.not.found">Termin '{0}' nicht gefunden!</entry>
  <entry key="category.does.not.exist">Kategorie nicht vorhanden</entry>
  <entry key="deleting.failed.because.of.remaining.services">Es sind noch Dienste mit dem Kalender verbunden. Kann ihn deshalb nicht entfernen!</entry>

  <!-- COMMON -->
  <entry key="template.x.not.found">Die Vorlage '{0}' wurde nicht gefunden!</entry>
  <entry key="news.for.abo.x">Neuigkeiten in {0}</entry>
  <entry key="reminder.for.x">Erinnerung an {0}</entry>
  <entry key="new">Neu</entry>
  <entry key="yes">Ja</entry>
  <entry key="no">Nein</entry>

</properties>


text:
define(function fc() {

  // Registry of subscribers
  var registry = {
    // event: [
    //   {
    //     callback: ...,
    //     context: ...
    //   },
    //   ...
    // ],
  };

  var on = function on(event, callback, context) {
    var binding = {
      callback: callback,
      context: context
    };
    var subscribers = registry[event] = registry[event] || [];
    subscribers.push(binding);
    return binding;
  };

  var off = function off(event, callback, context) {
    if (event && !callback && !context) {
      delete registry[event];
    } else if (callback || context) {
      var subscribers;
      if (event) {
        subscribers = {};
        subscribers[event] = registry[event]
      } else {
        subscribers = registry;
      }
      for (var key in subscribers) {
        if (subscribers.hasOwnProperty(key)) {
          var bindings = subscribers[key];
          for (var i = 0; i < bindings.length; i++) {
            var binding = bindings[i];
            var matchingCallback = callback && binding.callback === callback;
            var matchingContext = context && binding.callback === callback;
            if (
              (matchingCallback && matchingContext) ||
              (!callback && matchingContext) ||
              (!context && matchingCallback)
            ) {
              bindings.splice(i, 1);
            }
          }
          if (binding.length === 0) {
            delete subscribers[key];
          }
        }
      }
    }
  };

  var trigger = function trigger(event) {

    var args = Array.prototype.slice.call(arguments, 1);

    var subscribers = registry[event];

    if (subscribers !== undefined) {
      for (var i = 0; i < subscribers.length; i++) {
        var binding = subscribers[i];
        if (binding.context !== undefined) {
          binding.callback.call(binding.context, args);
        } else {
          binding.callback(args);
        }
      }
    }

    return event;
  };

  return {
    on: on,
    off: off,
    trigger: trigger,
    registry: registry
  };
});


text:
package com.juliaaano.payload.json;

import com.juliaaano.payload.provider.sourcing.PrioritizedProviderFactorySource;
import com.juliaaano.payload.provider.sourcing.ProviderFactorySource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

import static java.util.Collections.unmodifiableMap;

public class JsonPrioritizedProviderFactorySource<T extends JsonProviderFactory> extends PrioritizedProviderFactorySource<T> {

    private static final Logger log = LoggerFactory.getLogger(JsonPrioritizedProviderFactorySource.class);

    private static final Map<String, Class<?>> PROVIDER_FACTORIES;

    static {

        final HashMap<String, Class<? extends JsonProviderFactory>> providerFactories = new HashMap<>();

        providerFactories.put("GSON", Gson.class);
        providerFactories.put("JACKSONJSON", JacksonJson.class);
        providerFactories.put("JSONB", JsonB.class);

        PROVIDER_FACTORIES = unmodifiableMap(providerFactories);
    }

    public JsonPrioritizedProviderFactorySource(final ProviderFactorySource<T> source) {

        super(source);
    }

    @Override
    protected String priorityProperty() {

        return "json.provider";
    }

    @Override
    protected Class<?> mapToFactory(final String providerKey) {

        return Optional.ofNullable(PROVIDER_FACTORIES.get(providerKey))
                .orElseGet(() -> {
                    log.info("Property {} not mapped to an instance of {}. Apply default priority.",
                            providerKey,
                            JsonProviderFactory.class.getName()
                    );
                    return null;
                });
    }
}


text:
package com.github.haixing_hu.text;

import java.io.IOException;

import org.junit.Test;

import com.github.haixing_hu.io.exception.InvalidFormatException;
import com.github.haixing_hu.io.serialize.BinarySerialization;
import com.github.haixing_hu.io.serialize.XmlSerialization;
import com.github.haixing_hu.lang.StringUtils;
import com.github.haixing_hu.text.xml.XmlException;

import static org.junit.Assert.*;

/**
 * Unit test of the {@link Pattern} class.
 *
 * @author Haixing Hu
 */
public class PatternTest {

  /**
   * Test method for {@link Pattern#Pattern()}.
   */
  @Test
  public void testPattern() {
    final Pattern pattern = new Pattern();
    assertEquals(Pattern.DEFAULT_TYPE, pattern.getType());
    assertEquals(Pattern.DEFAULT_IGNORE_CASE, pattern.isIgnoreCase());
    assertEquals(StringUtils.EMPTY, pattern.getExpression());
  }

  /**
   * Test method for {@link Pattern#Pattern(PatternType, String)}.
   */
  @Test
  public void testPatternPatternTypeString() {
    Pattern pattern = new Pattern(PatternType.SUFFIX, "suffix");
    assertEquals(PatternType.SUFFIX, pattern.getType());
    assertEquals(Pattern.DEFAULT_IGNORE_CASE, pattern.isIgnoreCase());
    assertEquals("suffix", pattern.getExpression());

    pattern = new Pattern(PatternType.PREFIX, "prefix");
    assertEquals(PatternType.PREFIX, pattern.getType());
    assertEquals(Pattern.DEFAULT_IGNORE_CASE, pattern.isIgnoreCase());
    assertEquals("prefix", pattern.getExpression());
  }

  /**
   * Test method for {@link Pattern#Pattern(PatternType, boolean, String)}.
   */
  @Test
  public void testPatternPatternTypeBooleanString() {
    Pattern pattern = new Pattern(PatternType.SUFFIX, true, "suffix");
    assertEquals(PatternType.SUFFIX, pattern.getType());
    assertEquals(true, pattern.isIgnoreCase());
    assertEquals("suffix", pattern.getExpression());

    pattern = new Pattern(PatternType.PREFIX, false, "prefix");
    assertEquals(PatternType.PREFIX, pattern.getType());
    assertEquals(false, pattern.isIgnoreCase());
    assertEquals("prefix", pattern.getExpression());
  }

  /**
   * Test method for {@link Pattern#getType()} and {@link Pattern#setType(PatternType)}.
   */
  @Test
  public void testGetSetType() {
    final Pattern pattern = new Pattern();

    assertEquals(Pattern.DEFAULT_TYPE, pattern.getType());

    pattern.setType(PatternType.GLOB);
    assertEquals(PatternType.GLOB, pattern.getType());

    pattern.setType(PatternType.PREFIX);
    assertEquals(PatternType.PREFIX, pattern.getType());

    pattern.setType(PatternType.REGEX);
    assertEquals(PatternType.REGEX, pattern.getType());

    pattern.setType(PatternType.LITERAL);
    assertEquals(PatternType.LITERAL, pattern.getType());

    pattern.setType(PatternType.SUFFIX);
    assertEquals(PatternType.SUFFIX, pattern.getType());

    try {
      pattern.setType(null);
      fail("Must throw NullPointerException.");
    } catch (final NullPointerException e) {
      // pass
    }
  }

  /**
   * Test method for {@link Pattern#isIgnoreCase()} and
   * {@link Pattern#setIgnoreCase(boolean)}.
   */
  @Test
  public void testGetSetCaseInsensitive() {
    final Pattern pattern = new Pattern();

    assertEquals(Pattern.DEFAULT_IGNORE_CASE, pattern.isIgnoreCase());

    pattern.setIgnoreCase(true);
    assertEquals(true, pattern.isIgnoreCase());

    pattern.setIgnoreCase(false);
    assertEquals(false, pattern.isIgnoreCase());
  }

  /**
   * Test method for {@link Pattern#getExpression()} and
   * {@link Pattern#setExpression(String)}.
   */
  @Test
  public void testGetSetExpression() {
    final Pattern pattern = new Pattern();

    assertEquals(StringUtils.EMPTY, pattern.getExpression());

    pattern.setExpression("test");
    assertEquals("test", pattern.getExpression());

    try {
      pattern.setExpression(null);
      fail("Must throw NullPointerException.");
    } catch (final NullPointerException e) {
      // pass
    }
  }

  /**
   * Test method for {@link Pattern#matches(String)}.
   */
  @Test
  public void testMatches() {
    testMatchesForStringPattern();
    testMatchesForPrefixPattern();
    testMatchesForSuffixPattern();
    testMatchesForRegexPattern();
    testMatchesForGlobPattern();
  }

  private void testMatchesForStringPattern() {
    final Pattern p = new Pattern();
    p.setType(PatternType.LITERAL);

    p.setIgnoreCase(false);

    p.setExpression("");
    assertEquals(true, p.matches(""));
    assertEquals(false, p.matches("str"));

    p.setExpression("hello");
    assertEquals(true, p.matches("hello"));
    assertEquals(false, p.matches("str"));
    assertEquals(false, p.matches(""));
    assertEquals(false, p.matches("Hello"));

    p.setIgnoreCase(true);
    assertEquals(true, p.matches("hello"));
    assertEquals(false, p.matches("str"));
    assertEquals(false, p.matches(""));
    assertEquals(true, p.matches("Hello"));
  }

  private void testMatchesForPrefixPattern() {
    final Pattern p = new Pattern();
    p.setType(PatternType.PREFIX);

    p.setIgnoreCase(false);

    p.setExpression("");
    assertEquals(true, p.matches(""));
    assertEquals(true, p.matches("str"));

    p.setExpression("hello");
    assertEquals(true, p.matches("hello"));
    assertEquals(true, p.matches("hello123"));
    assertEquals(false, p.matches("str"));
    assertEquals(false, p.matches(""));
    assertEquals(false, p.matches("Hello"));
    assertEquals(false, p.matches("Hello123"));

    p.setIgnoreCase(true);
    assertEquals(true, p.matches("hello"));
    assertEquals(true, p.matches("hello123"));
    assertEquals(false, p.matches("str"));
    assertEquals(false, p.matches(""));
    assertEquals(true, p.matches("Hello"));
    assertEquals(true, p.matches("Hello123"));
  }

  private void testMatchesForSuffixPattern() {
    final Pattern p = new Pattern();
    p.setType(PatternType.SUFFIX);

    p.setIgnoreCase(false);

    p.setExpression("");
    assertEquals(true, p.matches(""));
    assertEquals(true, p.matches("str"));

    p.setExpression("hello");
    assertEquals(true, p.matches("hello"));
    assertEquals(true, p.matches("123hello"));
    assertEquals(false, p.matches("hello123"));
    assertEquals(false, p.matches("str"));
    assertEquals(false, p.matches(""));
    assertEquals(false, p.matches("Hello"));
    assertEquals(false, p.matches("123Hello"));
    assertEquals(false, p.matches("Hello123"));

    p.setIgnoreCase(true);
    assertEquals(true, p.matches("hello"));
    assertEquals(true, p.matches("123hello"));
    assertEquals(false, p.matches("hello123"));
    assertEquals(false, p.matches("str"));
    assertEquals(false, p.matches(""));
    assertEquals(true, p.matches("Hello"));
    assertEquals(true, p.matches("123Hello"));
    assertEquals(false, p.matches("Hello123"));
  }

  private void testMatchesForRegexPattern() {
    final Pattern p = new Pattern();
    p.setType(PatternType.REGEX);

    p.setIgnoreCase(false);

    p.setExpression("");
    assertEquals(true, p.matches(""));
    assertEquals(false, p.matches("str"));

    p.setExpression(".");
    assertEquals(false, p.matches(""));
    assertEquals(true, p.matches("s"));
    assertEquals(true, p.matches("t"));
    assertEquals(false, p.matches("st"));

    p.setExpression(".*");
    assertEquals(true, p.matches(""));
    assertEquals(true, p.matches("s"));
    assertEquals(true, p.matches("s"));
    assertEquals(true, p.matches("st"));

    p.setExpression("ab.c");
    assertEquals(false, p.matches(""));
    assertEquals(true, p.matches("abxc"));
    assertEquals(true, p.matches("abyc"));
    assertEquals(false, p.matches("abc"));
    assertEquals(false, p.matches("abxyc"));
    assertEquals(false, p.matches("abx"));

    p.setExpression("ab.*c");
    assertEquals(false, p.matches(""));
    assertEquals(true, p.matches("abxc"));
    assertEquals(true, p.matches("abyc"));
    assertEquals(true, p.matches("abc"));
    assertEquals(true, p.matches("abxyc"));
    assertEquals(false, p.matches("aBxc"));
    assertEquals(false, p.matches("Abyc"));
    assertEquals(false, p.matches("abC"));
    assertEquals(false, p.matches("AbxYC"));
    assertEquals(false, p.matches("abx"));

    p.setExpression("ab.+c");
    assertEquals(false, p.matches(""));
    assertEquals(true, p.matches("abxc"));
    assertEquals(true, p.matches("abyc"));
    assertEquals(false, p.matches("abc"));
    assertEquals(true, p.matches("abxyc"));
    assertEquals(false, p.matches("aBxc"));
    assertEquals(false, p.matches("Abyc"));
    assertEquals(false, p.matches("abC"));
    assertEquals(false, p.matches("AbxYC"));
    assertEquals(false, p.matches("abx"));

    p.setIgnoreCase(true);
    p.setExpression("ab.*c");
    assertEquals(false, p.matches(""));
    assertEquals(true, p.matches("abxc"));
    assertEquals(true, p.matches("abyc"));
    assertEquals(true, p.matches("abc"));
    assertEquals(true, p.matches("abxyc"));
    assertEquals(true, p.matches("aBxc"));
    assertEquals(true, p.matches("Abyc"));
    assertEquals(true, p.matches("abC"));
    assertEquals(true, p.matches("AbxYC"));
    assertEquals(false, p.matches("abx"));

    p.setExpression("ab.+c");
    assertEquals(false, p.matches(""));
    assertEquals(true, p.matches("abxc"));
    assertEquals(true, p.matches("abyc"));
    assertEquals(false, p.matches("abc"));
    assertEquals(true, p.matches("abxyc"));
    assertEquals(true, p.matches("aBxc"));
    assertEquals(true, p.matches("Abyc"));
    assertEquals(false, p.matches("abC"));
    assertEquals(true, p.matches("AbxYC"));
    assertEquals(false, p.matches("abx"));
  }

  private void testMatchesForGlobPattern() {
    final Pattern p = new Pattern();
    p.setType(PatternType.GLOB);

    p.setIgnoreCase(false);

    p.setExpression("");
    assertEquals(true, p.matches(""));
    assertEquals(false, p.matches("str"));

    p.setExpression("?");
    assertEquals(false, p.matches(""));
    assertEquals(true, p.matches("s"));
    assertEquals(true, p.matches("t"));
    assertEquals(false, p.matches("st"));

    p.setExpression("*");
    assertEquals(true, p.matches(""));
    assertEquals(true, p.matches("s"));
    assertEquals(true, p.matches("s"));
    assertEquals(true, p.matches("st"));

    p.setExpression("ab?c");
    assertEquals(false, p.matches(""));
    assertEquals(true, p.matches("abxc"));
    assertEquals(true, p.matches("abyc"));
    assertEquals(false, p.matches("abc"));
    assertEquals(false, p.matches("abxyc"));
    assertEquals(false, p.matches("abx"));

    p.setExpression("ab*c");
    assertEquals(false, p.matches(""));
    assertEquals(true, p.matches("abxc"));
    assertEquals(true, p.matches("abyc"));
    assertEquals(true, p.matches("abc"));
    assertEquals(true, p.matches("abxyc"));
    assertEquals(false, p.matches("aBxc"));
    assertEquals(false, p.matches("Abyc"));
    assertEquals(false, p.matches("abC"));
    assertEquals(false, p.matches("AbxYC"));
    assertEquals(false, p.matches("abx"));

    p.setIgnoreCase(true);
    p.setExpression("ab*c");
    assertEquals(false, p.matches(""));
    assertEquals(true, p.matches("abxc"));
    assertEquals(true, p.matches("abyc"));
    assertEquals(true, p.matches("abc"));
    assertEquals(true, p.matches("abxyc"));
    assertEquals(true, p.matches("aBxc"));
    assertEquals(true, p.matches("Abyc"));
    assertEquals(true, p.matches("abC"));
    assertEquals(true, p.matches("AbxYC"));
    assertEquals(false, p.matches("abx"));

  }

  @Test
  public void testXmlSerialization() throws XmlException {
    Pattern p1 = null;
    Pattern p2 = null;
    String xml = null;

    //  test for empty
    p1 = new Pattern();
    xml = XmlSerialization.serialize(Pattern.class, p1);
    System.out.println(xml);
    p2 = XmlSerialization.deserialize(Pattern.class, xml);
    assertEquals(p1, p2);

    p1.setIgnoreCase(true);
    xml = XmlSerialization.serialize(Pattern.class, p1);
    System.out.println(xml);
    p2 = XmlSerialization.deserialize(Pattern.class, xml);
    assertEquals(p1, p2);

    p1.setType(PatternType.REGEX);
    xml = XmlSerialization.serialize(Pattern.class, p1);
    System.out.println(xml);
    p2 = XmlSerialization.deserialize(Pattern.class, xml);
    assertEquals(p1, p2);

    p1.setExpression("expression");
    xml = XmlSerialization.serialize(Pattern.class, p1);
    System.out.println(xml);
    p2 = XmlSerialization.deserialize(Pattern.class, xml);
    assertEquals(p1, p2);

    p1.setType(Pattern.DEFAULT_TYPE);
    xml = XmlSerialization.serialize(Pattern.class, p1);
    System.out.println(xml);
    p2 = XmlSerialization.deserialize(Pattern.class, xml);
    assertEquals(p1, p2);

    p1.setIgnoreCase(Pattern.DEFAULT_IGNORE_CASE);
    p1.setType(PatternType.REGEX);
    xml = XmlSerialization.serialize(Pattern.class, p1);
    System.out.println(xml);
    p2 = XmlSerialization.deserialize(Pattern.class, xml);
    assertEquals(p1, p2);

    p1.setType(Pattern.DEFAULT_TYPE);
    p1.setIgnoreCase(Pattern.DEFAULT_IGNORE_CASE);
    xml = XmlSerialization.serialize(Pattern.class, p1);
    System.out.println(xml);
    p2 = XmlSerialization.deserialize(Pattern.class, xml);
    assertEquals(p1, p2);
  }

  @Test
  public void testBinarySerilization() throws IOException {
    Pattern p1 = null;
    Pattern p2 = null;
    byte[] data = null;

    //  test for null
    p1 = null;
    data = BinarySerialization.serialize(Pattern.class, p1);
    p2 = BinarySerialization.deserialize(Pattern.class, data, true);
    assertEquals(p1, p2);
    try {
      p2 = BinarySerialization.deserialize(Pattern.class, data, false);
      fail("shoudl throw");
    } catch (final InvalidFormatException e) {
      // pass
    }

    //  test for empty
    p1 = new Pattern();
    data = BinarySerialization.serialize(Pattern.class, p1);
    p2 = BinarySerialization.deserialize(Pattern.class, data, true);
    assertEquals(p1, p2);

    //  test for normal object
    p1.setIgnoreCase(true);
    data = BinarySerialization.serialize(Pattern.class, p1);
    p2 = BinarySerialization.deserialize(Pattern.class, data, true);
    assertEquals(p1, p2);

    p1.setType(PatternType.REGEX);
    data = BinarySerialization.serialize(Pattern.class, p1);
    p2 = BinarySerialization.deserialize(Pattern.class, data, true);
    assertEquals(p1, p2);

    p1.setExpression("expression");
    data = BinarySerialization.serialize(Pattern.class, p1);
    p2 = BinarySerialization.deserialize(Pattern.class, data, true);
    assertEquals(p1, p2);

    p1.setType(Pattern.DEFAULT_TYPE);
    data = BinarySerialization.serialize(Pattern.class, p1);
    p2 = BinarySerialization.deserialize(Pattern.class, data, true);
    assertEquals(p1, p2);
  }

  /**
   * Test method for {@link Pattern#equals(Object)} and
   * {@link Pattern#hashCode()}.
   */
  @Test
  public void testEqualsHashCode() {
    final Pattern p1 = new Pattern();
    final Pattern p2 = new Pattern();

    assertEquals(true, p1.equals(p1));
    assertEquals(true, p1.equals(p2));
    assertEquals(false, p1.equals(null));
    assertEquals(p1.hashCode(), p2.hashCode());

    p1.setIgnoreCase(false);
    p2.setIgnoreCase(true);
    assertEquals(false, p1.equals(p2));
    assertFalse(p1.hashCode() == p2.hashCode());

    p1.setIgnoreCase(false);
    p2.setIgnoreCase(false);
    p1.setExpression("expression");
    p2.setExpression("expression");
    assertEquals(true, p1.equals(p2));
    assertEquals(p1.hashCode(), p2.hashCode());

    p2.setExpression("expression2");
    assertEquals(false, p1.equals(p2));
    assertFalse(p1.hashCode() == p2.hashCode());

    p2.setExpression("expression");
    p1.setType(PatternType.LITERAL);
    p2.setType(PatternType.LITERAL);
    assertEquals(true, p1.equals(p2));
    assertEquals(p1.hashCode(), p2.hashCode());

    p2.setType(PatternType.REGEX);
    assertEquals(false, p1.equals(p2));
    assertFalse(p1.hashCode() == p2.hashCode());
  }

  /**
   * Test method for {@link Pattern#toString()}.
   */
  @Test
  public void testToString() {
    final Pattern p = new Pattern();

    System.out.println(p);

    p.setIgnoreCase(true);
    System.out.println(p);

    p.setType(PatternType.REGEX); System.out.println(p);
    System.out.println(p);

    p.setExpression("expression");
    System.out.println(p);

    p.setType(Pattern.DEFAULT_TYPE);
    p.setIgnoreCase(Pattern.DEFAULT_IGNORE_CASE);
    System.out.println(p);
  }

}


text:
clear_code = %x{clear}

puts 'Press enter to clear the screen.'
$stdin.gets
print clear_code
puts "It's cleared!  ... counting to 10 before quiting"

# backspace to overwrite previous output
10.times{|i| STDOUT.write "\r#{i}"; sleep 1}

puts
puts


text:
#include <memory>

#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
#include "webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h"
#include "webrtc/modules/video_coding/include/video_codec_interface.h"
#include "webrtc/video/payload_router.h"

using ::testing::_;
using ::testing::AnyNumber;
using ::testing::NiceMock;
using ::testing::Return;

namespace webrtc {

TEST(PayloadRouterTest, SendOnOneModule) {
  NiceMock<MockRtpRtcp> rtp;
  std::vector<RtpRtcp*> modules(1, &rtp);
  std::vector<VideoStream> streams(1);

  uint8_t payload = 'a';
  int8_t payload_type = 96;
  EncodedImage encoded_image;
  encoded_image._timeStamp = 1;
  encoded_image.capture_time_ms_ = 2;
  encoded_image._frameType = kVideoFrameKey;
  encoded_image._buffer = &payload;
  encoded_image._length = 1;

  PayloadRouter payload_router(modules, payload_type);
  payload_router.SetSendStreams(streams);

  EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type,
                                    encoded_image._timeStamp,
                                    encoded_image.capture_time_ms_, &payload,
                                    encoded_image._length, nullptr, _))
      .Times(0);
  EXPECT_EQ(-1, payload_router.Encoded(encoded_image, nullptr, nullptr));

  payload_router.set_active(true);
  EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type,
                                    encoded_image._timeStamp,
                                    encoded_image.capture_time_ms_, &payload,
                                    encoded_image._length, nullptr, _))
      .Times(1);
  EXPECT_EQ(0, payload_router.Encoded(encoded_image, nullptr, nullptr));

  payload_router.set_active(false);
  EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type,
                                    encoded_image._timeStamp,
                                    encoded_image.capture_time_ms_, &payload,
                                    encoded_image._length, nullptr, _))
      .Times(0);
  EXPECT_EQ(-1, payload_router.Encoded(encoded_image, nullptr, nullptr));

  payload_router.set_active(true);
  EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type,
                                    encoded_image._timeStamp,
                                    encoded_image.capture_time_ms_, &payload,
                                    encoded_image._length, nullptr, _))
      .Times(1);
  EXPECT_EQ(0, payload_router.Encoded(encoded_image, nullptr, nullptr));

  streams.clear();
  payload_router.SetSendStreams(streams);
  EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type,
                                    encoded_image._timeStamp,
                                    encoded_image.capture_time_ms_, &payload,
                                    encoded_image._length, nullptr, _))
      .Times(0);
  EXPECT_EQ(-1, payload_router.Encoded(encoded_image, nullptr, nullptr));
}

TEST(PayloadRouterTest, SendSimulcast) {
  NiceMock<MockRtpRtcp> rtp_1;
  NiceMock<MockRtpRtcp> rtp_2;
  std::vector<RtpRtcp*> modules;
  modules.push_back(&rtp_1);
  modules.push_back(&rtp_2);
  std::vector<VideoStream> streams(2);

  int8_t payload_type = 96;
  uint8_t payload = 'a';
  EncodedImage encoded_image;
  encoded_image._timeStamp = 1;
  encoded_image.capture_time_ms_ = 2;
  encoded_image._frameType = kVideoFrameKey;
  encoded_image._buffer = &payload;
  encoded_image._length = 1;

  PayloadRouter payload_router(modules, payload_type);
  payload_router.SetSendStreams(streams);

  CodecSpecificInfo codec_info_1;
  memset(&codec_info_1, 0, sizeof(CodecSpecificInfo));
  codec_info_1.codecType = kVideoCodecVP8;
  codec_info_1.codecSpecific.VP8.simulcastIdx = 0;

  payload_router.set_active(true);
  EXPECT_CALL(rtp_1, SendOutgoingData(encoded_image._frameType, payload_type,
                                      encoded_image._timeStamp,
                                      encoded_image.capture_time_ms_, &payload,
                                      encoded_image._length, nullptr, _))
      .Times(1);
  EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _))
      .Times(0);
  EXPECT_EQ(0, payload_router.Encoded(encoded_image, &codec_info_1, nullptr));

  CodecSpecificInfo codec_info_2;
  memset(&codec_info_2, 0, sizeof(CodecSpecificInfo));
  codec_info_2.codecType = kVideoCodecVP8;
  codec_info_2.codecSpecific.VP8.simulcastIdx = 1;

  EXPECT_CALL(rtp_2, SendOutgoingData(encoded_image._frameType, payload_type,
                                      encoded_image._timeStamp,
                                      encoded_image.capture_time_ms_, &payload,
                                      encoded_image._length, nullptr, _))
      .Times(1);
  EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _))
      .Times(0);
  EXPECT_EQ(0, payload_router.Encoded(encoded_image, &codec_info_2, nullptr));

  // Inactive.
  payload_router.set_active(false);
  EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _))
      .Times(0);
  EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _))
      .Times(0);
  EXPECT_EQ(-1, payload_router.Encoded(encoded_image, &codec_info_1, nullptr));
  EXPECT_EQ(-1, payload_router.Encoded(encoded_image, &codec_info_2, nullptr));

  // Invalid simulcast index.
  streams.pop_back();  // Remove a stream.
  payload_router.SetSendStreams(streams);
  payload_router.set_active(true);
  EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _))
      .Times(0);
  EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _))
      .Times(0);
  codec_info_2.codecSpecific.VP8.simulcastIdx = 1;
  EXPECT_EQ(-1, payload_router.Encoded(encoded_image, &codec_info_2, nullptr));
}

TEST(PayloadRouterTest, MaxPayloadLength) {
  // Without any limitations from the modules, verify we get the max payload
  // length for IP/UDP/SRTP with a MTU of 150 bytes.
  const size_t kDefaultMaxLength = 1500 - 20 - 8 - 12 - 4;
  NiceMock<MockRtpRtcp> rtp_1;
  NiceMock<MockRtpRtcp> rtp_2;
  std::vector<RtpRtcp*> modules;
  modules.push_back(&rtp_1);
  modules.push_back(&rtp_2);
  PayloadRouter payload_router(modules, 42);

  EXPECT_EQ(kDefaultMaxLength, PayloadRouter::DefaultMaxPayloadLength());
  std::vector<VideoStream> streams(2);
  payload_router.SetSendStreams(streams);

  // Modules return a higher length than the default value.
  EXPECT_CALL(rtp_1, MaxDataPayloadLength())
      .Times(1)
      .WillOnce(Return(kDefaultMaxLength + 10));
  EXPECT_CALL(rtp_2, MaxDataPayloadLength())
      .Times(1)
      .WillOnce(Return(kDefaultMaxLength + 10));
  EXPECT_EQ(kDefaultMaxLength, payload_router.MaxPayloadLength());

  // The modules return a value lower than default.
  const size_t kTestMinPayloadLength = 1001;
  EXPECT_CALL(rtp_1, MaxDataPayloadLength())
      .Times(1)
      .WillOnce(Return(kTestMinPayloadLength + 10));
  EXPECT_CALL(rtp_2, MaxDataPayloadLength())
      .Times(1)
      .WillOnce(Return(kTestMinPayloadLength));
  EXPECT_EQ(kTestMinPayloadLength, payload_router.MaxPayloadLength());
}

TEST(PayloadRouterTest, SetTargetSendBitrates) {
  NiceMock<MockRtpRtcp> rtp_1;
  NiceMock<MockRtpRtcp> rtp_2;
  std::vector<RtpRtcp*> modules;
  modules.push_back(&rtp_1);
  modules.push_back(&rtp_2);
  PayloadRouter payload_router(modules, 42);
  std::vector<VideoStream> streams(2);
  streams[0].max_bitrate_bps = 10000;
  streams[1].max_bitrate_bps = 100000;
  payload_router.SetSendStreams(streams);

  const uint32_t bitrate_1 = 10000;
  const uint32_t bitrate_2 = 76543;
  EXPECT_CALL(rtp_1, SetTargetSendBitrate(bitrate_1))
      .Times(1);
  EXPECT_CALL(rtp_2, SetTargetSendBitrate(bitrate_2))
      .Times(1);
  payload_router.SetTargetSendBitrate(bitrate_1 + bitrate_2);
}
}  // namespace webrtc


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

import java.io.Serializable;
import javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;

/**
 *
 * @see AWS API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetContextKeysForPrincipalPolicyRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     *

     * The ARN of a user, group, or role whose policies contain the context keys that you want listed. If you specify a
     * user, the list includes context keys that are found in all policies that are attached to the user. The list also
     * includes all groups that the user is a member of. If you pick a group or a role, then it includes only those
     * context keys that are found in policies attached to that entity. Note that all parameters are shown in unencoded
     * form here for clarity, but must be URL encoded to be included as a part of a real HTML request.
     *

     *

     * For more information about ARNs, see Amazon Resource Names (ARNs)
     * and AWS Service Namespaces in the AWS General Reference.
     *

     */
    private String policySourceArn;
    /**
     *

     * An optional list of additional policies for which you want the list of context keys that are referenced.
     *

     *

     * The regex pattern used to validate this parameter is a string of
     * characters consisting of the following:
     *

     *

     *

     *

     * Any printable ASCII character ranging from the space character ( ) through the end of the ASCII character range
     *

     *

     *

     *

     * The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
     *

     *

     *

     *

     * The special characters tab ( ), line feed ( ), and carriage return ( )
     *

     *

     *

     */
    private com.amazonaws.internal.SdkInternalList<String> policyInputList;

    /**
     *

     * The ARN of a user, group, or role whose policies contain the context keys that you want listed. If you specify a
     * user, the list includes context keys that are found in all policies that are attached to the user. The list also
     * includes all groups that the user is a member of. If you pick a group or a role, then it includes only those
     * context keys that are found in policies attached to that entity. Note that all parameters are shown in unencoded
     * form here for clarity, but must be URL encoded to be included as a part of a real HTML request.
     *

     *

     * For more information about ARNs, see Amazon Resource Names (ARNs)
     * and AWS Service Namespaces in the AWS General Reference.
     *

     *
     * @param policySourceArn
     *        The ARN of a user, group, or role whose policies contain the context keys that you want listed. If you
     *        specify a user, the list includes context keys that are found in all policies that are attached to the
     *        user. The list also includes all groups that the user is a member of. If you pick a group or a role, then
     *        it includes only those context keys that are found in policies attached to that entity. Note that all
     *        parameters are shown in unencoded form here for clarity, but must be URL encoded to be included as a part
     *        of a real HTML request.

     *

     *        For more information about ARNs, see Amazon Resource Names
     *        (ARNs) and AWS Service Namespaces in the AWS General Reference.
     */

    public void setPolicySourceArn(String policySourceArn) {
        this.policySourceArn = policySourceArn;
    }

    /**
     *

     * The ARN of a user, group, or role whose policies contain the context keys that you want listed. If you specify a
     * user, the list includes context keys that are found in all policies that are attached to the user. The list also
     * includes all groups that the user is a member of. If you pick a group or a role, then it includes only those
     * context keys that are found in policies attached to that entity. Note that all parameters are shown in unencoded
     * form here for clarity, but must be URL encoded to be included as a part of a real HTML request.
     *

     *

     * For more information about ARNs, see Amazon Resource Names (ARNs)
     * and AWS Service Namespaces in the AWS General Reference.
     *

     *
     * @return The ARN of a user, group, or role whose policies contain the context keys that you want listed. If you
     *         specify a user, the list includes context keys that are found in all policies that are attached to the
     *         user. The list also includes all groups that the user is a member of. If you pick a group or a role, then
     *         it includes only those context keys that are found in policies attached to that entity. Note that all
     *         parameters are shown in unencoded form here for clarity, but must be URL encoded to be included as a part
     *         of a real HTML request.

     *

     *         For more information about ARNs, see Amazon Resource Names
     *         (ARNs) and AWS Service Namespaces in the AWS General Reference.
     */

    public String getPolicySourceArn() {
        return this.policySourceArn;
    }

    /**
     *

     * The ARN of a user, group, or role whose policies contain the context keys that you want listed. If you specify a
     * user, the list includes context keys that are found in all policies that are attached to the user. The list also
     * includes all groups that the user is a member of. If you pick a group or a role, then it includes only those
     * context keys that are found in policies attached to that entity. Note that all parameters are shown in unencoded
     * form here for clarity, but must be URL encoded to be included as a part of a real HTML request.
     *

     *

     * For more information about ARNs, see Amazon Resource Names (ARNs)
     * and AWS Service Namespaces in the AWS General Reference.
     *

     *
     * @param policySourceArn
     *        The ARN of a user, group, or role whose policies contain the context keys that you want listed. If you
     *        specify a user, the list includes context keys that are found in all policies that are attached to the
     *        user. The list also includes all groups that the user is a member of. If you pick a group or a role, then
     *        it includes only those context keys that are found in policies attached to that entity. Note that all
     *        parameters are shown in unencoded form here for clarity, but must be URL encoded to be included as a part
     *        of a real HTML request.

     *

     *        For more information about ARNs, see Amazon Resource Names
     *        (ARNs) and AWS Service Namespaces in the AWS General Reference.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetContextKeysForPrincipalPolicyRequest withPolicySourceArn(String policySourceArn) {
        setPolicySourceArn(policySourceArn);
        return this;
    }

    /**
     *

     * An optional list of additional policies for which you want the list of context keys that are referenced.
     *

     *

     * The regex pattern used to validate this parameter is a string of
     * characters consisting of the following:
     *

     *

     *

     *

     * Any printable ASCII character ranging from the space character ( ) through the end of the ASCII character range
     *

     *

     *

     *

     * The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
     *

     *

     *

     *

     * The special characters tab ( ), line feed ( ), and carriage return ( )
     *

     *

     *

     *
     * @return An optional list of additional policies for which you want the list of context keys that are
     *         referenced.

     *

     *         The regex pattern used to validate this parameter is a
     *         string of characters consisting of the following:
     *

     *

     *

     *

     *         Any printable ASCII character ranging from the space character ( ) through the end of the ASCII character
     *         range
     *

     *

     *

     *

     *         The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
     *

     *

     *

     *

     *         The special characters tab ( ), line feed ( ), and carriage return ( )
     *

     *

     */

    public java.util.List<String> getPolicyInputList() {
        if (policyInputList == null) {
            policyInputList = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return policyInputList;
    }

    /**
     *

     * An optional list of additional policies for which you want the list of context keys that are referenced.
     *

     *

     * The regex pattern used to validate this parameter is a string of
     * characters consisting of the following:
     *

     *

     *

     *

     * Any printable ASCII character ranging from the space character ( ) through the end of the ASCII character range
     *

     *

     *

     *

     * The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
     *

     *

     *

     *

     * The special characters tab ( ), line feed ( ), and carriage return ( )
     *

     *

     *

     *
     * @param policyInputList
     *        An optional list of additional policies for which you want the list of context keys that are
     *        referenced.

     *

     *        The regex pattern used to validate this parameter is a
     *        string of characters consisting of the following:
     *

     *

     *

     *

     *        Any printable ASCII character ranging from the space character ( ) through the end of the ASCII character
     *        range
     *

     *

     *

     *

     *        The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
     *

     *

     *

     *

     *        The special characters tab ( ), line feed ( ), and carriage return ( )
     *

     *

     */

    public void setPolicyInputList(java.util.Collection<String> policyInputList) {
        if (policyInputList == null) {
            this.policyInputList = null;
            return;
        }

        this.policyInputList = new com.amazonaws.internal.SdkInternalList<String>(policyInputList);
    }

    /**
     *

     * An optional list of additional policies for which you want the list of context keys that are referenced.
     *

     *

     * The regex pattern used to validate this parameter is a string of
     * characters consisting of the following:
     *

     *

     *

     *

     * Any printable ASCII character ranging from the space character ( ) through the end of the ASCII character range
     *

     *

     *

     *

     * The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
     *

     *

     *

     *

     * The special characters tab ( ), line feed ( ), and carriage return ( )
     *

     *

     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setPolicyInputList(java.util.Collection)} or {@link #withPolicyInputList(java.util.Collection)} if you
     * want to override the existing values.
     *

     *
     * @param policyInputList
     *        An optional list of additional policies for which you want the list of context keys that are
     *        referenced.

     *

     *        The regex pattern used to validate this parameter is a
     *        string of characters consisting of the following:
     *

     *

     *

     *

     *        Any printable ASCII character ranging from the space character ( ) through the end of the ASCII character
     *        range
     *

     *

     *

     *

     *        The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
     *

     *

     *

     *

     *        The special characters tab ( ), line feed ( ), and carriage return ( )
     *

     *

     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetContextKeysForPrincipalPolicyRequest withPolicyInputList(String... policyInputList) {
        if (this.policyInputList == null) {
            setPolicyInputList(new com.amazonaws.internal.SdkInternalList<String>(policyInputList.length));
        }
        for (String ele : policyInputList) {
            this.policyInputList.add(ele);
        }
        return this;
    }

    /**
     *

     * An optional list of additional policies for which you want the list of context keys that are referenced.
     *

     *

     * The regex pattern used to validate this parameter is a string of
     * characters consisting of the following:
     *

     *

     *

     *

     * Any printable ASCII character ranging from the space character ( ) through the end of the ASCII character range
     *

     *

     *

     *

     * The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
     *

     *

     *

     *

     * The special characters tab ( ), line feed ( ), and carriage return ( )
     *

     *

     *

     *
     * @param policyInputList
     *        An optional list of additional policies for which you want the list of context keys that are
     *        referenced.

     *

     *        The regex pattern used to validate this parameter is a
     *        string of characters consisting of the following:
     *

     *

     *

     *

     *        Any printable ASCII character ranging from the space character ( ) through the end of the ASCII character
     *        range
     *

     *

     *

     *

     *        The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
     *

     *

     *

     *

     *        The special characters tab ( ), line feed ( ), and carriage return ( )
     *

     *

     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetContextKeysForPrincipalPolicyRequest withPolicyInputList(java.util.Collection<String> policyInputList) {
        setPolicyInputList(policyInputList);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getPolicySourceArn() != null)
            sb.append("PolicySourceArn: ").append(getPolicySourceArn()).append(",");
        if (getPolicyInputList() != null)
            sb.append("PolicyInputList: ").append(getPolicyInputList());
        sb.append("}");
        return sb.toString();
    }

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

        if (obj instanceof GetContextKeysForPrincipalPolicyRequest == false)
            return false;
        GetContextKeysForPrincipalPolicyRequest other = (GetContextKeysForPrincipalPolicyRequest) obj;
        if (other.getPolicySourceArn() == null ^ this.getPolicySourceArn() == null)
            return false;
        if (other.getPolicySourceArn() != null && other.getPolicySourceArn().equals(this.getPolicySourceArn()) == false)
            return false;
        if (other.getPolicyInputList() == null ^ this.getPolicyInputList() == null)
            return false;
        if (other.getPolicyInputList() != null && other.getPolicyInputList().equals(this.getPolicyInputList()) == false)
            return false;
        return true;
    }

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

        hashCode = prime * hashCode + ((getPolicySourceArn() == null) ? 0 : getPolicySourceArn().hashCode());
        hashCode = prime * hashCode + ((getPolicyInputList() == null) ? 0 : getPolicyInputList().hashCode());
        return hashCode;
    }

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

}


text:
package e2e

import (
	"github.com/kris-nova/klone/pkg/klone"
	"os"
)

func IdempotentKlone(path, query string) error {
	if err := os.RemoveAll(path); err != nil {
		return err
	}
	err := klone.Klone(query)
	if err != nil {
		return err
	}
	return nil
}


text:
    <video id="video" onclick="clickVideo()" width="100%" height="100%"
           src="https://mediastore.auckland.ac.nz/2016/1163/PHYSICS107L01C/366694/201605201000.LT347631.REV1.mp4"></video>

            <video muted id="thumbnail" width="320" height="180" src="" style="visibility: hidden;"></video>

                        Thumbnails BETA

                    Speed

                        <input type="number" id="video-speed" onchange="setSpeed(this.value)" min="0.5" max="3"
                               step="0.1" value="1">

                    Quality

                        &nbsp&nbsp

                    &nbsp&nbsp
                        Quality

                    Full Frame

                    High

                    Low

                    Audio Only

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp

                    <input type="range" id="volume-slider" class="clickable" min="0" max="1" value="1" step="0.01"
                           onclick="event.stopPropagation()"
                           oninput="setVolume(this.value)" onchange="if(this.value!=0){lastInputVolume=this.value}">

                                Space

                        Play/Pause

                                F

                        Toggle Fullscreen

                                ,

                        Decrease Speed

                                .

                        Increase Speed

                                /

                        Reset Speed

                                ←

                        Skip Backward 10 Seconds

                                →

                        Skip Forward 10 Seconds

                                B

                        Create Bookmark

Audio Only

                Click  to change

Bookmarks

Playlist BETA

Click  or press B to create a Bookmark

                        /

                This feature is in BETA. Correctness and completeness of listing is not guaranteed. Please report any issues here.


text:
<!doctype html>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Super Rent</title>
<link href="css/bootstrap.min.css" rel="stylesheet" />
<link href="css/style.css" rel="stylesheet" />
<link href="images/favicon.ico" rel="shortcut icon">

      <form class="form-signin" role="form">

Super Rent

        Search

 <select id="inputSearch" class="form-control" placeholder="City or School" required autofocus>
  <option value="wa">Waterloo</option>
  <option value="lo">London</option>
  <option value="ki">Kitchener</option>
  <option value="to">Toronto</option>
</select>
        <button class="btn btn-lg btn-primary btn-block" type="submit">Enter</button>
      </form>


text:
set -x
set -e
set -o nounset

# should be one of: interim_2015_EA_exclude_ZJU  interim_2015_EA_include_ZJU  interim_2015_EAL_exclude_ZJU  interim_2015_EAL_include_ZJU
# interim_2015_EAul_exclude_ZJU  interim_2015_EAul_include_ZJU
CONFIG=$1

: ${KBPREPO:?"Need to set KBPREPO to path to working copy of kbp"}
: ${KBPOPENREPO:?"Need to set KBPOPENREPO to path to working copy of kbp-2014-event-arguments"}

EVALDIR=${KBPOPENREPO}/output/${CONFIG}
LOG=$EVALDIR/log
PARAMSDIR=${KBPOPENREPO}/params/${CONFIG}

mkdir -p $EVALDIR/score_df/neutralizeRealis
$KBPREPO/kbp-scorer-bbn/target/appassembler/bin/kbpScorer2015 $PARAMSDIR/BBNKBPScorer2015.df.neutralizeRealis.params > $LOG/scorer2015_neutralizeRealis.df.log


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <title>Forms</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

Fill out the form!

            <form method="post">
                {{form.as_p}}
                {% csrf_token %}
                <input type="submit" class="btn btn-primary" value="Submit">
            </form>