text:
package com.firebase.ui.database;

import android.content.Context;

import com.firebase.ui.common.ChangeEventType;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;

import java.util.concurrent.Callable;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;

import static org.junit.Assert.assertTrue;

public class TestUtils {
    private static final String APP_NAME = "firebaseui-tests";
    private static final int TIMEOUT = 10000;

    public static FirebaseApp getAppInstance(Context context) {
        try {
            return FirebaseApp.getInstance(APP_NAME);
        } catch (IllegalStateException e) {
            return initializeApp(context);
        }
    }

    private static FirebaseApp initializeApp(Context context) {
        return FirebaseApp.initializeApp(context, new FirebaseOptions.Builder()
                .setApplicationId("fir-ui-tests")
                .setDatabaseUrl("https://fir-ui-tests.firebaseio.com/")
                .build(), APP_NAME);
    }

    public static ChangeEventListener runAndWaitUntil(
            ObservableSnapshotArray<?> array,
            Runnable task,
            Callable<Boolean> done) throws InterruptedException {

        final Semaphore semaphore = new Semaphore(0);
        ChangeEventListener listener = array.addChangeEventListener(new ChangeEventListener() {
            @Override
            public void onChildChanged(ChangeEventType type,
                                       DataSnapshot snapshot,
                                       int newIndex,
                                       int oldIndex) {
                semaphore.release();
            }

            @Override
            public void onDataChanged() {
            }

            @Override
            public void onError(DatabaseError error) {
                throw new IllegalStateException(error.toException());
            }
        });
        task.run();

        boolean isDone = false;
        long startedAt = System.currentTimeMillis();
        while (!isDone && System.currentTimeMillis() - startedAt < TIMEOUT) {
            semaphore.tryAcquire(1, TimeUnit.SECONDS);
            try {
                isDone = done.call();
            } catch (Exception e) {
                e.printStackTrace();
                // and we're not done
            }
        }
        assertTrue("Timed out waiting for expected results on FirebaseArray", isDone);

        return listener;
    }

    public static boolean isValuesEqual(ObservableSnapshotArray<Integer> array, int[] expected) {
        if (array.size() != expected.length) return false;
        for (Integer i : array) {
            if (!i.equals(expected[i])) {
                return false;
            }
        }
        return true;
    }

    public static void pushValue(DatabaseReference keyRef,
                                 DatabaseReference ref,
                                 Object value,
                                 Object priority) {
        String key = keyRef.push().getKey();

        if (priority != null) {
            keyRef.child(key).setValue(true, priority);
            ref.child(key).setValue(value, priority);
        } else {
            keyRef.child(key).setValue(true);
            ref.child(key).setValue(value);
        }
    }
}


text:
describe Juvet::Mapper::MappedRepository do
  describe "#initialize" do
    it "extracts the adapter from the options" do
      subject = described_class.new Object, adapter: :blah
      expect(subject.adapter).to eq :blah
    end

    it "defaults to the null adapter if it's not specified" do
      subject = described_class.new Object
      expect(subject.adapter).to eq :null
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>
<html ng-app="mango">
	<head>
		<meta charset="UTF-8">
		<title>Mango - GUI for Weapons Dataset</title>
		<link rel="stylesheet" type="text/css" href="resources/styles/home.css" />
		<link rel="stylesheet" type="text/css" href="resources/bower_components/nvd3/build/nv.d3.css">
	</head>
	<body>

		<div ng-controller="pieChartController">
		    <nvd3 options="options" data="data"></nvd3>
		</div>

		<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
		<script src="resources/bower_components/angular/angular.js"></script>
		<script src="resources/bower_components/d3/d3.js"></script>
		<script src="resources/bower_components/nvd3/build/nv.d3.js"></script>
		<script src="resources/bower_components/angular-nvd3/dist/angular-nvd3.js"></script>
		<script src="resources/scripts/home.js"></script>
	</body>
</html>


text:
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.Resolve;
using JetBrains.ReSharper.Psi.Util;

using T4CodeGenerator.Generators.Core.Contracts;

namespace T4CodeGenerator.Generators.Core.Generators
{
    [GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")]
    public abstract class GeneratorBase : IGenerator
    {
        private static readonly Dictionary<Type, string> ReflectionTypeToAliasIndex = new Dictionary<Type, string>
        {
            { typeof(byte), "byte" },
            { typeof(sbyte), "sbyte" },
            { typeof(short), "short" },
            { typeof(ushort), "ushort" },
            { typeof(int), "int" },
            { typeof(uint), "uint" },
            { typeof(long), "long" },
            { typeof(ulong), "ulong" },
            { typeof(float), "float" },
            { typeof(double), "double" },
            { typeof(decimal), "decimal" },
            { typeof(object), "object" },
            { typeof(bool), "bool" },
            { typeof(char), "char" },
            { typeof(string), "string" },
            { typeof(void), "void" }
        };

        /// <summary>
        /// Utility class to produce culture-oriented representation of an object as a string.
        /// </summary>
        public class ToStringInstanceHelper
        {
            private readonly GeneratorBase _generator;

            public ToStringInstanceHelper(GeneratorBase generator)
            {
                _generator = generator;
            }

            private IFormatProvider _formatProviderField = System.Globalization.CultureInfo.InvariantCulture;
            /// <summary>
            /// Gets or sets format provider to be used by ToStringWithCulture method.
            /// </summary>
            public IFormatProvider FormatProvider
            {
                get => this._formatProviderField;
                set
                {
                    if (value != null)
                    {
                        _formatProviderField = value;
                    }
                }
            }
            /// <summary>
            /// This is called from the compile/run appdomain to convert objects within an expression block to a string
            /// </summary>
            public string ToStringWithCulture(object objectToConvert)
            {
                if (objectToConvert == null)
                {
                    throw new ArgumentNullException("objectToConvert");
                }

                return _generator.ConvertObjectToString(objectToConvert, _formatProviderField);
            }
        }

        private StringBuilder _generationEnvironment;

        public IGeneratorDataProvider DataProvider { get; set; }

        public abstract string Name { get; }

        public virtual string Description => null;

        public virtual bool Visible => true;

        /// <summary>
        /// Gets the current indent we use when adding lines to the output
        /// </summary>
        /// <remarks>
        /// Always returns string.Empty because we do not need to manually manage identation.
        /// </remarks>
        public string CurrentIndent => string.Empty;

        /// <summary>
        /// Current transformation session
        /// </summary>
        public virtual IDictionary<string, object> Session { get; set; }

        /// <summary>
        /// Helper to produce culture-oriented representation of an object as a string
        /// </summary>
        public ToStringInstanceHelper ToStringHelper { get; }

        /// <summary>
        /// The string builder that generation-time code is using to assemble generated output
        /// </summary>
        protected StringBuilder GenerationEnvironment
        {
            get => _generationEnvironment ?? (_generationEnvironment = new StringBuilder());
            set => _generationEnvironment = value;
        }

        protected GeneratorBase()
        {
            this.ToStringHelper = new ToStringInstanceHelper(this);
        }

        public abstract bool IsAvailable();

        //public virtual void Initialize() { }

        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText() => this.GenerationEnvironment.ToString();

        public void LineBreak()
        {
            this.GenerationEnvironment.Append(Environment.NewLine);
        }

        /// <summary>
        /// Write text directly into the generated output
        /// </summary>
        public void Write(string textToAppend)
        {
            if (string.IsNullOrEmpty(textToAppend))
            {
                return;
            }

            // Remove all the newlines, the code will be reformatted anyway.
            textToAppend = textToAppend.Replace(Environment.NewLine, string.Empty);

            this.GenerationEnvironment.Append(textToAppend);
        }

        /// <summary>
        /// Write formatted text directly into the generated output
        /// </summary>
        public void Write(string format, params object[] args)
        {
            Write(string.Format(System.Globalization.CultureInfo.CurrentCulture, format, args));
        }

        /// <summary>
        /// Raise an error
        /// </summary>
        public void Error(string message)
        {
            throw new GeneratorErrorException(message);
        }

        public void Error(bool condition, string message)
        {
            if (condition)
            {
                throw new GeneratorErrorException(message);
            }
        }

        protected virtual string ConvertObjectToString(object obj, IFormatProvider formatProvider)
        {
            if (obj is IType type)
            {
                ProcessNamespacesOfType(type);
                return type.GetPresentableName(CSharpLanguage.Instance);
            }

            if (obj is Type reflectionType)
            {
                ProcessNamespacesOfType(reflectionType);
                return GetPresentableName(reflectionType);
            }

            Type t = obj.GetType();
            MethodInfo method = t.GetMethod("ToString", new[] { typeof(IFormatProvider) });
            if (method == null)
            {
                return obj.ToString();
            }

            return (string)method.Invoke(obj, new object[] { formatProvider });
        }

        /// <summary>
        /// Returns the attribute name without 'Attribute' prefix, adds missing namespaces.
        /// </summary>
        protected string Attribute<TAttribute>()
            where TAttribute : Attribute
        {
            var attributeType = typeof(TAttribute);
            ProcessNamespacesOfType(attributeType);

            return attributeType.Name.Replace("Attribute", string.Empty);
        }

        protected virtual void ProcessImportedNamespace(string @namespace) { }

        private void ProcessNamespacesOfType(IType type)
        {
            if (!type.IsSimplePredefined())
            {
                ITypeElement typeElement = type.GetTypeElement();
                string @namespace = typeElement?.GetContainingNamespace().QualifiedName;
                ProcessImportedNamespace(@namespace);
            }

            if (type is IArrayType arrayType)
            {
                ProcessNamespacesOfType(arrayType.ElementType);
            }
            else
            {
                foreach (IType genericUnderlyingType in GetGenericUnderlyingTypes(type))
                {
                    ProcessNamespacesOfType(genericUnderlyingType);
                }
            }
        }

        private void ProcessNamespacesOfType(Type reflectionType)
        {
            if (!ReflectionTypeToAliasIndex.ContainsKey(reflectionType))
            {
                ProcessImportedNamespace(reflectionType.Namespace);
            }

            if (reflectionType.ContainsGenericParameters)
            {
                Type[] genericArguments = reflectionType.GetGenericArguments();
                foreach (Type genericArgument in genericArguments)
                {
                    ProcessNamespacesOfType(genericArgument);
                }
            }
        }

        private static string GetPresentableName(Type reflectionType)
        {
            if (ReflectionTypeToAliasIndex.TryGetValue(reflectionType, out string alias))
            {
                return alias;
            }

            return reflectionType.Name;
        }

        private static IEnumerable<IType> GetGenericUnderlyingTypes(IType type)
        {
            if (!(type is IDeclaredType declaredType))
            {
                yield break;
            }

            ITypeElement typeElement = type.GetTypeElement();
            if (typeElement == null)
            {
                yield break;
            }

            ISubstitution substitution = declaredType.GetSubstitution();
            foreach (ITypeParameter typeParameter in typeElement.GetAllTypeParameters())
            {
                yield return substitution[typeParameter];
            }
        }
    }
}


text:
package org.openfact.provider;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

/**
 * @author Stian Thorgersen
 */
public class ProviderConfigurationBuilder {

    private List<ProviderConfigProperty> properties = new LinkedList<>();

    private ProviderConfigurationBuilder() {
    }

    public static ProviderConfigurationBuilder create() {
        return new ProviderConfigurationBuilder();
    }

    public ProviderConfigPropertyBuilder property() {
        return new ProviderConfigPropertyBuilder();
    }

    public ProviderConfigurationBuilder property(ProviderConfigProperty property) {
        properties.add(property);
        return this;
    }

    public ProviderConfigurationBuilder property(String name, String label, String helpText, String type, Object defaultValue, List<String> options, boolean secret) {
        ProviderConfigProperty property = new ProviderConfigProperty(name, label, helpText, type, defaultValue);
        property.setOptions(options);
        property.setSecret(secret);
        properties.add(property);
        return this;
    }
    public ProviderConfigurationBuilder property(String name, String label, String helpText, String type, Object defaultValue, List<String> options) {
        ProviderConfigProperty property = new ProviderConfigProperty(name, label, helpText, type, defaultValue);
        property.setOptions(options);
        properties.add(property);
        return this;
    }

    public List<ProviderConfigProperty> build() {
        return properties;
    }

    public class ProviderConfigPropertyBuilder {

        private String name;
        private String label;
        private String helpText;
        private String type;
        private Object defaultValue;
        private List<String> options;
        private boolean secret;

        public ProviderConfigPropertyBuilder name(String name) {
            this.name = name;
            return this;
        }

        public ProviderConfigPropertyBuilder label(String label) {
            this.label = label;
            return this;
        }

        public ProviderConfigPropertyBuilder helpText(String helpText) {
            this.helpText = helpText;
            return this;
        }

        public ProviderConfigPropertyBuilder type(String type) {
            this.type = type;
            return this;
        }

        public ProviderConfigPropertyBuilder defaultValue(Object defaultValue) {
            this.defaultValue = defaultValue;
            return this;
        }

        public ProviderConfigPropertyBuilder options(String... options) {
            this.options = Arrays.asList(options);
            return this;
        }

        public ProviderConfigPropertyBuilder secret(boolean secret) {
            this.secret = secret;
            return this;
        }

        public ProviderConfigurationBuilder add() {
            ProviderConfigProperty property = new ProviderConfigProperty();
            property.setName(name);
            property.setLabel(label);
            property.setHelpText(helpText);
            property.setType(type);
            property.setDefaultValue(defaultValue);
            property.setOptions(options);
            property.setSecret(secret);
            ProviderConfigurationBuilder.this.properties.add(property);
            return ProviderConfigurationBuilder.this;
        }

    }

}


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
var HELPERS = exports.HELPERS = {
  Timer: function Timer(callback, delay) {
    var timerId = void 0;
    var start = void 0;
    var remaining = delay;

    this.pause = function () {
      clearTimeout(timerId);
      remaining -= new Date() - start;
    };

    this.resume = function () {
      start = new Date();
      clearTimeout(timerId);
      timerId = setTimeout(callback, remaining);
    };

    this.clear = function () {
      clearTimeout(timerId);
    };

    this.resume();
  }
};


text:
interface AudioBoolean {
    ogg: string;
    mp3: string;
    wav: string;
    m4a: string;
}

interface VideoBoolean {
    ogg: string;
    h264: string;
    webm: string;
}

interface InputBoolean {
    autocomplete: boolean;
    autofocus: boolean;
    list: boolean;
    placeholder: boolean;
    max: boolean;
    min: boolean;
    multiple: boolean;
    pattern: boolean;
    required: boolean;
    step: boolean;
}

interface InputTypesBoolean {
    color: boolean;
    date: boolean;
    datetime: boolean;
    "datetime-local": boolean;
    email: boolean;
    month: boolean;
    number: boolean;
    range: boolean;
    search: boolean;
    tel: boolean;
    time: boolean;
    url: boolean;
    week: boolean;
}

interface CssColumnsBoolean extends Boolean {
    breakafter: boolean;
    breakbefore: boolean;
    breakinside: boolean;
    fill: boolean;
    gap: boolean;
    rule: boolean;
    rulecolor: boolean;
    rulestyle: boolean;
    rulewidth: boolean;
    span: boolean;
    width: boolean;
}

interface FlashBoolean extends Boolean {
    blocked: boolean;
}

interface IndexeddbBoolean extends Boolean {
    deletedatabase: boolean;
}

interface WebglextensionsBoolean extends Boolean {
    ANGLE_instanced_arrays: boolean;
    EXT_blend_minmax: boolean;
    EXT_disjoint_timer_query: boolean;
    EXT_frag_depth: boolean;
    EXT_sRGB: boolean;
    EXT_shader_texture_lod: boolean;
    EXT_texture_filter_anisotropic: boolean;
    OES_element_index_uint: boolean;
    OES_standard_derivatives: boolean;
    OES_texture_float: boolean;
    OES_texture_float_linear: boolean;
    OES_texture_half_float: boolean;
    OES_texture_half_float_linear: boolean;
    OES_vertex_array_object: boolean;
    WEBGL_compressed_texture_etc1: boolean;
    WEBGL_compressed_texture_s3tc: boolean;
    WEBGL_debug_renderer_info: boolean;
    WEBGL_debug_shaders: boolean;
    WEBGL_depth_texture: boolean;
    WEBGL_draw_buffers: boolean;
    WEBGL_lose_context: boolean;
    WEBKIT_EXT_texture_filter_anisotropic: boolean;
    WEBKIT_WEBGL_compressed_texture_s3tc: boolean;
    WEBKIT_WEBGL_depth_texture: boolean;
    WEBKIT_WEBGL_lose_context: boolean;
}

interface WebpBoolean extends Boolean {
    alpha: boolean;
    animation: boolean;
    lossless: boolean;
}

interface DatauriBoolean extends Boolean {
    over32kb: boolean;
}

interface FeatureDetects {
    // Documented

    ambientlight: boolean;
    applicationcache: boolean;
    audio: AudioBoolean;
    batteryapi: boolean;
    blobconstructor: boolean;
    canvas: boolean;
    canvastext: boolean;
    contenteditable: boolean;
    contextmenu: boolean;
    cookies: boolean;
    cors: boolean;
    cryptography: boolean;
    customelements: boolean;
    customprotocolhandler: boolean;
    customevent: boolean;
    dart: boolean;
    dataview: boolean;
    emoji: boolean;
    eventlistener: boolean;
    exiforientation: boolean;
    flash: false | FlashBoolean;
    forcetouch: boolean;
    fullscreen: boolean;
    gamepads: boolean;
    geolocation: boolean;
    hashchange: boolean;
    hiddenscroll: boolean;
    history: boolean;
    htmlimports: boolean;
    ie8compat: boolean;
    indexeddb: false | IndexeddbBoolean;
    indexeddbblob: boolean;
    input: InputBoolean;
    search: boolean;
    inputtypes: InputTypesBoolean;
    intl: boolean;
    json: boolean;
    ligatures: boolean;
    olreversed: boolean;
    mathml: boolean;
    messagechannel: boolean;
    notification: boolean;
    pagevisibility: boolean;
    performance: boolean;
    pointerevents: boolean;
    pointerlock: boolean;
    postmessage: boolean;
    proximity: boolean;
    queryselector: boolean;
    quotamanagement: boolean;
    requestanimationframe: boolean;
    serviceworker: boolean;
    svg: boolean;
    templatestrings: boolean;
    touchevents: boolean;
    typedarrays: boolean;
    unicoderange: boolean;
    unicode: boolean;
    userdata: boolean;
    vibrate: boolean;
    video: VideoBoolean;
    vml: boolean;
    webintents: boolean;
    animation: boolean;
    webgl: boolean;
    websockets: boolean;
    xdomainrequest: boolean;
    adownload: boolean;
    audioloop: boolean;
    audiopreload: boolean;
    webaudio: boolean;
    lowbattery: boolean;
    canvasblending: boolean;
    todataurljpeg: boolean;
    todataurlpng: boolean;
    todataurlwebp: boolean;
    canvaswinding: boolean;
    getrandomvalues: boolean;
    cssall: boolean;
    cssanimations: boolean;
    appearance: boolean;
    backdropfilter: boolean;
    backgroundblendmode: boolean;
    backgroundcliptext: boolean;
    bgpositionshorthand: boolean;
    bgpositionxy: boolean;
    bgrepeatspace: boolean;
    bgrepeatround: boolean;
    backgroundsize: boolean;
    bgsizecover: boolean;
    borderimage: boolean;
    borderradius: boolean;
    boxshadow: boolean;
    boxsizing: boolean;
    csscalc: boolean;
    checked: boolean;
    csschunit: boolean;
    csscolumns: false | CssColumnsBoolean;
    cssgrid: boolean;
    cssgridlegacy: boolean;
    cubicbezierrange: boolean;
    "display-runin": boolean;
    displaytable: boolean;
    ellipsis: boolean;
    cssescape: boolean;
    cssexunit: boolean;
    cssfilters: boolean;
    flexbox: boolean;
    flexboxlegacy: boolean;
    flexboxtweener: boolean;
    flexwrap: boolean;
    fontface: boolean;
    generatedcontent: boolean;
    cssgradients: boolean;
    hairline: boolean;
    hsla: boolean;
    csshyphens: boolean;
    softhyphens: boolean;
    softhyphensfind: boolean;
    cssinvalid: boolean;
    lastchild: boolean;
    cssmask: boolean;
    mediaqueries: boolean;
    multiplebgs: boolean;
    nthchild: boolean;
    objectfit: boolean;
    opacity: boolean;
    overflowscrolling: boolean;
    csspointerevents: boolean;
    csspositionsticky: boolean;
    csspseudoanimations: boolean;
    csspseudotransitions: boolean;
    cssreflections: boolean;
    regions: boolean;
    cssremunit: boolean;
    cssresize: boolean;
    rgba: boolean;
    cssscrollbar: boolean;
    scrollsnappoints: boolean;
    shapes: boolean;
    siblinggeneral: boolean;
    subpixelfont: boolean;
    supports: boolean;
    target: boolean;
    textalignlast: boolean;
    textshadow: boolean;
    csstransforms: boolean;
    csstransforms3d: boolean;
    csstransformslevel2: boolean;
    preserve3d: boolean;
    csstransitions: boolean;
    userselect: boolean;
    cssvalid: boolean;
    cssvhunit: boolean;
    cssvmaxunit: boolean;
    cssvminunit: boolean;
    cssvwunit: boolean;
    willchange: boolean;
    wrapflow: boolean;
    classlist: boolean;
    createelementattrs: boolean;
    "createelement-attrs": boolean;
    dataset: boolean;
    documentfragment: boolean;
    hidden: boolean;
    microdata: boolean;
    mutationobserver: boolean;
    passiveeventlisteners: boolean;
    bdi: boolean;
    datalistelem: boolean;
    details: boolean;
    outputelem: boolean;
    picture: boolean;
    progressbar: boolean;
    meter: boolean;
    ruby: boolean;
    template: boolean;
    time: boolean;
    texttrackapi: boolean;
    track: boolean;
    unknownelements: boolean;
    es5array: boolean;
    es5date: boolean;
    es5function: boolean;
    es5object: boolean;
    es5: boolean;
    strictmode: boolean;
    es5string: boolean;
    es5syntax: boolean;
    es5undefined: boolean;
    es6array: boolean;
    arrow: boolean;
    es6collections: boolean;
    contains: boolean;
    generators: boolean;
    es6math: boolean;
    es6number: boolean;
    es6object: boolean;
    promises: boolean;
    es6string: boolean;
    devicemotion: boolean;
    deviceorientation: boolean;
    oninput: boolean;
    filereader: boolean;
    filesystem: boolean;
    capture: boolean;
    fileinput: boolean;
    directory: boolean;
    formattribute: boolean;
    localizednumber: boolean;
    placeholder: boolean;
    requestautocomplete: boolean;
    formvalidation: boolean;
    sandbox: boolean;
    seamless: boolean;
    srcdoc: boolean;
    apng: boolean;
    imgcrossorigin: boolean;
    jpeg2000: boolean;
    jpegxr: boolean;
    sizes: boolean;
    srcset: boolean;
    webpalpha: boolean;
    webpanimation: boolean;
    webplossless: boolean;
    "webp-lossless": boolean;
    webp: false | WebpBoolean;
    inputformaction: boolean;
    inputformenctype: boolean;
    inputformmethod: boolean;
    inputformtarget: boolean;
    hovermq: boolean;
    pointermq: boolean;
    beacon: boolean;
    lowbandwidth: boolean;
    eventsource: boolean;
    fetch: boolean;
    xhrresponsetypearraybuffer: boolean;
    xhrresponsetypeblob: boolean;
    xhrresponsetypedocument: boolean;
    xhrresponsetypejson: boolean;
    xhrresponsetypetext: boolean;
    xhrresponsetype: boolean;
    xhr2: boolean;
    scriptasync: boolean;
    scriptdefer: boolean;
    speechrecognition: boolean;
    speechsynthesis: boolean;
    localstorage: boolean;
    sessionstorage: boolean;
    websqldatabase: boolean;
    stylescoped: boolean;
    svgasimg: boolean;
    svgclippaths: boolean;
    svgfilters: boolean;
    svgforeignobject: boolean;
    inlinesvg: boolean;
    smil: boolean;
    textareamaxlength: boolean;
    bloburls: boolean;
    datauri: false | DatauriBoolean;
    urlparser: boolean;
    urlsearchparams: boolean;
    videoautoplay: boolean;
    videocrossorigin: boolean;
    videoloop: boolean;
    videopreload: boolean;
    webglextensions: false | WebglextensionsBoolean;
    datachannel: boolean;
    getusermedia: boolean;
    peerconnection: boolean;
    websocketsbinary: boolean;
    atobbtoa: boolean;
    framed: boolean;
    matchmedia: boolean;
    blobworkers: boolean;
    dataworkers: boolean;
    sharedworkers: boolean;
    transferables: boolean;
    webworkers: boolean;

    // Undocumented - usually aliases or new features

    "atob-btoa": boolean;
    "battery-api": boolean;
    "blob-constructor": boolean;
    "display-table": boolean;
    "input-formaction": boolean;
    "input-formenctype": boolean;
    "input-formtarget": boolean;
    "object-fit": boolean;
    crypto: boolean;
    displayrunin: boolean;
    fileinputdirectory: boolean;
    inputsearchevent: boolean;
    raf: boolean;
    webanimations: boolean;
}

interface Dictionary<T> {
    [key: string]: T;
}

interface ModernizrAPI {
    on(feature: string, cb: (result: boolean) => any): void;

    addTest(feature: string, test: (() => boolean) | boolean): ModernizrStatic;
    addTest(feature: Dictionary<any>): ModernizrStatic;

    atRule(prop: string): boolean;

    _domPrefixes: string[];

    hasEvent(eventName: string, element?: EventTarget): boolean;

    mq(mq: string): boolean;

    prefixed(prop: string): string;
    prefixed(prop: string, obj: EventTarget, element?: boolean): any;

    prefixedCSS(prop: string): string;

    prefixedCSSValue(prop: string, value: string): boolean;

    _prefixes: string[];

    testAllProps(prop: string, value?: string, skipValueTest?: boolean): boolean;

    testProp(prop: string, value?: string, useValue?: boolean): boolean;

    testStyles(rule: string, callback: (elem: HTMLDivElement, rule: string) => void, nodes?: number, testnames?: string[]): boolean;
}

interface ModernizrStatic extends ModernizrAPI, FeatureDetects { }

declare var Modernizr: ModernizrStatic;
declare module "modernizr" {
    export = Modernizr;
}


text:
#include "fmacros.h"

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <netdb.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>

#include "anet.h"

static void anetSetError(char *err, const char *fmt, ...)
{
    va_list ap;

    if (!err) return;
    va_start(ap, fmt);
    vsnprintf(err, ANET_ERR_LEN, fmt, ap);
    va_end(ap);
}

int anetNonBlock(char *err, int fd)
{
    int flags;

    /* Set the socket non-blocking.
     * Note that fcntl(2) for F_GETFL and F_SETFL can't be
     * interrupted by a signal. */
    if ((flags = fcntl(fd, F_GETFL)) == -1) {
        anetSetError(err, "fcntl(F_GETFL): %s", strerror(errno));
        return ANET_ERR;
    }
    if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) {
        anetSetError(err, "fcntl(F_SETFL,O_NONBLOCK): %s", strerror(errno));
        return ANET_ERR;
    }
    return ANET_OK;
}

/* Set TCP keep alive option to detect dead peers. The interval option
 * is only used for Linux as we are using Linux-specific APIs to set
 * the probe send time, interval, and count. */
int anetKeepAlive(char *err, int fd, int interval)
{
    int val = 1;

    if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &val, sizeof(val)) == -1)
    {
        anetSetError(err, "setsockopt SO_KEEPALIVE: %s", strerror(errno));
        return ANET_ERR;
    }

#ifdef __linux__
    /* Default settings are more or less garbage, with the keepalive time
     * set to 7200 by default on Linux. Modify settings to make the feature
     * actually useful. */

    /* Send first probe after interval. */
    val = interval;
    if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &val, sizeof(val)) < 0) {
        anetSetError(err, "setsockopt TCP_KEEPIDLE: %s\n", strerror(errno));
        return ANET_ERR;
    }

    /* Send next probes after the specified interval. Note that we set the
     * delay as interval / 3, as we send three probes before detecting
     * an error (see the next setsockopt call). */
    val = interval/3;
    if (val == 0) val = 1;
    if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &val, sizeof(val)) < 0) {
        anetSetError(err, "setsockopt TCP_KEEPINTVL: %s\n", strerror(errno));
        return ANET_ERR;
    }

    /* Consider the socket in error state after three we send three ACK
     * probes without getting a reply. */
    val = 3;
    if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &val, sizeof(val)) < 0) {
        anetSetError(err, "setsockopt TCP_KEEPCNT: %s\n", strerror(errno));
        return ANET_ERR;
    }
#endif

    return ANET_OK;
}

static int anetSetTcpNoDelay(char *err, int fd, int val)
{
    if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)) == -1)
    {
        anetSetError(err, "setsockopt TCP_NODELAY: %s", strerror(errno));
        return ANET_ERR;
    }
    return ANET_OK;
}

int anetEnableTcpNoDelay(char *err, int fd)
{
    return anetSetTcpNoDelay(err, fd, 1);
}

int anetDisableTcpNoDelay(char *err, int fd)
{
    return anetSetTcpNoDelay(err, fd, 0);
}

int anetSetSendBuffer(char *err, int fd, int buffsize)
{
    if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &buffsize, sizeof(buffsize)) == -1)
    {
        anetSetError(err, "setsockopt SO_SNDBUF: %s", strerror(errno));
        return ANET_ERR;
    }
    return ANET_OK;
}

int anetTcpKeepAlive(char *err, int fd)
{
    int yes = 1;
    if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &yes, sizeof(yes)) == -1) {
        anetSetError(err, "setsockopt SO_KEEPALIVE: %s", strerror(errno));
        return ANET_ERR;
    }
    return ANET_OK;
}

int anetResolve(char *err, char *host, char *ipbuf)
{
    struct sockaddr_in sa;

    sa.sin_family = AF_INET;
    if (inet_aton(host, &sa.sin_addr) == 0) {
        struct hostent *he;

        he = gethostbyname(host);
        if (he == NULL) {
            anetSetError(err, "can't resolve: %s", host);
            return ANET_ERR;
        }
        memcpy(&sa.sin_addr, he->h_addr, sizeof(struct in_addr));
    }
    strcpy(ipbuf,inet_ntoa(sa.sin_addr));
    return ANET_OK;
}

static int anetCreateSocket(char *err, int domain) {
    int s, on = 1;
    if ((s = socket(domain, SOCK_STREAM, 0)) == -1) {
        anetSetError(err, "creating socket: %s", strerror(errno));
        return ANET_ERR;
    }

    /* Make sure connection-intensive things like the redis benchmark
     * will be able to close/open sockets a zillion of times */
    if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) {
        anetSetError(err, "setsockopt SO_REUSEADDR: %s", strerror(errno));
        return ANET_ERR;
    }
    return s;
}

#define ANET_CONNECT_NONE 0
#define ANET_CONNECT_NONBLOCK 1
static int anetTcpGenericConnect(char *err, char *addr, int port, int flags, char *bindaddr)
{
    int s;
    struct sockaddr_in sa, src_sa;

    if ((s = anetCreateSocket(err,AF_INET)) == ANET_ERR)
        return ANET_ERR;

    sa.sin_family = AF_INET;
    sa.sin_port = htons(port);
    if (inet_aton(addr, &sa.sin_addr) == 0) {
        struct hostent *he;

        he = gethostbyname(addr);
        if (he == NULL) {
            anetSetError(err, "can't resolve: %s", addr);
            close(s);
            return ANET_ERR;
        }
        memcpy(&sa.sin_addr, he->h_addr, sizeof(struct in_addr));
    }
    if (flags & ANET_CONNECT_NONBLOCK) {
        if (anetNonBlock(err,s) != ANET_OK)
            return ANET_ERR;
    }

    if (bindaddr && strncmp(bindaddr, "127.", 4) != 0) {
        memset(&src_sa, 0, sizeof(src_sa));
        src_sa.sin_family = AF_INET;
        src_sa.sin_addr.s_addr = inet_addr(bindaddr);
        bind(s, (struct sockaddr *)&src_sa, sizeof(src_sa));
    }

    if (connect(s, (struct sockaddr*)&sa, sizeof(sa)) == -1) {
        if (errno == EINPROGRESS &&
            flags & ANET_CONNECT_NONBLOCK)
            return s;

        anetSetError(err, "connect: %s", strerror(errno));
        close(s);
        return ANET_ERR;
    }
    return s;
}

int anetTcpConnect(char *err, char *addr, int port)
{
    return anetTcpGenericConnect(err,addr,port,ANET_CONNECT_NONE,NULL);
}

int anetTcpNonBlockConnect(char *err, char *addr, int port, char *bindaddr)
{
    return anetTcpGenericConnect(err,addr,port,ANET_CONNECT_NONBLOCK,bindaddr);
}

int anetUnixGenericConnect(char *err, char *path, int flags)
{
    int s;
    struct sockaddr_un sa;

    if ((s = anetCreateSocket(err,AF_LOCAL)) == ANET_ERR)
        return ANET_ERR;

    sa.sun_family = AF_LOCAL;
    strncpy(sa.sun_path,path,sizeof(sa.sun_path)-1);
    if (flags & ANET_CONNECT_NONBLOCK) {
        if (anetNonBlock(err,s) != ANET_OK)
            return ANET_ERR;
    }
    if (connect(s,(struct sockaddr*)&sa,sizeof(sa)) == -1) {
        if (errno == EINPROGRESS &&
            flags & ANET_CONNECT_NONBLOCK)
            return s;

        anetSetError(err, "connect: %s", strerror(errno));
        close(s);
        return ANET_ERR;
    }
    return s;
}

int anetUnixConnect(char *err, char *path)
{
    return anetUnixGenericConnect(err,path,ANET_CONNECT_NONE);
}

int anetUnixNonBlockConnect(char *err, char *path)
{
    return anetUnixGenericConnect(err,path,ANET_CONNECT_NONBLOCK);
}

/* Like read(2) but make sure 'count' is read before to return
 * (unless error or EOF condition is encountered) */
int anetRead(int fd, char *buf, int count)
{
    int nread, totlen = 0;
    while(totlen != count) {
        nread = read(fd,buf,count-totlen);
        if (nread == 0) return totlen;
        if (nread == -1) return -1;
        totlen += nread;
        buf += nread;
    }
    return totlen;
}

/* Like write(2) but make sure 'count' is read before to return
 * (unless error is encountered) */
int anetWrite(int fd, char *buf, int count)
{
    int nwritten, totlen = 0;
    while(totlen != count) {
        nwritten = write(fd,buf,count-totlen);
        if (nwritten == 0) return totlen;
        if (nwritten == -1) return -1;
        totlen += nwritten;
        buf += nwritten;
    }
    return totlen;
}

static int anetListen(char *err, int s, struct sockaddr *sa, socklen_t len) {
    if (bind(s,sa,len) == -1) {
        anetSetError(err, "bind: %s", strerror(errno));
        close(s);
        return ANET_ERR;
    }

    /* Use a backlog of 512 entries. We pass 511 to the listen() call because
     * the kernel does: backlogsize = roundup_pow_of_two(backlogsize + 1);
     * which will thus give us a backlog of 512 entries */
    if (listen(s, 511) == -1) {
        anetSetError(err, "listen: %s", strerror(errno));
        close(s);
        return ANET_ERR;
    }
    return ANET_OK;
}

int anetTcpServer(char *err, int port, char *bindaddr)
{
    int s;
    struct sockaddr_in sa;

    if ((s = anetCreateSocket(err,AF_INET)) == ANET_ERR)
        return ANET_ERR;

    memset(&sa,0,sizeof(sa));
    sa.sin_family = AF_INET;
    sa.sin_port = htons(port);
    sa.sin_addr.s_addr = htonl(INADDR_ANY);
    if (bindaddr && inet_aton(bindaddr, &sa.sin_addr) == 0) {
        anetSetError(err, "invalid bind address");
        close(s);
        return ANET_ERR;
    }
    if (anetListen(err,s,(struct sockaddr*)&sa,sizeof(sa)) == ANET_ERR)
        return ANET_ERR;
    return s;
}

int anetUnixServer(char *err, char *path, mode_t perm)
{
    int s;
    struct sockaddr_un sa;

    if ((s = anetCreateSocket(err,AF_LOCAL)) == ANET_ERR)
        return ANET_ERR;

    memset(&sa,0,sizeof(sa));
    sa.sun_family = AF_LOCAL;
    strncpy(sa.sun_path,path,sizeof(sa.sun_path)-1);
    if (anetListen(err,s,(struct sockaddr*)&sa,sizeof(sa)) == ANET_ERR)
        return ANET_ERR;
    if (perm)
        chmod(sa.sun_path, perm);
    return s;
}

static int anetGenericAccept(char *err, int s, struct sockaddr *sa, socklen_t *len) {
    int fd;
    while(1) {
        fd = accept(s,sa,len);
        if (fd == -1) {
            if (errno == EINTR)
                continue;
            else {
                anetSetError(err, "accept: %s", strerror(errno));
                return ANET_ERR;
            }
        }
        break;
    }
    return fd;
}

int anetTcpAccept(char *err, int s, char *ip, int *port) {
    int fd;
    struct sockaddr_in sa;
    socklen_t salen = sizeof(sa);
    if ((fd = anetGenericAccept(err,s,(struct sockaddr*)&sa,&salen)) == ANET_ERR)
        return ANET_ERR;

    if (ip) strcpy(ip,inet_ntoa(sa.sin_addr));
    if (port) *port = ntohs(sa.sin_port);
    return fd;
}

int anetUnixAccept(char *err, int s) {
    int fd;
    struct sockaddr_un sa;
    socklen_t salen = sizeof(sa);
    if ((fd = anetGenericAccept(err,s,(struct sockaddr*)&sa,&salen)) == ANET_ERR)
        return ANET_ERR;

    return fd;
}

int anetPeerToString(int fd, char *ip, int *port) {
    struct sockaddr_in sa;
    socklen_t salen = sizeof(sa);

    if (getpeername(fd,(struct sockaddr*)&sa,&salen) == -1) {
        *port = 0;
        ip[0] = '?';
        ip[1] = '\0';
        return -1;
    }
    if (ip) strcpy(ip,inet_ntoa(sa.sin_addr));
    if (port) *port = ntohs(sa.sin_port);
    return 0;
}

int anetSockName(int fd, char *ip, int *port) {
    struct sockaddr_in sa;
    socklen_t salen = sizeof(sa);

    if (getsockname(fd,(struct sockaddr*)&sa,&salen) == -1) {
        *port = 0;
        ip[0] = '?';
        ip[1] = '\0';
        return -1;
    }
    if (ip) strcpy(ip,inet_ntoa(sa.sin_addr));
    if (port) *port = ntohs(sa.sin_port);
    return 0;
}


text:
Openstack and Cloudstack evaluations, with and without nested virtualization.

---
To eliminate CLI message:
git config --global push.default simple

---
To verify repos. URL and branch, user:
git remote -v ; git branch -vv ; git config --global --list

---
To avouid username and password prompt:
git config credential.helper store

---
Nice git ref: http://happygitwithr.com/hello-git.html

---

As of March 24 2018 gitlab and github passwords should be congruent?
Also need todouble check honsys vs. evizbiz ...


text: select * from f_cek_payment_due_day();


text:
<?php

declare(strict_types=1);

namespace PHPCfg\Op\Iterator;

use PHPCfg\Op\Terminal;
use PhpCfg\Operand;

class Reset extends Terminal
{
    public Operand $var;

    public function __construct(Operand $var, array $attributes = [])
    {
        parent::__construct($attributes);
        $this->var = $this->addReadRef($var);
    }

    public function getVariableNames(): array
    {
        return ['var'];
    }
}


text:
var mongoose = require('mongoose');

var GroupSchema = new mongoose.Schema({
    identifier: {
        use: String,
        label: String,
        system: String,
        value: String
    },
    fhirType: String,
    actual: Boolean,
    code: {
        coding: [{
            system: String,
            code: String,
            display: String
        }]
    },
    name: String,
    quantity: Number,
    characteristic: [{
        code: {
            coding: [{
                system: String,
                code: String,
                display: String
            }]
        },
        valueCodeableConcept: {
            coding: [{
                system: String,
                code: String,
                display: String
            }]
        },
        valueBoolean: Boolean,
        valueQuantity: {
            value: String,
            units: String,
            system: String,
            code: String
        },
        valueRange: {
        },
        exclude: Boolean,
    }],
    member: [{
        reference: String,
        display: String
    }]
});

mongoose.model('Group', GroupSchema);


text:
import codecs
import re
from os import path
from setuptools import setup, find_packages

def read(*parts):
    filename = path.join(path.dirname(__file__), *parts)
    with codecs.open(filename, encoding='utf-8') as fp:
        return fp.read()

def find_version(*file_paths):
    version_file = read(*file_paths)
    version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
                              version_file, re.M)
    if version_match:
        return version_match.group(1)
    raise RuntimeError("Unable to find version string.")

setup(
    name='django-avatar',
    version=find_version("avatar", "__init__.py"),
    description="A Django app for handling user avatars",
    long_description=read('README.rst'),
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3.2',
        'Programming Language :: Python :: 3.3',
    ],
    keywords='avatar, django',
    author='Eric Florenzano',
    author_email='floguy@gmail.com',
    maintainer='Jannis Leidel',
    maintainer_email='jannis@leidel.info',
    url='http://github.com/jezdez/django-avatar/',
    license='BSD',
    packages=find_packages(exclude=['tests']),
    package_data={
        'avatar': [
            'templates/notification/*/*.*',
            'templates/avatar/*.html',
            'locale/*/LC_MESSAGES/*',
            'media/avatar/img/default.jpg',
        ],
    },
    dependency_links = [
        'https://api.github.com/repos/jessehon/django-appconf/tarball/v0.6.1#egg=django-appconf-0.6.1'
    ],
    install_requires=[
        'Pillow>=2.0',
        'django-appconf>=0.6.1',
    ],
    zip_safe=False,
)


text:
package app

import (
	"errors"
	"fmt"
	"io/ioutil"
	"log"
	"math/rand"
	"net/http"
	"os"
	"time"

	proto "github.com/gogo/protobuf/proto"
	"github.com/mesos/mesos-go/api/v1/lib"
	"github.com/mesos/mesos-go/api/v1/lib/backoff"
	"github.com/mesos/mesos-go/api/v1/lib/httpcli"
	"github.com/mesos/mesos-go/api/v1/lib/httpcli/httpsched"
	"github.com/mesos/mesos-go/api/v1/lib/resources"
	"github.com/mesos/mesos-go/api/v1/lib/scheduler/calls"
)

func prepareExecutorInfo(
	execBinary, execImage string,
	server server,
	wantsResources mesos.Resources,
	jobRestartDelay time.Duration,
	metricsAPI *metricsAPI,
) (*mesos.ExecutorInfo, error) {
	if execImage != "" {
		// Create mesos custom executor
		return &mesos.ExecutorInfo{
			Type:       mesos.ExecutorInfo_CUSTOM,
			ExecutorID: mesos.ExecutorID{Value: "default"},
			Name:       proto.String("Test Executor"),
			Command: &mesos.CommandInfo{
				Shell: func() *bool { x := false; return &x }(),
			},
			Container: &mesos.ContainerInfo{
				Type: mesos.ContainerInfo_DOCKER.Enum(),
				Docker: &mesos.ContainerInfo_DockerInfo{
					Image:          execImage,
					ForcePullImage: func() *bool { x := true; return &x }(),
					Parameters: []mesos.Parameter{
						{
							Key:   "entrypoint",
							Value: execBinary,
						}}}},
			Resources: wantsResources,
		}, nil
	} else if execBinary != "" {
		log.Println("No executor image specified, will serve executor binary from built-in HTTP server")
		listener, iport, err := newListener(server)
		if err != nil {
			return nil, err
		}
		server.port = iport // we're just working with a copy of server, so this is OK
		var (
			mux                    = http.NewServeMux()
			executorUris           = []mesos.CommandInfo_URI{}
			uri, executorCmd, err2 = serveExecutorArtifact(server, execBinary, mux)
			executorCommand        = fmt.Sprintf("./%s", executorCmd)
		)
		if err2 != nil {
			return nil, err2
		}
		wrapper := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			metricsAPI.artifactDownloads()
			mux.ServeHTTP(w, r)
		})
		executorUris = append(executorUris, mesos.CommandInfo_URI{Value: uri, Executable: proto.Bool(true)})

		go forever("artifact-server", jobRestartDelay, metricsAPI.jobStartCount, func() error { return http.Serve(listener, wrapper) })
		log.Println("Serving executor artifacts...")

		// Create mesos custom executor
		return &mesos.ExecutorInfo{
			Type:       mesos.ExecutorInfo_CUSTOM,
			ExecutorID: mesos.ExecutorID{Value: "default"},
			Name:       proto.String("Test Executor"),
			Command: &mesos.CommandInfo{
				Value: proto.String(executorCommand),
				URIs:  executorUris,
			},
			Resources: wantsResources,
		}, nil
	}
	return nil, errors.New("must specify an executor binary or image")
}

func buildWantsTaskResources(config Config) (r mesos.Resources) {
	r.Add(
		resources.NewCPUs(config.taskCPU).Resource,
		resources.NewMemory(config.taskMemory).Resource,
	)
	log.Println("wants-task-resources = " + r.String())
	return
}

func buildWantsExecutorResources(config Config) (r mesos.Resources) {
	r.Add(
		resources.NewCPUs(config.execCPU).Resource,
		resources.NewMemory(config.execMemory).Resource,
	)
	log.Println("wants-executor-resources = " + r.String())
	return
}

func buildHTTPSched(cfg Config, creds credentials) calls.Caller {
	var authConfigOpt httpcli.ConfigOpt
	// TODO(jdef) make this auth-mode configuration more pluggable
	if cfg.authMode == AuthModeBasic {
		log.Println("configuring HTTP Basic authentication")
		// TODO(jdef) this needs testing once mesos 0.29 is available
		authConfigOpt = httpcli.BasicAuth(creds.username, creds.password)
	}
	cli := httpcli.New(
		httpcli.Endpoint(cfg.url),
		httpcli.Codec(cfg.codec.Codec),
		httpcli.Do(httpcli.With(
			authConfigOpt,
			httpcli.Timeout(cfg.timeout),
		)),
	)
	if cfg.compression {
		// TODO(jdef) experimental; currently released versions of Mesos will accept this
		// header but will not send back compressed data due to flushing issues.
		log.Println("compression enabled")
		cli.With(httpcli.RequestOptions(httpcli.Header("Accept-Encoding", "gzip")))
	}
	return httpsched.NewCaller(cli, httpsched.Listener(func(n httpsched.Notification) {
		if cfg.verbose {
			log.Printf("scheduler client notification: %+v", n)
		}
	}))
}

func buildFrameworkInfo(cfg Config) *mesos.FrameworkInfo {
	failoverTimeout := cfg.failoverTimeout.Seconds()
	frameworkInfo := &mesos.FrameworkInfo{
		User:       cfg.user,
		Name:       cfg.name,
		Checkpoint: &cfg.checkpoint,
		Capabilities: []mesos.FrameworkInfo_Capability{
			{Type: mesos.FrameworkInfo_Capability_RESERVATION_REFINEMENT},
		},
	}
	if cfg.failoverTimeout > 0 {
		frameworkInfo.FailoverTimeout = &failoverTimeout
	}
	if cfg.role != "" {
		frameworkInfo.Role = &cfg.role
	}
	if cfg.principal != "" {
		frameworkInfo.Principal = &cfg.principal
	}
	if cfg.hostname != "" {
		frameworkInfo.Hostname = &cfg.hostname
	}
	if len(cfg.labels) > 0 {
		log.Println("using labels:", cfg.labels)
		frameworkInfo.Labels = &mesos.Labels{Labels: cfg.labels}
	}
	if cfg.gpuClusterCompat {
		frameworkInfo.Capabilities = append(frameworkInfo.Capabilities,
			mesos.FrameworkInfo_Capability{Type: mesos.FrameworkInfo_Capability_GPU_RESOURCES},
		)
	}
	return frameworkInfo
}

func loadCredentials(userConfig credentials) (result credentials, err error) {
	result = userConfig
	if result.password != "" {
		// this is the path to a file containing the password
		_, err = os.Stat(result.password)
		if err != nil {
			return
		}
		var f *os.File
		f, err = os.Open(result.password)
		if err != nil {
			return
		}
		defer f.Close()
		var bytes []byte
		bytes, err = ioutil.ReadAll(f)
		if err != nil {
			return
		}
		result.password = string(bytes)
	}
	return
}

func newInternalState(cfg Config, shutdown func()) (*internalState, error) {
	metricsAPI := initMetrics(cfg)
	executorInfo, err := prepareExecutorInfo(
		cfg.executor,
		cfg.execImage,
		cfg.server,
		buildWantsExecutorResources(cfg),
		cfg.jobRestartDelay,
		metricsAPI,
	)
	if err != nil {
		return nil, err
	}
	creds, err := loadCredentials(cfg.credentials)
	if err != nil {
		return nil, err
	}
	state := &internalState{
		config:             cfg,
		totalTasks:         cfg.tasks,
		reviveTokens:       backoff.BurstNotifier(cfg.reviveBurst, cfg.reviveWait, cfg.reviveWait, nil),
		wantsTaskResources: buildWantsTaskResources(cfg),
		executor:           executorInfo,
		metricsAPI:         metricsAPI,
		cli:                buildHTTPSched(cfg, creds),
		random:             rand.New(rand.NewSource(time.Now().Unix())),
		shutdown:           shutdown,
	}
	return state, nil
}

type internalState struct {
	tasksLaunched      int
	tasksFinished      int
	totalTasks         int
	role               string
	executor           *mesos.ExecutorInfo
	cli                calls.Caller
	config             Config
	wantsTaskResources mesos.Resources
	reviveTokens       <-chan struct{}
	metricsAPI         *metricsAPI
	err                error
	shutdown           func()
	random             *rand.Rand
}


text:
<?php

defined('PHPFOX') or exit('NO DICE!');

?>
<form method="post" action="{url link='admincp.report.add'}">
{if $bIsEdit}

<input type="hidden" name="id" value="{$aForms.report_id}" />

{/if}

		{phrase var='report.category_details'}

	{module name='admincp.product.form'}
	{module name='admincp.module.form'}

		{required}{phrase var='report.category_name'}:

			<input type="text" name="val[message]" value="{value type='input' id='message'}" size="40" maxlength="100" />

		<input type="submit" value="{if $bIsEdit}{phrase var='report.update'}{else}{phrase var='report.add'}{/if}" class="button" />

</form>


text:
order: 4
---

# Custom Data Sources

Django Data Wizard uses [IterTable] to determine the source columns present on the spreadsheet or other data source.  Django Data Wizard can use any Django model instance as a source for its data, provided there is a registered loader that can convert the source model into a [Iter class][IterTable].  Data Wizard provides two out-of-the the box loaders, [FileLoader] and [URLLoader], that can be used with the provided models in `data_wizard.sources` (`FileSource` and `URLSource`, respectively).

### Extending FileLoader
The default `FileLoader` can be used with any Django model with a `FileField` named `file`.  You can use a model with a different `FileField` name by creating a subclass of `data_wizard.loaders.FileLoader` and setting it as the loader for your model.

```python
# myapp/models.py
from django.db import models

class FileModel(models.Model):
    spreadsheet = models.FileField(upload_to='spreadsheets')
```

```python
# myapp/loaders.py
from data_wizard import loaders

class FileLoader(loaders.FileLoader):
    file_attr = 'spreadsheet'
```

```python
# myapp/wizard.py
import data_wizard
from .models import FileModel

data_wizard.set_loader(FileModel, "myapp.loaders.FileLoader")
```

If you have a generic loader that can work with multiple source models, you can also set the default loader through the [global settings][settings]:

```python
# myapp/settings.py
DATA_WIZARD = {
    'LOADER': 'myapp.loaders.FileLoader'
}
```

You should register a custom `ModelAdmin` class to add the Import action in the admin panel for your model.

```python
# myapp/admin.py
from django.contrib import admin
from data_wizard.admin import ImportActionModelAdmin

from .models import FileModel

@admin.register(FileModel)
class FileModelAdmin(ImportActionModelAdmin):
    pass
```

### Custom Loader
The default loaders support any file format supported by [IterTable] (Excel, CSV, JSON, and XML).  Additional formats can be integrating by creating a [custom IterTable class][custom-iter] and then registering it with the wizard.  To do this, extend `data_wizard.loaders.BaseLoader` with a custom `load_iter()` function that returns the data from IterTable, as in the example below.

It is likely that you will want to use a specific serializer with your custom loader.  If so, override `default_serializer` or `get_serializer_name()` on the loader.  By default, these return `None`, which requires the user to specify the serializer when creating or executing the `Run`.

```python
# myapp/models.py
from django.db import models

class CustomIterSource(models.Model):
    some_option = models.TextField()
```

```python
# myapp/loaders.py
from data_wizard import loaders
from .iter import CustomIter

class CustomIterLoader(loaders.BaseLoader):
    default_serializer = 'mydataapp.wizard.CustomSerializer'
    def load_iter(self):
        source = self.run.content_object
        return CustomIter(some_option=source.some_option)
```

```python
# myapp/wizard.py
import data_wizard
from .models import CustomIterSource

data_wizard.set_loader(CustomIterSource, "myapp.loaders.CustomIterLoader")
```

[IterTable]: ../itertable/index.md
[FileLoader]: https://github.com/wq/django-data-wizard/blob/master/data_wizard/loaders.py
[URLLoader]: https://github.com/wq/django-data-wizard/blob/master/data_wizard/loaders.py
[settings]: ./settings.md
[custom-iter]: ../itertable/custom.md


text:
{-# LANGUAGE OverloadedStrings #-}

{- |
Module      : Network.MPD.Commands.Stickers
Copyright   : (c) Ben Sinclair 2005-2009, Joachim Fasting 2012
License     : MIT (see LICENSE)

Maintainer  : joachim.fasting@gmail.com
Stability   : stable
Portability : unportable

Stickers.
-}

module Network.MPD.Commands.Stickers
    ( stickerGet
    , stickerSet
    , stickerDelete
    , stickerList
    , stickerFind
    ) where

import qualified Network.MPD.Applicative.Internal as A
import qualified Network.MPD.Applicative.Stickers as A
import           Network.MPD.Commands.Types
import           Network.MPD.Core

-- | Reads a sticker value for the specified object.
stickerGet :: MonadMPD m => ObjectType
           -> String -- ^ Object URI
           -> String -- ^ Sticker name
           -> m [String]
stickerGet typ uri = A.runCommand . A.stickerGet typ uri

-- | Adds a sticker value to the specified object.
stickerSet :: MonadMPD m => ObjectType
           -> String -- ^ Object URI
           -> String -- ^ Sticker name
           -> String -- ^ Sticker value
           -> m ()
stickerSet typ uri name = A.runCommand . A.stickerSet typ uri name

-- | Delete a sticker value from the specified object.
stickerDelete :: MonadMPD m => ObjectType
              -> String -- ^ Object URI
              -> String -- ^ Sticker name
              -> m ()
stickerDelete typ uri = A.runCommand . A.stickerDelete typ uri

-- | Lists the stickers for the specified object.
stickerList :: MonadMPD m => ObjectType
            -> String -- ^ Object URI
            -> m [(String, String)] -- ^ Sticker name\/sticker value
stickerList typ = A.runCommand . A.stickerList typ

-- | Searches the sticker database for stickers with the specified name, below
-- the specified path.
stickerFind :: MonadMPD m => ObjectType
            -> String -- ^ Path
            -> String -- ^ Sticker name
            -> m [(String, String)] -- ^ URI\/sticker value
stickerFind typ uri = A.runCommand . A.stickerFind typ uri


text:
<?php

	require_once('../php_image_magician.php');

	/*	Purpose: Open image
     *	Usage:	 resize('filename.type')
     * 	Params:	 filename.type - the filename to open
     */
	$magicianObj = new imageLib('sample_images/racecar.jpg');

	/*	Purpose: Add a watermark to your image
     *	Usage:	 addWatermark([watermark_image], [position], [padding], [transparency])
     * 	Params:	 watermark_image - the image to use as your watermark
     * 			 position - Specified by "width x height". EG: 200 x 300
     * 			 padding - Ignored when specifying exact pixel location
     * 			 transparency - Adds transparency to your watermark image. Set
	 *				value range is 0-100. 100 not being transparent at all.
     *	Output:	 Adds a watermark image 20px in and 30px down with 30%
	 *  		 transparency
     */
	$magicianObj -> addWatermark('sample_images/monkey.png', '20 x 30', 0, 30);

	/*	Purpose: Save image
     *	Usage:	 saveImage('[filename.type]', [quality])
     * 	Params:	 filename.type - the filename and file type to save as
 	 * 			 quality - (optional) 0-100 (100 being the highest (default))
     *				Only applies to jpg & png only
     */
	$magicianObj -> saveImage('output_4.3.png', 100);

?>


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

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

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

    /**
     *

     * The name of the ledger.
     *

     */
    private String name;
    /**
     *

     * The Amazon Resource Name (ARN) for the ledger.
     *

     */
    private String arn;
    /**
     *

     * The current status of the ledger.
     *

     */
    private String state;
    /**
     *

     * The date and time, in epoch time format, when the ledger was created. (Epoch time format is the number of seconds
     * elapsed since 12:00:00 AM January 1, 1970 UTC.)
     *

     */
    private java.util.Date creationDateTime;
    /**
     *

     * The permissions mode of the ledger.
     *

     */
    private String permissionsMode;
    /**
     *

     * The flag that prevents a ledger from being deleted by any user. If not provided on ledger creation, this feature
     * is enabled (true) by default.
     *

     *

     * If deletion protection is enabled, you must first disable it before you can delete the ledger. You can disable it
     * by calling the UpdateLedger operation to set the flag to false.
     *

     */
    private Boolean deletionProtection;
    /**
     *

     * Information about the encryption of data at rest in the ledger. This includes the current status, the KMS key,
     * and when the key became inaccessible (in the case of an error).
     *

     */
    private LedgerEncryptionDescription encryptionDescription;

    /**
     *

     * The name of the ledger.
     *

     *
     * @param name
     *        The name of the ledger.
     */

    public void setName(String name) {
        this.name = name;
    }

    /**
     *

     * The name of the ledger.
     *

     *
     * @return The name of the ledger.
     */

    public String getName() {
        return this.name;
    }

    /**
     *

     * The name of the ledger.
     *

     *
     * @param name
     *        The name of the ledger.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeLedgerResult withName(String name) {
        setName(name);
        return this;
    }

    /**
     *

     * The Amazon Resource Name (ARN) for the ledger.
     *

     *
     * @param arn
     *        The Amazon Resource Name (ARN) for the ledger.
     */

    public void setArn(String arn) {
        this.arn = arn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) for the ledger.
     *

     *
     * @return The Amazon Resource Name (ARN) for the ledger.
     */

    public String getArn() {
        return this.arn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) for the ledger.
     *

     *
     * @param arn
     *        The Amazon Resource Name (ARN) for the ledger.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeLedgerResult withArn(String arn) {
        setArn(arn);
        return this;
    }

    /**
     *

     * The current status of the ledger.
     *

     *
     * @param state
     *        The current status of the ledger.
     * @see LedgerState
     */

    public void setState(String state) {
        this.state = state;
    }

    /**
     *

     * The current status of the ledger.
     *

     *
     * @return The current status of the ledger.
     * @see LedgerState
     */

    public String getState() {
        return this.state;
    }

    /**
     *

     * The current status of the ledger.
     *

     *
     * @param state
     *        The current status of the ledger.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see LedgerState
     */

    public DescribeLedgerResult withState(String state) {
        setState(state);
        return this;
    }

    /**
     *

     * The current status of the ledger.
     *

     *
     * @param state
     *        The current status of the ledger.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see LedgerState
     */

    public DescribeLedgerResult withState(LedgerState state) {
        this.state = state.toString();
        return this;
    }

    /**
     *

     * The date and time, in epoch time format, when the ledger was created. (Epoch time format is the number of seconds
     * elapsed since 12:00:00 AM January 1, 1970 UTC.)
     *

     *
     * @param creationDateTime
     *        The date and time, in epoch time format, when the ledger was created. (Epoch time format is the number of
     *        seconds elapsed since 12:00:00 AM January 1, 1970 UTC.)
     */

    public void setCreationDateTime(java.util.Date creationDateTime) {
        this.creationDateTime = creationDateTime;
    }

    /**
     *

     * The date and time, in epoch time format, when the ledger was created. (Epoch time format is the number of seconds
     * elapsed since 12:00:00 AM January 1, 1970 UTC.)
     *

     *
     * @return The date and time, in epoch time format, when the ledger was created. (Epoch time format is the number of
     *         seconds elapsed since 12:00:00 AM January 1, 1970 UTC.)
     */

    public java.util.Date getCreationDateTime() {
        return this.creationDateTime;
    }

    /**
     *

     * The date and time, in epoch time format, when the ledger was created. (Epoch time format is the number of seconds
     * elapsed since 12:00:00 AM January 1, 1970 UTC.)
     *

     *
     * @param creationDateTime
     *        The date and time, in epoch time format, when the ledger was created. (Epoch time format is the number of
     *        seconds elapsed since 12:00:00 AM January 1, 1970 UTC.)
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeLedgerResult withCreationDateTime(java.util.Date creationDateTime) {
        setCreationDateTime(creationDateTime);
        return this;
    }

    /**
     *

     * The permissions mode of the ledger.
     *

     *
     * @param permissionsMode
     *        The permissions mode of the ledger.
     * @see PermissionsMode
     */

    public void setPermissionsMode(String permissionsMode) {
        this.permissionsMode = permissionsMode;
    }

    /**
     *

     * The permissions mode of the ledger.
     *

     *
     * @return The permissions mode of the ledger.
     * @see PermissionsMode
     */

    public String getPermissionsMode() {
        return this.permissionsMode;
    }

    /**
     *

     * The permissions mode of the ledger.
     *

     *
     * @param permissionsMode
     *        The permissions mode of the ledger.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see PermissionsMode
     */

    public DescribeLedgerResult withPermissionsMode(String permissionsMode) {
        setPermissionsMode(permissionsMode);
        return this;
    }

    /**
     *

     * The permissions mode of the ledger.
     *

     *
     * @param permissionsMode
     *        The permissions mode of the ledger.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see PermissionsMode
     */

    public DescribeLedgerResult withPermissionsMode(PermissionsMode permissionsMode) {
        this.permissionsMode = permissionsMode.toString();
        return this;
    }

    /**
     *

     * The flag that prevents a ledger from being deleted by any user. If not provided on ledger creation, this feature
     * is enabled (true) by default.
     *

     *

     * If deletion protection is enabled, you must first disable it before you can delete the ledger. You can disable it
     * by calling the UpdateLedger operation to set the flag to false.
     *

     *
     * @param deletionProtection
     *        The flag that prevents a ledger from being deleted by any user. If not provided on ledger creation, this
     *        feature is enabled (true) by default.

     *

     *        If deletion protection is enabled, you must first disable it before you can delete the ledger. You can
     *        disable it by calling the UpdateLedger operation to set the flag to false.
     */

    public void setDeletionProtection(Boolean deletionProtection) {
        this.deletionProtection = deletionProtection;
    }

    /**
     *

     * The flag that prevents a ledger from being deleted by any user. If not provided on ledger creation, this feature
     * is enabled (true) by default.
     *

     *

     * If deletion protection is enabled, you must first disable it before you can delete the ledger. You can disable it
     * by calling the UpdateLedger operation to set the flag to false.
     *

     *
     * @return The flag that prevents a ledger from being deleted by any user. If not provided on ledger creation, this
     *         feature is enabled (true) by default.

     *

     *         If deletion protection is enabled, you must first disable it before you can delete the ledger. You can
     *         disable it by calling the UpdateLedger operation to set the flag to false.
     */

    public Boolean getDeletionProtection() {
        return this.deletionProtection;
    }

    /**
     *

     * The flag that prevents a ledger from being deleted by any user. If not provided on ledger creation, this feature
     * is enabled (true) by default.
     *

     *

     * If deletion protection is enabled, you must first disable it before you can delete the ledger. You can disable it
     * by calling the UpdateLedger operation to set the flag to false.
     *

     *
     * @param deletionProtection
     *        The flag that prevents a ledger from being deleted by any user. If not provided on ledger creation, this
     *        feature is enabled (true) by default.

     *

     *        If deletion protection is enabled, you must first disable it before you can delete the ledger. You can
     *        disable it by calling the UpdateLedger operation to set the flag to false.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeLedgerResult withDeletionProtection(Boolean deletionProtection) {
        setDeletionProtection(deletionProtection);
        return this;
    }

    /**
     *

     * The flag that prevents a ledger from being deleted by any user. If not provided on ledger creation, this feature
     * is enabled (true) by default.
     *

     *

     * If deletion protection is enabled, you must first disable it before you can delete the ledger. You can disable it
     * by calling the UpdateLedger operation to set the flag to false.
     *

     *
     * @return The flag that prevents a ledger from being deleted by any user. If not provided on ledger creation, this
     *         feature is enabled (true) by default.

     *

     *         If deletion protection is enabled, you must first disable it before you can delete the ledger. You can
     *         disable it by calling the UpdateLedger operation to set the flag to false.
     */

    public Boolean isDeletionProtection() {
        return this.deletionProtection;
    }

    /**
     *

     * Information about the encryption of data at rest in the ledger. This includes the current status, the KMS key,
     * and when the key became inaccessible (in the case of an error).
     *

     *
     * @param encryptionDescription
     *        Information about the encryption of data at rest in the ledger. This includes the current status, the KMS
     *        key, and when the key became inaccessible (in the case of an error).
     */

    public void setEncryptionDescription(LedgerEncryptionDescription encryptionDescription) {
        this.encryptionDescription = encryptionDescription;
    }

    /**
     *

     * Information about the encryption of data at rest in the ledger. This includes the current status, the KMS key,
     * and when the key became inaccessible (in the case of an error).
     *

     *
     * @return Information about the encryption of data at rest in the ledger. This includes the current status, the KMS
     *         key, and when the key became inaccessible (in the case of an error).
     */

    public LedgerEncryptionDescription getEncryptionDescription() {
        return this.encryptionDescription;
    }

    /**
     *

     * Information about the encryption of data at rest in the ledger. This includes the current status, the KMS key,
     * and when the key became inaccessible (in the case of an error).
     *

     *
     * @param encryptionDescription
     *        Information about the encryption of data at rest in the ledger. This includes the current status, the KMS
     *        key, and when the key became inaccessible (in the case of an error).
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeLedgerResult withEncryptionDescription(LedgerEncryptionDescription encryptionDescription) {
        setEncryptionDescription(encryptionDescription);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getName() != null)
            sb.append("Name: ").append(getName()).append(",");
        if (getArn() != null)
            sb.append("Arn: ").append(getArn()).append(",");
        if (getState() != null)
            sb.append("State: ").append(getState()).append(",");
        if (getCreationDateTime() != null)
            sb.append("CreationDateTime: ").append(getCreationDateTime()).append(",");
        if (getPermissionsMode() != null)
            sb.append("PermissionsMode: ").append(getPermissionsMode()).append(",");
        if (getDeletionProtection() != null)
            sb.append("DeletionProtection: ").append(getDeletionProtection()).append(",");
        if (getEncryptionDescription() != null)
            sb.append("EncryptionDescription: ").append(getEncryptionDescription());
        sb.append("}");
        return sb.toString();
    }

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

        if (obj instanceof DescribeLedgerResult == false)
            return false;
        DescribeLedgerResult other = (DescribeLedgerResult) obj;
        if (other.getName() == null ^ this.getName() == null)
            return false;
        if (other.getName() != null && other.getName().equals(this.getName()) == false)
            return false;
        if (other.getArn() == null ^ this.getArn() == null)
            return false;
        if (other.getArn() != null && other.getArn().equals(this.getArn()) == false)
            return false;
        if (other.getState() == null ^ this.getState() == null)
            return false;
        if (other.getState() != null && other.getState().equals(this.getState()) == false)
            return false;
        if (other.getCreationDateTime() == null ^ this.getCreationDateTime() == null)
            return false;
        if (other.getCreationDateTime() != null && other.getCreationDateTime().equals(this.getCreationDateTime()) == false)
            return false;
        if (other.getPermissionsMode() == null ^ this.getPermissionsMode() == null)
            return false;
        if (other.getPermissionsMode() != null && other.getPermissionsMode().equals(this.getPermissionsMode()) == false)
            return false;
        if (other.getDeletionProtection() == null ^ this.getDeletionProtection() == null)
            return false;
        if (other.getDeletionProtection() != null && other.getDeletionProtection().equals(this.getDeletionProtection()) == false)
            return false;
        if (other.getEncryptionDescription() == null ^ this.getEncryptionDescription() == null)
            return false;
        if (other.getEncryptionDescription() != null && other.getEncryptionDescription().equals(this.getEncryptionDescription()) == false)
            return false;
        return true;
    }

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

        hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
        hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode());
        hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode());
        hashCode = prime * hashCode + ((getCreationDateTime() == null) ? 0 : getCreationDateTime().hashCode());
        hashCode = prime * hashCode + ((getPermissionsMode() == null) ? 0 : getPermissionsMode().hashCode());
        hashCode = prime * hashCode + ((getDeletionProtection() == null) ? 0 : getDeletionProtection().hashCode());
        hashCode = prime * hashCode + ((getEncryptionDescription() == null) ? 0 : getEncryptionDescription().hashCode());
        return hashCode;
    }

    @Override
    public DescribeLedgerResult clone() {
        try {
            return (DescribeLedgerResult) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
@interface OMSBaseViewController ()

@end

@implementation OMSBaseViewController

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    self.usesCapabilityDataForPaymentMethods = YES;
    return self;
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    self.usesCapabilityDataForPaymentMethods = YES;
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    // Workaround of iOS 12 bug on the tint color
    self.view.tintColor = nil;
    self.navigationController.navigationBar.tintColor = nil;

    [self updateUIColors];

    if ([[NSLocale.currentLocale objectForKey:NSLocaleCountryCode] isEqualToString:@"JP"]) {
        self.paymentAmount = Tool.japanPaymentAmount;
        self.paymentCurrencyCode = Tool.japanPaymentCurrency;
        self.allowedPaymentMethods = Tool.japanAllowedPaymentMethods;
    } else if ([[NSLocale.currentLocale objectForKey:NSLocaleCountryCode] isEqualToString:@"SG"]) {
        self.paymentAmount = Tool.singaporePaymentAmount;
        self.paymentCurrencyCode = Tool.singaporePaymentCurrency;
        self.allowedPaymentMethods = Tool.singaporeAllowedPaymentMethods;
    } else if ([[NSLocale.currentLocale objectForKey:NSLocaleCountryCode] isEqualToString:@"MY"]) {
        self.paymentAmount = Tool.malaysiaPaymentAmount;
        self.paymentCurrencyCode = Tool.malaysiaPaymentCurrency;
        self.allowedPaymentMethods = Tool.malaysiaAllowedPaymentMethods;
    } else {
        self.paymentAmount = Tool.thailandPaymentAmount;
        self.paymentCurrencyCode = Tool.thailandPaymentCurrency;
        self.allowedPaymentMethods = Tool.thailandAllowedPaymentMethods;
    }
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    [super prepareForSegue:segue sender:sender];

    if ([segue.identifier isEqualToString:@"PresentPaymentSettingScene"]) {
        UINavigationController *settingNavigationController = (UINavigationController *)segue.destinationViewController;
        PaymentSettingTableViewController *settingViewController = (PaymentSettingTableViewController *)settingNavigationController.topViewController;

        settingViewController.currentAmount = self.paymentAmount;
        settingViewController.currentCurrencyCode = self.paymentCurrencyCode;
        settingViewController.usesCapabilityDataForPaymentMethods = self.usesCapabilityDataForPaymentMethods;
        settingViewController.allowedPaymentMethods = [NSSet setWithArray:self.allowedPaymentMethods];
    }
}

- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
    [super traitCollectionDidChange:previousTraitCollection];

    [self updateUIColors];
}

- (void)updateUIColors {
    UIColor *modeChooserDefaultBackgroundColor = nil;

#ifdef __IPHONE_13_0
    if (@available(iOS 13.0, *)) {
        modeChooserDefaultBackgroundColor = UIColor.systemBackgroundColor;
    } else {
        modeChooserDefaultBackgroundColor = UIColor.whiteColor;
    }
#else
    modeChooserDefaultBackgroundColor = UIColor.whiteColor;
#endif

    UIImage *emptyImage = [Tool imageWithSize:CGSizeMake(1, 1) color:modeChooserDefaultBackgroundColor];
    [self.navigationController.navigationBar setBackgroundImage:emptyImage forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setBackgroundImage:emptyImage forBarMetrics:UIBarMetricsCompact];
    self.navigationController.navigationBar.shadowImage = emptyImage;

    UIImage *selectedModeBackgroundImage = [Tool imageWithSize:CGSizeMake(1, 41) actions:^(CGContextRef _Nonnull context) {
        CGContextSetFillColorWithColor(context, modeChooserDefaultBackgroundColor.CGColor);
        CGContextFillRect(context, CGRectMake(0, 0, 1, 40));
        CGContextSetFillColorWithColor(context, self.view.tintColor.CGColor);
        CGContextFillRect(context, CGRectMake(0, 40, 1, 1));
    }];

    [self.modeChooser setBackgroundImage:selectedModeBackgroundImage forState:UIControlStateSelected barMetrics:UIBarMetricsDefault];

    UIImage *normalModeBackgroundImage = [Tool imageWithSize:CGSizeMake(1, 41) color:modeChooserDefaultBackgroundColor];
    [self.modeChooser setBackgroundImage:normalModeBackgroundImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
    [self.modeChooser setBackgroundImage:normalModeBackgroundImage forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
    [self.modeChooser setBackgroundImage:normalModeBackgroundImage forState:UIControlStateSelected | UIControlStateHighlighted barMetrics:UIBarMetricsDefault];

    [self.modeChooser setDividerImage:normalModeBackgroundImage
                  forLeftSegmentState:UIControlStateSelected
                    rightSegmentState:UIControlStateNormal
                           barMetrics:UIBarMetricsDefault];
    [self.modeChooser setDividerImage:normalModeBackgroundImage
                  forLeftSegmentState:UIControlStateNormal
                    rightSegmentState:UIControlStateSelected
                           barMetrics:UIBarMetricsDefault];
    [self.modeChooser setDividerImage:normalModeBackgroundImage
                  forLeftSegmentState:UIControlStateHighlighted
                    rightSegmentState:UIControlStateNormal
                           barMetrics:UIBarMetricsDefault];
    [self.modeChooser setDividerImage:normalModeBackgroundImage
                  forLeftSegmentState:UIControlStateNormal
                    rightSegmentState:UIControlStateHighlighted
                           barMetrics:UIBarMetricsDefault];
    [self.modeChooser setDividerImage:normalModeBackgroundImage
                  forLeftSegmentState:UIControlStateSelected
                    rightSegmentState:UIControlStateHighlighted
                           barMetrics:UIBarMetricsDefault];
    [self.modeChooser setDividerImage:normalModeBackgroundImage
                  forLeftSegmentState:UIControlStateHighlighted
                    rightSegmentState:UIControlStateSelected
                           barMetrics:UIBarMetricsDefault];
    [self.modeChooser setDividerImage:normalModeBackgroundImage
                  forLeftSegmentState:UIControlStateNormal
                    rightSegmentState:UIControlStateNormal
                           barMetrics:UIBarMetricsDefault];

    NSDictionary<NSAttributedStringKey,id> *highlightedTitleAttributes = @{
        NSForegroundColorAttributeName: self.view.tintColor,
        NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleCallout]
    };
    NSDictionary<NSAttributedStringKey,id> *normalTitleAttributes = nil;

#ifdef __IPHONE_13_0
    if (@available(iOS 13.0, *)) {
        normalTitleAttributes = @{
            NSForegroundColorAttributeName: UIColor.labelColor,
            NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleCallout]
        };
    } else {
        normalTitleAttributes = @{
            NSForegroundColorAttributeName: UIColor.darkTextColor,
            NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleCallout]
        };
    }
#else
    normalTitleAttributes = @{
            NSForegroundColorAttributeName: UIColor.darkTextColor,
            NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleCallout]
    };
#endif
    [self.modeChooser setTitleTextAttributes:normalTitleAttributes
                                    forState:UIControlStateNormal];
    [self.modeChooser setTitleTextAttributes:normalTitleAttributes
                                    forState:UIControlStateHighlighted];
    [self.modeChooser setTitleTextAttributes:highlightedTitleAttributes
                                    forState:UIControlStateSelected];
    [self.modeChooser setTitleTextAttributes:highlightedTitleAttributes
                                    forState:UIControlStateHighlighted | UIControlStateSelected];
}

- (void)dismissForm {
    [self dismissFormWithCompletion:NULL];
}

- (void)dismissFormWithCompletion:(void (^ _Nullable)(void))completion {
    if (self.presentedViewController != nil) {
        [self dismissViewControllerAnimated:true completion:completion];
    } else {
        [self.navigationController popToViewController:self animated:true];
        if (completion) {
            completion();
        }
    }
}

- (IBAction)updatePaymentInformationFromSetting:(UIStoryboardSegue *)sender {
    if (![sender.sourceViewController isKindOfClass:[PaymentSettingTableViewController class]]) {
        return;
    }

    PaymentSettingTableViewController *settingViewController = (PaymentSettingTableViewController *)sender.sourceViewController;
    self.paymentAmount = settingViewController.currentAmount;
    self.paymentCurrencyCode = settingViewController.currentCurrencyCode;
    self.usesCapabilityDataForPaymentMethods = settingViewController.usesCapabilityDataForPaymentMethods;
    self.allowedPaymentMethods = settingViewController.allowedPaymentMethods.allObjects;
}

- (IBAction)codePathModeChangedHandler:(UISegmentedControl *)sender {
    if (sender.selectedSegmentIndex == 1) {
        self.currentCodePathMode = OMSCodePathModeCode;
    } else {
        self.currentCodePathMode = OMSCodePathModeStoryboard;
    }
}

@end


text:
"""
MySQL to GCS operator.
"""

import base64
import calendar
from datetime import date, datetime, timedelta
from decimal import Decimal

from MySQLdb.constants import FIELD_TYPE

from airflow.hooks.mysql_hook import MySqlHook
from airflow.operators.sql_to_gcs import BaseSQLToGoogleCloudStorageOperator
from airflow.utils.decorators import apply_defaults

class MySqlToGoogleCloudStorageOperator(BaseSQLToGoogleCloudStorageOperator):
    """Copy data from MySQL to Google cloud storage in JSON or CSV format.

    :param mysql_conn_id: Reference to a specific MySQL hook.
    :type mysql_conn_id: str
    :param ensure_utc: Ensure TIMESTAMP columns exported as UTC. If set to
        `False`, TIMESTAMP columns will be exported using the MySQL server's
        default timezone.
    :type ensure_utc: bool
    """
    ui_color = '#a0e08c'

    type_map = {
        FIELD_TYPE.BIT: 'INTEGER',
        FIELD_TYPE.DATETIME: 'TIMESTAMP',
        FIELD_TYPE.DATE: 'TIMESTAMP',
        FIELD_TYPE.DECIMAL: 'FLOAT',
        FIELD_TYPE.NEWDECIMAL: 'FLOAT',
        FIELD_TYPE.DOUBLE: 'FLOAT',
        FIELD_TYPE.FLOAT: 'FLOAT',
        FIELD_TYPE.INT24: 'INTEGER',
        FIELD_TYPE.LONG: 'INTEGER',
        FIELD_TYPE.LONGLONG: 'INTEGER',
        FIELD_TYPE.SHORT: 'INTEGER',
        FIELD_TYPE.TIME: 'TIME',
        FIELD_TYPE.TIMESTAMP: 'TIMESTAMP',
        FIELD_TYPE.TINY: 'INTEGER',
        FIELD_TYPE.YEAR: 'INTEGER',
    }

    @apply_defaults
    def __init__(self,
                 mysql_conn_id='mysql_default',
                 ensure_utc=False,
                 *args,
                 **kwargs):
        super().__init__(*args, **kwargs)
        self.mysql_conn_id = mysql_conn_id
        self.ensure_utc = ensure_utc

    def query(self):
        """
        Queries mysql and returns a cursor to the results.
        """
        mysql = MySqlHook(mysql_conn_id=self.mysql_conn_id)
        conn = mysql.get_conn()
        cursor = conn.cursor()
        if self.ensure_utc:
            # Ensure TIMESTAMP results are in UTC
            tz_query = "SET time_zone = '+00:00'"
            self.log.info('Executing: %s', tz_query)
            cursor.execute(tz_query)
        self.log.info('Executing: %s', self.sql)
        cursor.execute(self.sql)
        return cursor

    def field_to_bigquery(self, field):
        field_type = self.type_map.get(field[1], "STRING")
        # Always allow TIMESTAMP to be nullable. MySQLdb returns None types
        # for required fields because some MySQL timestamps can't be
        # represented by Python's datetime (e.g. 0000-00-00 00:00:00).
        field_mode = "NULLABLE" if field[6] or field_type == "TIMESTAMP" else "REQUIRED"
        return {
            'name': field[0],
            'type': field_type,
            'mode': field_mode,
        }

    def convert_type(self, value, schema_type):
        """
        Takes a value from MySQLdb, and converts it to a value that's safe for
        JSON/Google cloud storage/BigQuery. Dates are converted to UTC seconds.
        Decimals are converted to floats. Binary type fields are encoded with base64,
        as imported BYTES data must be base64-encoded according to Bigquery SQL
        date type documentation: https://cloud.google.com/bigquery/data-types

        :param value: MySQLdb column value
        :type value: Any
        :param schema_type: BigQuery data type
        :type schema_type: str
        """
        if isinstance(value, (datetime, date)):
            return calendar.timegm(value.timetuple())
        if isinstance(value, timedelta):
            return value.total_seconds()
        if isinstance(value, Decimal):
            return float(value)
        if isinstance(value, bytes) or schema_type == "BYTES":
            return base64.standard_b64encode(value).decode('ascii')
        return value


text:
module.exports = List;

function List(createsend, listId) {
    this.createsend = createsend;
    this.listId = listId;
}

List.prototype = {
    activateWebhook: function (webhookId, callback) {
        this.createsend.put('lists/' + this.listId + '/webhooks/' + webhookId + '/activate.json', null, null, callback);
    },

    createCustomField: function (details, callback) {
        this.createsend.post('lists/' + this.listId + '/customfields.json', null, details, callback);
    },

    createWebhook: function (details, callback) {
        this.createsend.post('lists/' + this.listId + '/webhooks.json', null, details, callback);
    },

    deactivateWebhook: function (webhookId, callback) {
        this.createsend.delete('lists/' + this.listId + '/webhooks/.json' + webhookId, null, null, callback);
    },

    delete: function (callback) {
        this.createsend.delete('lists/' + this.listId + '.json', null, null, callback);
    },

    deleteCustomField: function (key, callback) {
        this.createsend.delete('lists/' + this.listId + '/customfields/' + key + '.json', null, null, callback);
    },

    deleteWebhook: function (webhookId, callback) {
        this.createsend.delete('lists/' + this.listId + '/webhooks/' + webhookId + '.json', null, null, callback);
    },

    getActiveSubscribers: function (filter, callback) {
        this.createsend.get('lists/' + this.listId + '/active.json', filter, null, callback);
    },

    getBouncedSubscribers: function (filter, callback) {
        this.createsend.get('lists/' + this.listId + '/bounced.json', filter, null, callback);
    },

    getCustomFields: function (callback) {
        this.createsend.get('lists/' + this.listId + '/customfields.json', null, null, callback);
    },

    getDeletedSubscribers: function (filter, callback) {
        this.createsend.get('lists/' + this.listId + '/deleted.json', filter, null, callback);
    },

    getDetails: function (callback) {
        this.createsend.get('lists/' + this.listId + '.json', null, null, callback);
    },

    getSegments: function (callback) {
        this.createsend.get('lists/' + this.listId + '/segments.json', null, null, callback);
    },

    getStats: function (callback) {
        this.createsend.get('lists/' + this.listId + '/stats.json', null, null, callback);
    },

    getUnconfirmedSubscribers: function (filter, callback) {
        this.createsend.get('lists/' + this.listId + '/unconfirmed.json', filter, null, callback);
    },

    getUnsubscribedSubscribers: function (filter, callback) {
        this.createsend.get('lists/' + this.listId + '/unsubscribed.json', filter, null, callback);
    },

    getWebhooks: function (callback) {
        this.createsend.get('lists/' + this.listId + '/webhooks.json', null, null, callback);
    },

    testWebhook: function (webhookId, callback) {
        this.createsend.get('lists/' + this.listId + '/webhooks/' + webhookId + '/test.json', null, null, callback);
    },

    update: function (details, callback) {
        this.createsend.put('lists/' + this.listId + '.json', null, details, callback);
    },

    updateCustomField: function (key, details, callback) {
        this.createsend.put('lists/' + this.listId + '/customfields/' + key + '.json', null, details, callback);
    },

    updateCustomFieldOptions: function (key, details, callback) {
        this.createsend.put('lists/' + this.listId + '/customfields/' + key + '/options.json', null, details, callback);
    }
};


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
Mycologia 39(4): 441 (1947)

#### Original name
Caulocarpa Gilkey

### Remarks
null


text:
@interface OA2AccessGrantTests : SenTestCase

@end


text:
package org.opensingular.link;

import org.apache.wicket.RestartResponseException;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.component.IRequestablePage;
import org.opensingular.lib.commons.lambda.ISupplier;

/**
 * A link that opens ca new tab
 */
public class NewTabPageLink extends Link<ISupplier<IRequestablePage>> {
    private final IModel<String> target = new Model<>("_blank");

    public NewTabPageLink(String id, ISupplier<IRequestablePage> pageFactory) {
        super(id, new Model<>(pageFactory));
    }

    @Override
    public void onClick() {
        throw new RestartResponseException(getModelObject().get());
    }

    @Override
    protected void onComponentTag(ComponentTag tag) {
        super.onComponentTag(tag);
        tag.put("target", target.getObject());
    }

    /**
     * Set the _target value, default is _blank
     */
    public void setTarget(String target) {
        this.target.setObject(target);
    }
}