text:
package org.zstack.test.storage.primary.local;

import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
import org.zstack.core.cloudbus.CloudBus;
import org.zstack.core.componentloader.ComponentLoader;
import org.zstack.core.db.DatabaseFacade;
import org.zstack.header.host.HostInventory;
import org.zstack.header.host.MigrateVmOnHypervisorMsg.StorageMigrationPolicy;
import org.zstack.header.identity.SessionInventory;
import org.zstack.header.storage.primary.ImageCacheVO;
import org.zstack.header.storage.primary.PrimaryStorageInventory;
import org.zstack.header.storage.primary.PrimaryStorageOverProvisioningManager;
import org.zstack.header.vm.VmInstanceInventory;
import org.zstack.header.volume.VolumeType;
import org.zstack.header.volume.VolumeVO;
import org.zstack.kvm.KVMAgentCommands.MigrateVmCmd;
import org.zstack.simulator.kvm.KVMSimulatorConfig;
import org.zstack.storage.primary.local.LocalStorageHostRefVO;
import org.zstack.storage.primary.local.LocalStorageKvmBackend.CreateEmptyVolumeCmd;
import org.zstack.storage.primary.local.LocalStorageKvmBackend.DeleteBitsCmd;
import org.zstack.storage.primary.local.LocalStorageResourceRefVO;
import org.zstack.storage.primary.local.LocalStorageSimulatorConfig;
import org.zstack.storage.primary.local.LocalStorageSimulatorConfig.Capacity;
import org.zstack.test.Api;
import org.zstack.test.ApiSenderException;
import org.zstack.test.DBUtil;
import org.zstack.test.WebBeanConstructor;
import org.zstack.test.deployer.Deployer;
import org.zstack.utils.CollectionUtils;
import org.zstack.utils.Utils;
import org.zstack.utils.data.SizeUnit;
import org.zstack.utils.function.Function;
import org.zstack.utils.logging.CLogger;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * 1. migrate the vm with local storage
 *
 * confirm the volumes of the vm are inc-copied
 */
public class TestLocalStorage30 {
    CLogger logger = Utils.getLogger(TestLocalStorage30.class);
    Deployer deployer;
    Api api;
    ComponentLoader loader;
    CloudBus bus;
    DatabaseFacade dbf;
    SessionInventory session;
    KVMSimulatorConfig kconfig;
    LocalStorageSimulatorConfig config;
    PrimaryStorageOverProvisioningManager ratioMgr;
    long totalSize = SizeUnit.GIGABYTE.toByte(100);

    @Before
    public void setUp() throws Exception {
        DBUtil.reDeployDB();
        WebBeanConstructor con = new WebBeanConstructor();
        deployer = new Deployer("deployerXml/localStorage/TestLocalStorage30.xml", con);
        deployer.addSpringConfig("KVMRelated.xml");
        deployer.addSpringConfig("localStorageSimulator.xml");
        deployer.addSpringConfig("localStorage.xml");
        deployer.load();

        loader = deployer.getComponentLoader();
        bus = loader.getComponent(CloudBus.class);
        dbf = loader.getComponent(DatabaseFacade.class);
        config = loader.getComponent(LocalStorageSimulatorConfig.class);
        kconfig = loader.getComponent(KVMSimulatorConfig.class);
        ratioMgr = loader.getComponent(PrimaryStorageOverProvisioningManager.class);

        Capacity c = new Capacity();
        c.total = totalSize;
        c.avail = totalSize;

        config.capacityMap.put("host1", c);
        config.capacityMap.put("host2", c);

        deployer.build();
        api = deployer.getApi();
        session = api.loginAsAdmin();
    }

	@Test
	public void test() throws ApiSenderException, InterruptedException {
        HostInventory host2 = deployer.hosts.get("host2");
        HostInventory host1 = deployer.hosts.get("host1");
        VmInstanceInventory vm = deployer.vms.get("TestVm");
        PrimaryStorageInventory local = deployer.primaryStorages.get("local");

        List<VolumeVO> vols = dbf.listAll(VolumeVO.class);
        List<VolumeVO> volumesOnLocal = new ArrayList<VolumeVO>();

        ImageCacheVO cacheVO = dbf.listAll(ImageCacheVO.class).get(0);
        long imageSize = cacheVO.getSize();
        long usedVolumeSize = 0;
        for (VolumeVO vol : vols) {
            if (vol.getPrimaryStorageUuid().equals(local.getUuid())) {
                volumesOnLocal.add(vol);
                usedVolumeSize += ratioMgr.calculateByRatio(vol.getPrimaryStorageUuid(), vol.getSize());
            }
        }

        config.createEmptyVolumeCmds.clear();
        config.deleteBitsCmds.clear();
        vm = api.migrateVmInstance(vm.getUuid(), host2.getUuid());
        TimeUnit.SECONDS.sleep(5);
        LocalStorageHostRefVO ref1 = dbf.findByUuid(host1.getUuid(), LocalStorageHostRefVO.class);
        Assert.assertEquals(ref1.getTotalCapacity() - imageSize, ref1.getAvailableCapacity());
        LocalStorageHostRefVO ref2 = dbf.findByUuid(host2.getUuid(), LocalStorageHostRefVO.class);
        Assert.assertEquals(ref2.getTotalCapacity() - imageSize - usedVolumeSize, ref2.getAvailableCapacity());

        Assert.assertEquals(volumesOnLocal.size(), config.createEmptyVolumeCmds.size());
        for (final VolumeVO vol : volumesOnLocal) {
            // volumes are created on dst host
            CreateEmptyVolumeCmd cmd = CollectionUtils.find(config.createEmptyVolumeCmds, new Function<CreateEmptyVolumeCmd, CreateEmptyVolumeCmd>() {
                @Override
                public CreateEmptyVolumeCmd call(CreateEmptyVolumeCmd arg) {
                    return arg.getVolumeUuid().equals(vol.getUuid()) ? arg : null;
                }
            });
            Assert.assertNotNull(cmd);
            Assert.assertEquals(vol.getInstallPath(), cmd.getInstallUrl());

            LocalStorageResourceRefVO r = dbf.findByUuid(vol.getUuid(), LocalStorageResourceRefVO.class);
            Assert.assertEquals(host2.getUuid(), r.getHostUuid());

            // volumes are deleted on src host
            DeleteBitsCmd dcmd = CollectionUtils.find(config.deleteBitsCmds, new Function<DeleteBitsCmd, DeleteBitsCmd>() {
                @Override
                public DeleteBitsCmd call(DeleteBitsCmd arg) {
                    return arg.getPath().equals(vol.getInstallPath()) ? arg : null;
                }
            });
            Assert.assertNotNull(String.format("no delete command for volume[uuid:%s, path:%s]", vol.getUuid(), vol.getInstallPath()), dcmd);
        }

        Assert.assertFalse(kconfig.migrateVmCmds.isEmpty());
        MigrateVmCmd mcmd = kconfig.migrateVmCmds.get(0);
        Assert.assertEquals(host2.getManagementIp(), mcmd.getDestHostIp());
        Assert.assertEquals(vm.getUuid(), mcmd.getVmUuid());
        Assert.assertEquals(StorageMigrationPolicy.IncCopy.toString(), mcmd.getStorageMigrationPolicy());
	}
}


text:
NS_ASSUME_NONNULL_BEGIN

@interface DWAnimatedShapeLayer ()

@property (null_resettable, strong, nonatomic) NSMutableSet *animatableKeys;

@end

@implementation DWAnimatedShapeLayer

- (NSMutableSet *)animatableKeys {
    if (!_animatableKeys) {
        _animatableKeys = [NSMutableSet setWithObject:@"path"];
    }
    return _animatableKeys;
}

- (nullable id<CAAction>)actionForKey:(NSString *)event {
    if ([self.animatableKeys containsObject:event]) {
        return [self customAnimationForKey:event];
    }
    return [super actionForKey:event];
}

- (CABasicAnimation *)customAnimationForKey:(NSString *)key {
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:key];
    animation.fromValue = [self.presentationLayer valueForKey:key];
    animation.duration = [CATransaction animationDuration];
    return animation;
}

@end

NS_ASSUME_NONNULL_END

redpajama_set_name: RedPajamaGithub


text:
package com.yrkj.model.travels;

import java.util.Date;

/**
 * Created by 45425 on 2017/9/1.
 */
public class UserTravelInput {
    private  String open_id;
    private String left;

    public String getOpen_id() {
        return open_id;
    }

    public void setOpen_id(String open_id) {
        this.open_id = open_id;
    }

    public String getLeft() {
        return left;
    }

    public void setLeft(String left) {
        this.left = left;
    }

    public String getRight() {
        return right;
    }

    public void setRight(String right) {
        this.right = right;
    }

    private String right;
}


text:
DOMly precompiler plugin for Browserify

## Installation

    npm install domlyify

## Usage

This module is meant to be used together with
[browserify](http://browserify.org)

Example `example.js`:

    var template = require('./example-template.html');

    template({title: 'example'});

Example `example-template.html`:

    <h1>{{data.title}}</h1>

### Compile Options

This plugin can give DOMly's compile options.

    browserify -t [ domlyify --stripWhitespace true ] example.js

You can also configure it in package.json

```json
{
    "name": "example-package",
    "browserify": {
        "transform": [
            [ "domlyify", {"stripWhitespace": true } ],
        ]
    }
}

#### Available option

...

### With gulp.js

...

### With grunt.js

...

## Tests

    npm test

## Roadmap

    - add tests
    - add examples

## Author

Ezekiel Chentnik


text:
"use strict";
/* jshint -W024 */
/* jshint -W079 */
/* jshint expr:true */

var chai = require('chai');
var mockery = require('mockery');
var sinon = require('sinon');
var sinonChai = require("sinon-chai");
var expect = chai.expect;
chai.use(sinonChai);

describe('recipes', function () {
    var sut, playlistFake, trackIds;
    beforeEach(function () {
        trackIds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
        playlistFake = {
            replacePlaylist: sinon.spy(function(ds, playlistName, callback) { callback(null, trackIds); })
        };
        mockery.enable({
            warnOnUnregistered: false
        });
        mockery.registerMock('./playlists.js', playlistFake);
        sut = require('../server/recipes.js');
    });
    afterEach(function () {
        mockery.deregisterAll();
        mockery.disable();
    });
    describe('When increasing volume', function () {
        var dsFake;
        beforeEach(function (done) {
            var volumeInc = sinon.spy(function(callback) { callback(); });
            dsFake = {
                volumeInc: volumeInc
            };
            sut.volumeUp(dsFake, 5, done);
        });
        it('Should call DS volume inc 5 times', function () {
            expect(dsFake.volumeInc).to.have.callCount(5);
        });
    });
    describe('When decreasing volume', function () {
        var dsFake;
        beforeEach(function (done) {
            var volumeDec = sinon.spy(function(callback) { callback(); });
            dsFake = {
                volumeDec: volumeDec
            };
            sut.volumeDown(dsFake, 5, done);
        });
        it('Should call DS volume dec 5 times', function () {
            expect(dsFake.volumeDec).to.have.callCount(5);
        });
    });
    describe('When toggling sleep', function () {
        var dsFake;
        beforeEach(function () {
            var powerOn = sinon.spy(function(callback) { callback(); });
            var powerOff = sinon.spy(function(callback) { callback(); });
            dsFake = {
                powerOn: powerOn,
                powerOff: powerOff
            };
        });
        describe('When DS is currently on', function () {
            var result;
            beforeEach(function (done) {
                dsFake.standbyState = function (callback) { callback(null, '0'); };
                sut.toggleStandby(dsFake, function(err, data) {
                    expect(err).not.to.exist;
                    result = data;
                    done();
                });
            });
            it('Should call powerOff', function () {
                expect(dsFake.powerOff).to.have.been.called;
            });
            it('Should not call powerOn', function () {
                expect(dsFake.powerOn).not.to.have.been.called;
            });
            it('Should return new standby state', function () {
                expect(result).to.be.eql({ standbyState: 1 });
            });
        });
        describe('When DS is currently off', function () {
            var result;
            beforeEach(function (done) {
                dsFake.standbyState = function (callback) { callback(null, '1'); };
                sut.toggleStandby(dsFake, function(err, data) {
                    expect(err).not.to.exist;
                    result = data;
                    done();
                });
            });
            it('Should not call powerOff', function () {
                expect(dsFake.powerOff).not.to.have.been.called;
            });
            it('Should call powerOn', function () {
                expect(dsFake.powerOn).to.have.been.called;
            });
            it('Should return new standby state', function () {
                expect(result).to.be.eql({ standbyState: 0 });
            });
        });
    });
    describe('When playing', function () {
        var dsFake;
        beforeEach(function() {
            dsFake = {
                powerOn: sinon.spy(function(callback) { callback(); }),
                changeSource: sinon.spy(function(sourceId, callback) { callback(); }),
                setRadioChannel: sinon.spy(function(radioChannel, callback) { callback(); }),
                playRadio: sinon.spy(function(callback) { callback(); }),
                enableShuffle: sinon.spy(function(callback) { callback(); }),
                disableShuffle: sinon.spy(function(callback) { callback(); }),
                playFromPlaylistIndex: sinon.spy(function(index, callback) { callback(); })
            };
        });
        describe('using a ds which is currently off', function () {
            beforeEach(function() {
                dsFake.standbyState = function (callback) { callback(null, '1'); };
            });
            describe('a playlist', function () {
                var playlistName;
                beforeEach(function () {
                    playlistName = 'TestPlaylist';
                });
                describe('in shuffle mode', function () {
                    beforeEach(function (done) {
                        Math.random = function () { return 1; };
                        sut.play(dsFake, 0, playlistName, true, null, done);
                    });
                    it('Should power the ds on', function () {
                        expect(dsFake.powerOn).to.have.been.called;
                    });
                    it('Should change the source to id 0', function () {
                        expect(dsFake.changeSource).to.have.been.calledWith(0);
                    });
                    // it('Should replace the playlist', function () {
                    //     expect(playlistFake.replacePlaylist).to.have.been.called;
                    // });
                    it('Should enable shuffle mode', function () {
                        expect(dsFake.enableShuffle).to.have.been.called;
                    });
                    it('Should start playback', function () {
                        expect(dsFake.playFromPlaylistIndex).to.have.been.calledWith(trackIds.length + 1);
                    });
                    it('Should not play the radio', function () {
                        expect(dsFake.playRadio).not.to.have.been.called;
                    });
                });
                describe('In normal mode', function () {
                    beforeEach(function (done) {
                        sut.play(dsFake, 0, playlistName, false, null, done);
                    });
                    it('Should power the ds on', function () {
                        expect(dsFake.powerOn).to.have.been.called;
                    });
                    it('Should change the source to id 0', function () {
                        expect(dsFake.changeSource).to.have.been.calledWith(0);
                    });
                    // it('Should replace the playlist', function () {
                    //     expect(playlistFake.replacePlaylist).to.have.been.called;
                    // });
                    it('Should disable shuffle mode', function () {
                        expect(dsFake.disableShuffle).to.have.been.called;
                    });
                    it('Should start playback from the beginning', function () {
                        expect(dsFake.playFromPlaylistIndex).to.have.been.calledWith(0);
                    });
                    it('Should not play the radio', function () {
                        expect(dsFake.playRadio).not.to.have.been.called;
                    });
                });
            });
            describe('a radio channel', function () {
                var radioChannel;
                beforeEach(function (done) {
                    radioChannel = {
                        id: 23,
                        uri: 'http://opml.radiotime.com/Tune.ashx?id=s44491&formats=mp3,wma,aac,wmvideo,ogg,hls&partnerId=ah2rjr68&username=bazwilliams&c=ebrowse',
                        title: 'BBC Radio 6 Music (AAA)',
                        artwork: 'http://cdn-radiotime-logos.tunein.com/s44491g.png'
                    };
                    sut.play(dsFake, 1, null, false, radioChannel, done);
                });
                it('Should power the ds on', function () {
                    expect(dsFake.powerOn).to.have.been.called;
                });
                it('Should change the source to id 1', function () {
                    expect(dsFake.changeSource).to.have.been.calledWith(1);
                });
                it('Should set the radio channel', function () {
                    expect(dsFake.setRadioChannel).to.have.been.calledWith(radioChannel);
                });
                it('Should play the radio', function () {
                    expect(dsFake.playRadio).to.have.been.called;
                });
                it('Should not start playlist playback', function () {
                    expect(dsFake.playFromPlaylistIndex).not.to.have.been.called;
                });
            });
            describe('a specific source', function () {
                beforeEach(function (done) {
                    sut.play(dsFake, 7, null, false, null, done);
                });
                it('Should power the ds on', function () {
                    expect(dsFake.powerOn).to.have.been.called;
                });
                it('Should change the source to id 7', function () {
                    expect(dsFake.changeSource).to.have.been.calledWith(7);
                });
                it('Should not play the radio', function () {
                    expect(dsFake.playRadio).not.to.have.been.called;
                });
                it('Should not start playlist playback', function () {
                    expect(dsFake.playFromPlaylistIndex).not.to.have.been.called;
                });
            });
        });
        describe('using a ds which is already on', function () {
            beforeEach(function(done) {
                dsFake.standbyState = function (callback) { callback(null, '0'); };
                sut.play(dsFake, 7, null, false, null, done);
            });
            it('Should not power the ds on', function () {
                expect(dsFake.powerOn).not.to.have.been.called;
            });
            it('Should change the source to id 7', function () {
                expect(dsFake.changeSource).to.have.been.calledWith(7);
            });
            it('Should not play the radio', function () {
                expect(dsFake.playRadio).not.to.have.been.called;
            });
            it('Should not start playlist playback', function () {
                expect(dsFake.playFromPlaylistIndex).not.to.have.been.called;
            });
        });
    });
    describe('When listing radio stations', function () {
        var dsFake, result, fakeRadioData, radioIdArray;
        beforeEach(function (done) {
            fakeRadioData = { uri: '/test' };
            radioIdArray = [1, 2, 3];
            dsFake = {
                getRadioIdArray: sinon.spy(function (callback) { callback(null, radioIdArray); }),
                retrieveRadioStationDetails: sinon.spy(function(idArray, callback) { callback(null, fakeRadioData); })
            };
            sut.listRadioStations(dsFake, function(err, data) {
                expect(err).not.to.exist;
                result = data;
                done();
            });
        });
        it('Should retrieve radio station idArray', function () {
            expect(dsFake.getRadioIdArray).to.have.been.called;
        });
        it('Should retrieve radio station details using the idArray', function () {
            expect(dsFake.retrieveRadioStationDetails).to.have.been.calledWith(radioIdArray);
        });
        it('Should return the radio station details', function () {
            expect(result).to.be.eql(fakeRadioData);
        });
    });
});


text:
include_recipe "bosh_inception::mount_store_volume"
include_recipe "bosh_inception::useful_dirs"
include_recipe "bosh_inception::packages"
include_recipe "bosh_inception::setup_git"
include_recipe "bosh_inception::setup_ssh_keys"
include_recipe "bosh_inception::install_ruby"
include_recipe "bosh_inception::install_bosh"
include_recipe "bosh_inception::setup_dotfog"


text:
<?php

/**
 * The gmp extension in PHP does not implement certain necessary operations
 * for elliptic curve encryption
 * This class implements all neccessary static methods
 *
 */
class gmp_Utils {

    public static function gmp_mod2($n, $d) {
        if (extension_loaded('gmp') && USE_EXT=='GMP') {
            $res = gmp_div_r($n, $d);
            if (gmp_cmp(0, $res) > 0) {
                $res = gmp_add($d, $res);
            }
            return gmp_strval($res);
        } else {
            throw new Exception("PLEASE INSTALL GMP");
        }
    }

    public static function gmp_random($n) {
        if (extension_loaded('gmp') && USE_EXT=='GMP') {
            $random = gmp_strval(gmp_random());
            $small_rand = rand();
            while (gmp_cmp($random, $n) > 0) {
                $random = gmp_div($random, $small_rand, GMP_ROUND_ZERO);
            }

            return gmp_strval($random);
        } else {
            throw new Exception("PLEASE INSTALL GMP");
        }
    }

    public static function gmp_hexdec($hex) {
        if (extension_loaded('gmp') && USE_EXT=='GMP') {
            $dec = gmp_strval(gmp_init($hex), 10);

            return $dec;
        } else {
            throw new Exception("PLEASE INSTALL GMP");
        }
    }

    public static function gmp_dechex($dec) {
        if (extension_loaded('gmp') && USE_EXT=='GMP') {
            $hex = gmp_strval(gmp_init($hex), 16);

            return $hex;
        } else {
            throw new Exception("PLEASE INSTALL GMP");
        }
    }

}
?>


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>src/pixi/filters/TiltShiftYFilter.js - pixi.js</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="shortcut icon" type="image/png" href="../assets/favicon.png">

            API Docs for: 2.1.0

APIs

Classes

Modules

            <input type="search" id="api-filter" placeholder="Type to filter APIs">

AbstractFilter

AjaxRequest

AlphaMaskFilter

AsciiFilter

AssetLoader

AtlasLoader

autoDetectRecommendedRenderer

autoDetectRenderer

BaseTexture

BitmapFontLoader

BitmapText

BlurFilter

BlurXFilter

BlurYFilter

CanvasBuffer

CanvasGraphics

CanvasMaskManager

CanvasRenderer

CanvasTinter

Circle

ColorMatrixFilter

ColorStepFilter

ComplexPrimitiveShader

ConvolutionFilter

CrossHatchFilter

DisplacementFilter

DisplayObject

DisplayObjectContainer

DotScreenFilter

Ellipse

Event

EventTarget

FilterBlock

FilterTexture

Graphics

GraphicsData

GrayFilter

ImageLoader

InteractionData

InteractionManager

InvertFilter

JsonLoader

Matrix

MovieClip

NoiseFilter

NormalMapFilter

PixelateFilter

PixiFastShader

PixiShader

Point

Polygon

PolyK

PrimitiveShader

Rectangle

RenderTexture

RGBSplitFilter

Rope

Rounded Rectangle

SepiaFilter

SmartBlurFilter

Spine

SpineLoader

Sprite

SpriteBatch

SpriteSheetLoader

Stage

Strip

StripShader

Text

Texture

TilingSprite

TiltShiftFilter

TiltShiftXFilter

TiltShiftYFilter

TwistFilter

WebGLBlendModeManager

WebGLFastSpriteBatch

WebGLFilterManager

WebGLGraphics

WebGLGraphicsData

WebGLMaskManager

WebGLRenderer

WebGLShaderManager

WebGLSpriteBatch

WebGLStencilManager

PIXI

        Show:

            <input type="checkbox" id="api-show-inherited" checked>
            Inherited

            <input type="checkbox" id="api-show-protected">
            Protected

            <input type="checkbox" id="api-show-private">
            Private

            <input type="checkbox" id="api-show-deprecated">
            Deprecated

File: src/pixi/filters/TiltShiftYFilter.js

/**
 * @author Vico @vicocotea
 * original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/
 */

/**
 * A TiltShiftYFilter.
 *
 * @class TiltShiftYFilter
 * @extends AbstractFilter
 * @constructor
 */
PIXI.TiltShiftYFilter = function()
{
    PIXI.AbstractFilter.call( this );

    this.passes = [this];

    // set the uniforms
    this.uniforms = {
        blur: {type: '1f', value: 100.0},
        gradientBlur: {type: '1f', value: 600.0},
        start: {type: '2f', value:{x:0, y:window.screenHeight / 2}},
        end: {type: '2f', value:{x:600, y:window.screenHeight / 2}},
        delta: {type: '2f', value:{x:30, y:30}},
        texSize: {type: '2f', value:{x:window.screenWidth, y:window.screenHeight}}
    };

    this.updateDelta();

    this.fragmentSrc = [
        'precision mediump float;',
        'uniform sampler2D uSampler;',
        'uniform float blur;',
        'uniform float gradientBlur;',
        'uniform vec2 start;',
        'uniform vec2 end;',
        'uniform vec2 delta;',
        'uniform vec2 texSize;',
        'varying vec2 vTextureCoord;',

        'float random(vec3 scale, float seed) {',
        '   return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);',
        '}',

        'void main(void) {',
        '    vec4 color = vec4(0.0);',
        '    float total = 0.0;',

        '    float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);',
        '    vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));',
        '    float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;',

        '    for (float t = -30.0; t <= 30.0; t++) {',
        '        float percent = (t + offset - 0.5) / 30.0;',
        '        float weight = 1.0 - abs(percent);',
        '        vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);',
        '        sample.rgb *= sample.a;',
        '        color += sample * weight;',
        '        total += weight;',
        '    }',

        '    gl_FragColor = color / total;',
        '    gl_FragColor.rgb /= gl_FragColor.a + 0.00001;',
        '}'
    ];
};

PIXI.TiltShiftYFilter.prototype = Object.create( PIXI.AbstractFilter.prototype );
PIXI.TiltShiftYFilter.prototype.constructor = PIXI.TiltShiftYFilter;

/**
 * The strength of the blur.
 *
 * @property blur
 * @type Number
 */
Object.defineProperty(PIXI.TiltShiftYFilter.prototype, 'blur', {
    get: function() {
        return this.uniforms.blur.value;
    },
    set: function(value) {
        this.dirty = true;
        this.uniforms.blur.value = value;
    }
});

/**
 * The strength of the gradient blur.
 *
 * @property gradientBlur
 * @type Number
 */
Object.defineProperty(PIXI.TiltShiftYFilter.prototype, 'gradientBlur', {
    get: function() {
        return this.uniforms.gradientBlur.value;
    },
    set: function(value) {
        this.dirty = true;
        this.uniforms.gradientBlur.value = value;
    }
});

/**
 * The Y value to start the effect at.
 *
 * @property start
 * @type Number
 */
Object.defineProperty(PIXI.TiltShiftYFilter.prototype, 'start', {
    get: function() {
        return this.uniforms.start.value;
    },
    set: function(value) {
        this.dirty = true;
        this.uniforms.start.value = value;
        this.updateDelta();
    }
});

/**
 * The Y value to end the effect at.
 *
 * @property end
 * @type Number
 */
Object.defineProperty(PIXI.TiltShiftYFilter.prototype, 'end', {
    get: function() {
        return this.uniforms.end.value;
    },
    set: function(value) {
        this.dirty = true;
        this.uniforms.end.value = value;
        this.updateDelta();
    }
});

/**
 * Updates the filter delta values.
 *
 * @method updateDelta
 */
PIXI.TiltShiftYFilter.prototype.updateDelta = function(){
    var dx = this.uniforms.end.value.x - this.uniforms.start.value.x;
    var dy = this.uniforms.end.value.y - this.uniforms.start.value.y;
    var d = Math.sqrt(dx * dx + dy * dy);
    this.uniforms.delta.value.x = -dy / d;
    this.uniforms.delta.value.y = dx / d;
};


text:
var authorize = require('../lib/authorize')('user'),
    _ = require('lodash')
  ;

var
  _play = function(socket, data){
    deviceId = String(data.deviceId);
    var index = _.findIndex(socket.handshake.session.passport.user.devices, function(d){
        return String(d) == deviceId;
      });
    console.log(index, deviceId);
    console.log('play', data);
    if (index > -1){
      socket.join(deviceId);
      socket.to(deviceId).emit('playback:play', data);
    }
  };

module.exports = {
  play: authorize(_play)
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ivy-report.xsl"?>
<ivy-report version="1.0">
	<info
		organisation="org.apache.solr"
		module="analysis-extras"
		revision="working@dwarf"
		conf="compile"
		confs="compile"
		date="20160603183955"/>
	<dependencies>
		<module organisation="org.carrot2" name="morfologik-polish">
			<revision name="1.7.1" status="release" pubdate="20130716215600" resolver="public" artresolver="main" homepage="" downloaded="false" searched="false" default="false" conf="master" position="1">
				<metadata-artifact status="no" details="" size="5328" time="0" location="C:\Users\jiyu\.ivy2\cache\org.carrot2\morfologik-polish\ivy-1.7.1.xml" searched="false" original-local-location="C:\Users\jiyu\.ivy2\cache\org.carrot2\morfologik-polish\ivy-1.7.1.xml.original" origin-is-local="false" origin-location="https://repo1.maven.org/maven2/org/carrot2/morfologik-polish/1.7.1/morfologik-polish-1.7.1.pom"/>
				<caller organisation="org.apache.solr" name="analysis-extras" conf="compile" rev="1.7.1" rev-constraint-default="1.7.1" rev-constraint-dynamic="1.7.1" callerrev="working@dwarf"/>
				<artifacts>
					<artifact name="morfologik-polish" type="jar" ext="jar" status="no" details="" size="1947259" time="0" location="C:\Users\jiyu\.ivy2\cache\org.carrot2\morfologik-polish\jars\morfologik-polish-1.7.1.jar">
						<origin-location is-local="false" location="https://repo1.maven.org/maven2/org/carrot2/morfologik-polish/1.7.1/morfologik-polish-1.7.1.jar"/>
					</artifact>
				</artifacts>
			</revision>
		</module>
		<module organisation="org.carrot2" name="morfologik-stemming">
			<revision name="1.7.1" status="release" pubdate="20130716215520" resolver="public" artresolver="main" homepage="" downloaded="false" searched="false" default="false" conf="master" position="3">
				<metadata-artifact status="no" details="" size="5555" time="0" location="C:\Users\jiyu\.ivy2\cache\org.carrot2\morfologik-stemming\ivy-1.7.1.xml" searched="false" original-local-location="C:\Users\jiyu\.ivy2\cache\org.carrot2\morfologik-stemming\ivy-1.7.1.xml.original" origin-is-local="false" origin-location="https://repo1.maven.org/maven2/org/carrot2/morfologik-stemming/1.7.1/morfologik-stemming-1.7.1.pom"/>
				<caller organisation="org.apache.solr" name="analysis-extras" conf="compile" rev="1.7.1" rev-constraint-default="1.7.1" rev-constraint-dynamic="1.7.1" callerrev="working@dwarf"/>
				<artifacts>
					<artifact name="morfologik-stemming" type="jar" ext="jar" status="no" details="" size="36198" time="0" location="C:\Users\jiyu\.ivy2\cache\org.carrot2\morfologik-stemming\jars\morfologik-stemming-1.7.1.jar">
						<origin-location is-local="false" location="https://repo1.maven.org/maven2/org/carrot2/morfologik-stemming/1.7.1/morfologik-stemming-1.7.1.jar"/>
					</artifact>
				</artifacts>
			</revision>
		</module>
		<module organisation="org.carrot2" name="morfologik-fsa">
			<revision name="1.7.1" status="release" pubdate="20130716215511" resolver="public" artresolver="main" homepage="" downloaded="false" searched="false" default="false" conf="master" position="2">
				<metadata-artifact status="no" details="" size="5135" time="0" location="C:\Users\jiyu\.ivy2\cache\org.carrot2\morfologik-fsa\ivy-1.7.1.xml" searched="false" original-local-location="C:\Users\jiyu\.ivy2\cache\org.carrot2\morfologik-fsa\ivy-1.7.1.xml.original" origin-is-local="false" origin-location="https://repo1.maven.org/maven2/org/carrot2/morfologik-fsa/1.7.1/morfologik-fsa-1.7.1.pom"/>
				<caller organisation="org.apache.solr" name="analysis-extras" conf="compile" rev="1.7.1" rev-constraint-default="1.7.1" rev-constraint-dynamic="1.7.1" callerrev="working@dwarf"/>
				<artifacts>
					<artifact name="morfologik-fsa" type="jar" ext="jar" status="no" details="" size="54042" time="0" location="C:\Users\jiyu\.ivy2\cache\org.carrot2\morfologik-fsa\jars\morfologik-fsa-1.7.1.jar">
						<origin-location is-local="false" location="https://repo1.maven.org/maven2/org/carrot2/morfologik-fsa/1.7.1/morfologik-fsa-1.7.1.jar"/>
					</artifact>
				</artifacts>
			</revision>
		</module>
		<module organisation="com.ibm.icu" name="icu4j">
			<revision name="54.1" status="release" pubdate="20141001012113" resolver="public" artresolver="main" homepage="http://icu-project.org/" downloaded="false" searched="false" default="false" conf="master" position="0">
				<license name="ICU License" url="http://source.icu-project.org/repos/icu/icu/trunk/license.html"/>
				<metadata-artifact status="no" details="" size="2672" time="0" location="C:\Users\jiyu\.ivy2\cache\com.ibm.icu\icu4j\ivy-54.1.xml" searched="false" original-local-location="C:\Users\jiyu\.ivy2\cache\com.ibm.icu\icu4j\ivy-54.1.xml.original" origin-is-local="false" origin-location="https://repo1.maven.org/maven2/com/ibm/icu/icu4j/54.1/icu4j-54.1.pom"/>
				<caller organisation="org.apache.solr" name="analysis-extras" conf="compile" rev="54.1" rev-constraint-default="54.1" rev-constraint-dynamic="54.1" callerrev="working@dwarf"/>
				<artifacts>
					<artifact name="icu4j" type="jar" ext="jar" status="no" details="" size="11126867" time="0" location="C:\Users\jiyu\.ivy2\cache\com.ibm.icu\icu4j\jars\icu4j-54.1.jar">
						<origin-location is-local="false" location="https://repo1.maven.org/maven2/com/ibm/icu/icu4j/54.1/icu4j-54.1.jar"/>
					</artifact>
				</artifacts>
			</revision>
		</module>
	</dependencies>
</ivy-report>


text:
author: leifmadsen
comments: true
date: 2011-01-12 01:30:09+00:00
layout: post
slug: asterisk-the-definitive-guide-first-draft-complete
title: 'Asterisk: The Definitive Guide, First Draft Complete!'
wordpress_id: 276
categories:
- Asterisk
- Being Productive
- Musings
tags:
- Asterisk
- book
- dialplan
- OFPS
- the definitive guide
---

Today we marked the finishing of Asterisk: The Definitive Guide (3rd Edition) by sending the first draft off to the O'Reilly production team. We finished nearly on schedule (within a few days, which is remarkable considering we added 150 more pages than originally intentioned) and have our favourite copy editor Rachel Head (formerly Wheeler) who did the first edition of Asterisk: The Future of Telephony who we emphatically enjoyed working with. We're looking forward to it again.

With the draft done now, and the copy sent off to production to do their magic, I'm not quite sure what I'm going to do with my mornings! Perhaps I'll start blogging about some dialplan stuff, or coming up with some sort of project to build. We'll see! Any suggestions about things to document on my blog are of course welcome.

Don't stop posting your comments and suggestions to the OFPS site though! (http://ofps.oreilly.com) When the O'Reilly production team is done with the book in a few weeks, we're going to have time to do additional modifications and editing, so your comments will get addressed then. It's looking like the estimated shipping date of books for March is realistic at this point.

Thanks for all the support the community has shown us this far. This is going to be by far the best book on Asterisk to date.


text:
// Code generated by main. DO NOT EDIT.

package project

const (
	// Package-wide consts from generator "zz_generated_register".
	GroupName = "project.cattle.io"
)


text:
from urlparse import urlparse, urlunparse
import re

from bs4 import BeautifulSoup
import requests

from .base import BaseCrawler
from ...models import Entity, Author, AuthorType

class DailyNewsTZCrawler(BaseCrawler):
    DNTZ_RE = re.compile('(www\.)?dailynews.co.tz')

    def offer(self, url):
        """ Can this crawler process this URL? """
        parts = urlparse(url)
        return bool(self.DNTZ_RE.match(parts.netloc))

    def extract(self, doc, raw_html):
        """ Extract text and other things from the raw_html for this document. """
        super(DailyNewsTZCrawler, self).extract(doc, raw_html)

        soup = BeautifulSoup(raw_html)

        # gather title
        doc.title = self.extract_plaintext(soup.select(".article-main .article-header .article-title"))

        #gather publish date
        date = self.extract_plaintext(soup.select(".article-main .article-aside .published time"))
        doc.published_at = self.parse_timestamp(date)

        #gather text and summary
        doc.summary = self.extract_plaintext(soup.select(".article-main .article-full .article-content-main .article-intro p"))
        nodes = soup.select(".article-main .article-full .article-content-main .article-content p")
        doc.text = "\n\n".join(p.text.strip() for p in nodes)

        # gather author
        author = self.extract_plaintext(soup.select(".article-main .article-aside .createdby span:first-child"))
        if author:
            doc.author = Author.get_or_create(author.strip(), AuthorType.journalist())
        else:
            doc.author = Author.unknown()


text:
from django.apps import AppConfig

class CustomConfig(AppConfig):
    name = 'apps.default_config_app'


text:
package com.lynden.gmapsfx.shapes;

import com.lynden.gmapsfx.javascript.object.LatLong;
import com.lynden.gmapsfx.javascript.object.MVCArray;

/**
 *
 * @author Geoff Capper
 */
public class PolygonOptions extends FillableMapShapeOptions<PolygonOptions> {

    private LatLong center;
    private MVCArray paths;

    public PolygonOptions() {

    }
    public PolygonOptions center(LatLong center) {
        setProperty("center", center);
        this.center = center;
        return this;
    }

    public PolygonOptions paths(MVCArray paths) {
        setProperty("path", paths);
        this.paths = paths;
        return this;
    }

    @Override
    protected PolygonOptions getMe() {
        return this;
    }

}


text:
<?php

namespace Kendo\UI;

class GanttMessagesViews extends \Kendo\SerializableObject {
//>> Properties

    /**
    * The text similar to "Day" displayed as gantt "day" view title.
    * @param string $value
    * @return \Kendo\UI\GanttMessagesViews
    */
    public function day($value) {
        return $this->setProperty('day', $value);
    }

    /**
    * The text similar to "Week" displayed as gantt "week" view title.
    * @param string $value
    * @return \Kendo\UI\GanttMessagesViews
    */
    public function week($value) {
        return $this->setProperty('week', $value);
    }

    /**
    * The text similar to "Month" displayed as gantt "month" view title.
    * @param string $value
    * @return \Kendo\UI\GanttMessagesViews
    */
    public function month($value) {
        return $this->setProperty('month', $value);
    }

//<< Properties
}

?>


text:
module VagrantPlugins
  module Chef
    class CommandBuilder
      def initialize(config, client_type, is_windows=false, is_ui_colored=false)
        @client_type   = client_type
        @config        = config
        @is_windows    = is_windows
        @is_ui_colored = is_ui_colored

        if client_type != :solo && client_type != :client
          raise 'Invalid client_type, expected solo or client'
        end
      end

      def build_command
        "#{command_env}#{chef_binary_path} #{chef_arguments}"
      end

      protected

      def command_env
        @config.binary_env ? "#{@config.binary_env} " : ""
      end

      def chef_binary_path
        binary_path = "chef-#{@client_type}"
        if @config.binary_path
          binary_path = guest_friendly_path(File.join(@config.binary_path, binary_path))
        end
        binary_path
      end

      def chef_arguments
        chef_arguments = "-c #{provisioning_path("#{@client_type}.rb")}"
        chef_arguments << " -j #{provisioning_path("dna.json")}"
        chef_arguments << " #{@config.arguments}" if @config.arguments
        chef_arguments << " --no-color" unless @is_ui_colored
        chef_arguments.strip
      end

      def provisioning_path(file)
        guest_friendly_path(File.join(@config.provisioning_path, file))
      end

      def guest_friendly_path(path)
        return path unless @is_windows
        path.gsub!("/", "\\")
        path = "c:#{path}" if path.start_with?("\\")
        path
      end
    end
  end
end


text:
import { ServiceClientOptions, RequestOptions, ServiceCallback } from 'ms-rest';
import * as models from '../models';

/**
 * @class
 * ManagementLocks
 * __NOTE__: An instance of this class is automatically created for an
 * instance of the ManagementLockClient.
 */
export interface ManagementLocks {

    /**
     * Create or update a management lock at the resource group level.
     *
     * @param {string} resourceGroupName The resource group name.
     *
     * @param {string} lockName The lock name.
     *
     * @param {object} parameters The management lock parameters.
     *
     * @param {string} [parameters.level] Gets or sets the lock level of the
     * management lock. Possible values include: 'NotSpecified', 'CanNotDelete',
     * 'ReadOnly'
     *
     * @param {string} [parameters.notes] Gets or sets the notes of the management
     * lock.
     *
     * @param {string} [parameters.id] Gets or sets the Id of the lock.
     *
     * @param {string} [parameters.type] Gets or sets the type of the lock.
     *
     * @param {string} [parameters.name] Gets or sets the name of the lock.
     *
     * @param {object} [options] Optional Parameters.
     *
     * @param {object} [options.customHeaders] Headers that will be added to the
     * request
     *
     * @param {ServiceCallback} [callback] callback function; see ServiceCallback
     * doc in ms-rest index.d.ts for details
     */
    createOrUpdateAtResourceGroupLevel(resourceGroupName: string, lockName: string, parameters: models.ManagementLockObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.ManagementLockObject>): void;
    createOrUpdateAtResourceGroupLevel(resourceGroupName: string, lockName: string, parameters: models.ManagementLockObject, callback: ServiceCallback<models.ManagementLockObject>): void;

    /**
     * Create or update a management lock at the resource level or any level below
     * resource.
     *
     * @param {string} resourceGroupName The name of the resource group.
     *
     * @param {string} resourceProviderNamespace Resource identity.
     *
     * @param {string} parentResourcePath Resource identity.
     *
     * @param {string} resourceType Resource identity.
     *
     * @param {string} resourceName Resource identity.
     *
     * @param {string} lockName The name of lock.
     *
     * @param {object} parameters Create or update management lock parameters.
     *
     * @param {string} [parameters.level] Gets or sets the lock level of the
     * management lock. Possible values include: 'NotSpecified', 'CanNotDelete',
     * 'ReadOnly'
     *
     * @param {string} [parameters.notes] Gets or sets the notes of the management
     * lock.
     *
     * @param {string} [parameters.id] Gets or sets the Id of the lock.
     *
     * @param {string} [parameters.type] Gets or sets the type of the lock.
     *
     * @param {string} [parameters.name] Gets or sets the name of the lock.
     *
     * @param {object} [options] Optional Parameters.
     *
     * @param {object} [options.customHeaders] Headers that will be added to the
     * request
     *
     * @param {ServiceCallback} [callback] callback function; see ServiceCallback
     * doc in ms-rest index.d.ts for details
     */
    createOrUpdateAtResourceLevel(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, lockName: string, parameters: models.ManagementLockObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.ManagementLockObject>): void;
    createOrUpdateAtResourceLevel(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, lockName: string, parameters: models.ManagementLockObject, callback: ServiceCallback<models.ManagementLockObject>): void;

    /**
     * Deletes the management lock of a resource or any level below resource.
     *
     * @param {string} resourceGroupName The name of the resource group.
     *
     * @param {string} resourceProviderNamespace Resource identity.
     *
     * @param {string} parentResourcePath Resource identity.
     *
     * @param {string} resourceType Resource identity.
     *
     * @param {string} resourceName Resource identity.
     *
     * @param {string} lockName The name of lock.
     *
     * @param {object} [options] Optional Parameters.
     *
     * @param {object} [options.customHeaders] Headers that will be added to the
     * request
     *
     * @param {ServiceCallback} [callback] callback function; see ServiceCallback
     * doc in ms-rest index.d.ts for details
     */
    deleteAtResourceLevel(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, lockName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<void>): void;
    deleteAtResourceLevel(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, lockName: string, callback: ServiceCallback<void>): void;

    /**
     * Create or update a management lock at the subscription level.
     *
     * @param {string} lockName The name of lock.
     *
     * @param {object} parameters The management lock parameters.
     *
     * @param {string} [parameters.level] Gets or sets the lock level of the
     * management lock. Possible values include: 'NotSpecified', 'CanNotDelete',
     * 'ReadOnly'
     *
     * @param {string} [parameters.notes] Gets or sets the notes of the management
     * lock.
     *
     * @param {string} [parameters.id] Gets or sets the Id of the lock.
     *
     * @param {string} [parameters.type] Gets or sets the type of the lock.
     *
     * @param {string} [parameters.name] Gets or sets the name of the lock.
     *
     * @param {object} [options] Optional Parameters.
     *
     * @param {object} [options.customHeaders] Headers that will be added to the
     * request
     *
     * @param {ServiceCallback} [callback] callback function; see ServiceCallback
     * doc in ms-rest index.d.ts for details
     */
    createOrUpdateAtSubscriptionLevel(lockName: string, parameters: models.ManagementLockObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.ManagementLockObject>): void;
    createOrUpdateAtSubscriptionLevel(lockName: string, parameters: models.ManagementLockObject, callback: ServiceCallback<models.ManagementLockObject>): void;

    /**
     * Deletes the management lock of a subscription.
     *
     * @param {string} lockName The name of lock.
     *
     * @param {object} [options] Optional Parameters.
     *
     * @param {object} [options.customHeaders] Headers that will be added to the
     * request
     *
     * @param {ServiceCallback} [callback] callback function; see ServiceCallback
     * doc in ms-rest index.d.ts for details
     */
    deleteAtSubscriptionLevel(lockName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<void>): void;
    deleteAtSubscriptionLevel(lockName: string, callback: ServiceCallback<void>): void;

    /**
     * Gets the management lock of a scope.
     *
     * @param {string} lockName Name of the management lock.
     *
     * @param {object} [options] Optional Parameters.
     *
     * @param {object} [options.customHeaders] Headers that will be added to the
     * request
     *
     * @param {ServiceCallback} [callback] callback function; see ServiceCallback
     * doc in ms-rest index.d.ts for details
     */
    get(lockName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.ManagementLockObject>): void;
    get(lockName: string, callback: ServiceCallback<models.ManagementLockObject>): void;

    /**
     * Deletes the management lock of a resource group.
     *
     * @param {string} resourceGroup The resource group names.
     *
     * @param {string} lockName The name of lock.
     *
     * @param {object} [options] Optional Parameters.
     *
     * @param {object} [options.customHeaders] Headers that will be added to the
     * request
     *
     * @param {ServiceCallback} [callback] callback function; see ServiceCallback
     * doc in ms-rest index.d.ts for details
     */
    deleteAtResourceGroupLevel(resourceGroup: string, lockName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<void>): void;
    deleteAtResourceGroupLevel(resourceGroup: string, lockName: string, callback: ServiceCallback<void>): void;

    /**
     * Gets all the management locks of a resource group.
     *
     * @param {string} resourceGroupName Resource group name.
     *
     * @param {object} [options] Optional Parameters.
     *
     * @param {string} [options.filter] The filter to apply on the operation.
     *
     * @param {object} [options.customHeaders] Headers that will be added to the
     * request
     *
     * @param {ServiceCallback} [callback] callback function; see ServiceCallback
     * doc in ms-rest index.d.ts for details
     */
    listAtResourceGroupLevel(resourceGroupName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.ManagementLockListResult>): void;
    listAtResourceGroupLevel(resourceGroupName: string, callback: ServiceCallback<models.ManagementLockListResult>): void;

    /**
     * Gets all the management locks of a resource or any level below resource.
     *
     * @param {string} resourceGroupName The name of the resource group. The name
     * is case insensitive.
     *
     * @param {string} resourceProviderNamespace Resource identity.
     *
     * @param {string} parentResourcePath Resource identity.
     *
     * @param {string} resourceType Resource identity.
     *
     * @param {string} resourceName Resource identity.
     *
     * @param {object} [options] Optional Parameters.
     *
     * @param {string} [options.filter] The filter to apply on the operation.
     *
     * @param {object} [options.customHeaders] Headers that will be added to the
     * request
     *
     * @param {ServiceCallback} [callback] callback function; see ServiceCallback
     * doc in ms-rest index.d.ts for details
     */
    listAtResourceLevel(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.ManagementLockListResult>): void;
    listAtResourceLevel(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, callback: ServiceCallback<models.ManagementLockListResult>): void;

    /**
     * Get a list of management locks at resource level or below.
     *
     * @param {string} nextLink NextLink from the previous successful call to List
     * operation.
     *
     * @param {object} [options] Optional Parameters.
     *
     * @param {object} [options.customHeaders] Headers that will be added to the
     * request
     *
     * @param {ServiceCallback} [callback] callback function; see ServiceCallback
     * doc in ms-rest index.d.ts for details
     */
    listNext(nextLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.ManagementLockListResult>): void;
    listNext(nextLink: string, callback: ServiceCallback<models.ManagementLockListResult>): void;

    /**
     * Gets all the management locks of a subscription.
     *
     * @param {object} [options] Optional Parameters.
     *
     * @param {string} [options.filter] The filter to apply on the operation.
     *
     * @param {object} [options.customHeaders] Headers that will be added to the
     * request
     *
     * @param {ServiceCallback} [callback] callback function; see ServiceCallback
     * doc in ms-rest index.d.ts for details
     */
    listAtSubscriptionLevel(options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.ManagementLockListResult>): void;
    listAtSubscriptionLevel(callback: ServiceCallback<models.ManagementLockListResult>): void;

    /**
     * Gets all the management locks of a resource group.
     *
     * @param {string} nextPageLink The NextLink from the previous successful call
     * to List operation.
     *
     * @param {object} [options] Optional Parameters.
     *
     * @param {object} [options.customHeaders] Headers that will be added to the
     * request
     *
     * @param {ServiceCallback} [callback] callback function; see ServiceCallback
     * doc in ms-rest index.d.ts for details
     */
    listAtResourceGroupLevelNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.ManagementLockListResult>): void;
    listAtResourceGroupLevelNext(nextPageLink: string, callback: ServiceCallback<models.ManagementLockListResult>): void;

    /**
     * Gets all the management locks of a resource or any level below resource.
     *
     * @param {string} nextPageLink The NextLink from the previous successful call
     * to List operation.
     *
     * @param {object} [options] Optional Parameters.
     *
     * @param {object} [options.customHeaders] Headers that will be added to the
     * request
     *
     * @param {ServiceCallback} [callback] callback function; see ServiceCallback
     * doc in ms-rest index.d.ts for details
     */
    listAtResourceLevelNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.ManagementLockListResult>): void;
    listAtResourceLevelNext(nextPageLink: string, callback: ServiceCallback<models.ManagementLockListResult>): void;

    /**
     * Get a list of management locks at resource level or below.
     *
     * @param {string} nextPageLink The NextLink from the previous successful call
     * to List operation.
     *
     * @param {object} [options] Optional Parameters.
     *
     * @param {object} [options.customHeaders] Headers that will be added to the
     * request
     *
     * @param {ServiceCallback} [callback] callback function; see ServiceCallback
     * doc in ms-rest index.d.ts for details
     */
    listNextNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.ManagementLockListResult>): void;
    listNextNext(nextPageLink: string, callback: ServiceCallback<models.ManagementLockListResult>): void;

    /**
     * Gets all the management locks of a subscription.
     *
     * @param {string} nextPageLink The NextLink from the previous successful call
     * to List operation.
     *
     * @param {object} [options] Optional Parameters.
     *
     * @param {object} [options.customHeaders] Headers that will be added to the
     * request
     *
     * @param {ServiceCallback} [callback] callback function; see ServiceCallback
     * doc in ms-rest index.d.ts for details
     */
    listAtSubscriptionLevelNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.ManagementLockListResult>): void;
    listAtSubscriptionLevelNext(nextPageLink: string, callback: ServiceCallback<models.ManagementLockListResult>): void;
}


text:
SCRIPTS=scripts/JA
ORIGINALDATA=ranis/JA/data/goldstandard-v2/$1
OUTPUT=conv/JA/$1
# sentence split
mkdir -p ${OUTPUT}
cp ${ORIGINALDATA}/*.txt ${OUTPUT}
cp ${ORIGINALDATA}/*.ann ${OUTPUT}
echo "sentence split"
for i in ${OUTPUT}/*.txt
do
python ${SCRIPTS}/ssplit.py $i
done
# normalize
echo "normalize"
for i in ${OUTPUT}/*.split.txt
do
python ${SCRIPTS}/normalize.py $i > $i.normalized
mv $i.normalized $i
done
# move offset
for i in ${OUTPUT}/*.split.txt
do
id=${OUTPUT}/`basename $i .split.txt`
python ${SCRIPTS}/standoff.py ${id}.txt ${id}.ann ${id}.split.txt > ${id}.split.ann
done
# gold so
echo "make gold.so"
for i in ${OUTPUT}/IPSJ-JNL*.split.txt
do
id=`basename $i .split.txt`
python ${SCRIPTS}/mkgold.py ${OUTPUT}/${id}.split.txt - ${OUTPUT}/${id}.split.ann ${id} > ${OUTPUT}/${id}.split.gold.so
done
# cabocha (=> *.cabocha.so)
echo "make cabocha.so"
for i in ${OUTPUT}/*.split.txt
do
sed -e "s/ / /g" $i | cabocha -f1 -n1 > ${OUTPUT}/`basename $i .split.txt`.cabocha
done
for i in ${OUTPUT}/*.cabocha
do
id=${OUTPUT}/`basename $i .cabocha`
python ${SCRIPTS}/cabocha.py ${id}.cabocha ${id}.cabocha.txt ${id}.split.cabocha.so
done


text:
package com.capitalone.dashboard.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.RestController;

import com.capitalone.dashboard.ApiSettings;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import com.capitalone.dashboard.service.BinaryArtifactService;
import com.capitalone.dashboard.service.BuildService;
import com.capitalone.dashboard.service.CommitService;
import com.capitalone.dashboard.service.DeployService;
import com.capitalone.dashboard.service.PipelineService;
import com.capitalone.dashboard.service.DynamicPipelineServiceImpl;
import com.capitalone.dashboard.service.PipelineServiceImpl;

@Order(1)
@Configuration
@ComponentScan(
        excludeFilters = {
                @ComponentScan.Filter( RestController.class ),
                @ComponentScan.Filter( type = FilterType.ASSIGNABLE_TYPE, value = WebMVCConfig.class )
        },
        basePackages = "com.capitalone.dashboard"
)
public class RestApiAppConfig {

	@Value("${feature.dynamicPipeline:disabled}")
    private String featureDynamicPipeline;

	@Bean PipelineService pipelineService(PipelineRepository pipelineRepository, DashboardRepository dashboardRepository,
			CollectorItemRepository collectorItemRepository, BinaryArtifactService binaryArtifactService,
			BuildService buildService, CommitService commitService, DeployService deployService, ApiSettings settings) {
		if (featureEnabled(featureDynamicPipeline)) {
			return new DynamicPipelineServiceImpl(pipelineRepository, dashboardRepository,
					collectorItemRepository, binaryArtifactService,
					buildService, commitService, deployService, settings);
		} else {
			return new PipelineServiceImpl(pipelineRepository, dashboardRepository, collectorItemRepository, settings);
		}
	}

	private boolean featureEnabled(String featureValue) {
		return "enable".equalsIgnoreCase(featureValue)
				|| "enabled".equalsIgnoreCase(featureValue)
				|| "true".equalsIgnoreCase(featureValue);
	}
}


text:
This documentation provides information and complete interface listings for
two packages: **@truffle/decoder**, a high-level library for decoding, and
**@truffle/codec**, a low-level package for encoding, decoding, and data
representation.

## Contents

### High-level interface (for common use)

[[@truffle/decoder]] provides a high-level interface for **decoding
transactions, events, and state variables for Ethereum smart contracts.**
This package accepts Truffle's
[contract abstractions](https://www.trufflesuite.com/docs/truffle/reference/contract-abstractions)
as input (or Truffle's artifact files and a provider) and connects to the
blockchain to retrieve raw values for decoding.

### Low-level interface (for special-case purposes)

[[@truffle/codec]] provides the underlying low-level interfaces for performing
this decoding, as well as interfaces for encoding these values and for
decoding of local Solidity variables and other
data observable in a debugging trace.

This library is meant to be **self-contained**, makes **no network connections** of its
own, and **seeks to restrict its dependencies** to those which provide data
structures for high-precision numbers and other special-purpose data utilities.

_Although most use cases will not require invoking the codec directly, a
few key parts of this library are directly relevant to decoder use. See
notes below._

## ℹ Important notes

### Output format

Both the decoder and the codec return results as objects containing both type
information and either high-precision values or accurate errors in place of
values. We recommend familiarizing yourself with the [[Format]] documentation
in order to use these packages.

### Decoding modes

The decoder operates in either of two modes:
  1. Full mode (`"decodingMode": "full"`), which uses source code information
     to return types and values to match the original Solidity.
  2. ABI mode (`"decodingMode": "abi"`), which uses only information from the
     contract ABI and returns less information, e.g. returning
     [[Format.Values.UintResult|`UintResult`]]s in place of
     [[Format.Values.EnumResult|`EnumResult`]]s
     and [[Format.Values.AddressResult|`AddressResult`]]s istead of
     [[Format.Values.ContractResult|`ContractResult`]]s

By default, the decoder uses **full mode**, but for technical reasons, this may
not be reliable. If decoding fails in full mode, it **falls back to ABI mode.**

Returned decodings (i.e. [[CalldataDecoding]] and [[LogDecoding]]) indicate
which mode was used via the `"decodingMode"` field.

To ensure full mode works:
  * Use Solidity v0.4.12 or higher;
  * Ensure all contracts in your projects have distinct names;
  * Compile all your contracts at the same time;
  * Ensure all custom data types are declared in a file with at least one contract.

(Our apologies for these technical limitations, but we are working to address
these last three problems.)

If you can't use full mode or don't want to deal with the distinction,
the decoder provides
[[WireDecoder.abifyCalldataDecoding|`decoder.abifyCalldataDecoding`]]
and [[WireDecoder.abifyLogDecoding|`decoder.abifyLogDecoding`]] methods,
which accept decodings in either mode and always return ABI mode.

#### Additional notes on decoding modes

- Full mode may reject certain decodings (e.g. out of range enums) that are
  fine in ABI mode.

- ABI-fied full mode decodings may contain extra information that regular ABI
  mode results do not.

- Decoding mode applies to the entire decoding, but objects that contain
  multiple decodings (e.g. [[DecodedLog]]) may contain decodings in different
  modes.

- You can only decode state variables in full mode. If full mode fails
  while decoding a state variable, it will throw an exception.

- If a contract `Base` declares an event `Event` and a contract `Derived`
  inheriting from `Base` overrides `Event`, if `Derived` then emits
  `Base.Event`, ABI mode may not be able to decode it.

#### Additional notes on decoding state variables

- While internal function pointers can only be decoded in full mode,
  full mode still may not be able to determine all the information about
  them.  Thus, for internal function pointers, you may get a bare-bones
  decoding, or you may get a decoding with more information.

- Solidity 0.6.5 contains a bug that may cause some state variables to
  decode incorrectly if there is an immutable state variable which is
  written to but never read from.

- In any version of Solidity, it is impossible to decode an immutable
  state variable which is written to but never read from; these will
  decode to an error.

- Not all constant state variables can presently be decoded; some of
  these may simply decode to an error.

---

<p align="center">
⚡
</p>

---


text:
package com.ckkloverdos.thrift3r.protocol
package helper

import com.ckkloverdos.thrift3r.codec.Codec
import com.ckkloverdos.thrift3r.codec.enumeration.EnumCodec
import com.ckkloverdos.thrift3r.descriptor.{StructDescriptor, FieldInfo}
import scala.annotation.tailrec
import scala.collection.{SortedMap, GenMap, GenTraversable}

/**
 *
 * @author Christos KK Loverdos <loverdos@gmail.com>
 */
object ProtocolHelpers {
  final def encodeAndFlush[T <:AnyRef](protocol: Protocol, bean: T, codec: Codec[T]) {
    codec.encode(protocol, bean)
    protocol.flush()
  }

  final def writeList[T](
    protocol: Protocol,
    elementCodec: Codec[T],
    elements: GenTraversable[T]
  ) {
    val listProtocol = protocol.getListProtocol

    if(elements eq null) {
      listProtocol.writeEmptyList(elementCodec)
      return
    }

    val size = elements.size
    listProtocol.writeListBegin(elementCodec, size)
    for(element ← elements) {
      listProtocol.writeListElement(element, elementCodec)
    }
    listProtocol.writeListEnd()
  }

  final def readList[T](
    protocol: Protocol,
    elementCodec: Codec[T],
    addElement: (T) ⇒ Unit
  ) {

    def readSized(listProtocol: SizedListProtocol) {
      @tailrec def readElement(index: Int, size: Int) {
        if(index < size) {
          val element = listProtocol.readListElement(elementCodec)
          addElement(element)
          readElement(index + 1, size)
        }
      }

      val size = listProtocol.readListBegin()
      readElement(0, size)
      listProtocol.readListEnd()
    }

    def readUnsized(listProtocol: UnsizedListProtocol) {
      listProtocol.readListBegin()

      while(!listProtocol.readListEnd()) {
        val element = listProtocol.readListElement(elementCodec)
        addElement(element)
      }
    }

    protocol.getListProtocol match {
      case listProtocol: SizedListProtocol ⇒
        readSized(listProtocol)

      case listProtocol: UnsizedListProtocol ⇒
        readUnsized(listProtocol)
    }
  }

  final def writeSet[T](
    protocol: Protocol,
    elementCodec: Codec[T],
    elements: GenTraversable[T]
    ) {
    val setProtocol = protocol.getSetProtocol

    if(elements eq null) {
      setProtocol.writeEmptySet(elementCodec)
      return
    }

    val size = elements.size
    setProtocol.writeSetBegin(elementCodec, size)
    for(element ← elements) {
      setProtocol.writeSetElement(element, elementCodec)
    }
    setProtocol.writeSetEnd()
  }

  final def readSet[T](
    protocol: Protocol,
    elementCodec: Codec[T],
    addElement: (T) ⇒ Unit
  ) {
    def readSized(setProtocol: SizedSetProtocol) {
      @tailrec def readElement(index: Int, size: Int) {
        if(index < size) {
          val element = setProtocol.readSetElement(elementCodec)
          addElement(element)
          readElement(index + 1, size)
        }
      }

      val size = setProtocol.readSetBegin()
      readElement(0, size)
      setProtocol.readSetEnd()
    }

    def readUnsized(setProtocol: UnsizedSetProtocol) {
      setProtocol.readSetBegin()

      while(!setProtocol.readSetEnd()) {
        val element = setProtocol.readSetElement(elementCodec)
        addElement(element)
      }
    }

    protocol.getSetProtocol match {
      case setProtocol: SizedSetProtocol ⇒
        readSized(setProtocol)

      case setProtocol: UnsizedSetProtocol ⇒
        readUnsized(setProtocol)
    }
  }

  final def writeMap[K, V](
    protocol: Protocol,
    keyCodec: Codec[K],
    valueCodec: Codec[V],
    elements: GenMap[K, V]
  ) {
    val mapProtocol = protocol.getMapProtocol

    if(elements eq null) {
      mapProtocol.writeEmptyMap(keyCodec, valueCodec)
      return
    }

    val size = elements.size
    mapProtocol.writeMapBegin(keyCodec, valueCodec, size)
    elements.foreach {
      case (k, v) ⇒
        mapProtocol.writeMapElement(k, keyCodec, v, valueCodec)
    }
    mapProtocol.writeMapEnd()
  }

  final def readMap[K, V](
    protocol: Protocol,
    keyCodec: Codec[K],
    valueCodec: Codec[V],
    addElement: ((K, V)) ⇒ Unit
  ) {
    def decodeSized(mapProtocol: SizedMapProtocol) {
      @tailrec def decodeElement(index: Int, size: Int) {
        if(index < size) {
          val kv = mapProtocol.readMapElement(keyCodec, valueCodec)
          addElement(kv)
          decodeElement(index + 1, size)
        }
      }

      val size = mapProtocol.readMapBegin()
      decodeElement(0, size)
      mapProtocol.readMapEnd()
    }

    def decodeUnsized(mapProtocol: UnsizedMapProtocol) {
      mapProtocol.readMapBegin()
      while(!mapProtocol.readMapEnd()) {
        val kv = mapProtocol.readMapElement(keyCodec, valueCodec)
        addElement(kv)
      }
    }

    protocol.getMapProtocol match {
      case mapProtocol: SizedMapProtocol ⇒
        decodeSized(mapProtocol)

      case mapProtocol: UnsizedMapProtocol ⇒
        decodeUnsized(mapProtocol)
    }
  }

  final def writeStruct[T <: AnyRef](
    protocol: Protocol,
    descriptor: StructDescriptor[T],
    fieldInfoByID: SortedMap[Short, FieldInfo],
    value: T
  ) {
    val arity = descriptor.arity
    val structProtocol = protocol.getStructProtocol

    @tailrec def encodeField(id: Short) {
      if(id >= arity) { return }

      val fieldInfo = fieldInfoByID(id)
      val fieldValue = fieldInfo.field.getter(value.asInstanceOf[AnyRef])
      val fieldName = fieldInfo.name
      val fieldCodec = fieldInfo.codec.asInstanceOf[Codec[Any]]

      structProtocol.writeField(fieldCodec, id, fieldName, fieldValue)

      encodeField((id + 1).toShort)
    }

    structProtocol.writeStructBegin(descriptor.name)
    encodeField(0.toShort)
    structProtocol.writeStructEnd()
  }

  final def readStruct(
    protocol: Protocol,
    fieldInfoByID: SortedMap[Short, FieldInfo],
    fieldInfoByName: SortedMap[String, FieldInfo],
    params: Array[AnyRef]
  ) {
    val arity = params.size

    def readStrictFields(structProtocol: StrictFieldsStructProtocol) {
      @tailrec def readField(fieldID: Short) {
        if(fieldID >= arity) {return}

        val fieldInfo = fieldInfoByID(fieldID)
        val fieldCodec = fieldInfo.codec

        structProtocol.readFieldBegin()
        val fieldValue = structProtocol.readField(fieldCodec)
        structProtocol.readFieldEnd()

        params(fieldID) = fieldValue.asInstanceOf[AnyRef]

        readField((fieldID + 1).toShort)
      }

      structProtocol.readStructBegin()
      readField(0.toShort)
      structProtocol.readStructEnd()
    }

    def readFieldsByName(structProtocol: FieldsByNameStructProtocol) {
      @tailrec def readField(counter: Short) {
        if(counter >= arity) {return}

        val fieldName =  structProtocol.readFieldBegin()
        val fieldInfo = fieldInfoByName(fieldName)
        val fieldCodec = fieldInfo.codec
        val fieldID = fieldInfo.id

        val fieldValue = structProtocol.readField(fieldCodec, fieldName)
        structProtocol.readFieldEnd()

        params(fieldID) = fieldValue.asInstanceOf[AnyRef]

        readField((counter + 1).toShort)
      }

      structProtocol.readStructBegin()
      readField(0.toShort)
      structProtocol.readStructEnd()
    }

    def readFieldsByID(structProtocol: FieldsByIDStructProtocol) {
      @tailrec def readField(counter: Short) {
        if(counter >= arity) {return}

        val fieldID = structProtocol.readFieldBegin()
        val fieldInfo = fieldInfoByID(fieldID)
        val fieldCodec = fieldInfo.codec
        val fieldValue = structProtocol.readField(fieldCodec, fieldID)
        structProtocol.readFieldEnd()

        params(fieldID) = fieldValue.asInstanceOf[AnyRef]

        readField((counter + 1).toShort)
      }

      structProtocol.readStructBegin()
      readField(0.toShort)
      structProtocol.readStructEnd()
    }

    protocol.getStructProtocol match {
      case structProtocol: StrictFieldsStructProtocol ⇒
        readStrictFields(structProtocol)

      case structProtocol: FieldsByNameStructProtocol ⇒
        readFieldsByName(structProtocol)

      case structProtocol: FieldsByIDStructProtocol ⇒
        readFieldsByID(structProtocol)
    }
  }

  final def writeEnum(protocol: Protocol, value: Enum[_]) =
    protocol.getEnumProtocol.writeEnum(value)

  final def readEnum[E <: Enum[_]](protocol: Protocol, codec: EnumCodec[E]) = {
    protocol.getEnumProtocol match {
      case enumProtocol: IntEnumProtocol ⇒
        val ordinal = enumProtocol.readEnum()
        codec.fromOrdinal(ordinal)

      case enumProtocol: StringEnumProtocol ⇒
        val name = enumProtocol.readEnum()
        codec.fromNameIgnoringCase(name)
    }
  }

  final def writeBoolBasedOption[T](protocol: Protocol, codec: Codec[T], value: Option[T]) {
    value match {
      case null | None ⇒
        protocol.writeBool(false) // not present

      case Some(element) ⇒
        protocol.writeBool(true) // present
        codec.encode(protocol, element)
    }
  }

  final def readBoolBasedOption[T](protocol: Protocol, codec: Codec[T]): Option[T] = {
    protocol.readBool() match {
      case false ⇒ None
      case true  ⇒ Some(codec.decode(protocol))
    }
  }

  final def writeSetBasedOption[T](protocol: Protocol, codec: Codec[T], value: Option[T]) {
    val setProtocol = protocol.getSetProtocol
    value match {
      case null | None ⇒
        setProtocol.writeEmptySet(codec)

      case Some(element) ⇒
        setProtocol.writeSetBegin(codec, 1)
        setProtocol.writeSetElement(element, codec)
        setProtocol.writeSetEnd()
    }
  }

  final def readSetBasedOption[T](protocol: Protocol, codec: Codec[T]): Option[T] = {
    protocol.getSetProtocol match {
      case setProtocol: SizedSetProtocol ⇒
        val size = setProtocol.readSetBegin()
        require(size == 1)
        val element = setProtocol.readSetElement(codec)
        setProtocol.readSetEnd()
        Some(element)

      case setProtocol: UnsizedSetProtocol ⇒
        setProtocol.readSetBegin()
        if(setProtocol.readSetEnd()) {
          None
        }
        else {
          val element = setProtocol.readSetElement(codec)
          require(setProtocol.readSetEnd())
          Some(element)
        }
    }
  }
}


text:
struct generate_t : public sketo::functions::base<Job(size_t)> {
	Job operator()(size_t) const {
		int percentage = rand() % 100;
		return Job(percentage);
	}
} generate;


text:
module Commons.NoReflexDom
    ( module Commons.NoReflex
    , module Commons.NoReflexDom.EventMap
    , module Commons.NoReflexDom.Import
    , module Commons.NoReflexDom.Local
    , module Commons.NoReflexDom.Logger
    , module Commons.NoReflexDom.QuaViewMonad
    ) where

import Commons.NoReflex
import Commons.NoReflexDom.EventMap
import Commons.NoReflexDom.Import
import Commons.NoReflexDom.Local
import Commons.NoReflexDom.Logger
import Commons.NoReflexDom.QuaViewMonad ( QuaViewTrans (..), QuaViewM, Writing, NoWriting
                                        , IsWritingEvents (..), showUserMessage, showUserPanic
                                        , registerEvent, askEvent
                                        , replaceUserMessageCallback, replaceUserPanicCallback
                                        )


text:
import json

from django.http import HttpResponse
from django.template import loader
from hs_core.views.utils import authorize, ACTION_TO_AUTHORIZE
from hs_access_control.models import PrivilegeCodes
from hs_core.tasks import resource_debug
from django.shortcuts import redirect
from celery.result import AsyncResult

def debug_resource(request, shortkey):
    """ Debug view for resource depicts output of various integrity checking scripts """
    resource, _, _ = authorize(request, shortkey,
                               needed_permission=ACTION_TO_AUTHORIZE.VIEW_RESOURCE)
    # importing here to avoid circular dependency
    from hs_core.management.utils import check_irods_files
    irods_issues, irods_errors = check_irods_files(resource, log_errors=False, return_errors=True)

    template = loader.get_template('debug/debug_resource.html')
    context = {
        'shortkey': shortkey,
        'creator': resource.creator,
        'resource': resource,
        'raccess': resource.raccess,
        'owners': resource.raccess.owners,
        'editors': resource.raccess.get_users_with_explicit_access(PrivilegeCodes.CHANGE),
        'viewers': resource.raccess.get_users_with_explicit_access(PrivilegeCodes.VIEW),
        'public_AVU': resource.getAVU('isPublic'),
        'type_AVU': resource.getAVU('resourceType'),
        'modified_AVU': resource.getAVU('bag_modified'),
        'quota_AVU': resource.getAVU('quotaUserName'),
    }
    return HttpResponse(template.render(context, request))

def irods_issues(request, shortkey):
    """ Debug view for resource depicts output of various integrity checking scripts, runs async """
    resource, _, _ = authorize(request, shortkey,
                               needed_permission=ACTION_TO_AUTHORIZE.VIEW_RESOURCE)

    task = resource_debug.apply_async((resource.short_id,))
    return redirect("get_debug_task_status", task_id=task.task_id)

def check_task_status(request, task_id=None, *args, **kwargs):
    ''' Checks the task status of the resource_debug job specified by the task_id '''
    if resource_debug.AsyncResult(task_id).ready():
        status = "SUCCESS"
        try:
            irods_issues, irods_errors = AsyncResult(task_id).get()
        except Exception as e:
            status = "ERROR - {}".format(e)
        context = {
            'status': status,
            'irods_issues': irods_issues,
            'irods_errors': irods_errors,
        }
        return HttpResponse(json.dumps(context))
    else:
        return HttpResponse(json.dumps({"status": None,
                                        "state": AsyncResult(task_id).state}),
                            content_type="application/json")


text:
package com.akexorcist.googledirection.constant;

/**
 * Created by Akexorcist on 11/29/15 AD.
 */
public class Unit {
    public static final String METRIC = "metric";
    public static final String IMPERIAL = "imperial";
}


text:
using System;

namespace System.Data.Sql {
	[AttributeUsage (AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	[Serializable]
	public class SqlFacetAttribute : Attribute
	{
		#region Fields

		bool isFixedLength;
		bool isNullable;
		int maxSize;
		int precision;
		int scale;

		#endregion // Fields

		#region Constructors

		public SqlFacetAttribute ()
		{
			isFixedLength = false;
			isNullable = false;
			maxSize = 0;
			precision = 0;
			scale = 0;
		}

		#endregion // Constructors

		#region Properties

		public bool IsFixedLength {
			get { return isFixedLength; }
			set { isFixedLength = value; }
		}

		public bool IsNullable {
			get { return isNullable; }
			set { isNullable = value; }
		}

		public int MaxSize {
			get { return maxSize; }
			set { maxSize = value; }
		}

		public int Precision {
			get { return precision; }
			set { precision = value; }
		}

		public int Scale {
			get { return scale; }
			set { scale = value; }
		}

		#endregion // Properties
	}
}

#endif


text:
package com.android.core.widget;

//import android.app.Fragment;
//import android.app.FragmentTransaction;
import android.graphics.Color;
import android.os.Build;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.android.core.R;
import com.android.core.StaticValue;
import com.android.core.control.MDTintUtil;
import com.android.core.control.ScreenUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: allen
 * @date: 2016-08-31 14:15
 */
public class TabStripView extends LinearLayout implements View.OnClickListener {

    private static final String KEY_CURRENT_TAG = "com.android.core.widget.TabStripViewTag";

    private List<ViewHolder> mViewHolderList;
    private OnTabSelectedListener mTabSelectListener;
    private FragmentActivity mFragmentActivity;
    private String mCurrentTag;
    private String mRestoreTag;
    /*主内容显示区域View的id*/
    private int mMainContentLayoutId;
    /*选中的Tab文字颜色*/
    private ColorStateList mSelectedTextColor;
    /*正常的Tab文字颜色*/
    private ColorStateList mNormalTextColor;
    /*Tab文字的颜色*/
    private float mTabTextSize;
    /*默认选中的tab index*/
    private int mDefaultSelectedTab = 0;

    private int mCurrentSelectedTab;

    public TabStripView(Context context) {
        this(context, null);
    }

    public TabStripView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public TabStripView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.TabStripView, 0, 0);

        ColorStateList tabTextColor = typedArray.getColorStateList(R.styleable.TabStripView_navigateTabTextColor);
        ColorStateList selectedTabTextColor = typedArray.getColorStateList(R.styleable.TabStripView_navigateTabSelectedTextColor);

        mTabTextSize = typedArray.getDimensionPixelSize(R.styleable.TabStripView_navigateTabTextSize, 0);
        mMainContentLayoutId = typedArray.getResourceId(R.styleable.TabStripView_containerId, 0);

        mNormalTextColor = (tabTextColor != null ? tabTextColor : context.getResources().getColorStateList(R.color.abc_tab_text_normal));

        if (selectedTabTextColor != null) {
            mSelectedTextColor = selectedTabTextColor;
        } else {
            ScreenUtil.checkAppCompatTheme(context);
            TypedValue typedValue = new TypedValue();
            context.getTheme().resolveAttribute(R.attr.colorPrimary, typedValue, true);
            mSelectedTextColor = context.getResources().getColorStateList(typedValue.resourceId);
        }

        mViewHolderList = new ArrayList<>();
    }

    public void addTab(Class frameLayoutClass, TabParam tabParam) {
        int defaultLayout = R.layout.abc_navi_tab_view;
//        if (tabParam.tabViewResId > 0) {
//            defaultLayout = tabParam.tabViewResId;
//        }
        if (TextUtils.isEmpty(tabParam.title)) {
            tabParam.title = getContext().getString(tabParam.titleStringRes);
        }

        View view = LayoutInflater.from(getContext()).inflate(defaultLayout, null);
        view.setFocusable(true);

        ViewHolder holder = new ViewHolder();

        holder.tabIndex = mViewHolderList.size();

        holder.fragmentClass = frameLayoutClass;
        holder.tag = tabParam.title;
        holder.pageParam = tabParam;

        holder.tabIcon = (ImageView) view.findViewById(R.id.tab_icon);
        holder.tabTitle = ((TextView) view.findViewById(R.id.tab_title));

        if (TextUtils.isEmpty(tabParam.title)) {
            holder.tabTitle.setVisibility(View.INVISIBLE);
        } else {
            holder.tabTitle.setText(tabParam.title);
        }

        if (mTabTextSize != 0) {
            holder.tabTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize);
        }
        if (mNormalTextColor != null) {
            holder.tabTitle.setTextColor(mNormalTextColor);
        }

        if (tabParam.backgroundColor > 0) {
            view.setBackgroundResource(tabParam.backgroundColor);
        }

        if (tabParam.iconResId > 0) {
            holder.tabIcon.setImageResource(tabParam.iconResId);
        } else {
            holder.tabIcon.setVisibility(View.INVISIBLE);
        }

        if (tabParam.iconResId > 0 && tabParam.iconSelectedResId > 0) {
            view.setTag(holder);
            view.setOnClickListener(this);
            mViewHolderList.add(holder);
        }

        addView(view, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 1.0F));

    }

    @Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        if (mMainContentLayoutId == 0) {
            throw new RuntimeException("mFrameLayoutId Cannot be 0");
        }
        if (mViewHolderList.size() == 0) {
            throw new RuntimeException("mViewHolderList.size Cannot be 0, Please call addTab()");
        }
        if (!(getContext() instanceof FragmentActivity)) {
            throw new RuntimeException("parent activity must is extends FragmentActivity");
        }
        mFragmentActivity = (FragmentActivity) getContext();

        ViewHolder defaultHolder = null;

        hideAllFragment();
        if (!TextUtils.isEmpty(mRestoreTag)) {
            for (ViewHolder holder : mViewHolderList) {
                if (TextUtils.equals(mRestoreTag, holder.tag)) {
                    defaultHolder = holder;
                    mRestoreTag = null;
                    break;
                }
            }
        } else {
            defaultHolder = mViewHolderList.get(mDefaultSelectedTab);
        }

        showFragment(defaultHolder);
    }

    @Override
    public void onClick(View v) {
        Object object = v.getTag();
        if (object != null && object instanceof ViewHolder) {
            ViewHolder holder = (ViewHolder) v.getTag();
            showFragment(holder);
            if (mTabSelectListener != null) {
                mTabSelectListener.onTabSelected(holder);
            }
        }
    }

    /**
     * 显示 holder 对应的 fragment
     *
     * @param holder
     */
    private void showFragment(ViewHolder holder) {
//        FragmentTransaction transaction = mFragmentActivity.getFragmentManager().beginTransaction();
        FragmentTransaction transaction = mFragmentActivity.getSupportFragmentManager().beginTransaction();
        if (isFragmentShown(transaction, holder.tag)) {
            return;
        }
        setCurrSelectedTabByTag(holder.tag);

//        Fragment fragment = mFragmentActivity.getFragmentManager().findFragmentByTag(holder.tag);
        Fragment fragment = mFragmentActivity.getSupportFragmentManager().findFragmentByTag(holder.tag);
        if (fragment == null) {
            fragment = getFragmentInstance(holder.tag);
            transaction.add(mMainContentLayoutId, fragment, holder.tag);
        } else {
            transaction.show(fragment);
        }
        transaction.commit();
        mCurrentSelectedTab = holder.tabIndex;
    }

    private boolean isFragmentShown(FragmentTransaction transaction, String newTag) {
        if (TextUtils.equals(newTag, mCurrentTag)) {
            return true;
        }

        if (TextUtils.isEmpty(mCurrentTag)) {
            return false;
        }

//        Fragment fragment = mFragmentActivity.getFragmentManager().findFragmentByTag(mCurrentTag);
        Fragment fragment = mFragmentActivity.getSupportFragmentManager().findFragmentByTag(mCurrentTag);
        if (fragment != null && !fragment.isHidden()) {
            transaction.hide(fragment);
        }

        return false;
    }

    /*设置当前选中tab的图片和文字颜色*/
    private void setCurrSelectedTabByTag(String tag) {
        if (TextUtils.equals(mCurrentTag, tag)) {
            return;
        }
        for (ViewHolder holder : mViewHolderList) {
            if (TextUtils.equals(mCurrentTag, holder.tag)) {
                holder.tabIcon.setImageResource(holder.pageParam.iconResId);
                if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
                    MDTintUtil.setTint(holder.tabIcon, R.color.abc_tab_text_normal);
                }
                holder.tabTitle.setTextColor(mNormalTextColor);
            } else if (TextUtils.equals(tag, holder.tag)) {
//                holder.tabIcon.setImageResource(holder.pageParam.iconSelectedResId);
                if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
                    MDTintUtil.setTint(holder.tabIcon, StaticValue.color);
                }
                holder.tabTitle.setTextColor(mSelectedTextColor);
            }
        }
        mCurrentTag = tag;
    }

    public Fragment getFragmentInstance(String tag) {
        Fragment fragment = null;
        for (ViewHolder holder : mViewHolderList) {
            if (TextUtils.equals(tag, holder.tag)) {
                try {
                    fragment = (Fragment) Class.forName(holder.fragmentClass.getName()).newInstance();
                } catch (InstantiationException e) {
                    e.printStackTrace();
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (ClassNotFoundException e) {
                    e.printStackTrace();
                }
                break;
            }
        }
        return fragment;
    }

    private void hideAllFragment() {
        if (mViewHolderList == null || mViewHolderList.size() == 0) {
            return;
        }
//        FragmentTransaction transaction = mFragmentActivity.getFragmentManager().beginTransaction();
        FragmentTransaction transaction = mFragmentActivity.getSupportFragmentManager().beginTransaction();

        for (ViewHolder holder : mViewHolderList) {
//            Fragment fragment = mFragmentActivity.getFragmentManager().findFragmentByTag(holder.tag);
            Fragment fragment = mFragmentActivity.getSupportFragmentManager().findFragmentByTag(holder.tag);
            if (fragment != null && !fragment.isHidden()) {
                transaction.hide(fragment);
            }
        }
        transaction.commit();
    }

    public void setSelectedTabTextColor(ColorStateList selectedTextColor) {
        mSelectedTextColor = selectedTextColor;
    }

    public void setSelectedTabTextColor(int color) {
        mSelectedTextColor = ColorStateList.valueOf(color);
    }

    public void setTabTextColor(ColorStateList color) {
        mNormalTextColor = color;
    }

    public void setTabTextColor(int color) {
        mNormalTextColor = ColorStateList.valueOf(color);
    }

    public void setFrameLayoutId(int frameLayoutId) {
        mMainContentLayoutId = frameLayoutId;
    }

    public void onRestoreInstanceState(Bundle savedInstanceState) {
        if (savedInstanceState != null) {
            mRestoreTag = savedInstanceState.getString(KEY_CURRENT_TAG);
        }
    }

    public void onSaveInstanceState(Bundle outState) {
        outState.putString(KEY_CURRENT_TAG, mCurrentTag);
    }

    public static class ViewHolder {
        public String tag;
        public TabParam pageParam;
        public ImageView tabIcon;
        public TextView tabTitle;
        public Class fragmentClass;
        public int tabIndex;
    }

    public static class TabParam {
        public int backgroundColor = android.R.color.white;
        public int iconResId;
        public int iconSelectedResId;
        public int titleStringRes;
        //        public int tabViewResId;
        public String title;

        public TabParam(int iconResId, int iconSelectedResId, String title) {
            this.iconResId = iconResId;
            this.iconSelectedResId = iconSelectedResId;
            this.title = title;
        }

        public TabParam(int iconResId, int iconSelectedResId, int titleStringRes) {
            this.iconResId = iconResId;
            this.iconSelectedResId = iconSelectedResId;
            this.titleStringRes = titleStringRes;
        }

        public TabParam(int backgroundColor, int iconResId, int iconSelectedResId, int titleStringRes) {
            this.backgroundColor = backgroundColor;
            this.iconResId = iconResId;
            this.iconSelectedResId = iconSelectedResId;
            this.titleStringRes = titleStringRes;
        }

        public TabParam(int backgroundColor, int iconResId, int iconSelectedResId, String title) {
            this.backgroundColor = backgroundColor;
            this.iconResId = iconResId;
            this.iconSelectedResId = iconSelectedResId;
            this.title = title;
        }
    }

    public interface OnTabSelectedListener {
        void onTabSelected(ViewHolder holder);
    }

    public void setTabSelectListener(OnTabSelectedListener tabSelectListener) {
        mTabSelectListener = tabSelectListener;
    }

    public void setDefaultSelectedTab(int index) {
        if (index >= 0 && index < mViewHolderList.size()) {
            mDefaultSelectedTab = index;
        }
    }

    public void setCurrentSelectedTab(int index) {
        if (index >= 0 && index < mViewHolderList.size()) {
            ViewHolder holder = mViewHolderList.get(index);
            showFragment(holder);
        }
    }

    public int getCurrentSelectedTab() {
        return mCurrentSelectedTab;
    }

}