text:
{-# LANGUAGE RecordWildCards #-}

module Main where

import           Control.Concurrent.Async
import qualified Data.ByteString.Char8     as S
import           Data.Monoid
import           Data.Word
import           Options.Applicative
import           System.Log.Logger

import           Candide.Server
import           Vaultaire.Program
import           Vaultaire.Types

data Options = Options
    { host           :: String
    , port           :: Word16
    , user           :: String
    , pass           :: String
    , debug          :: Bool
    , quiet          :: Bool
    , cacheFile      :: String
    , cacheFlushFreq :: Integer
    , origin         :: String
    , namespace      :: String
    }

helpfulParser :: ParserInfo Options
helpfulParser = info (helper <*> optionsParser) fullDesc

optionsParser :: Parser Options
optionsParser = Options <$> parseHost
                        <*> parsePort
                        <*> parseUser
                        <*> parsePass
                        <*> parseDebug
                        <*> parseQuiet
                        <*> parseCacheFile
                        <*> parseCacheFlushFreq
                        <*> parseOrigin
                        <*> parseNameSpace
  where
    parseHost = strOption $
           long "host"
        <> short 'H'
        <> metavar "HOSTNAME"
        <> value "localhost"
        <> showDefault
        <> help "PostgreSQL host name or IP address"

    parsePort = option auto $
           long "port"
        <> short 'p'
        <> metavar "PORT"
        <> value 5432
        <> showDefault
        <> help "PostgreSQL port"

    parseUser = strOption $
           long "host"
        <> short 'u'
        <> metavar "USER"
        <> help "PostgreSQL username"

    parsePass = strOption $
           long "pass"
        <> short 'P'
        <> metavar "PASSWORD"
        <> help "PostgreSQL password"

    parseDebug = switch $
           long "debug"
        <> short 'd'
        <> help "Output lots of debugging information"

    parseQuiet = switch $
           long "quiet"
        <> short 'q'
        <> help "Only emit warnings or fatal messages"

    parseCacheFile = strOption $
           long "cache-file"
        <> short 'c'
        <> value ""
        <> help "Location to read/write cached SourceDicts"

    -- This doesn't mean that marquised will rigorously flush the cache
    -- every `t` seconds. To clarify: marquised consideres flushing the
    -- cache after it finishes reading every spool file. If the cache
    -- hasn't been flushed in the last `t` seconds, it will be flushed
    -- before processing the next spool file.
    parseCacheFlushFreq = option auto $
           long "cache-flush-freq"
        <> short 't'
        <> help "Period of time to wait between cache writes, in seconds"
        <> value 42

    parseNameSpace = argument str (metavar "NAMESPACE")

    parseOrigin = argument str (metavar "ORIGIN")

defaultCacheLoc :: String -> String
defaultCacheLoc = (++) "/var/cache/marquise/"

main :: IO ()
main = do
    Options{..} <- execParser helpfulParser

    let level
          | debug     = Debug
          | quiet     = Quiet
          | otherwise = Normal

    quit <- initializeProgram "candided" level

    cacheFile' <- return $ case cacheFile of
        "" -> defaultCacheLoc origin
        x  -> x

    a <- runCandideDaemon host port user pass (Origin $ S.pack origin) namespace quit cacheFile' cacheFlushFreq

    -- wait forever
    wait a
    debugM "Main.main" "End"


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <link href="style.css" rel="stylesheet" title="Default Style">
    <title>Olha elaaa</title>

Welcome to FulaninhoServer

There are examples of requests below

An image

An iframe

redpajama_set_name: RedPajamaGithub


text:
      {% if messages.count() > 0%}
        <input type="checkbox" class="checkall" />

        From
        Subject

      {% else %}
        You have no new messages

{% endif %}

  {% for message in messages %}

      <input type="checkbox" class="checkbox" name="" data-message-id="{{message.key().id()}}"/>

      {% if message.starred == "True" %}

      {% else %}

      {% endif %}
      {{message.sender.first_name}} {{message.sender.last_name}}
      {{message.subject}}

      {{message.created.ctime()}}

  {% endfor %}


text:
var ConnectionObject = require('./connectionObject');

var m_connectionRegex = /^([^:]+):\/\/(?:([^:]+)(?::([^@\/]+))?@)?(?:([^\/:]+)(?::(\d+))?)?\/([^\?]+)(?:\?(.*))?$/;

/**
 * Parses a connection string to extract the driver name,
 * username, password, hostname, port, database, and
 * parameter string.
 *
 * @param {string} connectionString
 * @param {any} driver
 * @returns {ConnectionObject}
 */
function ParseConnection(connectionString, driver) {
    [match, driverName, username, password, hostname, port, database, parameters] = m_connectionRegex.exec(connectionString);
    return new ConnectionObject(driverName, username, password, hostname, port, database, parameters, driver);
}

module.exports = ParseConnection;


text:
"use strict";

var KLA = KLA || {};

if (typeof console === 'undefined') {
    var console = {};
    console.log = function() {};
    console.dir = function() {};
}

KLA.Analyzer = (function() {

    var me,
        distanceBetweenKeysCached;

    me = function() {
        return me;
    };

    // utility function
    var memoize = function(funct) {
        var cache = {};
        return function() {
            var key = arguments.length + Array.prototype.join.call(arguments,",");
            if (key in cache) return cache[key];
            else return cache[key] = funct.apply(this,arguments);
        };
    };

    function distanceBetweenKeys(keyMap, keyIndex1, keyIndex2) {
        var xDiff = keyMap[keyIndex1].cx - keyMap[keyIndex2].cx,
            yDiff = keyMap[keyIndex1].cy - keyMap[keyIndex2].cy;
        return Math.sqrt(xDiff*xDiff + yDiff*yDiff);
    }

    /*
        Look up where the char was typed and any other information we'll need.

        Input:
        * keySet
        * charCode

        An object with the following properties will be returned:
          * fingerUsed          - Represents the finger used.
          * keyIndex            - keyID for the keySet
          * charCode            - Char code for character pressed
          * pushType            - What type of key (ie, KB.PRIME_PUSH, KB.SHIFT_PUSH, etc)
          * errors              - A string array indicating any errors
    */
    function findCharInKeySet(keySet, charCode) {
        var ret,
            len,
            keys = keySet.keys,
            ii,
            hand;
        ret = {
            fingerUsed: null,
            keyIndex: null,
            charCode: charCode,
            pushType: null,
            errors: []
        };

        //console.log("Entering findCharInKeySet");

        len = keys.length;
        for (ii = 0; ii < len; ii++) {
            if ( keys[ii].primary && keys[ii].primary === charCode ) {
                ret.fingerUsed = keys[ii].finger;
                ret.keyIndex = ii;
                ret.pushType = KB.PRIME_PUSH;
                break;
            } else if ( keys[ii].shift && keys[ii].shift === charCode ) {
                ret.fingerUsed = keys[ii].finger;
                ret.keyIndex = ii;
                ret.pushType = KB.SHIFT_PUSH;
                break;
            } else if ( keys[ii].altGr && keys[ii].altGr === charCode ) {
                ret.fingerUsed = keys[ii].finger;
                ret.keyIndex = ii;
                ret.pushType = KB.ALTGR_PUSH;
                break;
            } else if ( keys[ii].shiftAltGr && keys[ii].shiftAltGr === charCode ) {
                ret.fingerUsed = keys[ii].finger;
                ret.keyIndex = ii;
                ret.pushType = KB.SHIFT_ALTGR_PUSH;
                break;
            }
        }

        // Blogs often change certain characters to other codes, so do some character changes to accommodate certain instances
        if (ret.fingerUsed === null) {
	        switch (charCode) {
	            case 8217:
	                return findCharInKeySet(keySet, 39); // '
                case 8220:
                case 8221:
                    return findCharInKeySet(keySet, 34); // "
                case 8211:
	                return findCharInKeySet(keySet, 45); // -
	        }
	        ret.errors.push("Char code not found: " + charCode + " ("+String.fromCharCode(charCode)+")");
        }

        if ( ret.pushType !== KB.PRIME_PUSH && (charCode === 16 || charCode === -16 || charCode === -18) ) {
	        //console.log("Shift Key and Alt GR Key can only be set as 'primary' key presses.");
	        ret.errors.push("Shift Key and Alt GR Key can only be set as 'primary' key presses.");
	        return ret;
        }

        //console.dir(ret);
        //console.log("Leaving findCharInKeySet");

        return ret;
    }

    /*
        Returns an array of the fingers used to press the key.
        An object from the "findCharInKeySet" function is taken in as input.
    */
    function getFingersUsed( char2KeyMap, keyInfo ) {
        var hand = KB.finger.whichHand( keyInfo.fingerUsed ),
            fingers = {},
            shiftInfo,
            altGrInfo;

        //console.log("Entering getFingersUsed");

        fingers[keyInfo.fingerUsed] = true;

        if (keyInfo.pushType === KB.SHIFT_PUSH) {
            shiftInfo = (hand === "right") ? char2KeyMap[16] : char2KeyMap[-16];
            fingers[ shiftInfo.fingerUsed ] = true;
        } else if (keyInfo.pushType === KB.ALTGR_PUSH) {
            altGrInfo = char2KeyMap[-18];
            //console.dir(altGrInfo);
            fingers[ altGrInfo.fingerUsed ] = true;
        } else if (keyInfo.pushType === KB.SHIFT_ALTGR_PUSH) {
            shiftInfo = (hand === "right") ? char2KeyMap[16] : char2KeyMap[-16];
            altGrInfo = char2KeyMap[-18];
            fingers[ shiftInfo.fingerUsed ] = true;
            fingers[ altGrInfo.fingerUsed ] = true;
        }

        //console.log("Leaving getFingersUsed");

        return fingers;
    }

    /*
        input:
	        keyMap             - key map
	        fingerHomes        - object indexed by fingers, maps to key index where they start
	        fingerPositions    - current finger positions (same type of object as fingerHomes)
	        except             - finger indexes to not return to home keys
	        analysis           - analysis object
    */
    function returnFingersToHomeRow(config) {

        var finger,
            fingerHomes = config.fingerHomes,
            fingerPositions = config.fingerPositions,
            keyMap = config.keyMap,
            except = config.except,
            analysis = config.analysis;

        //console.log("Entering returnFingersToHomeRow");

        for (finger in KB.fingers) {
            if ( except[finger] ) {continue;} // don't return finger if in except list
            if ( fingerHomes[finger] === fingerPositions[finger]) {continue;} // finger already home
            //console.log("finger:"+finger);
            analysis.distance[finger] += distanceBetweenKeysCached(keyMap, fingerPositions[finger], fingerHomes[finger] );
            fingerPositions[finger] = fingerHomes[finger]; // return finger to key
        }

        //console.log("Leaving returnFingersToHomeRow");
    }

    /*
    Inputs:
	   keyInfo: char2KeyMap[charCode],
	   char2KeyMap:
	   fingerPositions: curFingerPos,
	   keyMap: keyMap,
	   analysis: analysis
    */
    function typeKey(config) {

        var keyInfo = config.keyInfo,
            char2KeyMap = config.char2KeyMap,
            fingerPositions = config.fingerPositions,
            keyMap = config.keyMap,
            analysis = config.analysis,
            hand = KB.finger.whichHand( keyInfo.fingerUsed ),
            shiftInfo = {},
            altGrInfo = {},
            errors = [],
            tmpHand;

        //console.log("Entering typeKey");

        switch (keyInfo.pushType) {
            case KB.SHIFT_PUSH:
                shiftInfo = (hand === "right") ? char2KeyMap[16] : char2KeyMap[-16];
                break;
            case KB.ALTGR_PUSH:
                altGrInfo = char2KeyMap[-18];
                break;
            case KB.SHIFT_ALTGR_PUSH:
                shiftInfo = (hand === "right") ? char2KeyMap[16] : char2KeyMap[-16];
                altGrInfo = char2KeyMap[-18];
                break;
        }

        if ( ( shiftInfo.fingerUsed && shiftInfo.fingerUsed === altGrInfo.fingerUsed ) ||
            shiftInfo.fingerUsed === keyInfo.fingerUsed ||
            altGrInfo.fingerUsed === keyInfo.fingerUsed ) {
            errors.push("Keyboard configuration error: Same finger used to type shift, altgr or " + String.fromCharCode(keyInfo.charCode));
            console.log("Exiting typeKey due to errors.");
            return errors;
        }

        //shift key has been lifted up
        if (
            (!angular.equals(analysis.tmp.prevShiftInfo, {}) && !angular.equals(shiftInfo, analysis.tmp.prevShiftInfo))
        ) {
            analysis.tmp.prevFingerUsed = analysis.tmp.prevShiftInfo.fingerUsed;
            analysis.tmp.prevHandUsed = KB.finger.leftRightOrThumb(analysis.tmp.prevShiftInfo.fingerUsed);
            analysis.tmp.prevKeyIndex = analysis.tmp.prevShiftInfo.keyIndex;
            //console.log('shift up');
        }

        // shift key has gone down
        if (
            (angular.equals(analysis.tmp.prevShiftInfo, {}) || !angular.equals(shiftInfo, analysis.tmp.prevShiftInfo)) &&
            !angular.equals(shiftInfo, {})
        ) {

            analysis.distance[shiftInfo.fingerUsed] += moveFingerToKey( keyMap, fingerPositions, shiftInfo );
            analysis.fingerUsage[shiftInfo.fingerUsed]++;
            analysis.rowUsage[keyMap[shiftInfo.keyIndex].row]++;
            analysis.keyData[shiftInfo.keyIndex].count++;
            analysis.numKeys++;
            analysis.modifierUse.shift++;

            if (analysis.tmp.prevFingerUsed === shiftInfo.fingerUsed) {
                if (analysis.tmp.prevKeyIndex !== shiftInfo.keyIndex) {
                    analysis.consecFingerPressIgnoreDups[shiftInfo.fingerUsed]++;
                }
                analysis.consecFingerPress[shiftInfo.fingerUsed]++;
            }
            analysis.tmp.prevFingerUsed = shiftInfo.fingerUsed;

            tmpHand = KB.finger.leftRightOrThumb(shiftInfo.fingerUsed);
            if (analysis.tmp.prevHandUsed === tmpHand ) {
                if (analysis.tmp.prevKeyIndex !== shiftInfo.keyIndex) {
                    analysis.consecHandPressIgnoreDups[tmpHand]++;
                }
                analysis.consecHandPress[tmpHand]++;
            }
            analysis.tmp.prevHandUsed = tmpHand;

            analysis.tmp.prevKeyIndex = shiftInfo.keyIndex;

            //console.log('shift down');

        } else if ( typeof shiftInfo.fingerUsed !== "undefined" ) {
            analysis.modifierUse.shift++;
        }

        // altgr key has been lifted up
        if (
            (!angular.equals(analysis.tmp.prevAltGrInfo, {}) && !angular.equals(altGrInfo, analysis.tmp.prevAltGrInfo))
        ) {
            analysis.tmp.prevFingerUsed = analysis.tmp.prevAltGrInfo.fingerUsed;
            analysis.tmp.prevHandUsed = KB.finger.leftRightOrThumb(analysis.tmp.prevAltGrInfo.fingerUsed);
            analysis.tmp.prevKeyIndex = analysis.tmp.prevAltGrInfo.keyIndex;
        }

        // altgr key has gone down
        if (
            (angular.equals(analysis.tmp.prevAltGrInfo, {}) || !angular.equals(altGrInfo, analysis.tmp.prevAltGrInfo)) &&
            !angular.equals(altGrInfo, {})
        ) {

            analysis.distance[altGrInfo.fingerUsed] += moveFingerToKey( keyMap, fingerPositions, altGrInfo );
            analysis.fingerUsage[altGrInfo.fingerUsed]++;
            analysis.rowUsage[keyMap[altGrInfo.keyIndex].row]++;
            analysis.keyData[altGrInfo.keyIndex].count++;
            analysis.numKeys++;
            analysis.modifierUse.altGr++;

            if (analysis.tmp.prevFingerUsed === altGrInfo.fingerUsed) {
                if (analysis.tmp.prevKeyIndex !== altGrInfo.keyIndex) {
                    analysis.consecFingerPressIgnoreDups[altGrInfo.fingerUsed]++;
                }
                analysis.consecFingerPress[altGrInfo.fingerUsed]++;
            }
            analysis.tmp.prevFingerUsed = altGrInfo.fingerUsed;

            tmpHand = KB.finger.leftRightOrThumb(altGrInfo.fingerUsed);
            if (analysis.tmp.prevHandUsed === tmpHand ) {
                if (analysis.tmp.prevKeyIndex !== altGrInfo.keyIndex) {
                    analysis.consecHandPressIgnoreDups[tmpHand]++;
                }
                analysis.consecHandPress[tmpHand]++;
            }
            analysis.tmp.prevHandUsed = tmpHand;

            analysis.tmp.prevKeyIndex = altGrInfo.keyIndex;

        } else if ( typeof altGrInfo.fingerUsed !== "undefined" ) {
            analysis.modifierUse.altGr++;
        }

        if ( ( shiftInfo.fingerUsed && shiftInfo.fingerUsed === altGrInfo.fingerUsed ) ||
            shiftInfo.fingerUsed === keyInfo.fingerUsed ||
            altGrInfo.fingerUsed === keyInfo.fingerUsed ) {
            errors.push("Keyboard configuration error: Same finger used to type shift, altgr or " + String.fromCharCode(keyInfo.charCode));
            console.log("Exiting typeKey due to errors.");
            return errors;
        }

        // record stats
    /*
        if ( typeof shiftInfo.fingerUsed !== "undefined" ) {
            analysis.distance[shiftInfo.fingerUsed] += moveFingerToKey( keyMap, fingerPositions, shiftInfo );
            analysis.fingerUsage[shiftInfo.fingerUsed]++;
            analysis.rowUsage[keyMap[shiftInfo.keyIndex].row]++;
            analysis.keyData[shiftInfo.keyIndex].count++;
            analysis.numKeys++;
            analysis.modifierUse.shift++;

            if (analysis.tmp.prevFingerUsed === shiftInfo.fingerUsed) {
                if (analysis.tmp.prevKeyIndex !== shiftInfo.keyIndex) {
                    analysis.consecFingerPressIgnoreDups[shiftInfo.fingerUsed]++;
                }
                analysis.consecFingerPress[shiftInfo.fingerUsed]++;
            }
            analysis.tmp.prevFingerUsed = shiftInfo.fingerUsed;

            tmpHand = KB.finger.leftRightOrThumb(shiftInfo.fingerUsed);
            if (analysis.tmp.prevHandUsed === tmpHand ) {
                if (analysis.tmp.prevKeyIndex !== shiftInfo.keyIndex) {
                    analysis.consecHandPressIgnoreDups[tmpHand]++;
                }
                analysis.consecHandPress[tmpHand]++;
            }
            analysis.tmp.prevHandUsed = tmpHand;

            analysis.tmp.prevKeyIndex = shiftInfo.keyIndex;
        }
        */
        /*
        if ( typeof altGrInfo.fingerUsed !== "undefined" ) {
            analysis.distance[altGrInfo.fingerUsed] += moveFingerToKey( keyMap, fingerPositions, altGrInfo );
            analysis.fingerUsage[altGrInfo.fingerUsed]++;
            analysis.rowUsage[keyMap[altGrInfo.keyIndex].row]++;
            analysis.keyData[altGrInfo.keyIndex].count++;
            analysis.numKeys++;
            analysis.modifierUse.altGr++;

            if (analysis.tmp.prevFingerUsed === altGrInfo.fingerUsed) {
                if (analysis.tmp.prevKeyIndex !== altGrInfo.keyIndex) {
                    analysis.consecFingerPressIgnoreDups[altGrInfo.fingerUsed]++;
                }
                analysis.consecFingerPress[altGrInfo.fingerUsed]++;
            }
            analysis.tmp.prevFingerUsed = altGrInfo.fingerUsed;

            tmpHand = KB.finger.leftRightOrThumb(altGrInfo.fingerUsed);
            if (analysis.tmp.prevHandUsed === tmpHand ) {
                if (analysis.tmp.prevKeyIndex !== altGrInfo.keyIndex) {
                    analysis.consecHandPressIgnoreDups[tmpHand]++;
                }
                analysis.consecHandPress[tmpHand]++;
            }
            analysis.tmp.prevHandUsed = tmpHand;

            analysis.tmp.prevKeyIndex = altGrInfo.keyIndex;
        }
        */

        if (typeof shiftInfo.fingerUsed !== "undefined" && typeof altGrInfo.fingerUsed !== "undefined") {
            analysis.modifierUse.shiftAltGr++;
        }

        // handle the key that was typed

        analysis.fingerUsage[keyInfo.fingerUsed]++;
        analysis.distance[keyInfo.fingerUsed] += moveFingerToKey( keyMap, fingerPositions, keyInfo );
        analysis.rowUsage[keyMap[keyInfo.keyIndex].row]++;
        analysis.keyData[keyInfo.keyIndex].count++;
        analysis.numKeys++;

        if (analysis.tmp.prevFingerUsed === keyInfo.fingerUsed) {
            if (analysis.tmp.prevKeyIndex !== keyInfo.keyIndex) {
                analysis.consecFingerPressIgnoreDups[keyInfo.fingerUsed]++;
            }
            analysis.consecFingerPress[keyInfo.fingerUsed]++;
        }
        analysis.tmp.prevFingerUsed = keyInfo.fingerUsed;

        tmpHand = KB.finger.leftRightOrThumb(keyInfo.fingerUsed);
        if (analysis.tmp.prevHandUsed === tmpHand ) {
            if (analysis.tmp.prevKeyIndex !== keyInfo.keyIndex) {
                analysis.consecHandPressIgnoreDups[tmpHand]++;
            }
            analysis.consecHandPress[tmpHand]++;
        }
        analysis.tmp.prevHandUsed = tmpHand;

        // update key index for next press
        analysis.tmp.prevKeyIndex = keyInfo.keyIndex;

        analysis.tmp.prevShiftInfo = shiftInfo;
        analysis.tmp.prevAltGrInfo = altGrInfo;

        //console.log("Leaving typeKey");
        return errors;
    }

    /*
        Updates the fingerPositions object and returns the distance the finger moved
    */
    function moveFingerToKey( keyMap, fingerPositions, keyInfo) {
        //console.log("Entering moveFingerToKey");
        var dist = distanceBetweenKeysCached(keyMap, keyInfo.keyIndex, fingerPositions[keyInfo.fingerUsed]);
        fingerPositions[keyInfo.fingerUsed] = keyInfo.keyIndex;
        //console.log("Exiting moveFingerToKey");
        return dist;
    }

    /*
        config.keyMap
        config.keySet
        config.text
    */
    me.examine = function(config) {
        if (!config || !config.keyMap || !config.keySet || typeof config.text === "undefined") {
            console.log("config object for examine function does not contain the needed parameters.");
            return;
        }

        var tLen = config.text.length,
            ii,
            jj,
            text = config.text.replace(/\r\n/g,"\r").replace(/\n/g,"\r"),
            keyMap = config.keyMap,
            keySet = config.keySet,
            charCode,
            finger,
            fingerLabel,
            curFingerPos = {},
            char2KeyMap = {},
            analysis = {}; // holds data we collect

//console.log('-----')

        analysis.distance =    [0,0,0,0,0,0,0,0,0,0,0];
        analysis.fingerUsage = [0,0,0,0,0,0,0,0,0,0,0];
        analysis.rowUsage = [0, 0, 0, 0, 0];
        analysis.errors = [];
        analysis.keyData = {length:0}; // records number of times pushed
        analysis.charData = {}; // records information about characters // TODO: charData should only be computed once, not 5-6 times
        analysis.tmp = {}; // holds temporary data
        analysis.tmp.prevShiftInfo = {};
        analysis.tmp.prevAltGrInfo = {};
        analysis.consecFingerPress = [0,0,0,0,0,0,0,0,0,0,0];
        analysis.consecFingerPressIgnoreDups = [0,0,0,0,0,0,0,0,0,0,0];
        analysis.consecHandPress = {"left":0,"right":0,"thumbs":0};
        analysis.consecHandPressIgnoreDups = {"left":0,"right":0,"thumbs":0};
        analysis.modifierUse = {"shift":0,"altGr":0,"shiftAltGr":0};
        analysis.numKeys = 0;

        // initialize data keyData and charData data set
        for (ii = 0; ii < keySet.keys.length; ii++) {
            analysis.keyData[ii] = {};
            analysis.keyData[ii].count = 0;
            analysis.keyData[ii].index = ii;
            analysis.keyData.length++;

            for (jj in KB.PUSH_TYPES) {
                charCode = keySet.keys[ii][KB.PUSH_TYPES[jj]];
                if (typeof charCode === "number") {
                    analysis.charData[charCode] = {};
                }
            }
        }

        distanceBetweenKeysCached = memoize(distanceBetweenKeys);

        // initialize current finger positions
        curFingerPos[KB.finger.LEFT_PINKY] = keySet.fingerStart[KB.finger.LEFT_PINKY];
        curFingerPos[KB.finger.LEFT_RING] = keySet.fingerStart[KB.finger.LEFT_RING];
        curFingerPos[KB.finger.LEFT_MIDDLE] = keySet.fingerStart[KB.finger.LEFT_MIDDLE];
        curFingerPos[KB.finger.LEFT_INDEX] = keySet.fingerStart[KB.finger.LEFT_INDEX];
        curFingerPos[KB.finger.LEFT_THUMB] = keySet.fingerStart[KB.finger.LEFT_THUMB];
        curFingerPos[KB.finger.RIGHT_THUMB] = keySet.fingerStart[KB.finger.RIGHT_THUMB];
        curFingerPos[KB.finger.RIGHT_INDEX] = keySet.fingerStart[KB.finger.RIGHT_INDEX];
        curFingerPos[KB.finger.RIGHT_MIDDLE] = keySet.fingerStart[KB.finger.RIGHT_MIDDLE];
        curFingerPos[KB.finger.RIGHT_RING] = keySet.fingerStart[KB.finger.RIGHT_RING];
        curFingerPos[KB.finger.RIGHT_PINKY] = keySet.fingerStart[KB.finger.RIGHT_PINKY];

        // shit and altgr keys
        char2KeyMap[16] = char2KeyMap[16] || findCharInKeySet(keySet, 16);
        char2KeyMap[-16] = char2KeyMap[-16] || findCharInKeySet(keySet, -16);
        char2KeyMap[-18] = char2KeyMap[-18] || findCharInKeySet(keySet, -18);

        if (char2KeyMap[16].errors.length > 1) {
            analysis.errors.push("Fatal Error: (left) Shift key not set correctly.");
            return analysis;
        }
        if (char2KeyMap[-16].errors.length > 1) {
            analysis.errors.push("Fatal Error: (right) Shift key not set correctly.");
            return analysis;
        }
        if (char2KeyMap[16].errors.length > 1) {
            analysis.errors.push("Fatal Error: AltGr key not set correctly.");
            return analysis;
        }

        for (ii = 0; ii < tLen; ii++) {
            charCode = text.charCodeAt(ii);
            //console.log(charCode);

            // return object contains: fingerUsed, keyIndex, pushType, errors
            char2KeyMap[charCode] = char2KeyMap[charCode] || findCharInKeySet(keySet, charCode);

            if ( char2KeyMap[charCode].fingerUsed === null ) {
                console.log("Char code not found on keyboard (ignoring key):" + charCode);
                analysis.errors.push.apply(analysis.errors, char2KeyMap[charCode].errors);
                continue;
            }

            returnFingersToHomeRow({
                keyMap: keyMap,
                fingerHomes: keySet.fingerStart,
                fingerPositions: curFingerPos,
                except: getFingersUsed( char2KeyMap, char2KeyMap[charCode] ),
                analysis: analysis
            });

            typeKey({
                keyInfo: char2KeyMap[charCode],
                char2KeyMap: char2KeyMap,
                fingerPositions: curFingerPos,
                keyMap: keyMap,
                analysis: analysis
            });
        }

        // done typing, but return fingers to the home row
        returnFingersToHomeRow({
            keyMap: keyMap,
            fingerHomes: keySet.fingerStart,
            fingerPositions: curFingerPos,
            except: {},
            analysis: analysis
        });

        analysis.pixelsPerCm = keyMap.pixelsPerCm;
        analysis.layoutName = keySet.label;

        for (finger in KB.fingers) {
            fingerLabel = KB.fingers[finger];
	        //console.log(fingerLabel + " distance:" + analysis.distance[ finger ]);
	        var numCm = (analysis.distance[ finger ] / keyMap.pixelsPerCm);
	        var numMeters = (numCm * 0.001);
	        var numFeet = numMeters * 3.2808399;
	        var numMiles = numMeters * 0.000621371192;

	        //console.log("meters:" + numMeters);
	        //console.log("feet:" + numFeet);
	        //console.log("miles:" + numMiles);
	    }

        distanceBetweenKeysCached = null;
        return analysis;
    };

    /*
        Takes in results from multiple calls to examine and scores them
    */
    me.scoreLayouts = function(analysis) {
        var results = {};

        // DISTANCE
        results.distScores = [];

        var ii, jj, total = [], len = analysis.length;
        for (ii = 0; ii < len; ii++) {
            total[ii] = 0;
            for (jj = 0; jj < analysis[ii].distance.length; jj++) {
                total[ii] += (analysis[ii].distance[jj] / analysis[ii].pixelsPerCm);
            }
        }

        for (ii = 0; ii < len; ii++) {
            results.distScores[ii] = Math.max(0, 4 - (total[ii] / analysis[ii].numKeys)) / 4;
            if ( !isFinite(results.distScores[ii]) ) { results.distScores[ii]=0;}
        }

        // FINGER USAGE
        results.fingerScores = [];
        var percent;
        var fScoring = {};
        fScoring[KB.finger.LEFT_PINKY] =    0.5;
        fScoring[KB.finger.LEFT_RING] =     1.0;
        fScoring[KB.finger.LEFT_MIDDLE] =   4.0;
        fScoring[KB.finger.LEFT_INDEX] =    2.0;
        fScoring[KB.finger.LEFT_THUMB] =    0.5;
        fScoring[KB.finger.RIGHT_THUMB] =   0.5;
        fScoring[KB.finger.RIGHT_INDEX] =   2.0;
        fScoring[KB.finger.RIGHT_MIDDLE] =  4.0;
        fScoring[KB.finger.RIGHT_RING] =    1.0;
        fScoring[KB.finger.RIGHT_PINKY] =   0.5;

        for (ii = 0; ii < len; ii++) {
            total = 0;
            for (jj = 0; jj < analysis[ii].fingerUsage.length; jj++) {
                if (!fScoring[jj]) {continue;}//skip non-fingers
                percent = (analysis[ii].fingerUsage[jj] / analysis[ii].numKeys) * 100;
                percent = Math.min(percent, 20); // 20 is the max allowed percent
                total += (percent * fScoring[jj]);
            }
            results.fingerScores[ii] = total / 260; // 220 is max possible score
        }

        // CONSEC FINGER USAGE
        results.consecFingerScores = [];
        total = [];
        for (ii = 0; ii < len; ii++) {
            total[ii] = 0;
            for (jj = 0; jj < analysis[ii].consecFingerPressIgnoreDups.length; jj++) {
                total[ii] += analysis[ii].consecFingerPressIgnoreDups[jj] ;
            }
            total[ii] = (total[ii] / analysis[ii].numKeys) * 100;
        }
        for (ii = 0; ii < len; ii++) {
            results.consecFingerScores[ii] = Math.max(0, 10 - total[ii]) / 10;
        }

        // CONSEC HAND USAGE
        results.consecHandScores = [];
        total = [];
        for (ii = 0; ii < len; ii++) {
            total[ii] = (analysis[ii].consecHandPressIgnoreDups["left"] +
                         analysis[ii].consecHandPressIgnoreDups["right"]) / analysis[ii].numKeys;
            total[ii] = (total[ii]) * 100;
        }
        for (ii = 0; ii < len; ii++) {
            results.consecHandScores[ii] = Math.max(0, 50 - total[ii]) / 50;
        }

        // put it all together!
        var consecHandWeight = 17, consecFingerWeight = 17, fingerUsageWeight = 33, distWeight = 33;
        results.finalList = [];
        for (ii = 0; ii < len; ii++) {
            results.finalList[ii] = {};
            results.finalList[ii].layoutName = analysis[ii].layoutName;
            results.finalList[ii].score =
                (results.consecHandScores[ii] * consecHandWeight) +
                (results.consecFingerScores[ii] * consecFingerWeight) +
                (results.fingerScores[ii] * fingerUsageWeight) +
                (results.distScores[ii] * distWeight);
            if ( !isFinite( results.finalList[ii].score ) ) { results.finalList[ii].score=0;}
        }

        results.finalList.sort(function(a,b) {
            return b.score - a.score;
        });

        return results;
    };

    return me;
})();


text:
package com.example;

class ApiBase {
}


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.cirurgica.model;

/**
 *
 * @author Leo
 */
public class EstadoCivil {

    private Integer cdEsatdoVicil;
    private String nmEstadoCivil;

    public EstadoCivil() {
    }

    /**
     * @return the cdEsatdoVicil
     */
    public Integer getCdEsatdoVicil() {
        return cdEsatdoVicil;
    }

    /**
     * @param cdEsatdoVicil the cdEsatdoVicil to set
     */
    public void setCdEsatdoVicil(Integer cdEsatdoVicil) {
        this.cdEsatdoVicil = cdEsatdoVicil;
    }

    /**
     * @return the nmEstadoCivil
     */
    public String getNmEstadoCivil() {
        return nmEstadoCivil;
    }

    /**
     * @param nmEstadoCivil the nmEstadoCivil to set
     */
    public void setNmEstadoCivil(String nmEstadoCivil) {
        this.nmEstadoCivil = nmEstadoCivil;
    }
}


text:
+++
title = "Reading List #3"
date = 2018-02-02T13:40:30Z
metatitle = "Reading List #3 — James Greenwood"
metadescription = "My weekly reading list #3. Things I've read and enjoyed over the last 7 days."
+++

## Quincy Jones. Some life!

I really enjoyed reading this. Quincy Jones has had some life (and still giving the ball a kick by all accounts!). A long read but well worth the time.

[https://www.gq.com/story/quincy-jones-has-a-story](Quincy Jones has a story)

## Screenpeek

Come in handy on a few Shopify projects that we're working on at the minute.

[https://screenpeek.io/](Get Screenpeek)

## The missing bullet holes

Loved this story — so much so that I've bought the book.

[The missing bullet holes](https://medium.com/@penguinpress/an-excerpt-from-how-not-to-be-wrong-by-jordan-ellenberg-664e708cfc3d)

—

See you next week.


text:
ENV["RAILS_ENV"] ||= "test"

require File.expand_path(File.dirname(__FILE__) + '/../../spec/fixtures/app/config/environment')
require 'cucumber/rails/world'
require 'cucumber/rails/rspec'
require 'cucumber/formatter/unicode'

require 'webrat'
require 'webrat/core/matchers'

# grrr, finding this sucked
ActionController::Base.allow_rescue = true

Webrat.configure do |config|
  config.mode = :rails
end


text:
The actual snapshot is saved in `test.js.snap`.

Generated by [AVA](https://avajs.dev).

## snapshots cannot be used in hooks

> error message

    '`t.snapshot()` can only be used in tests'

## `t.try()` cannot be used in hooks

> error message

    '`t.try()` can only be used in tests'


text:
module ActiveRecord
  module Associations
    class AssociationProxy #:nodoc:
      protected
        def set_belongs_to_association_for(record)
          if @reflection.options[:as]
            record["#{@reflection.options[:as]}_id"]   = @owner.id unless @owner.new_record?
            record["#{@reflection.options[:as]}_type"] = @owner.class.base_class.name.to_s
          elsif @reflection.options[:primary_key]
            record[@reflection.primary_key_name] = @owner.send(@reflection.options[:primary_key]) unless @owner.new_record?
          else
            record[@reflection.primary_key_name] = @owner.id unless @owner.new_record?
          end
        end
    end
  end
end


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>org.ctnitchie</groupId>
	<artifactId>doclet.freemarker</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>doclet.freemarker</name>
	<url>http://maven.apache.org</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.3</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>2.5.5</version>
				<configuration>
					<descriptorRefs>
						<descriptorRef>jar-with-dependencies</descriptorRef>
					</descriptorRefs>
					<appendAssemblyId>false</appendAssemblyId>
					<finalName>freemarkerdoclet</finalName>
					<classifier>jar-with-dependencies</classifier>
				</configuration>
				<executions>
					<execution>
						<id>make-assembly</id> <!-- this is used for inheritance merges -->
						<phase>package</phase> <!-- bind to the packaging phase -->
						<goals>
							<goal>single</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.sun</groupId>
			<artifactId>tools</artifactId>
			<version>1.7.0</version>
			<scope>system</scope>
			<systemPath>${java.home}/../lib/tools.jar</systemPath>
		</dependency>
		<dependency>
			<groupId>org.freemarker</groupId>
			<artifactId>freemarker</artifactId>
			<version>2.3.28</version>
		</dependency>
		<dependency>
			<groupId>org.jsoup</groupId>
			<artifactId>jsoup</artifactId>
			<version>1.8.2</version>
		</dependency>
	</dependencies>
</project>


text:
class URL
  class Service
    module AcceptsEndpoint

      # creates the endpoint for which ever object it's imported into
      def endpoint arg, &blk
        endpoint = if arg.is_a?(Hash)
          f = arg.first
          name = f.shift
          f.shift
        else
          name = arg
        end

        eigenclass.send :attr_reader, "#{name}_endpoint"
        instance_eval <<-RUBY, __FILE__, __LINE__
          def #{name} params=nil, args={}
            if params.nil?
              @#{name}_endpoint
            else
              @#{name}_endpoint.find(params,args)
            end
          end
        RUBY

        builder = EndpointBuilder.new(@base_url,endpoint,&blk)
        e = builder._endpoint

        e.inflate_into ||= @inflate_into if @inflate_into
        instance_variable_set "@#{name}_endpoint",e
      end

      # allows access to the eigenclass
      def eigenclass
        class << self; self; end
      end
    end
  end
end


text:
(function($) {

    $.widget("mapbender.mbCopyright", {
        options: {},
        elementUrl: null,
        popup: null,
        _create: function() {
            this.elementUrl = Mapbender.configuration.application.urls.element + '/' + this.element.attr('id') + '/';
            if(this.options.autoOpen){
                this.open();
            }
            this._trigger('ready');
            this._ready();
        },

        /**
         * Default action for mapbender element
         */
        defaultAction: function(callback){
            this.open(callback);
        },
        open: function(callback){
            this.callback = callback ? callback : null;
            var self = this;
            if(!this.popup || !this.popup.$element){
               this.popup = new Mapbender.Popup2({
                    title: self.element.attr('title'),
                    modal: true,
                    closeButton: true,
                    closeOnOutsideClick: true,
                    content: [ $.ajax({url: self.elementUrl + 'content'})],
                    width: 350,
                    height: 170,
                    buttons: {
                        'ok': {
                            label: 'OK',
                            cssClass: 'button right',
                            callback: function(){
                                this.close();
                            }
                        }
                    }
                });
            } else {
                this.popup.open();
            }
        },
        close: function(){
            if(this.popup){
                this.popup.close();
            }
            this.callback ? this.callback.call() : this.callback = null;
        },
        /**
         *
         */
        ready: function(callback) {
            if(this.readyState === true) {
                callback();
            } else {
                this.readyCallbacks.push(callback);
            }
        },
        /**
         *
         */
        _ready: function() {
            for(callback in this.readyCallbacks) {
                callback();
                delete(this.readyCallbacks[callback]);
            }
            this.readyState = true;
        },
        _destroy: $.noop
    });

})(jQuery);


text:
package edu.gemini.pit.ui.util;

import javax.swing.ImageIcon;
import java.awt.Component;
import java.awt.Graphics;
import java.net.URL;

/**
 * An Icon that draws itself at a position offset from the passed coords. Useful for pushing
 * around icons that don't like up the way you want, without having to mess with the image
 * file. Yes, it's lazy.
 * @author rnorris
 */
@SuppressWarnings("serial")
public class OffsetImageIcon extends ImageIcon {

	private final int xoffset, yoffset;

	public OffsetImageIcon(URL url, int xoffset, int yoffset) {
		super(url);
		this.xoffset = xoffset;
		this.yoffset = yoffset;
	}

	@Override
	public synchronized void paintIcon(Component arg0, Graphics arg1, int arg2, int arg3) {
		super.paintIcon(arg0, arg1, arg2 + xoffset, arg3 + yoffset);
	}

}


text:
<?php

class Leads_builder {

	static protected $_ci;

	private static function init(){
		self::$_ci = & get_instance();
	}

	public static function initLeadsRepository(){
		self::init();
		$leadsArray = array('Singer','Writer','Composer','Producer');
		self::$_ci->load->entities($leadsArray,'listing_leads');
		self::$_ci->load->repository('LeadsRepository','listing_leads');
		self::$_ci->load->model('listing_leads/leads_model');
		self::$_ci->load->library('listing_leads/leads_lib');
		self::$_ci->load->library('listing_leads/leads_cache');
	}

	public static function getLeadsRepository(){
		self::initLeadsRepository();
		$leadsModel = new leads_model();
		$leadsLib   = new leads_lib($leadsModel);
		$leadsCache = new leads_cache();
		return new LeadsRepository($leadsModel,$leadsLib,$leadsCache);
	}
}


text:
User Manual

If you are seeing this message, it is because the Hacking Guide was not built during the Apache ActiveMQ Artemis build.  To
build Apache ActiveMQ Artemis with the Hacking Guide you must use the maven release profile:
mvn clean install -Prelease.


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/bigquery/dataexchange/v1beta1/dataexchange.proto

namespace Google\Cloud\BigQuery\DataExchange\V1beta1;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * A listing is what gets published into a data exchange that a subscriber can
 * subscribe to. It contains a reference to the data source along with
 * descriptive information that will help subscribers find and subscribe the
 * data.
 *
 * Generated from protobuf message google.cloud.bigquery.dataexchange.v1beta1.Listing
 */
class Listing extends \Google\Protobuf\Internal\Message
{
    /**
     * Output only. The resource name of the listing.
     * e.g. `projects/myproject/locations/US/dataExchanges/123/listings/456`
     *
     * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     */
    private $name = '';
    /**
     * Required. Human-readable display name of the listing. The display name must contain
     * only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces
     * ( ), ampersands (&) and can't start or end with spaces.
     * Default value is an empty string.
     * Max length: 63 bytes.
     *
     * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED];
     */
    private $display_name = '';
    /**
     * Optional. Short description of the listing. The description must not contain
     * Unicode non-characters and C0 and C1 control codes except tabs (HT),
     * new lines (LF), carriage returns (CR), and page breaks (FF).
     * Default value is an empty string.
     * Max length: 2000 bytes.
     *
     * Generated from protobuf field string description = 3 [(.google.api.field_behavior) = OPTIONAL];
     */
    private $description = '';
    /**
     * Optional. Email or URL of the primary point of contact of the listing.
     * Max Length: 1000 bytes.
     *
     * Generated from protobuf field string primary_contact = 4 [(.google.api.field_behavior) = OPTIONAL];
     */
    private $primary_contact = '';
    /**
     * Optional. Documentation describing the listing.
     *
     * Generated from protobuf field string documentation = 5 [(.google.api.field_behavior) = OPTIONAL];
     */
    private $documentation = '';
    /**
     * Output only. Current state of the listing.
     *
     * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.Listing.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];
     */
    private $state = 0;
    /**
     * Optional. Base64 encoded image representing the listing. Max Size: 3.0MiB
     * Expected image dimensions are 512x512 pixels, however the API only
     * performs validation on size of the encoded data.
     * Note: For byte fields, the contents of the field are base64-encoded (which
     * increases the size of the data by 33-36%) when using JSON on the wire.
     *
     * Generated from protobuf field bytes icon = 8 [(.google.api.field_behavior) = OPTIONAL];
     */
    private $icon = '';
    /**
     * Optional. Details of the data provider who owns the source data.
     *
     * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.DataProvider data_provider = 9 [(.google.api.field_behavior) = OPTIONAL];
     */
    private $data_provider = null;
    /**
     * Optional. Categories of the listing. Up to two categories are allowed.
     *
     * Generated from protobuf field repeated .google.cloud.bigquery.dataexchange.v1beta1.Listing.Category categories = 10 [(.google.api.field_behavior) = OPTIONAL];
     */
    private $categories;
    /**
     * Optional. Details of the publisher who owns the listing and who can share
     * the source data.
     *
     * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.Publisher publisher = 11 [(.google.api.field_behavior) = OPTIONAL];
     */
    private $publisher = null;
    /**
     * Optional. Email or URL of the request access of the listing.
     * Subscribers can use this reference to request access.
     * Max Length: 1000 bytes.
     *
     * Generated from protobuf field string request_access = 12 [(.google.api.field_behavior) = OPTIONAL];
     */
    private $request_access = '';
    protected $source;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\BigQuery\DataExchange\V1beta1\Listing\BigQueryDatasetSource $bigquery_dataset
     *           Required. Shared dataset i.e. BigQuery dataset source.
     *     @type string $name
     *           Output only. The resource name of the listing.
     *           e.g. `projects/myproject/locations/US/dataExchanges/123/listings/456`
     *     @type string $display_name
     *           Required. Human-readable display name of the listing. The display name must contain
     *           only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces
     *           ( ), ampersands (&) and can't start or end with spaces.
     *           Default value is an empty string.
     *           Max length: 63 bytes.
     *     @type string $description
     *           Optional. Short description of the listing. The description must not contain
     *           Unicode non-characters and C0 and C1 control codes except tabs (HT),
     *           new lines (LF), carriage returns (CR), and page breaks (FF).
     *           Default value is an empty string.
     *           Max length: 2000 bytes.
     *     @type string $primary_contact
     *           Optional. Email or URL of the primary point of contact of the listing.
     *           Max Length: 1000 bytes.
     *     @type string $documentation
     *           Optional. Documentation describing the listing.
     *     @type int $state
     *           Output only. Current state of the listing.
     *     @type string $icon
     *           Optional. Base64 encoded image representing the listing. Max Size: 3.0MiB
     *           Expected image dimensions are 512x512 pixels, however the API only
     *           performs validation on size of the encoded data.
     *           Note: For byte fields, the contents of the field are base64-encoded (which
     *           increases the size of the data by 33-36%) when using JSON on the wire.
     *     @type \Google\Cloud\BigQuery\DataExchange\V1beta1\DataProvider $data_provider
     *           Optional. Details of the data provider who owns the source data.
     *     @type array<int>|\Google\Protobuf\Internal\RepeatedField $categories
     *           Optional. Categories of the listing. Up to two categories are allowed.
     *     @type \Google\Cloud\BigQuery\DataExchange\V1beta1\Publisher $publisher
     *           Optional. Details of the publisher who owns the listing and who can share
     *           the source data.
     *     @type string $request_access
     *           Optional. Email or URL of the request access of the listing.
     *           Subscribers can use this reference to request access.
     *           Max Length: 1000 bytes.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Bigquery\Dataexchange\V1Beta1\Dataexchange::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. Shared dataset i.e. BigQuery dataset source.
     *
     * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.Listing.BigQueryDatasetSource bigquery_dataset = 6 [(.google.api.field_behavior) = REQUIRED];
     * @return \Google\Cloud\BigQuery\DataExchange\V1beta1\Listing\BigQueryDatasetSource|null
     */
    public function getBigqueryDataset()
    {
        return $this->readOneof(6);
    }

    public function hasBigqueryDataset()
    {
        return $this->hasOneof(6);
    }

    /**
     * Required. Shared dataset i.e. BigQuery dataset source.
     *
     * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.Listing.BigQueryDatasetSource bigquery_dataset = 6 [(.google.api.field_behavior) = REQUIRED];
     * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\Listing\BigQueryDatasetSource $var
     * @return $this
     */
    public function setBigqueryDataset($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\BigQuery\DataExchange\V1beta1\Listing\BigQueryDatasetSource::class);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * Output only. The resource name of the listing.
     * e.g. `projects/myproject/locations/US/dataExchanges/123/listings/456`
     *
     * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Output only. The resource name of the listing.
     * e.g. `projects/myproject/locations/US/dataExchanges/123/listings/456`
     *
     * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Required. Human-readable display name of the listing. The display name must contain
     * only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces
     * ( ), ampersands (&) and can't start or end with spaces.
     * Default value is an empty string.
     * Max length: 63 bytes.
     *
     * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED];
     * @return string
     */
    public function getDisplayName()
    {
        return $this->display_name;
    }

    /**
     * Required. Human-readable display name of the listing. The display name must contain
     * only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces
     * ( ), ampersands (&) and can't start or end with spaces.
     * Default value is an empty string.
     * Max length: 63 bytes.
     *
     * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED];
     * @param string $var
     * @return $this
     */
    public function setDisplayName($var)
    {
        GPBUtil::checkString($var, True);
        $this->display_name = $var;

        return $this;
    }

    /**
     * Optional. Short description of the listing. The description must not contain
     * Unicode non-characters and C0 and C1 control codes except tabs (HT),
     * new lines (LF), carriage returns (CR), and page breaks (FF).
     * Default value is an empty string.
     * Max length: 2000 bytes.
     *
     * Generated from protobuf field string description = 3 [(.google.api.field_behavior) = OPTIONAL];
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Optional. Short description of the listing. The description must not contain
     * Unicode non-characters and C0 and C1 control codes except tabs (HT),
     * new lines (LF), carriage returns (CR), and page breaks (FF).
     * Default value is an empty string.
     * Max length: 2000 bytes.
     *
     * Generated from protobuf field string description = 3 [(.google.api.field_behavior) = OPTIONAL];
     * @param string $var
     * @return $this
     */
    public function setDescription($var)
    {
        GPBUtil::checkString($var, True);
        $this->description = $var;

        return $this;
    }

    /**
     * Optional. Email or URL of the primary point of contact of the listing.
     * Max Length: 1000 bytes.
     *
     * Generated from protobuf field string primary_contact = 4 [(.google.api.field_behavior) = OPTIONAL];
     * @return string
     */
    public function getPrimaryContact()
    {
        return $this->primary_contact;
    }

    /**
     * Optional. Email or URL of the primary point of contact of the listing.
     * Max Length: 1000 bytes.
     *
     * Generated from protobuf field string primary_contact = 4 [(.google.api.field_behavior) = OPTIONAL];
     * @param string $var
     * @return $this
     */
    public function setPrimaryContact($var)
    {
        GPBUtil::checkString($var, True);
        $this->primary_contact = $var;

        return $this;
    }

    /**
     * Optional. Documentation describing the listing.
     *
     * Generated from protobuf field string documentation = 5 [(.google.api.field_behavior) = OPTIONAL];
     * @return string
     */
    public function getDocumentation()
    {
        return $this->documentation;
    }

    /**
     * Optional. Documentation describing the listing.
     *
     * Generated from protobuf field string documentation = 5 [(.google.api.field_behavior) = OPTIONAL];
     * @param string $var
     * @return $this
     */
    public function setDocumentation($var)
    {
        GPBUtil::checkString($var, True);
        $this->documentation = $var;

        return $this;
    }

    /**
     * Output only. Current state of the listing.
     *
     * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.Listing.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @return int
     */
    public function getState()
    {
        return $this->state;
    }

    /**
     * Output only. Current state of the listing.
     *
     * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.Listing.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @param int $var
     * @return $this
     */
    public function setState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\DataExchange\V1beta1\Listing\State::class);
        $this->state = $var;

        return $this;
    }

    /**
     * Optional. Base64 encoded image representing the listing. Max Size: 3.0MiB
     * Expected image dimensions are 512x512 pixels, however the API only
     * performs validation on size of the encoded data.
     * Note: For byte fields, the contents of the field are base64-encoded (which
     * increases the size of the data by 33-36%) when using JSON on the wire.
     *
     * Generated from protobuf field bytes icon = 8 [(.google.api.field_behavior) = OPTIONAL];
     * @return string
     */
    public function getIcon()
    {
        return $this->icon;
    }

    /**
     * Optional. Base64 encoded image representing the listing. Max Size: 3.0MiB
     * Expected image dimensions are 512x512 pixels, however the API only
     * performs validation on size of the encoded data.
     * Note: For byte fields, the contents of the field are base64-encoded (which
     * increases the size of the data by 33-36%) when using JSON on the wire.
     *
     * Generated from protobuf field bytes icon = 8 [(.google.api.field_behavior) = OPTIONAL];
     * @param string $var
     * @return $this
     */
    public function setIcon($var)
    {
        GPBUtil::checkString($var, False);
        $this->icon = $var;

        return $this;
    }

    /**
     * Optional. Details of the data provider who owns the source data.
     *
     * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.DataProvider data_provider = 9 [(.google.api.field_behavior) = OPTIONAL];
     * @return \Google\Cloud\BigQuery\DataExchange\V1beta1\DataProvider|null
     */
    public function getDataProvider()
    {
        return $this->data_provider;
    }

    public function hasDataProvider()
    {
        return isset($this->data_provider);
    }

    public function clearDataProvider()
    {
        unset($this->data_provider);
    }

    /**
     * Optional. Details of the data provider who owns the source data.
     *
     * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.DataProvider data_provider = 9 [(.google.api.field_behavior) = OPTIONAL];
     * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\DataProvider $var
     * @return $this
     */
    public function setDataProvider($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\BigQuery\DataExchange\V1beta1\DataProvider::class);
        $this->data_provider = $var;

        return $this;
    }

    /**
     * Optional. Categories of the listing. Up to two categories are allowed.
     *
     * Generated from protobuf field repeated .google.cloud.bigquery.dataexchange.v1beta1.Listing.Category categories = 10 [(.google.api.field_behavior) = OPTIONAL];
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getCategories()
    {
        return $this->categories;
    }

    /**
     * Optional. Categories of the listing. Up to two categories are allowed.
     *
     * Generated from protobuf field repeated .google.cloud.bigquery.dataexchange.v1beta1.Listing.Category categories = 10 [(.google.api.field_behavior) = OPTIONAL];
     * @param array<int>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setCategories($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\BigQuery\DataExchange\V1beta1\Listing\Category::class);
        $this->categories = $arr;

        return $this;
    }

    /**
     * Optional. Details of the publisher who owns the listing and who can share
     * the source data.
     *
     * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.Publisher publisher = 11 [(.google.api.field_behavior) = OPTIONAL];
     * @return \Google\Cloud\BigQuery\DataExchange\V1beta1\Publisher|null
     */
    public function getPublisher()
    {
        return $this->publisher;
    }

    public function hasPublisher()
    {
        return isset($this->publisher);
    }

    public function clearPublisher()
    {
        unset($this->publisher);
    }

    /**
     * Optional. Details of the publisher who owns the listing and who can share
     * the source data.
     *
     * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.Publisher publisher = 11 [(.google.api.field_behavior) = OPTIONAL];
     * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\Publisher $var
     * @return $this
     */
    public function setPublisher($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\BigQuery\DataExchange\V1beta1\Publisher::class);
        $this->publisher = $var;

        return $this;
    }

    /**
     * Optional. Email or URL of the request access of the listing.
     * Subscribers can use this reference to request access.
     * Max Length: 1000 bytes.
     *
     * Generated from protobuf field string request_access = 12 [(.google.api.field_behavior) = OPTIONAL];
     * @return string
     */
    public function getRequestAccess()
    {
        return $this->request_access;
    }

    /**
     * Optional. Email or URL of the request access of the listing.
     * Subscribers can use this reference to request access.
     * Max Length: 1000 bytes.
     *
     * Generated from protobuf field string request_access = 12 [(.google.api.field_behavior) = OPTIONAL];
     * @param string $var
     * @return $this
     */
    public function setRequestAccess($var)
    {
        GPBUtil::checkString($var, True);
        $this->request_access = $var;

        return $this;
    }

    /**
     * @return string
     */
    public function getSource()
    {
        return $this->whichOneof("source");
    }

}


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

<TITLE>
ParamValueType
</TITLE>

<META NAME="date" CONTENT="2011-07-19">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.jboss.shrinkwrap.descriptor.api.javaee5

Interface ParamValueType<T>

All Superinterfaces:
org.jboss.shrinkwrap.descriptor.api.Child<T>

All Known Implementing Classes:
ParamValueTypeImpl

public interface ParamValueType<T>
extends org.jboss.shrinkwrap.descriptor.api.Child<T>

This interface defines the contract for the  param-valueType  xsd type

 Original Documentation:

 This type is a general type that can be used to declare

 parameter/value lists.

Since:

Generation date :2011-07-19T22:54:35.59+02:00

Author:

Ralf Battenfeld

Method Summary

 java.util.List<java.lang.String>
getDescriptionList()

          Returns all description elements

 java.lang.String
getParamName()

          Returns the param-name element

 java.lang.String
getParamValue()

          Returns the param-value element

 ParamValueType<T>
removeAllDescription()

          Removes the description element

 ParamValueType<T>
removeParamName()

          Removes the param-name element

 ParamValueType<T>
removeParamValue()

          Removes the param-value element

 ParamValueType<T>
setDescription(java.lang.String description)

          Creates a new description element

 ParamValueType<T>
setDescriptionList(java.lang.String... values)

          Creates for all String objects representing description elements,
 a new description element

 ParamValueType<T>
setParamName(java.lang.String paramName)

          If not already created, a new param-name element with the given value will be created.

 ParamValueType<T>
setParamValue(java.lang.String paramValue)

          If not already created, a new param-value element with the given value will be created.

Methods inherited from interface org.jboss.shrinkwrap.descriptor.api.Child

up

Method Detail

setDescription

ParamValueType<T> setDescription(java.lang.String description)

Creates a new description element

Returns:
the current instance of ParamValueType<T>

setDescriptionList

ParamValueType<T> setDescriptionList(java.lang.String... values)

Creates for all String objects representing description elements,
 a new description element

Parameters:
list - of description objects

Returns:
the current instance of ParamValueType<T>

removeAllDescription

ParamValueType<T> removeAllDescription()

Removes the description element

Returns:
the current instance of ParamValueType<T>

getDescriptionList

java.util.List<java.lang.String> getDescriptionList()

Returns all description elements

Returns:
list of description

setParamName

ParamValueType<T> setParamName(java.lang.String paramName)

If not already created, a new param-name element with the given value will be created.
 Otherwise, the existing param-name element will be updated with the given value.

Returns:
the current instance of ParamValueType<T>

removeParamName

ParamValueType<T> removeParamName()

Removes the param-name element

Returns:
the current instance of ParamValueType<T>

getParamName

java.lang.String getParamName()

Returns the param-name element

Returns:
the node defined for the element param-name

setParamValue

ParamValueType<T> setParamValue(java.lang.String paramValue)

If not already created, a new param-value element with the given value will be created.
 Otherwise, the existing param-value element will be updated with the given value.

Returns:
the current instance of ParamValueType<T>

removeParamValue

ParamValueType<T> removeParamValue()

Removes the param-value element

Returns:
the current instance of ParamValueType<T>

getParamValue

java.lang.String getParamValue()

Returns the param-value element

Returns:
the node defined for the element param-value

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
package com.ptoceti.osgi.obix.angular.impl;

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.osgi.service.http.HttpContext;
import org.osgi.service.log.LogService;

public class FileSystemHttpContext implements HttpContext{

	public String getMimeType(String arg0) {
		return null;
	}

	public URL getResource(String filePath) {

		URL url = null;

		File file = new File(filePath);
		if( file.exists() && !file.isDirectory()) {
			try {
				url= file.toURI().toURL();
			} catch (MalformedURLException e) {
				Activator.log(LogService.LOG_ERROR, "Error creating url for file path: " + filePath);
			}
		}

		return url;
	}

	public boolean handleSecurity(HttpServletRequest arg0,
			HttpServletResponse arg1) throws IOException {

		return true;
	}

}


text:
// Copyright (c) Zolution Software Ltd. All rights reserved.
// Licensed under the MIT License, see LICENSE.txt in the solution root for license information

using System.Linq.Expressions;

namespace Rezolver.Compilation.Expressions
{
    internal class ExpressionReplacement
    {
        public Expression Original { get; private set; }

        public Expression Replacement { get; private set; }

        public ExpressionReplacement(Expression original, Expression replacement)
        {
            Original = original;
            Replacement = replacement;
        }
    }
}


text:
package model.expression;

import java.util.ArrayList;
import java.util.List;
import model.Model;
import Exceptions.SlogoException;

public class SinExpression extends OneParameterExpression {

    public SinExpression (List<String> cmdList, Model model) throws SlogoException {
        super(cmdList, model);
    }

    @Override
    public List<Expression> evaluate () throws SlogoException {
        List<Expression> finalExpressionList = new ArrayList<Expression>();
        NumberExpression exp = (NumberExpression) expression;
        finalExpressionList.add(exp.sin());
        return finalExpressionList;
    }

}


text:
int human_select_cell_to_leave(struct s_cell **player_cells, int nb_cells);
struct s_cell *human_select_cell_to_go_to(struct s_cell *src_cell);
uint16_t human_select_nb_pawns(struct s_cell *src_cell);

#endif


text:
/// <reference types="iobroker" />
export interface CustomStateSubscription {
    pattern: RegExp;
    callback: (id: string, state: ioBroker.State | null | undefined) => void;
}
export interface CustomObjectSubscription {
    pattern: RegExp;
    callback: (id: string, obj: ioBroker.Object | null | undefined) => void;
}
export declare function applyCustomStateSubscriptions(id: string, state: ioBroker.State | null | undefined): void;
export declare function applyCustomObjectSubscriptions(id: string, obj: ioBroker.Object | null | undefined): void;
/**
 * Subscribe to some ioBroker states
 * @param pattern
 * @param callback
 * @returns a subscription ID
 */
export declare function subscribeStates(pattern: string | RegExp, callback: (id: string, state: ioBroker.State | null | undefined) => void): string | undefined;
/**
 * Release the custom subscription with the given id
 * @param id The subscription ID returned by @link{subscribeStates}
 */
export declare function unsubscribeStates(id: string): void;
/**
 * Subscribe to some ioBroker objects
 * @param pattern
 * @param callback
 * @returns a subscription ID
 */
export declare function subscribeObjects(pattern: string | RegExp, callback: (id: string, object: ioBroker.Object | null | undefined) => void): string | undefined;
/**
 * Release the custom subscription with the given id
 * @param id The subscription ID returned by @link{subscribeObjects}
 */
export declare function unsubscribeObjects(id: string): void;
/** Clears all custom subscriptions */
export declare function clearCustomSubscriptions(): void;


text:
category:
- Locations and mapping
- Culture and tourism
- Community services
- Business
license: http://www1.toronto.ca/wps/portal/contentonly?vgnextoid=4a37e03bb8d1e310VgnVCM10000071d60f89RCRD
maintainer: Open Data Team
maintainer_email: opendata@toronto.ca
notes: The database consists of the name of the facility, address, ward information,
  ownership of facilities that are available on a rental basis for cultural events.
organization: Economic Development & Culture
resources:
- format: XLS
  name: Making Space For Culture Readme
  url: http://opendata.toronto.ca/gcc/MSFC_Readme.xls
- format: XLSX
  name: Making Space For Culture Tabular Data (Excel)
  url: http://opendata.toronto.ca/gcc/MSFC_44%20Wards_Complete_Final.xlsx
- format: ZIP
  name: Making Space For Culture Shapefile (MTM3)
  url: http://opendata.toronto.ca/gcc/make_space_for_culture_mtm3.zip
- format: ZIP
  name: Making Space For Culture Shapefile (WGS84)
  url: http://opendata.toronto.ca/gcc/make_space_for_culture_wgs84.zip
- format: ''
  name: View Map (zoom in to view)
  url: http://map.toronto.ca/maps/map.jsp?app=OpenData
source: http://www1.toronto.ca/wps/portal/contentonly?vgnextoid=4f6bdda2f1405410VgnVCM10000071d60f89RCRD&vgnextchannel=1a66e03bb8d1e310VgnVCM10000071d60f89RCRD
title: Cultural Spaces
---


text:
from __future__ import print_function
from builtins import input

import datetime

def load_db():
    device_list = []

    import appdirs, os
    app_dir = appdirs.user_data_dir('transmission-manager')
    db_file = os.path.join(app_dir,"device_list")
    if os.path.exists( db_file ):
        with open(db_file, 'r') as df:
            db_lines = df.readlines()

        from device import Device
        for db_line in db_lines:
            d = Device()
            d.from_string(db_line)
            device_list.append(d)

    return device_list

def save_db(device_list):
    import appdirs, os
    app_dir = appdirs.user_data_dir('transmission-manager')
    db_file = os.path.join(app_dir,"device_list")

    if not os.path.exists( app_dir ):
        os.makedirs(app_dir)

    with open(db_file, 'w') as df:
        for d in device_list:
            df.write(d.to_string()+'\n')

def active_device(mac, ip='0.0.0.0', name='', time_stamp = datetime.datetime.now()):
    device_list = load_db()

    #time_stamp = datetime.datetime.now()

    mac_list = []
    for d in device_list:
        mac_list.append(d._mac)

    if not mac in mac_list:
        #have not found this device previously
        if len(name) < 1:
            #FIXME: should be more automated - no input should really be required
            name = input('What is the name of this machine? ('+ip+', '+mac+') ')

        from device import Device

        unkn_d = Device(name, mac)

        unkn_d.add_ip(ip)
        unkn_d.add_ts(time_stamp)

        #print("Adding new DEVICE to DB")
        device_list.append(unkn_d)

    else:
        # already part of the db - only add time stamp
        #print("Updating existing DEVICE in DB")

        index = mac_list.index(mac)
        device_list[index].add_ip(ip)
        device_list[index].add_ts(time_stamp)

    save_db(device_list)

def record_peers(ip_peers):
    import communication
    mac_peers = communication.find_macs(ip_peers)

    from device import Device

    for ip_peer,mac_peer in zip(ip_peers,mac_peers):
        active_device(mac_peer,ip_peer)

def main():
    #print("Initializing network knowledge to make life easier.")

    import communication
    local_ip = communication.find_local_ip()
    local_mac = communication.find_mac(local_ip)
    local_name = communication.host_name()

    active_device(local_mac,local_ip,local_name)

    #fixed_ips = input('Do you have fixed IPs assigned to certain machines? (Y/N) ')

    local_ip_peers = communication.find_peers(local_ip)

    record_peers(local_ip_peers)

if __name__ == '__main__':
    main()


text:
package org.keycloak.quarkus.runtime.cli;

import java.util.Collection;
import java.util.Map;

import picocli.CommandLine;
import picocli.CommandLine.Help;
import picocli.CommandLine.Help.Column;
import picocli.CommandLine.Help.TextTable;
import picocli.CommandLine.Model.CommandSpec;
import picocli.CommandLine.Model.UsageMessageSpec;

/**
 * A {@link picocli.CommandLine.IHelpSectionRenderer} based on Quarkus CLI to show subcommands in help messages.
 */
class SubCommandListRenderer implements CommandLine.IHelpSectionRenderer {

    @Override
    public String render(Help help) {
        CommandSpec spec = help.commandSpec();
        if (spec.subcommands().isEmpty()) {
            return "";
        }

        Column commands = new Column(24, 2, Column.Overflow.SPAN);
        Column descriptions = new Column(spec.usageMessage().width() - 24, 2,
                Column.Overflow.WRAP);

        TextTable textTable = TextTable.forColumns(help.colorScheme(), commands, descriptions);
        textTable.setAdjustLineBreaksForWideCJKCharacters(spec.usageMessage().adjustLineBreaksForWideCJKCharacters());

        addHierarchy(spec.subcommands().values(), textTable, "");
        return textTable.toString();
    }

    private void addHierarchy(Collection<CommandLine> collection, CommandLine.Help.TextTable textTable,
            String indent) {
        collection.stream().distinct().forEach(subcommand -> {
            // create comma-separated list of command name and aliases
            String names = String.join(", ", subcommand.getCommandSpec().names());
            String description = description(subcommand.getCommandSpec().usageMessage());
            textTable.addRowValues(indent + names, description);

            Map<String, CommandLine> subcommands = subcommand.getSubcommands();
            if (!subcommands.isEmpty()) {
                addHierarchy(subcommands.values(), textTable, indent + "  ");
            }
        });
    }

    private String description(UsageMessageSpec usageMessage) {
        if (usageMessage.header().length > 0) {
            return usageMessage.header()[0];
        }
        if (usageMessage.description().length > 0) {
            return usageMessage.description()[0];
        }
        return "";
    }
}