text:
require(['mod'], function (mod) {
    /**
     * 工具函数对象
     * @type {{checkObjKey: util.checkObjKey, checkObjKeyValue: util.checkObjKeyValue, checkObjValue: util.checkObjValue, getNoRepeat: util.getNoRepeat, getModelData: util.getModelData}}
     */
    var util = {
        /**
         * 校验对象的属性名在基础对象中是否存在
         * @param checkObj 校验的对象
         * @param baseObj  基础对象
         * @param checkObjName 校验的对象名称
         */
        checkObjKey: function (checkObj, baseObj, checkObjName) {
            for (var attr in checkObj) {
                if (!baseObj[attr]) {
                    alert(checkObjName + " err:" + attr);
                    console.log(checkObjName + " err:" + attr);
                }
            }
        },
        /**
         * 校验对象的属性名以及属性值在基础对象中是否存在
         * @param checkObj 校验的对象
         * @param baseObj  基础对象
         * @param checkObjName 校验的对象名称
         */
        checkObjKeyValue: function (checkObj, baseObj, checkObjName) {
            for (var attr in checkObj) {
                if (!baseObj[attr]) {
                    alert(checkObjName + " err:" + attr);
                    console.log(checkObjName + " err:" + attr);
                }
                for (var i = 0; i < checkObj[attr].length; i++) {
                    if (!baseObj[checkObj[attr][i]]) {
                        alert(checkObjName + "err:" + attr + checkObj[attr][i]);
                        console.log(checkObjName + " err:" + attr + checkObj[attr][i]);
                    }
                }
            }
        },
        /**
         * 校验对象的属性值在基础对象中是否存在
         * @param checkObj 校验的对象
         * @param baseObj  基础对象
         * @param checkObjName 校验的对象名称
         */
        checkObjValue: function (checkObj, baseObj, checkObjName) {
            for (var attr in checkObj) {
                for (var i = 0; i < checkObj[attr].length; i++) {
                    if (!baseObj[checkObj[attr][i]]) {
                        alert(checkObjName + "err:" + attr + checkObj[attr][i]);
                        console.log(checkObjName + " err:" + attr + checkObj[attr][i]);
                    }
                }
            }
        },
        /**
         * 去掉数组中重复内容
         * @param arr 数组
         * @returns {Array}
         */
        getNoRepeat: function (arr) {
            var newArr = new Array();
            for (var i = 0; i < arr.length; i++) {
                if (newArr.indexOf(arr[i]) > 0) {

                } else {
                    newArr.push(arr[i]);
                }
            }
            return newArr;
        },
        /**
         * 获得模块数据
         * @param rowStr
         * @returns {string}
         */
        getModelData:function(rowStr) {
            var row = eval(rowStr);
            var dataObj = row.getSimpleData(),
                str = rowStr + '.setSimpleData({';
            for (var f in dataObj) {
                if (dataObj[f]) {
                    if (dataObj[f] === true)
                        str += f + ':' + dataObj[f] + ','
                    else
                        str += f + ':\'' + dataObj[f] + '\','
                }
            }
            str += '});';
            return str;
        },
        /**
         * 页面侧滑效果
         * @return {[type]} [description]
         */
        navControl: function(){
            var openOffcanvas = $('[data-offcanvas="open"]');
            var closeOffcanvas = $('[data-offcanvas="close"]');
            var offcanvasNav = $('.offcanvas-nav');
            openOffcanvas.click(function(){
                openOffcanvas.addClass('nav-open');
                offcanvasNav.addClass('open');
                $('body').append('

');
            });
            closeOffcanvas.click(function(){
                openOffcanvas.removeClass('nav-open');
                offcanvasNav.removeClass('open');
                $('.offcanvas-backdrop').remove();
            });
            $(document).on('click', '.offcanvas-backdrop', function(){
                openOffcanvas.removeClass('nav-open');
                offcanvasNav.removeClass('open');
                $('.offcanvas-backdrop').remove();
            });
        }
    };
    util.navControl();

    var allJsObj = mod.allJsObj;
    treeObj = mod.treeObj;
    var captionObj = mod.captionObj;
    var cssObj = mod.cssObj;
    var modeluiObj = mod.modeluiObj;
    var dependObj = mod.dependObj;
    var modeDependObj = mod.modeDependObj;
    var colorBaseObj = mod.colorBaseObj;
    var defaultColor = mod.defaultColor;
    var modelIdArr=mod.modelIdArr;
    var colorObj = {};
    var gridObj = {};
    for (var color in colorBaseObj) {
        var arr = [];
        arr.push(colorBaseObj[color][5]);
        arr.push(colorBaseObj[color][7]);
        arr.push(colorBaseObj[color][11]);
        colorObj[color] = arr;
    }
    /*确保obj中属性为最大集合 begin*/
    /*校验属性是否存在*/
    util.checkObjKey(modeluiObj, allJsObj, 'modeluiObj');
    util.checkObjKey(cssObj, allJsObj, 'cssObj');
    /*校验属性以及属性值是否存在*/
    util.checkObjKeyValue(dependObj, allJsObj, 'dependObj');
    util.checkObjKeyValue(modeDependObj, allJsObj, 'modeDependObj');
    /*校验属性值是否存在*/
    util.checkObjValue(treeObj, allJsObj, 'treeObj');
    /*提取className*/
    var headClassName='head-div',//头部提示类名
        contentClassName='containers ',//内容区域类名
    /*色块区域类名*/
        colorClassName={
            msgOut:'color-whole-div',/*头部信息外部div类名*/
            msgInner:'color-head-div',/*头部信息内部div类名*/
            areaInput:'color-input-div u-row',/*颜色输入区域类名*/
            lineDiv:'u-text color-input u-col-md-4',/*横线外盒子类名*/
            lineDivHide:'u-text color-input u-col-md-4 color-visible',
            lineInput:'color-in',/*横线input类名*/
            area:'color-content-div',//颜色区域类名
            areaLeft:'color-left-div',//颜色区域左侧类名
            areaRight:'color-right-div',//颜色区域右侧类名
            areaDiv:'color-div'//色块类名
        },
    /*/!*下载区域类名*!/
     evalOut='eval-whole-div',/!*下载提示外部类名*!/
     evalInner='eval-head-div',/!*下载提示内部类名*!/
     runButton='u-button raised u-eval-button',/!*执行按钮类名*!/*/
        listClassName={
            line:'tree-whole-div',/*每个模块的类名*/
            checkBoxDiv:'tree-icon',/*小模块标题行类名*/
            checkBoxSpan:'fa fa-minus-square-o',/*展开关闭按钮*/
            textDiv:'tree-div u-row textDiv',/*小模块区域类名*/
            textLabel:'u-checkbox tree-parent',/*小模块每行的类名*/
            textInput:'u-checkbox-input',/*小模块选择框类名*/
            textSpan:'u-checkbox-label select-module'/*小模块名类名*/
        };
    /*确保obj中属性为最大集合 end*/
    var app, viewModel,metaObj = {},treemetaObj = {},wholeStr = '
',
    // headStr ='

定制

本功能可自定义选中下载特定模块,设置主题颜色,并可以导入之前选择进行更新操作

',
        contentStr = '
',
        colorStr = '

设置主题颜色,左侧选中主色,右侧选择辅色。通过点击色块进行选中,也可在输入框中输入rgb格式的颜色编码。
';
    colorStr += '
';
    colorStr += '
' +'主色<input id="color0" value="63,81,181" class='+'"'+colorClassName.lineInput+'"'+'/>
';
    colorStr += '
' +'主色加深<input id="color1" value="48,63,159" class='+'"'+colorClassName.lineInput+'"'+'/>
';
    colorStr += '
' +'辅色<input id="color2" value="83,109,254" class='+'"'+colorClassName.lineInput+'"'+'/>
';
    colorStr += '
';
    colorStr += '
';
    var colorLeftStr = '
';
    var colorRightStr = '
';
    for (var color in colorObj) {
        colorLeftStr += '

';
        colorRightStr += '

';
    }
    colorLeftStr += '
';
    colorRightStr += '
';
    colorStr += colorLeftStr;
    colorStr += colorRightStr;
    colorStr += '
';
    colorStr += '
';
    /*var evalStr = '

下载文件setting.txt中保存了上次配置的信息,将信息复制至文本域中并点击执行可恢复上次配置。
';
     evalStr += '<button id="eavl-button" class='+'"'+runButton+'"'+' >执行</button>';
     evalStr += '<textarea style="width: 100%;height: 70px;"u-meta=\'{"id":"str","type":"textarea","data":"evalData","field":"str"}\'></textarea>';
     evalStr += '
';*/
    // 遍历obj创建datatable的field字段,同时生成html列表
    for (var model in treeObj) {
        treemetaObj[model] = {};
        contentStr += '
';
        if (model != 'all')
            contentStr += '
' +captionObj[model] +
                '' +
                '<input type="checkbox" class='+'"'+listClassName.textInput+'"'+'>' +
                '全选' +
                '' +
                '
';
        contentStr += '
';
        for (var i = 0; i < treeObj[model].length; i++) {
            var field = treeObj[model][i];
            var firstClass = '';
            metaObj[field] = {};
            contentStr += '
' + '<input type="checkbox" class='+'"'+listClassName.textInput+'"'+'>' + ''
                + captionObj[field] + '
';
        }
        contentStr += '
';
        contentStr += '
';
    }
    contentStr += '
';
    // wholeStr += headStr + contentStr + colorStr + evalStr;
    // wholeStr += '
';
    var contentStrArr=contentStr.split('
');
    document.getElementById('colorModel').appendChild(u.makeDOM(colorStr));
    for(var i=2;i<=10;i++){
        var modelTemp='
'+contentStrArr[i]+'
';
        document.getElementById(modelIdArr[i-2]).appendChild(u.makeDOM(modelTemp));
    }
    u.on(document.getElementById('eavl-button'), 'click', function () {
        value = viewModel.evalData.getCurrentRow().getValue('str');
        eval(value)
    });
    u.on(document, 'click', function (e) {
        /* 模块展开收起 */
        var targetEle = u.closest(e.target, 'fa');
        if (targetEle) {
            var treeDiv = u.closest(targetEle, 'tree-whole-div').querySelector('.tree-div');
            if (u.hasClass(targetEle, 'fa-minus-square-o')) { //收起
                u.removeClass(targetEle, 'fa-minus-square-o');
                u.addClass(targetEle, 'fa-plus-square-o');
                treeDiv.style.display = 'none';
            } else { //展开
                u.removeClass(targetEle, 'fa-plus-square-o');
                u.addClass(targetEle, 'fa-minus-square-o');
                treeDiv.style.display = 'block';
            }
        }
        /* 色块点击 */
        var targetEle = u.closest(e.target, 'color-div');
        if (targetEle) {
            var colorRow = viewModel.colorData.getCurrentRow();
            var color0 = targetEle.getAttribute('color0');
            var color1 = targetEle.getAttribute('color1');
            var color2 = targetEle.getAttribute('color2');
            if (color0) {
                colorRow.setValue('color0', color0);
            }
            if (color1) {
                colorRow.setValue('color1', color1);
            }
            if (color2) {
                colorRow.setValue('color2', color2);
            }

            // var mainColorEles = document.querySelectorAll('.main-color-show');
            // var assistColorEles = document.querySelectorAll('.assist-color-show');
            // for(var i=0; i<mainColorEles.length; i++){
            //     mainColorEles[i].style.backgroundColor = 'rgb(' + color0 + ')';
            //     mainColorEles[i].style.borderColor = 'rgb(' + color0 + ')';
            //     assistColorEles[i].style.backgroundColor = 'rgb(' + color2 + ')';
            //     assistColorEles[i].style.borderColor = 'rgb(' + color2 + ')';
            // }
        }
    });
    /* 处理全部 */
    viewModel = {
        treeData: new u.DataTable({
            meta: treemetaObj
        }),
        modelData: new u.DataTable({
            meta: metaObj
        }),
        colorData: new u.DataTable({
            meta: {
                color0: {},
                color1: {},
                color2: {}
            }
        }),
        evalData: new u.DataTable({
            meta: {
                str: {}
            }
        })
    };
    app = u.createApp({
        el: 'body',
        model: viewModel
    });
    var r = viewModel.modelData.createEmptyRow();
    viewModel.modelData.setRowSelect(0);

    var treeRow = viewModel.treeData.createEmptyRow();
    viewModel.treeData.setRowSelect(0);

    var colorRow = viewModel.colorData.createEmptyRow();
    viewModel.colorData.setRowSelect(0);

    var evalRow = viewModel.evalData.createEmptyRow();
    viewModel.evalData.setRowSelect(0);

    /**
     * valuechange
     */
    var valueAry = {};
    viewModel.colorData.on('valueChange', function(event){
        valueAry[event.field] = event.newValue;
        var color0 = valueAry['color0'];
        var color1 = valueAry['color1'];
        var color2 = valueAry['color2'];

        var mainColorEles = document.querySelectorAll('.main-color-show');
        var assistColorEles = document.querySelectorAll('.assist-color-show');
        for(var i=0; i<mainColorEles.length; i++){
            mainColorEles[i].style.backgroundColor = 'rgb(' + color0 + ')';
            mainColorEles[i].style.borderColor = 'rgb(' + color0 + ')';
            assistColorEles[i].style.backgroundColor = 'rgb(' + color2 + ')';
            assistColorEles[i].style.borderColor = 'rgb(' + color2 + ')';
        }
    });

    /*按钮处理begin*/
    function clickFun() {
        var r = viewModel.modelData.rows()[0];
        var modelFlag = false;
        var jsStr = '';
        var cssStr = '';
        var jsArr = [];
        var cssArr = [];
        if (r.getValue('model')) {
            modelFlag = true;
        }
        for (var field in allJsObj) {
            if (r.getValue(field)) {
                jsArr.push(allJsObj[field]);
                if (modelFlag && modeluiObj[field])
                    jsArr.push(modeluiObj[field]);
                if (cssObj[field])
                    cssArr.push(cssObj[field])
            }
        }
        cssArr = cssArr.toString().split(',');
        cssArr = util.getNoRepeat(cssArr);
        var colorRow = viewModel.colorData.getCurrentRow();
        color0 = colorRow.getValue('color0');
        color1 = colorRow.getValue('color1');
        color2 = colorRow.getValue('color2');
        color0 = color0 ? color0 : defaultColor[0];
        color1 = color1 ? color1 : defaultColor[1];
        color2 = color2 ? color2 : defaultColor[2];
        colorArr = [color0, color1, color2];
        settingStr = '';
        settingStr += util.getModelData('viewModel.colorData.getCurrentRow()');
        settingStr += util.getModelData('viewModel.modelData.getCurrentRow()');
        settingStr += util.getModelData('viewModel.treeData.getCurrentRow()');
        dataJson = {
            jsArr: jsArr,
            cssArr: cssArr,
            colorArr: colorArr,
            settingStr: settingStr
        };
        u.showLoading();
        u.ajax({
            type: 'post',
            dataType: 'json',
            data: dataJson,
            url: '/customized',
            success: function (patch) {
                u.hideLoading();
                patch = patch.replace('..', '');
                document.getElementById('ss').href = patch;
                document.getElementById('ss').click();
            },
            error: function (patch) {
                u.hideLoading();
            }
        })
    }
    u.on(document.getElementById('button'), 'click', clickFun);
    u.on(document.getElementById('buttonTop'), 'click', clickFun);
    /*按钮处理end*/
    /*处理依赖关系begin*/
    var dependCountObj = {};
    viewModel.modelData.on('valueChange', function (options) {
        var field = options.field,
            newValue = options.newValue,
            row = viewModel.modelData.getCurrentRow();
        if(treeObj.gridMode.indexOf(field) > -1){
            gridModeChangeFun(field,newValue,row);
            return;
        }
        dependFun(dependObj, field, newValue);
        if (field == 'model') {
            // 当前修改mdoel,如果之前选择modeDependObj的值之后处理相关的依赖
            for (var modelField in modeDependObj) {
                var modelFieldValue = row.getValue(modelField);
                if (modelFieldValue) {
                    dependFun(modeDependObj, modelField, newValue);
                }
            }
        }
        var modelFlag = row.getValue('model');
        if (modelFlag && field != 'model') {
            dependFun(modeDependObj, field, newValue);
        }
        if (field == 'grid') {
            if (newValue) {
                row.setValue('gridBase', true);
                // gridEnabled(true);
            } else {
                // gridEnabled(false);
                // var treeRow = viewModel.treeData.getCurrentRow();
                // treeRow.setValue('gridMode', true);
                // treeRow.setValue('gridMode', false);
                // row.setValue('gridBase', false);
            }
        }
    });
    gridModeTrueCount = 0;
    /**
     * grid子项发生改变时的处理
     * @param field  键
     * @param value  值
     * @param row  当前行
     */
    function gridModeChangeFun(field,value,row){
        if(value){
            gridModeTrueCount += 1;
        }else{
            gridModeTrueCount -= 1;
        }
        if(gridModeTrueCount > 0){
            row.setValue('grid',true);
            if(gridModeTrueCount > 1){
                app.getComp('gridBase').setEnable(false);
            }else{
                app.getComp('gridBase').setEnable(true);
            }
        }else{
            row.setValue('grid',false);
        }
    };
    /**
     * 处理依赖的方法
     * @param dependObj 依赖的对象
     * @param field  键
     * @param value  值
     */
    function dependFun(dependObj, field, value) {
        row = viewModel.modelData.getCurrentRow();
        if (dependObj[field] && dependObj[field].length > 0) {
            for (var i = 0; i < dependObj[field].length; i++) {
                var f = dependObj[field][i];
                if (!dependCountObj[f])
                    dependCountObj[f] = 0;
                if (value) {
                    row.setValue(f, true);
                    dependCountObj[f] += 1;
                } else {
                    dependCountObj[f] -= 1;
                }
                if (dependCountObj[f] > 0) {
                    //设置不可修改
                    app.getComp(f).setEnable(false);
                } else {
                    //设置可修改
                    app.getComp(f).setEnable(true);
                }
            }
        }
    }
    /* 处理依赖关系end */
    /* 处理tree选中 */
    viewModel.treeData.on('valueChange', function (options) {
        var field = options.field,
            newValue = options.newValue,
            treeRow = viewModel.treeData.getCurrentRow();
        modelRow = viewModel.modelData.getCurrentRow(),
            arr = treeObj[field],
            dependFlag = true;
        /* 处理全选以及全部取消 */
        if (field == 'all') {
            if (newValue) {
                for (var f in treeObj) {
                    treeRow.setValue(f, true);
                }
            } else {
                dependCountObj = {};
                for (var f in allJsObj) {
                    modelRow.setValue(f, false);
                }
                for (var f in treeObj) {
                    if (f != 'all')
                        treeRow.setValue(f, false);
                }
                dependCountObj = {}
            }
        }
        if (newValue) {
            for (i = 0; i < arr.length; i++) {
                modelRow.setValue(arr[i], true);
            }
        } else {
            while (dependFlag) {
                dependFlag = false;
                for (i = 0; i < arr.length; i++) {
                    var depandField = arr[i];
                    if (dependCountObj[depandField] > 0 || !modelRow.getValue(depandField)) {

                    } else {
                        modelRow.setValue(depandField, false);
                        dependFlag = true;
                    }
                }
            }
        }
        if (field == 'gridMode') {
            modelRow.setValue('gridBase', true);
        }
    });
    /**
     * 设置grid是否可用
     * @param enable
     */
    function gridEnabled(enable) {
        var gridArr = treeObj.gridMode;
        for (var i = 1; i < gridArr.length; i++) {
            app.getComp(gridArr[i]).setEnable(enable);
        }
        app.getComp('gridMode').setEnable(enable);
    }
    // gridEnabled(false);
    // app.getComp('gridBase').setEnable(false);

    /*导航开关*/
    u.on(document.getElementById('navId'), 'click', function () {
        u.addClass(this, 'nav-open');
        u.addClass(document.getElementById('offId'),'open');
    });
    u.on(document.getElementById('offIdI'),'click',function () {
        u.removeClass(document.getElementById('offId'),'open');
        u.removeClass(document.getElementById('navId'),'nav-open');
    });
    $('.color-div')[4].click();
    $('.color-div')[20].click();
});


text:
describe("Reading.Collections.Items", function() {
  beforeEach(function() {
    this.subject = new Reading.Collections.Items();
  });

  it("is defined as a Backbone.Collection", function() {
    expect(this.subject).toBeA(Backbone.Collection);
  });

  it("defines model as Reading.Models.Item", function() {
    expect(this.subject.model).toEqual(Reading.Models.Item);
  });
});

describe("Reading.Collections.Items#comparator", function() {
  beforeEach(function() {
    this.subject = new Reading.Collections.Items();
  });

  it("returns the items publication date", function() {
    var publishedAt = "Thu, 24 Nov 2011 17:00:00 -0600",
        item        = new Reading.Models.Item({ publishedAt: publishedAt }),
        date        = new Date(publishedAt);

    expect(this.subject.comparator(item)).toEqual(-date.getTime());
  });
});

describe("Reading.Collections.Items#groupedByDate", function() {
  beforeEach(function() {
    this.subject = new Reading.Collections.Items();
    this.subject.add({ publishedAt: "Thu, 24 Nov 2011 12:00:00 -0600" });
    this.subject.add({ publishedAt: "Wed, 23 Nov 2011 14:30:00 -0600" });
    this.subject.add({ publishedAt: "Thu, 24 Nov 2011 17:00:00 -0600" });
  });

  it("groups items by publication date", function() {
    var result = this.subject.groupedByDate(),
        keys   = result.keys(),
        values = result.values();

    expect(keys.first().value()).toEqual("Thursday, November 24, 2011");
    expect(values.first().size().value()).toEqual(2);
    expect(keys.last().value()).toEqual("Wednesday, November 23, 2011");
    expect(values.last().size().value()).toEqual(1);
  });

  it("wraps the items in a collection", function() {
    var values = this.subject.groupedByDate().values();
    expect(values.first().value()).toBeA(Reading.Collections.Items);
    expect(values.last().value()).toBeA(Reading.Collections.Items);
  });
});

describe("Reading.Collections.Items#unread", function() {
  beforeEach(function() {
    this.subject = new Reading.Collections.Items();
    this.subject.add({ unread: true });
    this.subject.add({ unread: true });
    this.subject.add({ unread: false });
  });

  it("returns only unread items", function() {
    expect(this.subject.unread().size().value()).toEqual(2);
  });
});

redpajama_set_name: RedPajamaGithub


text:
    <meta content='About - G. R. Plyler's Blog' name='title' />
    <meta content='About - G. R. Plyler's Blog' name='og:title' />
    <title>About - G. R. Plyler's Blog</title>
    <link href='/images/fav.png' rel='shortcut icon'>

<link href='/stylesheets/style.css' rel='stylesheet' type='text/css' />
<link href='/stylesheets/syntax.css' rel='stylesheet' type='text/css' />
<link href='/stylesheets/responsive.css' rel='stylesheet' type='text/css' />

<meta content='width=device-width, initial-scale=1.0, user-scalable=no' name='viewport'>
<meta content='text/html; charset=utf-8' http-equiv='content-type' />
<meta content="http://muan.co/images/og.png" property="og:image" />
<meta content="" property="fb:app_id" />

  <meta content='http://localhost:4000' property='og:url' />
  <meta content="The thoughts, words and technical ramblings of g.r.plyler" property='og:description' />
  <meta content="blog" property="og:type" />

G. R. Plyler's Blog

    About

    Email

    GitHub

About

Hello Valued Reader,

My name is Ryan Plyler, otherwise known in other communities as
Rudker or Rudker_Fern in Minecraft. This is the blog that
ties those names together.

In short, I love computers, innovation, team building,
teamwork, collaboration, and product design.
UNIX/Linux computers have been a third of my life.

However, computers are not my only interest.
I have sometimes been called a Renaissance man.
This site is the beginnings of a the publicly
available collections of my work, and writing, thoughts
and adventures in technology, life, science, and the
days of the modern internet.

My Interests

Computers

UNIX Environments

Python Programming

Mac

Linux Mint, Debian, Ubuntu, DSL

Building Computers

Technology Education

Information Systems

Communications

Entreprenuership

Business Building

Finance Management

Customer Relations

Management

Leading Teams

Self sustaining, and efficient work environment

Product Design

3D Art, Design and Virtual Realization

System Orchestration

Productivity system design

Engineering

Wood Working

Metal Working

CAD Systems

Music

Electronic Music Composition

Film Score Composition

Orchestral Composition for film

That about sums if up. If you would like to get
in contact with me, just shoot me an email.
Thanks for reading.

  built with Jekyll using Scribble theme


text:
package com.vishnus1224.snakeprogressview;

import android.graphics.Canvas;

/**
 * Created by Vishnu on 10/10/2015.
 *
 * Represents an object which will be shown on the screen.
 */
interface ScreenObject {

    /**
     * For initializing essential components of the object when it is constructed.
     */
    void initialize();

    /**
     * Helper for drawing the object on the screen.
     * @param canvas The canvas to draw on.
     */
    void draw(Canvas canvas);
}


text:
import json

from datetime import datetime, timedelta

from django.views.generic import ListView, TemplateView, DetailView
from django.http import Http404
from django.shortcuts import get_object_or_404, redirect
from braces.views import LoginRequiredMixin

from .models import SessionType, Timeslot, Appointment
from . import service

class TimeslotListView(LoginRequiredMixin, TemplateView):

    template_name = "counselling/timeslot/listing.html"

    def get_context_data(self, **kwargs):
        context = super(TimeslotListView, self).get_context_data(**kwargs)
        context["timeslots"] = json.dumps(self._get_timeslots())
        return context

    def _get_timeslots(self):

        yesterday = datetime.now() - timedelta(weeks=52)
        timeslots = Timeslot.objects.filter(
            assignee=self.request.user,
            start_time__gt=yesterday
        )

        r = []
        for slot in timeslots:
            r.append({
                "title": slot.session_type.name,
                "id": slot.pk,
                "start": slot.start_time.isoformat(),
                "end": slot.end_time.isoformat(),
            })

        return r

class VariablesView(TemplateView):
    """
    This is a handy place to put stuff that lives only in Python but we want to
    keep DRY.  On a higher traffic site, I might add some caching here, but for
    a project this small, I'm not going to bother.
    """
    template_name = "variables.js"

    def get_context_data(self, **kwargs):
        context = super(VariablesView, self).get_context_data(**kwargs)
        context["session_types"] = SessionType.objects.filter(
            specialists=self.request.user
        )
        return context

class AppointmentTimeslotListView(TemplateView):
    """
    This view offers a user the choice of multiple available timeslots for their
    session appointment.
    """
    template_name = "counselling/appointment/timeslots.html"

    def get_context_data(self, *args, **kwargs):
        appointment = get_object_or_404(Appointment, token=kwargs['token'])
        timeslots = service.get_available_timeslots(appointment)
        return {
            "appointment": appointment,
            "timeslots": timeslots,
        }

class AppointmentTimeslotSelectionView(DetailView):
    """
    With this view the user can review the timeslot selection and confirm it.
    """
    template_name = "counselling/appointment/timeslot-selection.html"
    model = Timeslot

    def get_queryset(self):
        self.appointment = get_object_or_404(Appointment, token=self.kwargs['token'])
        return service.get_available_timeslots(self.appointment)

    def get_context_data(self, **kwargs):
        result = super().get_context_data(**kwargs)
        result['appointment'] = self.appointment
        return result

    def post(self, request, *args, **kwargs):
        timeslot = self.get_object()
        self.appointment.timeslot = timeslot
        self.appointment.save()
        service.confirm_appointment(self.appointment)
        return redirect('counselling-appointment-confirmation', token=self.appointment.token)

class AppointmentConfirmationView(TemplateView):
    template_name = "counselling/appointment/confirmation.html"


text:
require 'active_support/core_ext/kernel/reporting'
require 'spec_helper'

describe Sysutil do

  Config.configure(root_password: 'ROOT PASSWORD HERE')

  it 'has a version number' do
    expect(Sysutil::VERSION).not_to be nil
  end

  describe Sysutil::User do

    user = Sysutil::User

    describe '.current_user' do
      it 'returns the current system user' do
        expect(user.current_user).to eq(`echo -n $USER`)
      end
    end

    describe '.list' do
      it 'provides a list of users as array' do
        expect(user.list).to be_an(Array)
      end
    end

    describe '.add!' do
      it 'adds a user' do
        u = user.add!('testuser', 'testpassword')
        expect(u).to eq(true)
      end
    end

    describe '.delete!' do
      it 'deletes a user' do
        u = user.delete!('testuser')
        expect(u).to eq(true)
      end
    end

  end
end


text:
define words with 3rd party dictionary

This is a tweak for jailbroken iOS devices.

[Theos](http://iphonedevwiki.net/index.php/Theos/Setup) is required to build.

More information: http://cydia.saurik.com/package/com.gviridis.definei/


text:
Accounts.ui.config({
  requestPermissions: {
  },
  requestOfflineToken: {
  },
  passwordSignupFields: 'USERNAME_ONLY'
});

Accounts.config({
  forbidClientAccountCreation : true
});

Template.mainPage.displayInformation = function() {
  return Session.get("displayInfo");
}

Template.mainPage.welcomePage = function() {
  return Session.get("welcomePage");
}

Template.userInformation.events = {
  'click #logOutButton' : function(event) {
    Meteor.logout();
    return false;
  },

  'click #displayInformation': function(event) {
    Session.set("displayInfo", true);
    return false;
  }
}

Template.tutorial.events = {
  'click #quitInformationPanel' : function(event) {
    Session.set("displayInfo", false);
    return false;
  },

  'click #skiptutorial' : function(event) {
    Session.set("displayInfo", false);
    return false;
  },

  'click #step2linkPrevious' : function(event) {
  	$("#step2").hide();
  	$("#step1").fadeIn();
    return false;
  },

  'click #step3linkPrevious' : function(event) {
    $("#step3").hide();
  	$("#step2").fadeIn();
    return false;
  },

  'click #step4linkPrevious' : function(event) {
  	$("#step4").hide();
  	$("#step3").fadeIn();
    return false;
  },

  'click #step5linkPrevious' : function(event) {
  	$("#step5").hide();
  	$("#step4").fadeIn();
    return false;
  },

  'click #step6linkPrevious' : function(event) {
  	$("#step6").hide();
  	$("#step5").fadeIn();
    return false;
  },

  'click #step7linkPrevious' : function(event) {
  	$("#step7").hide();
  	$("#step6").fadeIn();
    return false;
  },

  'click #step1linkNext' : function(event) {
  	$("#step1").hide();
    $("#step2").fadeIn();
    return false;
  },

  'click #step2linkNext' : function(event) {
  	$("#step2").hide();
    $("#step3").fadeIn();
    return false;
  },

  'click #step3linkNext' : function(event) {
  	$("#step3").hide();
    $("#step4").fadeIn();
    return false;
  },

  'click #step4linkNext' : function(event) {
  	$("#step4").hide();
    $("#step5").fadeIn();
    return false;
  },

  'click #step5linkNext' : function(event) {
  	$("#step5").hide();
    $("#step6").fadeIn();
    return false;
  },

  'click #step6linkNext' : function(event) {
  	$("#step6").hide();
    $("#step7").fadeIn();
    return false;
  },

  'click #displayInformation': function(event) {
    Session.set("displayInfo", true);
    return false;
  }
}

Template.welcome.events = {
  'click #goTutorial' : function(event) {
    Session.set("welcomePage", false);
    return false;
  },

  'click #displayInformation': function(event) {
    Session.set("displayInfo", true);
    return false;
  }
}

Template.players.player = function () {
  return Players.find({});
}

Template.introduceStrategy.player = function () {
  return Players.find({idPlayer: Meteor.user().username});
}

Template.introduceStrategy.events = {
  'click #submitStrategy' : function(event) {
    var p = document.getElementById('pValue').value;
    var q = document.getElementById('qValue').value;
    var idSession = Players.findOne({idPlayer: Meteor.user().username}).idSession;
    var round = Players.findOne({idPlayer: Meteor.user().username}).pPlayed.length;
    Meteor.call('saveStrategy', Meteor.user().username, p, q, idSession, round);
    Session.set("state", 1);
    return false;
  }
}

Template.loginSection.events = {
  'click #loginSectionLogin' : function(event) {
    var u = document.getElementById('loginSectionUsername').value;
    var p = document.getElementById('loginSectionPassword').value;
    Session.set("displayInfo", false);
    var loginSuccess = true;
    Meteor.loginWithPassword(u,p,function(wrong){
      if(wrong){
        alert("Wrong Password");
	    console.log("wrongpass");
        }
      else{
	    var session = Players.findOne({idPlayer: u}).idSession;
	    if(Meteor.userId() && Meteor.user().username !== "admin"){
	      Session.set("displayInfo", true);
	      Session.set("welcomePage", true);
	      Session.set("state", 0);
	      Meteor.call('insertGroup', u, session);

        }
      }
    });
    return false;
  }
}

Template.introduceSuggestions.username= function(){
  return Meteor.user().username;
}

Template.introduceSuggestions.events = {

	'click #submitSuggestion' : function(event){
		var suggestion = document.getElementById('suggestionField').value;
		var user =  Meteor.user().username;
		Meteor.call('introduceStrategy', user, suggestion);

		$("#suggestionForm").hide();
		$("#finalConsiderations").hide();
  	    $("#thanksSuggestions").fadeIn("slow");
  	    return false;
	}

}

Template.createSession.events = {
  'click #createNewSession' : function(event) {
    var idSession = document.getElementById('sessionId').value;
    var populationSize = document.getElementById('populationSize').value;
    var groupSize = document.getElementById('groupSize').value;
    var numberRounds = document.getElementById('numberRounds').value;
    var rule = document.getElementById('rule').value;

    //cria ids e pass para todos os utilizadores
    //inicializa todas as estruturas

    Meteor.call('createSession', idSession, populationSize, groupSize, numberRounds, "today", rule);

    document.getElementById('createSessionForm').reset();

    return false;
  }
}

Template.gameArea.state = function(){
  return Session.get("state");
}

Template.gameArea.events = {

  'click #updateRoundReward' : function(event) {
    var user =  Meteor.user().username;
    var session = Players.findOne({idPlayer: user}).idSession;
    var round = Players.findOne({idPlayer: Meteor.user().username}).reward.length;
    Meteor.call('updateRoundReward', user, session, round);
    Session.set("state", 2);
  },

  'click #playNextRound' : function(event) {
    var user =  Meteor.user().username;
    var session = Players.findOne({idPlayer: user}).idSession;
    Meteor.call('prepareNextRound', user, session);
    Session.set("state", 0);
  }
}

Template.tutorial.nRounds = function(){
	var idSession = Players.findOne({idPlayer: Meteor.user().username}).idSession;
	var session = Sessions.findOne({idSession: idSession});
	return session.numberRounds;
}

Template.tutorial.groupSize = function(){
	var idSession = Players.findOne({idPlayer: Meteor.user().username}).idSession;
	var session = Sessions.findOne({idSession: idSession});
	return session.groupSize;
}

Template.tutorial.groupSize = function(){
	var idSession = Players.findOne({idPlayer: Meteor.user().username}).idSession;
	var session = Sessions.findOne({idSession: idSession});
	return session.groupSize;
}

Template.tutorial.populationSize = function(){
	var idSession = Players.findOne({idPlayer: Meteor.user().username}).idSession;
	var session = Sessions.findOne({idSession: idSession});
	return session.populationSize;
}

Template.listOfUsers.userss = function() {
  return Meteor.users.find({});
}

Template.adminArea.show = function() {
  return (Meteor.user() && Meteor.user().username=="admin");

}

Template.gameArea.show = function() {
  return (Meteor.user() && Meteor.user().username !="admin");
}

Template.gameArea.username = function() {
  return Meteor.user().username;
}

Template.viewSuggestions.suggestions = function(){
	return Suggestions.find({});
}

Template.groupCapacity.sessions = function(){
  return Sessions.find({});
}

Template.groupCapacity.groups = function(idSession){
  return Sessions.findOne({idSession: idSession}).groupCapacity;
}

Template.gameArea.groupMates = function() {
  var user = Players.findOne({idPlayer: Meteor.user().username});
  return Players.find({actualGroup: user.actualGroup, idSession: user.idSession});
}

Template.reportRoundReward.groupMates = function() {
  var user = Players.findOne({idPlayer: Meteor.user().username});
  return Players.find({actualGroup: user.actualGroup, idSession: user.idSession});
}

Template.reportRoundReward.roundReward = function() {
  var rewards = Players.findOne({idPlayer: Meteor.user().username}).reward;
  return rewards[rewards.length-1];
}

Template.reportRoundReward.ownOfferReward = function() {
  var p = Players.findOne({idPlayer: Meteor.user().username}).pPlayed;
  p = p[p.length-1];
  return 10-p;
}

Template.reportRoundReward.roundRewardReportOther = function() {
  var rReward = Players.findOne({idPlayer: Meteor.user().username}).othersOfferReport;
  return rReward[rReward.length-1];
}

Template.reportRoundReward.roundRewardReportMine = function() {
  var rReward = Players.findOne({idPlayer: Meteor.user().username}).myOfferReport;
  return rReward[rReward.length-1];
}

Template.gameArea.totalReward = function() {
  var listRewards = Players.findOne({idPlayer: Meteor.user().username}).reward;
  var totalReward = 0;
  for(i=0; i<listRewards.length; i++){
    totalReward = totalReward + parseFloat(listRewards[i]);
  }
  return Math.round(totalReward*100)/100;
}

//player state logic propositons (decide what to show to the player)

Template.introduceStrategy.rule = function() {
	var idSession = Players.findOne({idPlayer: Meteor.user().username}).idSession;
	var session = Sessions.findOne({idSession: idSession});
	return session.rule;
}

Template.tutorial.rule = function() {
	var idSession = Players.findOne({idPlayer: Meteor.user().username}).idSession;
	var session = Sessions.findOne({idSession: idSession});
	return session.rule;
}

Template.waitOtherStrategies.playersLeft = function() {
  var idSession = Players.findOne({idPlayer: Meteor.user().username}).idSession;
  var round = Players.findOne({idPlayer: Meteor.user().username}).reward.length;
  var receivedStrategies = Plays.find({idSession: idSession, round: round}).count();
  var populationSize = Sessions.findOne({idSession: idSession}).populationSize;

  return populationSize - receivedStrategies;

}

Template.gameArea.rewardComputed = function() {
  var rewards = Players.findOne({idPlayer: Meteor.user().username}).reward.length;
  var strategies = Players.findOne({idPlayer: Meteor.user().username}).pPlayed.length;
  return rewards == strategies && Session.get("state")==2;
}

Template.gameArea.allRoundsPlayed = function() {
  var rewards = Players.findOne({idPlayer: Meteor.user().username}).reward.length;
  var numberRounds = Sessions.findOne({idSession: Players.findOne({idPlayer: Meteor.user().username}).idSession}).numberRounds;

  return (rewards == numberRounds);
}

Template.gameArea.strategiesInserted = function(){
	var pSize = Players.findOne({idPlayer: Meteor.user().username}).pPlayed.length;
	var rSize = Players.findOne({idPlayer: Meteor.user().username}).reward.length;
  return (Session.get("state") > 0) && (pSize >= rSize);
}

Template.gameArea.allAgentsResponded = function(){
  var idSession = Players.findOne({idPlayer: Meteor.user().username}).idSession;
  var round = Players.findOne({idPlayer: Meteor.user().username}).reward.length;
  var receivedStrategies = Plays.find({idSession: idSession, round: round}).count();
  var populationSize = Sessions.findOne({idSession: idSession}).populationSize;

  return (receivedStrategies >= populationSize) || (Session.get("state")==2);
}

Template.gameArea.allRewardsCalculated = function(){
  return true;
}


text:
JsHamcrest.Integration.screwunit();
JsMockito.Integration.screwunit();

Screw.Matchers.throwsMessage = function(exceptionText) {
  return new JsHamcrest.SimpleMatcher({
    matches: function(actualFunction) {
      try {
        actualFunction();
      } catch (e) {
        var message = e.message || e;
        if (JsHamcrest.Matchers.equalTo(exceptionText).matches(message)) {
          return true;
        } else {
          throw e;
        }
      }
      return false;
    },

    describeTo: function(description) {
      description.append('throws "').append(exceptionText).append('"');
    }
  });
}

var MyObject = function() {};
MyObject.prototype = {
  greeting: function() { return "hello" },
  farewell: function() { return "goodbye" }
};

var MyUnwritableObject = function() {};

Object.defineProperties(MyUnwritableObject.prototype, {
  greeting: { enumerable: false, writable: false, value: function() { return "hello" } },
  farewell: { enumerable: true, writable: false, value: function() { return "goodbye" } }
});


text:
<!--
Copyright 2015 - Tomasz Cichocinski <tomaszcichocinski@gmail.com>
Released under the MIT License - https://github.com/Baransu/mendela-pl-p
-->

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>14</title>
    </head>
    <body>
        <input type="text" name="name" value="">
        <script type="text/javascript">
            var input = document.querySelector('input');
            input.style.backgroundColor = 'white';
            input.addEventListener('mouseover', function(e){
                e.target.style.backgroundColor = "#888888";
            }, false)
            input.addEventListener('mouseout', function(e){
                e.target.style.backgroundColor = 'white';
            }, false)
        </script>
    </body>
</html>


text:
<!DOCTYPE html>

    <meta charset="UTF-8" />
    <meta name="robots" content="index, follow, all" />
    <title>Thelia\Module\Validator\ModuleValidator | Thelia 2 API</title>

            <link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="../../../css/bootstrap-theme.min.css">
        <link rel="stylesheet" type="text/css" href="../../../css/sami.css">

        <meta name="MobileOptimized" content="width">
        <meta name="HandheldFriendly" content="true">
        <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">

                <form id="search-form" action="../../../search.html" method="GET">

            <input name="search"
                   class="typeahead form-control"
                   type="search"
                   placeholder="Search">
        </form>

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

                </button>
                Thelia 2 API

Classes

Namespaces

Interfaces

Traits

Index

Search

class

Thelia

Module

Validator

ModuleValidator

ModuleValidator

    class
    ModuleValidator

Class ModuleValidartor

Methods

                    __construct(
    string $modulePath = null,
    Translator $translator = null)

No description

                    setModulePath(
    mixed $modulePath)

No description

    mixed

                    getModulePath()

No description

    ModuleDescriptorValidator|null

                    getModuleDescriptor()

No description

    ModuleDefinition|null

                    getModuleDefinition()

No description

    mixed

                    getModuleVersion()

No description

    array

                    getErrors()

No description

    Translator

                    getTranslator()

No description

                    validate(
    bool $checkCurrentVersion = true)

Validate a module, checks :

                    loadModuleDefinition()

No description

    array

                    getModulesDependOf(
    bool|null $active = true)

Get an array of modules that depend of the current module

                    getCurrentModuleDependencies()

No description

Details

at line 57

    __construct(
    string $modulePath = null,
    Translator $translator = null)

Parameters

    string
                $modulePath
                the path of the module directory

    Translator
                $translator
                FOR UNIT TEST PURPOSE ONLY

at line 75

    setModulePath(
    mixed $modulePath)

Parameters

    mixed
                $modulePath

at line 83

    mixed
    getModulePath()

Return Value

    mixed

at line 91

    ModuleDescriptorValidator|null
    getModuleDescriptor()

Return Value

    ModuleDescriptorValidator|null

at line 99

    ModuleDefinition|null
    getModuleDefinition()

Return Value

    ModuleDefinition|null

at line 107

    mixed
    getModuleVersion()

Return Value

    mixed

at line 116

    array
    getErrors()

Return Value

    array

at line 124

    Translator
    getTranslator()

Return Value

    Translator

at line 142

    validate(
    bool $checkCurrentVersion = true)

Validate a module, checks :

version of Thelia

modules dependencies

Parameters

    bool
                $checkCurrentVersion
                if true it will also check if the module is
                                 already installed (not activated - present in module list)

at line 209

    loadModuleDefinition()

at line 347

    array
    getModulesDependOf(
    bool|null $active = true)

Get an array of modules that depend of the current module

Parameters

    bool|null
                $active
                if true only search in activated module, false only deactivated and null on all modules

Return Value

    array
            array of array with code which is the module code that depends of this current module and
                  version which is the required version of current module

at line 389

    getCurrentModuleDependencies()

        Generated by Sami, the API Documentation Generator.


text:
As explained [here](http://golang.org/doc/faq#atomic_maps) and [here](http://blog.golang.org/go-maps-in-action), the `map` type in Go doesn't support concurrent reads and writes. `concurrent-map` provides a high-performance solution to this by sharding the map with minimal time spent waiting for locks.

## usage

Import the package:

```go
import (
	"github.com/streamrail/concurrent-map"
)

```

```bash
go get "github.com/streamrail/concurrent-map"
```

The package is now imported under the "cmap" namespace.

## example

```go

	// Create a new map.
	map := cmap.New()

	// Sets item within map, sets "bar" under key "foo"
	map.Set("foo", "bar")

	// Retrieve item from map.
	if tmp, ok := map.Get("foo"); ok {
		bar := tmp.(string)
	}

	// Removes item under key "foo"
	map.Remove("foo")

```

For more examples have a look at concurrent_map_test.go.

Running tests:

```bash
go test "github.com/streamrail/concurrent-map"
```

## license
MIT (see [LICENSE](https://github.com/streamrail/concurrent-map/blob/master/LICENSE) file)


text:
/**
 * TODO: Document.
 */
package org.apache.reef.task.events;


text:
package projects.manager;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.web.context.WebApplicationContext;

public class ServletInitializer extends SpringBootServletInitializer {

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(ProjectStarter.class);
	}

	protected WebApplicationContext run(SpringApplication application) {
//		application.getSources().remove(ErrorPageFilter.class);//fix for glassfish
		return (WebApplicationContext) application.run();
	}
}


text:
<?php

namespace Symfony\Component\Icu;

use Symfony\Component\Intl\ResourceBundle\CurrencyBundle;
use Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface;

/**
 * An ICU-specific implementation of {@link \Symfony\Component\Intl\ResourceBundle\CurrencyBundleInterface}.
 *
 * This class normalizes the data of the ICU .res files to satisfy the contract
 * defined in {@link \Symfony\Component\Intl\ResourceBundle\CurrencyBundleInterface}.
 *
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
class IcuCurrencyBundle extends CurrencyBundle
{
    const INDEX_SYMBOL = 0;

    const INDEX_NAME = 1;

    const INDEX_FRACTION_DIGITS = 0;

    const INDEX_ROUNDING_INCREMENT = 1;

    public function __construct(StructuredBundleReaderInterface $reader)
    {
        parent::__construct(realpath(IcuData::getResourceDirectory() . '/curr'), $reader);
    }

    /**
     * {@inheritdoc}
     */
    public function getLocales()
    {
        return $this->readEntry('misc', array('Locales'));
    }

    /**
     * {@inheritdoc}
     */
    public function getCurrencyNames($locale = null)
    {
        if (null === $locale) {
            $locale = \Locale::getDefault();
        }

        $names = parent::getCurrencyNames($locale);

        $collator = new \Collator($locale);
        $collator->asort($names);

        return $names;
    }

    /**
     * {@inheritdoc}
     */
    public function getFractionDigits($currency)
    {
        $entry = $this->readEntry('misc', array('CurrencyMeta'));

        if (!isset($entry[$currency][self::INDEX_FRACTION_DIGITS])) {
            // The 'DEFAULT' key contains the fraction digits and the rounding
            // increment that are common for a lot of currencies.
            // Only currencies with different values are added to the icu-data
            // (e.g: CHF and JPY)
            return $entry['DEFAULT'][self::INDEX_FRACTION_DIGITS];
        }

        return $entry[$currency][self::INDEX_FRACTION_DIGITS];
    }

    /**
     * {@inheritdoc}
     */
    public function getRoundingIncrement($currency)
    {
        $entry = $this->readEntry('misc', array('CurrencyMeta'));

        if (!isset($entry[$currency][self::INDEX_ROUNDING_INCREMENT])) {
            // The 'DEFAULT' key contains the fraction digits and the rounding
            // increment that are common for a lot of currencies.
            // Only currencies with different values are added to the icu-data
            // (e.g: CHF and JPY)
            return $entry['DEFAULT'][self::INDEX_ROUNDING_INCREMENT];
        }

        return $entry[$currency][self::INDEX_ROUNDING_INCREMENT];
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Biblthca Lichenol. 50: 154 (1993)

#### Original name
Caloplaca lecidellae Poelt & Hinter.

### Remarks
null


text:
'use strict';
var components = require('../../api/v1/components'),
    Response = require('../../../lib/response').response,
    httpStatuses = require('../../res/httpStatuses'),
    errors = require('../../../lib/errorHandler/index').errBuilder.Errors,
    logger = require('../../../lib/logger/index').init(),
    requestParser = require('../helpers/requestParser');

var usage = function(req, res){
    res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
    res.status(httpStatuses.OK.code).send();
};

var getComponents = function(req, res, next){
    var url = req.forwardedHeaders.baseUrl + req.url,
        responder = new Response(res, next),
        accountId = requestParser.getAccountIdFromReq(req);

    if(!accountId){
        responder(errors.build(errors.Generic.NotAuthorized));
        return;
    }
    components.getComponents(accountId, url, req.query.full, function(err, components){
        if(!err){
            responder(httpStatuses.OK.code, components);
        } else {
            responder(err);
        }
    });
};

var getComponent = function(req, res, next){
    var accountId = requestParser.getAccountIdFromReq(req),
        responder = new Response(res, next);
    if(!accountId) {
        responder(errors.build(errors.Generic.NotAuthorized));
        return;
    }

    var options = {
        compId: req.params.componentId,
        accountId: accountId,
        url: req.forwardedHeaders.baseUrl + req.url
    };

    components.getComponent(options, function(err, comp){
        if(!err){
            responder(httpStatuses.OK.code, comp);
        } else {
            responder(err);
        }
    });
};

var addComponent = function(req, res, next){
    var options = {
        component: req.body,
        accountId: req.params.accountId,
        baseUrl: req.forwardedHeaders.baseUrl + req.url
    };
    var responder = new Response(res, next);
    components.addComponent(options, function(err, comp) {
        if(!err) {
            logger.info("Success Add Component Registration " + JSON.stringify(comp));
            responder(httpStatuses.Created.code, comp);
        } else {
            logger.error("Add Component Registration " + JSON.stringify(err));
            responder(err);
        }
    });
};

var updateComponent = function(req, res, next){
    var options = {
        compId: req.params.componentId,
        componentToUpdate: req.body,
        accountId: req.params.accountId,
        baseUrl: req.forwardedHeaders.baseUrl + req.url.substring(0, req.url.indexOf(req.params.componentId) - 1)
    };
    var responder = new Response(res, next);
    components.updateComponent(options, function(err, comp){
        if(!err){
            responder(httpStatuses.Created.code, comp);
        } else {
            responder(err);
        }
    });
};

module.exports = {
    usage: usage,
    getComponents: getComponents,
    getComponent: getComponent,
    addComponent: addComponent,
    updateComponent: updateComponent
};


text:
using OpenSage.Data.Ini;

namespace OpenSage.Logic.Object
{
    [AddedIn(SageGame.Bfme2)]
    public sealed class ReplaceObjectUpdateModuleData : UpdateModuleData
    {
        internal static ReplaceObjectUpdateModuleData Parse(IniParser parser) => parser.ParseBlock(FieldParseTable);

        private static readonly IniParseTable<ReplaceObjectUpdateModuleData> FieldParseTable = new IniParseTable<ReplaceObjectUpdateModuleData>
        {
            { "SpecialPowerTemplate", (parser, x) => x.SpecialPowerTemplate = parser.ParseAssetReference() },
            { "SkipContinue", (parser, x) => x.SkipContinue = parser.ParseBoolean() },
            { "UnpackingVariation", (parser, x) => x.UnpackingVariation = parser.ParseInteger() },
            { "UnpackTime", (parser, x) => x.UnpackTime = parser.ParseInteger() },
            { "PreparationTime", (parser, x) => x.PreparationTime = parser.ParseInteger() },
            { "PersistentPrepTime", (parser, x) => x.PersistentPrepTime = parser.ParseInteger() },
            { "PackTime", (parser, x) => x.PackTime = parser.ParseInteger() },
            { "AwardXPForTriggering", (parser, x) => x.AwardXPForTriggering = parser.ParseInteger() },
            { "StartAbilityRange", (parser, x) => x.StartAbilityRange = parser.ParseFloat() },
            { "MustFinishAbility", (parser, x) => x.MustFinishAbility = parser.ParseBoolean() },
            { "ReplaceObject", (parser, x) => x.ReplaceObject = ReplaceObject.Parse(parser) },
            { "ReplaceRadius", (parser, x) => x.ReplaceRadius = parser.ParseFloat() },
            { "ReplaceFX", (parser, x) => x.ReplaceFX = parser.ParseAssetReference() },
            { "Scatter", (parser, x) => x.Scatter = parser.ParseBoolean() },
        };

        public string SpecialPowerTemplate { get; private set; }
        public bool SkipContinue { get; private set; }
        public int UnpackingVariation { get; private set; }
        public int UnpackTime { get; private set; }
        public int PreparationTime { get; private set; }
        public int PersistentPrepTime { get; private set; }
        public int PackTime { get; private set; }
        public int AwardXPForTriggering { get; private set; }
        public float StartAbilityRange { get; private set; }
        public bool MustFinishAbility { get; private set; }
        public ReplaceObject ReplaceObject { get; private set; }
        public float ReplaceRadius { get; private set; }
        public string ReplaceFX { get; private set; }
        public bool Scatter { get; private set; }
    }

    public sealed class ReplaceObject
    {
        internal static ReplaceObject Parse(IniParser parser) => parser.ParseBlock(FieldParseTable);

        private static readonly IniParseTable<ReplaceObject> FieldParseTable = new IniParseTable<ReplaceObject>
        {
            { "TargetObjectFilter", (parser, x) => x.TargetObjectFilter = ObjectFilter.Parse(parser) },
            { "ReplacementObjectName", (parser, x) => x.ReplacementObjectName = parser.ParseAssetReferenceArray() }
        };

        public ObjectFilter TargetObjectFilter { get; private set; }
        public string[] ReplacementObjectName { get; private set; }
    }
}


text:
package stexfires.io;

import stexfires.core.TextRecord;
import stexfires.io.spec.RecordFileSpec;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.util.Objects;

/**
 * @author Mathias Kalb
 * @since 0.1
 */
public class BaseRecordFile<W extends TextRecord, R extends W, S extends RecordFileSpec>
        implements ReadableRecordFile<R, S>, WritableRecordFile<W, S> {

    protected final Path path;
    protected final S fileSpec;

    public BaseRecordFile(Path path, S fileSpec) {
        Objects.requireNonNull(path);
        Objects.requireNonNull(fileSpec);
        this.path = path;
        this.fileSpec = fileSpec;
    }

    @Override
    public final Path getPath() {
        return path;
    }

    @Override
    public final S getFileSpec() {
        return fileSpec;
    }

    @Override
    public ReadableRecordProducer<R> openProducer() throws IOException {
        throw new UnsupportedOperationException("openProducer() not implemented");
    }

    @Override
    public WritableRecordConsumer<W> openConsumer(OpenOption... writeOptions) throws IOException {
        throw new UnsupportedOperationException("openConsumer(OpenOption...) not implemented");
    }

    protected final InputStream newInputStream() throws IOException {
        return Files.newInputStream(path);
    }

    protected final OutputStream newOutputStream(OpenOption... writeOptions) throws IOException {
        return Files.newOutputStream(path, writeOptions);
    }

}


text:
using System;
using System.Threading;
using System.Threading.Tasks;
using NServiceBus;
using NServiceBus.AcceptanceTesting;
using NServiceBus.AcceptanceTesting.Support;
using NServiceBus.Raw.DelayedRetries;
using NServiceBus.Transport;

static class DelayedRetryEndpointComponentExtensions
{
    public static IScenarioWithEndpointBehavior<TContext> WithDelayedRetryEndpointComponent<TTransport, TContext>(this IScenarioWithEndpointBehavior<TContext> scenario, Action<TransportExtensions<TTransport>> customizeTransport, string name)
        where TContext : ScenarioContext
        where TTransport : TransportDefinition, new()
    {
        var component = new DelayedRetryEndpointComponent<TTransport, TContext>(name, customizeTransport);
        return scenario.WithComponent(component);
    }
}

class DelayedRetryEndpointComponent<TTransport, TContext> : IComponentBehavior
    where TContext : ScenarioContext
    where TTransport : TransportDefinition, new()
{
    string name;
    Action<TransportExtensions<TTransport>> customizeTransport;

    public DelayedRetryEndpointComponent(string name, Action<TransportExtensions<TTransport>> customizeTransport)
    {
        this.name = name;
        this.customizeTransport = customizeTransport;
    }

    public Task<ComponentRunner> CreateRunner(RunDescriptor run)
    {
        var endpoint = new DelayedRetryEndpoint<TTransport>(name, null, customizeTransport);

        return Task.FromResult<ComponentRunner>(new Runner(name, endpoint));
    }

    class Runner : ComponentRunner
    {
        DelayedRetryEndpoint<TTransport> endpoint;

        public Runner(string name, DelayedRetryEndpoint<TTransport> endpoint)
        {
            Name = name;
            this.endpoint = endpoint;
        }

        public override Task ComponentsStarted(CancellationToken token)
        {
            return Task.FromResult(0);
        }

        public override Task Start(CancellationToken token)
        {
            return endpoint.Start();
        }

        public override async Task Stop()
        {
            if (endpoint != null)
            {
                await endpoint.Stop().ConfigureAwait(false);
            }
        }

        public override string Name { get; }
    }
}


text:
#include "utils/task_thread_pool.h"

#include <thread>

#include "base/integral_types.h"
#include "base/logging.h"

namespace vraudio {

// A simple worker thread wrapper, to be used by TaskThreadPool.
class TaskThreadPool::WorkerThread {
 public:
  // Constructor.
  //
  // @param parent_pool The |TaskThreadPool| which owns and manages this
  //     |WorkerThread| instance.
  WorkerThread()
      : parent_pool_(), task_closure_(), task_loop_triggered_(false) {}

  // Copy constructor. Necessary for allowing this class to be storied in
  // std::vector<WorkerThread> container class.
  //
  // @param other |WorkerThread| instance this instance will be copied from.
  WorkerThread(const TaskThreadPool::WorkerThread& other)
      : parent_pool_(), task_closure_(), task_loop_triggered_(false) {}

  // Destructor.
  ~WorkerThread();

  // Sets the parent pool for this |WorkerThread|.
  //
  // @param parent_pool The |TaskThreadPool| which owns this |WorkerThread|.
  // @return True indicates that the thread could be started.
  bool SetParentAndStart(TaskThreadPool* parent_pool);

  // Indicates that the worker thread should run the |TaskClosure| task.
  //
  // @param task_closure The task function which |TaskThreadPool| assigns to
  //      this |WorkerThread|.
  void Run(TaskClosure task_closure);

  // Waits for the |WorkerThread| task loop to exit, for shutdown.
  void Join();

  // Checks whether this |WorkerThread| is available for a task assignment.
  bool IsAvailable() const;

 private:
  // The task loop for this |WorkerThread|. This function will wait for an
  // assigned task, execute the task, and then reset itself to wait for the next
  // task.
  void TaskLoop();

  // This |WorkerThread|'s parent |TaskThreadPool|.
  TaskThreadPool* parent_pool_;

  // Condition allowing the |TaskThreadPool| to trigger this worker thread to
  // continue once it has been given a work assignment.
  std::condition_variable execute_task_condition_;

  // Mutex for receiving |execute_task_condition_| notification.
  std::mutex execute_task_mutex_;

  // The current task binding which the Worker Thread has been asked to
  // execute.
  TaskClosure task_closure_;

  // An atomic boolean to indicate that a task loop trigger has occurred. This
  // may happen even when a task has not been assigned during shutdown.
  std::atomic<bool> task_loop_triggered_;

  // The worker thread.
  std::thread task_thread_;
};

TaskThreadPool::TaskThreadPool()
    : num_worker_threads_available_(0),
      is_pool_running_(false) {}

TaskThreadPool::~TaskThreadPool() { StopThreadPool(); }

bool TaskThreadPool::StartThreadPool(size_t num_worker_threads) {
  if (is_pool_running_) {
    return true;
  }
  is_pool_running_ = true;
  worker_threads_.resize(num_worker_threads);

  // Start all worker threads.
  for (auto& worker_thread : worker_threads_) {
    bool thread_started = worker_thread.SetParentAndStart(this);
    if (!thread_started) {
      StopThreadPool();
      return false;
    }
  }

  // Wait for all worker threads to be launched.
  std::unique_lock<std::mutex> worker_lock(worker_available_mutex_);
  worker_available_condition_.wait(worker_lock, [this, num_worker_threads]() {
    return !is_pool_running_.load() || num_worker_threads_available_.load() ==
                                           static_cast<int>(num_worker_threads);
  });

  return true;
}

void TaskThreadPool::StopThreadPool() {
  if (!is_pool_running_) {
    return;
  }
  // Shut down all active worker threads.
  {
    std::lock_guard<std::mutex> worker_lock(worker_available_mutex_);
    is_pool_running_ = false;
  }
  worker_available_condition_.notify_one();

  // Join and destruct workers.
  worker_threads_.resize(0);
}

bool TaskThreadPool::WaitUntilWorkerBecomesAvailable() {
  if (!is_pool_running_.load()) {
    return false;
  }
  if (num_worker_threads_available_.load() > 0) {
    return true;
  }
  std::unique_lock<std::mutex> worker_lock(worker_available_mutex_);
  worker_available_condition_.wait(worker_lock, [this]() {
    return (num_worker_threads_available_.load() > 0) ||
           !is_pool_running_.load();
  });
  return num_worker_threads_available_.load() > 0 && is_pool_running_.load();
}

bool TaskThreadPool::RunOnWorkerThread(TaskThreadPool::TaskClosure closure) {
  if (!is_pool_running_.load() || num_worker_threads_available_.load() == 0) {
    return false;
  }
  // Find the first available worker thread.
  WorkerThread* available_worker_thread = nullptr;
  for (auto& worker_thread : worker_threads_) {
    if (worker_thread.IsAvailable()) {
      available_worker_thread = &worker_thread;
      break;
    }
  }
  DCHECK(available_worker_thread);
  {
    std::lock_guard<std::mutex> lock(worker_available_mutex_);
    --num_worker_threads_available_;
  }
  available_worker_thread->Run(std::move(closure));
  return true;
}

size_t TaskThreadPool::GetAvailableTaskThreadCount() const {
  return num_worker_threads_available_.load();
}

bool TaskThreadPool::IsPoolRunning() { return is_pool_running_.load(); }

void TaskThreadPool::SignalWorkerAvailable() {
  {
    std::lock_guard<std::mutex> lock(worker_available_mutex_);
    ++num_worker_threads_available_;
  }
  worker_available_condition_.notify_one();
}

TaskThreadPool::WorkerThread::~WorkerThread() { Join(); }

bool TaskThreadPool::WorkerThread::SetParentAndStart(
    TaskThreadPool* parent_pool) {
  parent_pool_ = parent_pool;

  // Start the worker thread.
  task_thread_ = std::thread(std::bind(&WorkerThread::TaskLoop, this));
  return true;
}

void TaskThreadPool::WorkerThread::Run(TaskThreadPool::TaskClosure closure) {
  if (closure) {
    task_closure_ = std::move(closure);
    {
      std::lock_guard<std::mutex> lock(execute_task_mutex_);
      task_loop_triggered_ = true;
    }
    execute_task_condition_.notify_one();
  }
}

void TaskThreadPool::WorkerThread::Join() {
  DCHECK(!parent_pool_->IsPoolRunning());
  // Aquire and release lock to assure that the notify cannot happen between the
  // check of the predicate and wait of the |push_conditional_|.
  { std::lock_guard<std::mutex> lock(execute_task_mutex_); }
  execute_task_condition_.notify_one();
  if (task_thread_.joinable()) {
    task_thread_.join();
  }
}

bool TaskThreadPool::WorkerThread::IsAvailable() const {
  return !task_loop_triggered_.load();
}

void TaskThreadPool::WorkerThread::TaskLoop() {
  // Signal back to the parent thread pool that this thread has started and is
  // ready for use.
  task_loop_triggered_ = false;

  while (parent_pool_->IsPoolRunning() || task_closure_ != nullptr) {
    parent_pool_->SignalWorkerAvailable();
    std::unique_lock<std::mutex> task_lock(execute_task_mutex_);
    execute_task_condition_.wait(task_lock, [this]() {
      return task_loop_triggered_.load() || !parent_pool_->IsPoolRunning();
    });

    // Execute the assigned task.
    if (task_closure_ != nullptr) {
      task_closure_();

      // Clear the assigned task and return to ready state.
      task_closure_ = nullptr;
    }
    task_loop_triggered_ = false;
  }
}

}  // namespace vraudio


text:
var fs = require('fs');
var colors = require('colors');
var template_file_name = '_template.json';
var template_keys = require('./languages/' + template_file_name);

fs.readdir('./languages', function(err, files) {
  if (err) console.log(err);
  files.forEach(function(fileName) {
    if (fileName == template_file_name) { return; }
    var language = fileName.substr(0, fileName.length-5);
    console.log("\n" + language + ":\n");

    var search_localized_strings_cmd = "cd /Applications && cat *.app/Contents/Resources/" + language + ".lproj/MainMenu.strings | grep '";

    for (var key in template_keys) {
      search_localized_strings_cmd += '\\|"' + key + '"';
    }

    search_localized_strings_cmd += '\' -A 1';

    console.log(search_localized_strings_cmd);
    console.log("\n\n");
  });
});


text:
// Copyright 2007-2015 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
namespace MassTransit.Saga.Pipeline.Filters
{
    using System.Threading.Tasks;
    using MassTransit.Pipeline;
    using Pipes;
    using Util;

    /// <summary>
    /// Splits a context item off the pipe and carries it out-of-band to be merged
    /// once the next filter has completed
    /// </summary>
    /// <typeparam name="TSaga"></typeparam>
    /// <typeparam name="TMessage"></typeparam>
    public class SagaSplitFilter<TSaga, TMessage> :
        IFilter<SagaConsumeContext<TSaga, TMessage>>
        where TMessage : class
        where TSaga : class, ISaga
    {
        readonly IFilter<SagaConsumeContext<TSaga>> _next;

        public SagaSplitFilter(IFilter<SagaConsumeContext<TSaga>> next)
        {
            _next = next;
        }

        void IProbeSite.Probe(ProbeContext context)
        {
            ProbeContext scope = context.CreateFilterScope("split");
            scope.Set(new
            {
                ConsumerType = TypeMetadataCache<TSaga>.ShortName,
            });

            _next.Probe(scope);
        }

        public Task Send(SagaConsumeContext<TSaga, TMessage> context, IPipe<SagaConsumeContext<TSaga, TMessage>> next)
        {
            var mergePipe = new SagaMergePipe<TSaga, TMessage>(next);

            return _next.Send(context, mergePipe);
        }
    }
}


text:
esp_bridge
================

This is source code for esp8266 support bridge for arduino or any MCU using SLIP protocol via Serial port.
###Library for arduino: [https://github.com/tuanpmt/espduino](https://github.com/tuanpmt/espduino)

If you want using only ESP8266, you can find the **Native MQTT client** library for ESP8266 work well here:
[https://github.com/tuanpmt/esp_mqtt](https://github.com/tuanpmt/esp_mqtt)

Warning
==============
This project **only execute commands from other MCU** via Serial port (like arduino).

Features
========
- Rock Solid wifi network client for Arduino (of course need to test more and resolve more issues :v)
- **More reliable** than AT COMMAND library (Personal comments)
- **Firmware applications written on ESP8266 can be read out completely. For security applications, sometimes you should use it as a Wifi client (network client) and other MCU with Readout protection.**
- It can be combined to work in parallel with the AT-COMMAND library
- MQTT module:
    + MQTT client run stable as Native MQTT client (esp_mqtt)
    + Support subscribing, publishing, authentication, will messages, keep alive pings and all 3 QoS levels (it should be a fully functional client).
    + **Support multiple connection (to multiple hosts).**
    + Support SSL
    + Easy to setup and use
- REST module:
    + Support method GET, POST, PUT, DELETE
    + setContent type, set header, set User Agent
    + Easy to used API
    + Support SSL
- WIFI module:

Installations
========

You can found here for instructions: [https://github.com/tuanpmt/espduino](https://github.com/tuanpmt/espduino)

Compile
=======

```bash
git clone --recursive https://github.com/tuanpmt/esp_bridge
cd esp_bridge
make all
```

Limited
========
It is not completely tested. Welcome your submitting issues.

Contributing
==========
There is very much needed module for this library, welcome your pull request:

Donations
==================
Invite me to a coffee
[![Donate](https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JR9RVLFC4GE6J)

Authors:
=====
[Tuan PM](https://twitter.com/tuanpmt)

**LICENSE - "MIT License"**

Copyright (c) 2014-2015 Tuan PM, [https://twitter.com/tuanpmt](https://twitter.com/tuanpmt)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


text:
<ion-modal-view>
  <ion-content>

        Do you want to leave your job?

					Yes
					Cancel

  </ion-content>
</ion-modal-view>


text:
using System;
using System.Threading.Tasks;
using Qlue.Logging;

namespace Qlue
{
    public interface IRequestChannel : IDisposable
    {
        TResponse SendWaitResponse<TResponse>(object request, TimeSpan timeout, ILog logForDispatch = null);

        Task<TResponse> SendWaitResponseAsync<TResponse>(object request, TimeSpan timeout, ILog logForDispatch = null);

        string SendOneWay(object request, ILog logForDispatch = null);

        Task<string> SendOneWayAsync(object request, ILog logForDispatch = null);

        Task<string> SendNotifyAsync(object notifyObject, string topicName = null, ILog logForDispatch = null);

        string SendNotify(object notifyObject, string topicName = null, ILog logForDispatch = null);
    }
}


text:
package com.github.gquintana.beepbeep.sql;

import com.github.gquintana.beepbeep.BeepBeepException;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class DriverSqlConnectionProvider implements SqlConnectionProvider {
    private final Class<? extends java.sql.Driver> driverClass;
    private final String url;
    private final String username;
    private final String password;
    private static final Pattern URL_PATTERN = Pattern.compile("^jdbc:([^:]+):.*");
    private static final Map<String, String> DRIVER_CLASS_BY_TYPE = createDriverClassByType();

    @SuppressWarnings("unchecked")
    public DriverSqlConnectionProvider(String driverClassName, String url, String username, String password) {
        try {
            this.driverClass = (Class<? extends Driver>) Class.forName(driverClassName);
        } catch (ClassNotFoundException e) {
            throw new BeepBeepException("Invalid SQL Driver " + driverClassName, e);
        }
        this.url = url;
        this.username = username;
        this.password = password;

    }

    public Class<? extends Driver> getDriverClass() {
        return driverClass;
    }

    public String getUrl() {
        return url;
    }

    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password;
    }

    @Override
    public Connection getConnection() throws SQLException {
        return DriverManager.getConnection(url, username, password);
    }

    private static Map<String, String> createDriverClassByType() {
        Map<String, String> driverClassByType = new HashMap<>();
        driverClassByType.put("h2", "org.h2.Driver");
        driverClassByType.put("hsqldb", "org.hsqldb.jdbc.JDBCDriver");
        driverClassByType.put("mysql", "com.mysql.jdbc.Driver");
        driverClassByType.put("oracle", "oracle.jdbc.driver.OracleDriver");
        driverClassByType.put("postgresql", "org.postgresql.Driver");
        driverClassByType.put("sqlserver", "com.microsoft.sqlserver.jdbc.SQLServerDriver");
        driverClassByType.put("derby", "org.apache.derby.jdbc.ClientDriver");
        driverClassByType.put("sybase", "com.sybase.jdbc.SybDriver");
        return driverClassByType;
    }

    public static DriverSqlConnectionProvider create(String url, String username, String password) {
        Matcher urlMatcher = URL_PATTERN.matcher(url);
        String driverClassName = null;
        if (urlMatcher.matches()) {
            String type = urlMatcher.group(1);
            driverClassName = DRIVER_CLASS_BY_TYPE.get(type);
        }
        if (driverClassName == null) {
            throw new IllegalArgumentException("Unrecognized database type");
        }
        return new DriverSqlConnectionProvider(driverClassName, url, username, password);
    }

    public SingleSqlConnectionProvider single() {
        return new SingleSqlConnectionProvider(this);
    }

    @Override
    public void close() {

    }
}


text:
namespace operations_research {
namespace scheduling {
namespace rcpsp {

// RCPSP parser.
// Parse a RCPSP problem and load it into a RcpspProblem proto.
// See description of the problem in ./rcpsp.proto
class RcpspParser {
 public:
  RcpspParser();

  // We keep the fully qualified name for swig.
  ::operations_research::scheduling::rcpsp::RcpspProblem problem() const {
    return rcpsp_;
  }

  // Returns false if an error occurred.
  bool ParseFile(const std::string& file_name);

 private:
  enum LoadStatus {
    NOT_STARTED,
    HEADER_SECTION,
    PROJECT_SECTION,
    INFO_SECTION,
    PRECEDENCE_SECTION,
    REQUEST_SECTION,
    RESOURCE_SECTION,
    RESOURCE_MIN_SECTION,
    PARSING_FINISHED,
    ERROR_FOUND
  };

  void ProcessRcpspLine(const std::string& line);
  void ProcessPattersonLine(const std::string& line);
  void ProcessRcpspMaxLine(const std::string& line);
  void ReportError(const std::string& line);
  // Sets the number of declared tasks, and initialize data structures
  // accordingly.
  void SetNumDeclaredTasks(int t);
  int strtoint32(const std::string& word);
  int64_t strtoint64(const std::string& word);

  std::string basedata_;
  int64_t seed_;
  LoadStatus load_status_;
  int num_declared_tasks_;
  int current_task_;
  std::vector<std::vector<int> > temp_delays_;
  std::vector<int> recipe_sizes_;
  int unreads_;
  RcpspProblem rcpsp_;
};

}  // namespace rcpsp
}  // namespace scheduling
}  // namespace operations_research

#endif  // OR_TOOLS_SCHEDULING_RCPSP_PARSER_H_


text:
bref: ""
draft: false
menu:
  sidenav:
    name: Downloads   -
    weight: -268
    parent: Wildfly Swarm
sidebar: sidenav
title: "Teiid Wildfly Swarm Downloads"
toc: true
weight: 10
---

Teiid Wildfly Swarm Downloads....


text:
<!doctype html>

<meta charset="UTF-8">
<title>HTML Parts</title>

Example HTML parts

Open your browser's console or developer mode to see the log messages from the different inputs!

Text Input:
<input type="text" id="text" onKeyDown="readText()">
(read the text when you hit 'enter')

Range Slider:
<input type="range" id="range" min="0" max="100" onChange="readRange()">
(read the value from 1 to 100 when you change)

Number Input:
<input type="number" id="number" onChange="readNumber()">
(read number when you change)

Button:
<input type="button" id="button" value="Button" onClick="clickButton()">
(detect button click)

Imgae Button:
<input type="image" id="image" src="sfe.jpg" onMouseOver="mouseoverImage()">
(detect mouse over image)

Selection:
<select id="select" onChange="readSelect()">
  <option value="Uno">Uno</option>
  <option value="Micro">Micro</option>
  <option value="Mega">Mega</option>
  <option value="Zero">Zero</option>
</select>
(read selection on change)

Checkbox:
<input type="checkbox" id="checkbox" onClick="readCheckbox()">
(read checkbox value on click)

Radio Button:
<input type="radio" id="radio" onChange="readRadio()">
(read radio value on click)


text:
package org.picocontainer.defaults;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.core.JVM;
import com.thoughtworks.xstream.io.xml.XppDriver;
import junit.framework.TestCase;
import org.picocontainer.MutablePicoContainer;
import org.picocontainer.PicoContainer;
import org.picocontainer.testmodel.DependsOnTouchable;
import org.picocontainer.testmodel.SimpleTouchable;

/**
 * @author Aslak Hellesøy
 * @version $Revision$
 */
public class XStreamSerialisationTestCase extends TestCase {
    private XStream xStream = new XStream(new XppDriver());

    public void testShouldBeAbleToSerialiseEmptyPico() {
        if (JVM.is14()) {
            MutablePicoContainer pico = new DefaultPicoContainer();
            String picoXml = xStream.toXML(pico);
            PicoContainer serializedPico = (PicoContainer) xStream.fromXML(picoXml);

            assertEquals(0, serializedPico.getComponentInstances().size());
        }
    }

    public void testShouldBeAbleToSerialisePicoWithUninstantiatedComponents() {
        if (JVM.is14()) {
            MutablePicoContainer pico = new DefaultPicoContainer();
            pico.registerComponentImplementation(SimpleTouchable.class);
            pico.registerComponentImplementation(DependsOnTouchable.class);
            String picoXml = xStream.toXML(pico);
            PicoContainer serializedPico = (PicoContainer) xStream.fromXML(picoXml);

            assertEquals(2, serializedPico.getComponentInstances().size());
        }
    }

    public void testShouldBeAbleToSerialisePicoWithInstantiatedComponents() {
        if (JVM.is14()) {
            MutablePicoContainer pico = new DefaultPicoContainer();
            pico.registerComponentImplementation(SimpleTouchable.class);
            pico.registerComponentImplementation(DependsOnTouchable.class);
            pico.getComponentInstances();
            String picoXml = xStream.toXML(pico);
            PicoContainer serializedPico = (PicoContainer) xStream.fromXML(picoXml);

            assertEquals(2, serializedPico.getComponentInstances().size());
        }
    }
}


text:
package de.adesso.jenkinshue;

import java.io.File;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import lombok.extern.log4j.Log4j2;

/**
 *
 * @author wennier
 *
 */
@Log4j2
@SpringBootApplication
public class Application {

	@Value("${trust-store:#{null}}")
	private String trustStore;

	@Value("${trust-store-password:#{null}}")
	private String trustStorePassword;

	@PostConstruct
	public void init() {
		if(trustStore != null && trustStorePassword != null) {
			log.debug(new File(trustStore).getAbsolutePath());
			System.setProperty("javax.net.ssl.trustStore", trustStore);
			System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
			log.info("Keystore set");
		}
	}

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}

}


text:
namespace AutoMapper.QueryableExtensions.Impl
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Linq.Expressions;
    using System.Reflection;

    public class MemberGetterExpressionResultConverter : IExpressionResultConverter
    {
        public ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap)
        {
            return ExpressionResolutionResult(expressionResolutionResult, propertyMap.SourceMembers);
        }

        public ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult,
            ConstructorParameterMap propertyMap)
        {
            return ExpressionResolutionResult(expressionResolutionResult, propertyMap.SourceMembers);
        }

        private static ExpressionResolutionResult ExpressionResolutionResult(
            ExpressionResolutionResult expressionResolutionResult, IEnumerable<IMemberGetter> sourceMembers)
        {
            return sourceMembers.Aggregate(expressionResolutionResult, ExpressionResolutionResult);
        }

        private static ExpressionResolutionResult ExpressionResolutionResult(
            ExpressionResolutionResult expressionResolutionResult, IMemberGetter getter)
        {
            Expression currentChild = expressionResolutionResult.ResolutionExpression;
            Type currentChildType;
            var memberInfo = getter.MemberInfo;

            var propertyInfo = memberInfo as PropertyInfo;
            if (propertyInfo != null)
            {
                currentChild = Expression.Property(currentChild, propertyInfo);
                currentChildType = propertyInfo.PropertyType;
            }
            else
                currentChildType = currentChild.Type;

            return new ExpressionResolutionResult(currentChild, currentChildType);
        }

        public bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap)
        {
            return propertyMap.SourceMembers.Any();
        }

        public bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, ConstructorParameterMap propertyMap)
        {
            return propertyMap.SourceMembers.Any();
        }
    }
}


text:
#include <aws/iot/model/CreateAuditSuppressionRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

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

CreateAuditSuppressionRequest::CreateAuditSuppressionRequest() :
    m_checkNameHasBeenSet(false),
    m_resourceIdentifierHasBeenSet(false),
    m_expirationDateHasBeenSet(false),
    m_suppressIndefinitely(false),
    m_suppressIndefinitelyHasBeenSet(false),
    m_descriptionHasBeenSet(false),
    m_clientRequestToken(Aws::Utils::UUID::RandomUUID()),
    m_clientRequestTokenHasBeenSet(true)
{
}

Aws::String CreateAuditSuppressionRequest::SerializePayload() const
{
  JsonValue payload;

  if(m_checkNameHasBeenSet)
  {
   payload.WithString("checkName", m_checkName);

  }

  if(m_resourceIdentifierHasBeenSet)
  {
   payload.WithObject("resourceIdentifier", m_resourceIdentifier.Jsonize());

  }

  if(m_expirationDateHasBeenSet)
  {
   payload.WithDouble("expirationDate", m_expirationDate.SecondsWithMSPrecision());
  }

  if(m_suppressIndefinitelyHasBeenSet)
  {
   payload.WithBool("suppressIndefinitely", m_suppressIndefinitely);

  }

  if(m_descriptionHasBeenSet)
  {
   payload.WithString("description", m_description);

  }

  if(m_clientRequestTokenHasBeenSet)
  {
   payload.WithString("clientRequestToken", m_clientRequestToken);

  }

  return payload.View().WriteReadable();
}


text:
<?php

declare(strict_types=1);

namespace Gpupo\CommonSchema\Tests\Bridge\Trading\Order\Shipping;

use Gpupo\CommonSchema\Bridge\Trading\Order\Shipping\PaymentBridge;
use Gpupo\CommonSchema\ORM\Entity\Banking\Report\Report;
use Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Payment\Payment;
use Gpupo\CommonSchema\ORM\EntityDecorator\Banking\Report\Records;
use Gpupo\CommonSchema\Tests\AbstractTestCase;
use Gpupo\CommonSchema\Tests\DataProvider\DataProviderBankingTrait;

/**
 * @coversNothing
 */
class PaymentBridgeTest extends AbstractTestCase
{
    use DataProviderBankingTrait;

    /**
     * @dataProvider dataProviderReport
     */
    public function testAccessNewBankingRecords(Report $report, array $expected)
    {
        $this->truncate(Payment::class);
        $this->persistIfNotExist($report);
        $bridge = new PaymentBridge($this->getDoctrineEntityManager());
        $records = $bridge->getNewReportRecords();

        if (null === $records) {
            $this->truncate(Payment::class);
            $records = $bridge->getNewReportRecords();
        }

        $this->assertInstanceOf(Records::class, $records);

        return $bridge;
    }
}


text:
package hex.genmodel.algos.tree;

import java.io.PrintStream;
import java.util.ArrayList;

/**
 * Subgraph for representing a tree.
 * A subgraph contains nodes.
 */
class SharedTreeSubgraph {
  private final int subgraphNumber;
  private final String name;
  private SharedTreeNode rootNode;

  // Even though all the nodes are reachable from rootNode, keep a second handy list of nodes.
  // For some bookkeeping tasks.
  private ArrayList<SharedTreeNode> nodesArray;

  /**
   * Create a new tree object.
   * @param sn Tree number
   * @param n Tree name
   */
  SharedTreeSubgraph(int sn, String n) {
    subgraphNumber = sn;
    name = n;
    nodesArray = new ArrayList<>();
  }

  /**
   * Make the root node in the tree.
   * @return The node
   */
  SharedTreeNode makeRootNode() {
    SharedTreeNode n = new SharedTreeNode(null, subgraphNumber, nodesArray.size(), 0);
    n.setInclusiveNa(true);
    nodesArray.add(n);
    rootNode = n;
    return n;
  }

  /**
   * Make the left child of a node.
   * @param parent Parent node
   * @return The new child node
   */
  SharedTreeNode makeLeftChildNode(SharedTreeNode parent) {
    SharedTreeNode child = new SharedTreeNode(parent, subgraphNumber, nodesArray.size(), parent.getDepth() + 1);
    nodesArray.add(child);
    makeLeftEdge(parent, child);
    return child;
  }

  /**
   * Make the right child of a node.
   * @param parent Parent node
   * @return The new child node
   */
  SharedTreeNode makeRightChildNode(SharedTreeNode parent) {
    SharedTreeNode child = new SharedTreeNode(parent, subgraphNumber, nodesArray.size(), parent.getDepth() + 1);
    nodesArray.add(child);
    makeRightEdge(parent, child);
    return child;
  }

  private void makeLeftEdge(SharedTreeNode parent, SharedTreeNode child) {
    parent.setLeftChild(child);
  }

  private void makeRightEdge(SharedTreeNode parent, SharedTreeNode child) {
    parent.setRightChild(child);
  }

  void print() {
    System.out.println("");
    System.out.println("    ----- " + name + " -----");

    System.out.println("    Nodes");
    for (SharedTreeNode n : nodesArray) {
      n.print();
    }

    System.out.println("");
    System.out.println("    Edges");
    rootNode.printEdges();
  }

  void printDot(PrintStream os, int maxLevelsToPrintPerEdge, boolean detail) {
    os.println("");
    os.println("subgraph " + "cluster_" + subgraphNumber + " {");
    os.println("/* Nodes */");

    int maxLevel = -1;
    for (SharedTreeNode n : nodesArray) {
      if (n.getDepth() > maxLevel) {
        maxLevel = n.getDepth();
      }
    }

    for (int level = 0; level <= maxLevel; level++) {
      os.println("");
      os.println("/* Level " + level + " */");
      os.println("{");
      rootNode.printDotNodesAtLevel(os, level, detail);
      os.println("}");
    }

    os.println("");
    os.println("/* Edges */");
    for (SharedTreeNode n : nodesArray) {
      n.printDotEdges(os, maxLevelsToPrintPerEdge);
    }
    os.println("");
    os.println("fontsize=40");
    os.println("label=\"" + name + "\"");
    os.println("}");
  }
}