text:
@implementation REMainViewController {

}

static int s_tensu = 0;
static int s_imadoko = 0;
static int s_nokori = 30 * 5;

- (void)viewDidLoad {
    // create label
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(30, 35, 270, 20)];
    [label setText:[NSString stringWithFormat:@"%d", s_tensu]];
    [label setBackgroundColor:[UIColor colorWithRed:0.8f green:0.8f blue:0.8f alpha:1.0f]];
    [label setTag:100];
    [self.view addSubview:label];

    // create button1
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(30, 70, 120, 45)];
    [button setTag:101];
    [button addTarget:self action:@selector(ぼたんがおされた:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    label = [[UILabel alloc] initWithFrame:button.frame];
    [label setBackgroundColor:[UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f]];
    [label setText:@"タマ"];
    [label setTag:1];
    [label setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:label];

    // create button2
    button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(30, 130, 120, 45)];
    [button setTag:102];
    [button addTarget:self action:@selector(ぼたんがおされた:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    label = [[UILabel alloc] initWithFrame:button.frame];
    [label setBackgroundColor:[UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f]];
    [label setText:@"モモ"];
    [label setTag:2];
    [label setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:label];

    // create button3
    button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(30, 190, 120, 45)];
    [button setTag:103];
    [button addTarget:self action:@selector(ぼたんがおされた:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    label = [[UILabel alloc] initWithFrame:button.frame];
    [label setBackgroundColor:[UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f]];
    [label setText:@"トラ"];
    [label setTag:3];
    [label setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:label];

    // create button4
    button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(30, 250, 120, 45)];
    [button setTag:104];
    [button addTarget:self action:@selector(ぼたんがおされた:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    label = [[UILabel alloc] initWithFrame:button.frame];
    [label setBackgroundColor:[UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f]];
    [label setText:@"ベー"];
    [label setTag:4];
    [label setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:label];

    // create button5
    button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(30, 310, 120, 45)];
    [button setTag:105];
    [button addTarget:self action:@selector(ぼたんがおされた:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    label = [[UILabel alloc] initWithFrame:button.frame];
    [label setBackgroundColor:[UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f]];
    [label setText:@"ノラ"];
    [label setTag:5];
    [label setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:label];

    // create button6
    button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(30, 370, 120, 45)];
    [button setTag:106];
    [button addTarget:self action:@selector(ぼたんがおされた:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    label = [[UILabel alloc] initWithFrame:button.frame];
    [label setBackgroundColor:[UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f]];
    [label setText:@"コマ"];
    [label setTag:6];
    [label setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:label];

    // create button7
    button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(30, 430, 120, 45)];
    [button setTag:107];
    [button addTarget:self action:@selector(ぼたんがおされた:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    label = [[UILabel alloc] initWithFrame:button.frame];
    [label setBackgroundColor:[UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f]];
    [label setText:@"シロ"];
    [label setTag:7];
    [label setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:label];

    // create button8
    button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(170, 70, 120, 45)];
    [button setTag:108];
    [button addTarget:self action:@selector(ぼたんがおされた:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    label = [[UILabel alloc] initWithFrame:button.frame];
    [label setBackgroundColor:[UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f]];
    [label setText:@"クロ"];
    [label setTag:8];
    [label setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:label];

    // create button9
    button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(170, 130, 120, 45)];
    [button setTag:109];
    [button addTarget:self action:@selector(ぼたんがおされた:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    label = [[UILabel alloc] initWithFrame:button.frame];
    [label setBackgroundColor:[UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f]];
    [label setText:@"ヒメ"];
    [label setTag:9];
    [label setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:label];

    // create button10
    button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(170, 190, 120, 45)];
    [button setTag:110];
    [button addTarget:self action:@selector(ぼたんがおされた:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    label = [[UILabel alloc] initWithFrame:button.frame];
    [label setBackgroundColor:[UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f]];
    [label setText:@"レオ"];
    [label setTag:10];
    [label setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:label];

    // create button11
    button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(170, 250, 120, 45)];
    [button setTag:111];
    [button addTarget:self action:@selector(ぼたんがおされた:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    label = [[UILabel alloc] initWithFrame:button.frame];
    [label setBackgroundColor:[UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f]];
    [label setText:@"ソラ"];
    [label setTag:11];
    [label setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:label];

    // create button12
    button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(170, 310, 120, 45)];
    [button setTag:112];
    [button addTarget:self action:@selector(ぼたんがおされた:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    label = [[UILabel alloc] initWithFrame:button.frame];
    [label setBackgroundColor:[UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f]];
    [label setText:@"ルナ"];
    [label setTag:12];
    [label setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:label];

    // create button13
    button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(170, 370, 120, 45)];
    [button setTag:113];
    [button addTarget:self action:@selector(ぼたんがおされた:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    label = [[UILabel alloc] initWithFrame:button.frame];
    [label setBackgroundColor:[UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f]];
    [label setText:@"リン"];
    [label setTag:13];
    [label setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:label];

    // create button14
    button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(170, 430, 120, 45)];
    [button setTag:114];
    [button addTarget:self action:@selector(ぼたんがおされた:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    label = [[UILabel alloc] initWithFrame:button.frame];
    [label setBackgroundColor:[UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f]];
    [label setText:@"ジャンゴ"];
    [label setTag:14];
    [label setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:label];

    // create timers
    [((UILabel *) [self.view viewWithTag:100]) setText:@"よ〜い・・・"];
    NSTimer *timer = [NSTimer timerWithTimeInterval:3.0f target:self selector:@selector(かっこよく消す) userInfo:nil repeats:NO];
    [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
}

- (IBAction)ぼたんがおされた:(id)sender {
    int tag = [sender tag] - 100;
    int maeno_tensu = s_tensu;
    switch (tag) {
        case 1:
            if (s_imadoko == 1)
                s_tensu +=1;
            break;

        case 2:
            if (s_imadoko == 2)
                s_tensu +=1;
            break;

        case 3:
            if (s_imadoko == 3)
                s_tensu +=1;
            break;

        case 4:
            if (s_imadoko == 4)
                s_tensu +=1;
            break;

        case 5:
            if (s_imadoko == 5)
                s_tensu +=1;
            break;

        case 6:
            if (s_imadoko == 6)
                s_tensu +=1;
            break;

        case 7:
            if (s_imadoko == 7)
                s_tensu +=1;
            break;

        case 8:
            if (s_imadoko == 8)
                s_tensu +=1;
            break;

        case 9:
            if (s_imadoko == 9)
                s_tensu +=1;
            break;

        case 10:
            if (s_imadoko == 10)
                s_tensu +=1;
            break;

        case 11:
            if (s_imadoko == 11)
                s_tensu +=1;
            break;

        case 12:
            if (s_imadoko == 12)
                s_tensu +=1;
            break;

        case 13:
            if (s_imadoko == 13)
                s_tensu +=1;
            break;

        case 14:
            if (s_imadoko == 14)
                s_tensu +=1;
            break;

        default:
            break;
    }
    if (maeno_tensu != s_tensu)
        [self SE再生];
}

- (void)かっこよく消す {
    static int imadoko = 1;

    [UIView animateWithDuration:0.3f animations:^{
        [[self.view viewWithTag:imadoko] setAlpha:0.0f];
    }];

    if (imadoko++ < 14) {
        NSTimer *timer = [NSTimer timerWithTimeInterval:0.1f target:self selector:@selector(かっこよく消す) userInfo:nil repeats:NO];
        [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
    } else {
        [((UILabel *) [self.view viewWithTag:100]) setText:@"すた〜と!"];
        NSTimer *timer = [NSTimer timerWithTimeInterval:2.0f target:self selector:@selector(タイマーメソッド1) userInfo:nil repeats:YES];
        [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];

        timer = [NSTimer timerWithTimeInterval:0.2f target:self selector:@selector(タイマーメソッド2) userInfo:nil repeats:YES];
        [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
    }
}

- (void)タイマーメソッド1 {
    unsigned int val = arc4random();
    int val2 = 0;

    if (s_nokori <= 0)
        return;

    if (val < UINT_MAX / 14)
        val2 = 1;
    else if (val < UINT_MAX / 14 * 2)
        val2 = 2;
    else if (val < UINT_MAX / 14 * 3)
        val2 = 3;
    else if (val < UINT_MAX / 14 * 4)
        val2 = 4;
    else if (val < UINT_MAX / 14 * 5)
        val2 = 5;
    else if (val < UINT_MAX / 14 * 6)
        val2 = 6;
    else if (val < UINT_MAX / 14 * 7)
        val2 = 7;
    else if (val < UINT_MAX / 14 * 8)
        val2 = 8;
    else if (val < UINT_MAX / 14 * 9)
        val2 = 9;
    else if (val < UINT_MAX / 14 * 10)
        val2 = 10;
    else if (val < UINT_MAX / 14 * 11)
        val2 = 11;
    else if (val < UINT_MAX / 14 * 12)
        val2 = 12;
    else if (val < UINT_MAX / 14 * 13)
        val2 = 13;
    else
        val2 = 14;

    switch (val2) {
        case 1:
        {
            [UIView animateWithDuration:1.5f animations:^{
                [[self.view viewWithTag:1] setAlpha:1.0f];
            } completion:^(BOOL finished){
                [UIView animateWithDuration:0.5f animations:^{
                    [[self.view viewWithTag:1] setAlpha:0.0f];
                }];
            }];
        }
            break;

        case 2:
        {
            [UIView animateWithDuration:1.5f animations:^{
                [[self.view viewWithTag:2] setAlpha:1.0f];
            } completion:^(BOOL finished){
                [UIView animateWithDuration:0.5f animations:^{
                    [[self.view viewWithTag:2] setAlpha:0.0f];
                }];
            }];
        }
            break;

        case 3:
        {
            [UIView animateWithDuration:1.5f animations:^{
                [[self.view viewWithTag:3] setAlpha:1.0f];
            } completion:^(BOOL finished){
                [UIView animateWithDuration:0.5f animations:^{
                    [[self.view viewWithTag:3] setAlpha:0.0f];
                }];
            }];
        }
            break;

        case 4:
        {
            [UIView animateWithDuration:1.5f animations:^{
                [[self.view viewWithTag:4] setAlpha:1.0f];
            } completion:^(BOOL finished){
                [UIView animateWithDuration:0.5f animations:^{
                    [[self.view viewWithTag:4] setAlpha:0.0f];
                }];
            }];
        }
            break;

        case 5:
        {
            [UIView animateWithDuration:1.5f animations:^{
                [[self.view viewWithTag:5] setAlpha:1.0f];
            } completion:^(BOOL finished){
                [UIView animateWithDuration:0.5f animations:^{
                    [[self.view viewWithTag:5] setAlpha:0.0f];
                }];
            }];
        }
            break;

        case 6:
        {
            [UIView animateWithDuration:1.5f animations:^{
                [[self.view viewWithTag:6] setAlpha:1.0f];
            } completion:^(BOOL finished){
                [UIView animateWithDuration:0.5f animations:^{
                    [[self.view viewWithTag:6] setAlpha:0.0f];
                }];
            }];
        }
            break;

        case 7:
        {
            [UIView animateWithDuration:1.5f animations:^{
                [[self.view viewWithTag:7] setAlpha:1.0f];
            } completion:^(BOOL finished){
                [UIView animateWithDuration:0.5f animations:^{
                    [[self.view viewWithTag:7] setAlpha:0.0f];
                }];
            }];
        }
            break;

        case 8:
        {
            [UIView animateWithDuration:1.5f animations:^{
                [[self.view viewWithTag:8] setAlpha:1.0f];
            } completion:^(BOOL finished){
                [UIView animateWithDuration:0.5f animations:^{
                    [[self.view viewWithTag:8] setAlpha:0.0f];
                }];
            }];
        }
            break;

        case 9:
        {
            [UIView animateWithDuration:1.5f animations:^{
                [[self.view viewWithTag:9] setAlpha:1.0f];
            } completion:^(BOOL finished){
                [UIView animateWithDuration:0.5f animations:^{
                    [[self.view viewWithTag:9] setAlpha:0.0f];
                }];
            }];
        }
            break;

        case 10:
        {
            [UIView animateWithDuration:1.5f animations:^{
                [[self.view viewWithTag:10] setAlpha:1.0f];
            } completion:^(BOOL finished){
                [UIView animateWithDuration:0.5f animations:^{
                    [[self.view viewWithTag:10] setAlpha:0.0f];
                }];
            }];
        }
            break;

        case 11:
        {
            [UIView animateWithDuration:1.5f animations:^{
                [[self.view viewWithTag:11] setAlpha:1.0f];
            } completion:^(BOOL finished){
                [UIView animateWithDuration:0.5f animations:^{
                    [[self.view viewWithTag:11] setAlpha:0.0f];
                }];
            }];
        }
            break;

        case 12:
        {
            [UIView animateWithDuration:1.5f animations:^{
                [[self.view viewWithTag:12] setAlpha:1.0f];
            } completion:^(BOOL finished){
                [UIView animateWithDuration:0.5f animations:^{
                    [[self.view viewWithTag:12] setAlpha:0.0f];
                }];
            }];
        }
            break;

        case 13:
        {
            [UIView animateWithDuration:1.5f animations:^{
                [[self.view viewWithTag:13] setAlpha:1.0f];
            } completion:^(BOOL finished){
                [UIView animateWithDuration:0.5f animations:^{
                    [[self.view viewWithTag:13] setAlpha:0.0f];
                }];
            }];
        }
            break;

        case 14:
        {
            [UIView animateWithDuration:1.5f animations:^{
                [[self.view viewWithTag:14] setAlpha:1.0f];
            } completion:^(BOOL finished){
                [UIView animateWithDuration:0.5f animations:^{
                    [[self.view viewWithTag:14] setAlpha:0.0f];
                }];
            }];
        }
            break;

        default:
            break;
    }

    s_imadoko = val2;
}

- (void)タイマーメソッド2 {
    if (s_tensu > 0 && s_nokori > 0) {
        s_nokori -= 1;
        [((UILabel *)[self.view viewWithTag:100]) setText:[NSString stringWithFormat:@"ただいまの点数 %d点, 残り %d秒", s_tensu, s_nokori / 5]];
        if (s_nokori <= 0) {
            UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"おつかれさまでした" message:@"" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [alertView show];
        }
    }
}

- (void)SE再生 {
    static AVAudioPlayer *player = nil;
    if (player == nil) {
        NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"cat" ofType:@"aif"];
        NSURL *file = [[NSURL alloc] initFileURLWithPath:soundPath];
        player = [[AVAudioPlayer alloc] initWithContentsOfURL:file error:nil];
        [player setDelegate:self];
        [player prepareToPlay];
    }
    if ([player isPlaying]) {
        [player setCurrentTime:0.0f];
    } else
        [player play];
}

@end


text:
'use strict';

var path = require('path'),
    dust = require('dustjs-linkedin'),
    utils = require('./utils'),
    patch = require('./patch'),
    River = require('./brook'),
    reqwire = require('./reqwire');

var loaders = {
    dust: require('./reader/dust'),
    js: require('./reader/js')
};

function createRenderContext(options) {
    var context;

    // Hoist *only* view, settings, and ext to global context.
    context = dust.makeBase({
        views: options.views,
        settings: options.settings,
        ext: options.ext
    });

    // Remove from child context so global values are used.
    delete options.views;
    delete options.settings;
    delete options.ext;

    context = context.push(options);
    return context;
}

exports.create = function (type, config) {
    var reader, engine;

    config = config || {};
    config.cache = (config.cache === undefined) ? true : !!config.cache;

    // Load referenced helpers
    if (Array.isArray(config.helpers)) {
        config.helpers.forEach(function (module) {
            // allow configuration of helpers like:
            // "helpers": ["./lib/abc", { "name": "./lib/test", "arguments": { "debug": true } }]
            if (typeof module === 'string') {
                reqwire.init(module, dust);
            }
            else if (module.hasOwnProperty('name')) {
                reqwire.init(module.name, dust, module.arguments);
            }
        });
    }

    function reset() {
        patch.undo();
        if (!config.cache) {
            dust.cache = {};
        }
    }

    reader = loaders[type].create();
    engine = function engine(file, options, callback) {
        var ext, views, name, layout, context, stream;

        options = options || {};

        if (!file) {
            return callback(new Error("no template specified"));
        }

        // This needs to be deferred until runtime in case an engine
        // gets created and isn't used. That's because it modifies
        // a global dust object.
        patch.apply(config, reader);

        // Figure out where the views live.
        views = utils.resolveViewDir(options);

        // Get the correct extension. (NOTE: requires leading '.')
        ext = path.extname(file);
        if (options.ext) {
            ext = '.' + options.ext;
        }

        // Resolve page layout, first checking request context options,
        // then falling back to application config. Explicit `false` for
        // and settings disables layout.
        layout = undefined;
        if (options.layout !== false) {
            layout = options.layout;
            if (config.layout !== false) {
                layout = layout || config.layout;
            }
        }

        // Get the correct template name from the provided file name and
        // sort out context/template, etc.
        name = utils.nameify(file, views, ext);
        if (typeof layout === 'string') {
            options._main = name;
            name = layout;
        }

        context = createRenderContext(options);
        if (config.stream) {
            stream = dust.stream(name, context);
            stream.on('error', reset);
            stream.on('end', reset);
            callback(null, new River(stream));
            return;
        }

        dust.render(name, context, function () {
            reset();
            callback.apply(undefined, arguments);
        });
    };

    // Make settings available
    Object.defineProperty(engine, 'settings', {
        get: function () {
            return utils.deepClone(config);
        }
    });

    return engine;
};

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8" ?>
<document>

<application name="pn" timeStamp="Thu Aug 20 14:50:20 2015">

<property name="ProjectID" value="9B6088FE1AB54D32B7CC4690DF9EF551" type="project"/>
<property name="ProjectIteration" value="2" type="project"/>
<property name="ProjectFile" value="F:/WinShare/fpga/data_selector_verilog/data_selector_verilog.xise" type="project"/>
<property name="ProjectCreationTimestamp" value="2015-08-20T14:30:12" type="project"/>

<property name="PROP_Enable_Message_Filtering" value="false" type="design"/>
<property name="PROP_FitterReportFormat" value="HTML" type="process"/>
<property name="PROP_LastAppliedGoal" value="Balanced" type="design"/>
<property name="PROP_LastAppliedStrategy" value="Xilinx Default (unlocked)" type="design"/>
<property name="PROP_ManualCompileOrderImp" value="false" type="design"/>
<property name="PROP_PropSpecInProjFile" value="Store all values" type="design"/>
<property name="PROP_Simulator" value="ISim (VHDL/Verilog)" type="design"/>
<property name="PROP_SynthTopFile" value="changed" type="process"/>
<property name="PROP_Top_Level_Module_Type" value="HDL" type="design"/>
<property name="PROP_UseSmartGuide" value="false" type="design"/>
<property name="PROP_UserConstraintEditorPreference" value="Text Editor" type="process"/>
<property name="PROP_intProjectCreationTimestamp" value="2015-08-20T14:30:12" type="design"/>
<property name="PROP_intWbtProjectID" value="9B6088FE1AB54D32B7CC4690DF9EF551" type="design"/>
<property name="PROP_intWbtProjectIteration" value="2" type="process"/>
<property name="PROP_intWorkingDirLocWRTProjDir" value="Same" type="design"/>
<property name="PROP_intWorkingDirUsed" value="No" type="design"/>
<property name="PROP_AutoTop" value="true" type="design"/>
<property name="PROP_DevFamily" value="Spartan3A and Spartan3AN" type="design"/>
<property name="PROP_DevDevice" value="xc3s50a" type="design"/>
<property name="PROP_DevFamilyPMName" value="spartan3a" type="design"/>
<property name="PROP_DevPackage" value="tq144" type="design"/>
<property name="PROP_Synthesis_Tool" value="XST (VHDL/Verilog)" type="design"/>
<property name="PROP_DevSpeed" value="-4" type="design"/>
<property name="PROP_PreferredLanguage" value="Verilog" type="design"/>
<property name="FILE_UCF" value="1" type="source"/>
<property name="FILE_VERILOG" value="1" type="source"/>

</application>
</document>


text:
<resources>
    <string name="app_name">Change Viewpoint</string>
    <string name="geometry">Geometry</string>
    <string name="center_scale">Center & Scale</string>
    <string name="animate">Animate</string>
</resources>


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: Documents/DocumentList.proto

package Diadoc.Api.Proto.Documents;

public final class DocumentListProtos {
  private DocumentListProtos() {}
  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistry registry) {
  }
  public interface DocumentListOrBuilder extends
      // @@protoc_insertion_point(interface_extends:Diadoc.Api.Proto.Documents.DocumentList)
      com.google.protobuf.MessageOrBuilder {

    /**
     * required int32 TotalCount = 1;
     */
    boolean hasTotalCount();
    /**
     * required int32 TotalCount = 1;
     */
    int getTotalCount();

    /**
     * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
     */
    java.util.List<Diadoc.Api.Proto.Documents.DocumentProtos.Document>
        getDocumentsList();
    /**
     * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
     */
    Diadoc.Api.Proto.Documents.DocumentProtos.Document getDocuments(int index);
    /**
     * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
     */
    int getDocumentsCount();
    /**
     * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
     */
    java.util.List<? extends Diadoc.Api.Proto.Documents.DocumentProtos.DocumentOrBuilder>
        getDocumentsOrBuilderList();
    /**
     * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
     */
    Diadoc.Api.Proto.Documents.DocumentProtos.DocumentOrBuilder getDocumentsOrBuilder(
        int index);

    /**
     * optional bool HasMoreResults = 3;
     */
    boolean hasHasMoreResults();
    /**
     * optional bool HasMoreResults = 3;
     */
    boolean getHasMoreResults();
  }
  /**
   * Protobuf type {@code Diadoc.Api.Proto.Documents.DocumentList}
   */
  public static final class DocumentList extends
      com.google.protobuf.GeneratedMessage implements
      // @@protoc_insertion_point(message_implements:Diadoc.Api.Proto.Documents.DocumentList)
      DocumentListOrBuilder {
    // Use DocumentList.newBuilder() to construct.
    private DocumentList(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
      this.unknownFields = builder.getUnknownFields();
    }
    private DocumentList(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

    private static final DocumentList defaultInstance;
    public static DocumentList getDefaultInstance() {
      return defaultInstance;
    }

    public DocumentList getDefaultInstanceForType() {
      return defaultInstance;
    }

    private final com.google.protobuf.UnknownFieldSet unknownFields;
    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet
        getUnknownFields() {
      return this.unknownFields;
    }
    private DocumentList(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      initFields();
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!parseUnknownField(input, unknownFields,
                                     extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
            case 8: {
              bitField0_ |= 0x00000001;
              totalCount_ = input.readInt32();
              break;
            }
            case 18: {
              if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
                documents_ = new java.util.ArrayList<Diadoc.Api.Proto.Documents.DocumentProtos.Document>();
                mutable_bitField0_ |= 0x00000002;
              }
              documents_.add(input.readMessage(Diadoc.Api.Proto.Documents.DocumentProtos.Document.PARSER, extensionRegistry));
              break;
            }
            case 24: {
              bitField0_ |= 0x00000002;
              hasMoreResults_ = input.readBool();
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e.getMessage()).setUnfinishedMessage(this);
      } finally {
        if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
          documents_ = java.util.Collections.unmodifiableList(documents_);
        }
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return Diadoc.Api.Proto.Documents.DocumentListProtos.internal_static_Diadoc_Api_Proto_Documents_DocumentList_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return Diadoc.Api.Proto.Documents.DocumentListProtos.internal_static_Diadoc_Api_Proto_Documents_DocumentList_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList.class, Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList.Builder.class);
    }

    public static com.google.protobuf.Parser<DocumentList> PARSER =
        new com.google.protobuf.AbstractParser<DocumentList>() {
      public DocumentList parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new DocumentList(input, extensionRegistry);
      }
    };

    @java.lang.Override
    public com.google.protobuf.Parser<DocumentList> getParserForType() {
      return PARSER;
    }

    private int bitField0_;
    public static final int TOTALCOUNT_FIELD_NUMBER = 1;
    private int totalCount_;
    /**
     * required int32 TotalCount = 1;
     */
    public boolean hasTotalCount() {
      return ((bitField0_ & 0x00000001) == 0x00000001);
    }
    /**
     * required int32 TotalCount = 1;
     */
    public int getTotalCount() {
      return totalCount_;
    }

    public static final int DOCUMENTS_FIELD_NUMBER = 2;
    private java.util.List<Diadoc.Api.Proto.Documents.DocumentProtos.Document> documents_;
    /**
     * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
     */
    public java.util.List<Diadoc.Api.Proto.Documents.DocumentProtos.Document> getDocumentsList() {
      return documents_;
    }
    /**
     * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
     */
    public java.util.List<? extends Diadoc.Api.Proto.Documents.DocumentProtos.DocumentOrBuilder>
        getDocumentsOrBuilderList() {
      return documents_;
    }
    /**
     * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
     */
    public int getDocumentsCount() {
      return documents_.size();
    }
    /**
     * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
     */
    public Diadoc.Api.Proto.Documents.DocumentProtos.Document getDocuments(int index) {
      return documents_.get(index);
    }
    /**
     * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
     */
    public Diadoc.Api.Proto.Documents.DocumentProtos.DocumentOrBuilder getDocumentsOrBuilder(
        int index) {
      return documents_.get(index);
    }

    public static final int HASMORERESULTS_FIELD_NUMBER = 3;
    private boolean hasMoreResults_;
    /**
     * optional bool HasMoreResults = 3;
     */
    public boolean hasHasMoreResults() {
      return ((bitField0_ & 0x00000002) == 0x00000002);
    }
    /**
     * optional bool HasMoreResults = 3;
     */
    public boolean getHasMoreResults() {
      return hasMoreResults_;
    }

    private void initFields() {
      totalCount_ = 0;
      documents_ = java.util.Collections.emptyList();
      hasMoreResults_ = false;
    }
    private byte memoizedIsInitialized = -1;
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      if (!hasTotalCount()) {
        memoizedIsInitialized = 0;
        return false;
      }
      for (int i = 0; i < getDocumentsCount(); i++) {
        if (!getDocuments(i).isInitialized()) {
          memoizedIsInitialized = 0;
          return false;
        }
      }
      memoizedIsInitialized = 1;
      return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        output.writeInt32(1, totalCount_);
      }
      for (int i = 0; i < documents_.size(); i++) {
        output.writeMessage(2, documents_.get(i));
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        output.writeBool(3, hasMoreResults_);
      }
      getUnknownFields().writeTo(output);
    }

    private int memoizedSerializedSize = -1;
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(1, totalCount_);
      }
      for (int i = 0; i < documents_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(2, documents_.get(i));
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBoolSize(3, hasMoreResults_);
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }

    private static final long serialVersionUID = 0L;
    @java.lang.Override
    protected java.lang.Object writeReplace()
        throws java.io.ObjectStreamException {
      return super.writeReplace();
    }

    public static Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }
    public static Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input);
    }
    public static Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input, extensionRegistry);
    }
    public static Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }

    public static Builder newBuilder() { return Builder.create(); }
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder(Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList prototype) {
      return newBuilder().mergeFrom(prototype);
    }
    public Builder toBuilder() { return newBuilder(this); }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code Diadoc.Api.Proto.Documents.DocumentList}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:Diadoc.Api.Proto.Documents.DocumentList)
        Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentListOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return Diadoc.Api.Proto.Documents.DocumentListProtos.internal_static_Diadoc_Api_Proto_Documents_DocumentList_descriptor;
      }

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return Diadoc.Api.Proto.Documents.DocumentListProtos.internal_static_Diadoc_Api_Proto_Documents_DocumentList_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList.class, Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList.Builder.class);
      }

      // Construct using Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
          getDocumentsFieldBuilder();
        }
      }
      private static Builder create() {
        return new Builder();
      }

      public Builder clear() {
        super.clear();
        totalCount_ = 0;
        bitField0_ = (bitField0_ & ~0x00000001);
        if (documentsBuilder_ == null) {
          documents_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000002);
        } else {
          documentsBuilder_.clear();
        }
        hasMoreResults_ = false;
        bitField0_ = (bitField0_ & ~0x00000004);
        return this;
      }

      public Builder clone() {
        return create().mergeFrom(buildPartial());
      }

      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return Diadoc.Api.Proto.Documents.DocumentListProtos.internal_static_Diadoc_Api_Proto_Documents_DocumentList_descriptor;
      }

      public Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList getDefaultInstanceForType() {
        return Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList.getDefaultInstance();
      }

      public Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList build() {
        Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      public Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList buildPartial() {
        Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList result = new Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList(this);
        int from_bitField0_ = bitField0_;
        int to_bitField0_ = 0;
        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
          to_bitField0_ |= 0x00000001;
        }
        result.totalCount_ = totalCount_;
        if (documentsBuilder_ == null) {
          if (((bitField0_ & 0x00000002) == 0x00000002)) {
            documents_ = java.util.Collections.unmodifiableList(documents_);
            bitField0_ = (bitField0_ & ~0x00000002);
          }
          result.documents_ = documents_;
        } else {
          result.documents_ = documentsBuilder_.build();
        }
        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
          to_bitField0_ |= 0x00000002;
        }
        result.hasMoreResults_ = hasMoreResults_;
        result.bitField0_ = to_bitField0_;
        onBuilt();
        return result;
      }

      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList) {
          return mergeFrom((Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList other) {
        if (other == Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList.getDefaultInstance()) return this;
        if (other.hasTotalCount()) {
          setTotalCount(other.getTotalCount());
        }
        if (documentsBuilder_ == null) {
          if (!other.documents_.isEmpty()) {
            if (documents_.isEmpty()) {
              documents_ = other.documents_;
              bitField0_ = (bitField0_ & ~0x00000002);
            } else {
              ensureDocumentsIsMutable();
              documents_.addAll(other.documents_);
            }
            onChanged();
          }
        } else {
          if (!other.documents_.isEmpty()) {
            if (documentsBuilder_.isEmpty()) {
              documentsBuilder_.dispose();
              documentsBuilder_ = null;
              documents_ = other.documents_;
              bitField0_ = (bitField0_ & ~0x00000002);
              documentsBuilder_ =
                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
                   getDocumentsFieldBuilder() : null;
            } else {
              documentsBuilder_.addAllMessages(other.documents_);
            }
          }
        }
        if (other.hasHasMoreResults()) {
          setHasMoreResults(other.getHasMoreResults());
        }
        this.mergeUnknownFields(other.getUnknownFields());
        return this;
      }

      public final boolean isInitialized() {
        if (!hasTotalCount()) {

          return false;
        }
        for (int i = 0; i < getDocumentsCount(); i++) {
          if (!getDocuments(i).isInitialized()) {

            return false;
          }
        }
        return true;
      }

      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (Diadoc.Api.Proto.Documents.DocumentListProtos.DocumentList) e.getUnfinishedMessage();
          throw e;
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }
      private int bitField0_;

      private int totalCount_ ;
      /**
       * required int32 TotalCount = 1;
       */
      public boolean hasTotalCount() {
        return ((bitField0_ & 0x00000001) == 0x00000001);
      }
      /**
       * required int32 TotalCount = 1;
       */
      public int getTotalCount() {
        return totalCount_;
      }
      /**
       * required int32 TotalCount = 1;
       */
      public Builder setTotalCount(int value) {
        bitField0_ |= 0x00000001;
        totalCount_ = value;
        onChanged();
        return this;
      }
      /**
       * required int32 TotalCount = 1;
       */
      public Builder clearTotalCount() {
        bitField0_ = (bitField0_ & ~0x00000001);
        totalCount_ = 0;
        onChanged();
        return this;
      }

      private java.util.List<Diadoc.Api.Proto.Documents.DocumentProtos.Document> documents_ =
        java.util.Collections.emptyList();
      private void ensureDocumentsIsMutable() {
        if (!((bitField0_ & 0x00000002) == 0x00000002)) {
          documents_ = new java.util.ArrayList<Diadoc.Api.Proto.Documents.DocumentProtos.Document>(documents_);
          bitField0_ |= 0x00000002;
         }
      }

      private com.google.protobuf.RepeatedFieldBuilder<
          Diadoc.Api.Proto.Documents.DocumentProtos.Document, Diadoc.Api.Proto.Documents.DocumentProtos.Document.Builder, Diadoc.Api.Proto.Documents.DocumentProtos.DocumentOrBuilder> documentsBuilder_;

      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public java.util.List<Diadoc.Api.Proto.Documents.DocumentProtos.Document> getDocumentsList() {
        if (documentsBuilder_ == null) {
          return java.util.Collections.unmodifiableList(documents_);
        } else {
          return documentsBuilder_.getMessageList();
        }
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public int getDocumentsCount() {
        if (documentsBuilder_ == null) {
          return documents_.size();
        } else {
          return documentsBuilder_.getCount();
        }
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public Diadoc.Api.Proto.Documents.DocumentProtos.Document getDocuments(int index) {
        if (documentsBuilder_ == null) {
          return documents_.get(index);
        } else {
          return documentsBuilder_.getMessage(index);
        }
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public Builder setDocuments(
          int index, Diadoc.Api.Proto.Documents.DocumentProtos.Document value) {
        if (documentsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureDocumentsIsMutable();
          documents_.set(index, value);
          onChanged();
        } else {
          documentsBuilder_.setMessage(index, value);
        }
        return this;
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public Builder setDocuments(
          int index, Diadoc.Api.Proto.Documents.DocumentProtos.Document.Builder builderForValue) {
        if (documentsBuilder_ == null) {
          ensureDocumentsIsMutable();
          documents_.set(index, builderForValue.build());
          onChanged();
        } else {
          documentsBuilder_.setMessage(index, builderForValue.build());
        }
        return this;
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public Builder addDocuments(Diadoc.Api.Proto.Documents.DocumentProtos.Document value) {
        if (documentsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureDocumentsIsMutable();
          documents_.add(value);
          onChanged();
        } else {
          documentsBuilder_.addMessage(value);
        }
        return this;
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public Builder addDocuments(
          int index, Diadoc.Api.Proto.Documents.DocumentProtos.Document value) {
        if (documentsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureDocumentsIsMutable();
          documents_.add(index, value);
          onChanged();
        } else {
          documentsBuilder_.addMessage(index, value);
        }
        return this;
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public Builder addDocuments(
          Diadoc.Api.Proto.Documents.DocumentProtos.Document.Builder builderForValue) {
        if (documentsBuilder_ == null) {
          ensureDocumentsIsMutable();
          documents_.add(builderForValue.build());
          onChanged();
        } else {
          documentsBuilder_.addMessage(builderForValue.build());
        }
        return this;
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public Builder addDocuments(
          int index, Diadoc.Api.Proto.Documents.DocumentProtos.Document.Builder builderForValue) {
        if (documentsBuilder_ == null) {
          ensureDocumentsIsMutable();
          documents_.add(index, builderForValue.build());
          onChanged();
        } else {
          documentsBuilder_.addMessage(index, builderForValue.build());
        }
        return this;
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public Builder addAllDocuments(
          java.lang.Iterable<? extends Diadoc.Api.Proto.Documents.DocumentProtos.Document> values) {
        if (documentsBuilder_ == null) {
          ensureDocumentsIsMutable();
          com.google.protobuf.AbstractMessageLite.Builder.addAll(
              values, documents_);
          onChanged();
        } else {
          documentsBuilder_.addAllMessages(values);
        }
        return this;
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public Builder clearDocuments() {
        if (documentsBuilder_ == null) {
          documents_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000002);
          onChanged();
        } else {
          documentsBuilder_.clear();
        }
        return this;
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public Builder removeDocuments(int index) {
        if (documentsBuilder_ == null) {
          ensureDocumentsIsMutable();
          documents_.remove(index);
          onChanged();
        } else {
          documentsBuilder_.remove(index);
        }
        return this;
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public Diadoc.Api.Proto.Documents.DocumentProtos.Document.Builder getDocumentsBuilder(
          int index) {
        return getDocumentsFieldBuilder().getBuilder(index);
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public Diadoc.Api.Proto.Documents.DocumentProtos.DocumentOrBuilder getDocumentsOrBuilder(
          int index) {
        if (documentsBuilder_ == null) {
          return documents_.get(index);  } else {
          return documentsBuilder_.getMessageOrBuilder(index);
        }
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public java.util.List<? extends Diadoc.Api.Proto.Documents.DocumentProtos.DocumentOrBuilder>
           getDocumentsOrBuilderList() {
        if (documentsBuilder_ != null) {
          return documentsBuilder_.getMessageOrBuilderList();
        } else {
          return java.util.Collections.unmodifiableList(documents_);
        }
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public Diadoc.Api.Proto.Documents.DocumentProtos.Document.Builder addDocumentsBuilder() {
        return getDocumentsFieldBuilder().addBuilder(
            Diadoc.Api.Proto.Documents.DocumentProtos.Document.getDefaultInstance());
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public Diadoc.Api.Proto.Documents.DocumentProtos.Document.Builder addDocumentsBuilder(
          int index) {
        return getDocumentsFieldBuilder().addBuilder(
            index, Diadoc.Api.Proto.Documents.DocumentProtos.Document.getDefaultInstance());
      }
      /**
       * repeated .Diadoc.Api.Proto.Documents.Document Documents = 2;
       */
      public java.util.List<Diadoc.Api.Proto.Documents.DocumentProtos.Document.Builder>
           getDocumentsBuilderList() {
        return getDocumentsFieldBuilder().getBuilderList();
      }
      private com.google.protobuf.RepeatedFieldBuilder<
          Diadoc.Api.Proto.Documents.DocumentProtos.Document, Diadoc.Api.Proto.Documents.DocumentProtos.Document.Builder, Diadoc.Api.Proto.Documents.DocumentProtos.DocumentOrBuilder>
          getDocumentsFieldBuilder() {
        if (documentsBuilder_ == null) {
          documentsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
              Diadoc.Api.Proto.Documents.DocumentProtos.Document, Diadoc.Api.Proto.Documents.DocumentProtos.Document.Builder, Diadoc.Api.Proto.Documents.DocumentProtos.DocumentOrBuilder>(
                  documents_,
                  ((bitField0_ & 0x00000002) == 0x00000002),
                  getParentForChildren(),
                  isClean());
          documents_ = null;
        }
        return documentsBuilder_;
      }

      private boolean hasMoreResults_ ;
      /**
       * optional bool HasMoreResults = 3;
       */
      public boolean hasHasMoreResults() {
        return ((bitField0_ & 0x00000004) == 0x00000004);
      }
      /**
       * optional bool HasMoreResults = 3;
       */
      public boolean getHasMoreResults() {
        return hasMoreResults_;
      }
      /**
       * optional bool HasMoreResults = 3;
       */
      public Builder setHasMoreResults(boolean value) {
        bitField0_ |= 0x00000004;
        hasMoreResults_ = value;
        onChanged();
        return this;
      }
      /**
       * optional bool HasMoreResults = 3;
       */
      public Builder clearHasMoreResults() {
        bitField0_ = (bitField0_ & ~0x00000004);
        hasMoreResults_ = false;
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:Diadoc.Api.Proto.Documents.DocumentList)
    }

    static {
      defaultInstance = new DocumentList(true);
      defaultInstance.initFields();
    }

    // @@protoc_insertion_point(class_scope:Diadoc.Api.Proto.Documents.DocumentList)
  }

  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_Diadoc_Api_Proto_Documents_DocumentList_descriptor;
  private static
    com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internal_static_Diadoc_Api_Proto_Documents_DocumentList_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor
      getDescriptor() {
    return descriptor;
  }
  private static com.google.protobuf.Descriptors.FileDescriptor
      descriptor;
  static {
    java.lang.String[] descriptorData = {
      "\n\034Documents/DocumentList.proto\022\032Diadoc.A" +
      "pi.Proto.Documents\032\030Documents/Document.p" +
      "roto\"s\n\014DocumentList\022\022\n\nTotalCount\030\001 \002(\005" +
      "\0227\n\tDocuments\030\002 \003(\0132$.Diadoc.Api.Proto.D" +
      "ocuments.Document\022\026\n\016HasMoreResults\030\003 \001(" +
      "\010B\024B\022DocumentListProtos"
    };
    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
        new com.google.protobuf.Descriptors.FileDescriptor.    InternalDescriptorAssigner() {
          public com.google.protobuf.ExtensionRegistry assignDescriptors(
              com.google.protobuf.Descriptors.FileDescriptor root) {
            descriptor = root;
            return null;
          }
        };
    com.google.protobuf.Descriptors.FileDescriptor
      .internalBuildGeneratedFileFrom(descriptorData,
        new com.google.protobuf.Descriptors.FileDescriptor[] {
          Diadoc.Api.Proto.Documents.DocumentProtos.getDescriptor(),
        }, assigner);
    internal_static_Diadoc_Api_Proto_Documents_DocumentList_descriptor =
      getDescriptor().getMessageTypes().get(0);
    internal_static_Diadoc_Api_Proto_Documents_DocumentList_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
        internal_static_Diadoc_Api_Proto_Documents_DocumentList_descriptor,
        new java.lang.String[] { "TotalCount", "Documents", "HasMoreResults", });
    Diadoc.Api.Proto.Documents.DocumentProtos.getDescriptor();
  }

  // @@protoc_insertion_point(outer_class_scope)
}


text:
  * Robin Hahling <Rolinh> <robin.hahling@gw-computing.net>

## CONTRIBUTORS:

  * Alexandre Perrin
  * Baptiste Daroussin
  * Cyril Roelandt
  * Frank Villaro-Dixon
  * Kevin Gillieron
  * Landry Breuil
  * Matthieu Le Jeune
  * Sylvain Laperche
  * Tobias Patzl
  * Michiel Pater

## TRANSLATORS:

French:

  * Robin Hahling <Rolinh> <robin.hahling@gw-computing.net>

Swedish:

  * Andreas Rönnquist <gusnan@gusnan.se>

Dutch:

  * Michiel Pater <mpater@tradosoft.com>

<!-- vim: set filetype=markdown textwidth=80 -->


text:
using System.Runtime.Serialization;
using Imageboard10.Core.Models.Links.LinkTypes;
using Newtonsoft.Json;

namespace Imageboard10.Core.Models.Links.Serialization
{
    /// <summary>
    /// Сериализатор ссылок.
    /// </summary>
    public sealed class RootLinkSerializer : LinkSerializerBase<RootLink, RootLinkSerializer.Jo>
    {
        [DataContract]
        public class Jo
        {
            [DataMember(Name = "e")]
            public string Engine { get; set; }
        }

        /// <summary>
        /// Идентификатор типа ссылки.
        /// </summary>
        public override string LinkTypeId => "root";

        /// <summary>
        /// Получить объект JSON.
        /// </summary>
        /// <param name="link">Ссылка.</param>
        /// <returns>Объект JSON.</returns>
        protected override Jo GetJsonObject(RootLink link)
        {
            return new Jo()
            {
                Engine = link.Engine
            };
        }

        /// <summary>
        /// Заполнить значения.
        /// </summary>
        /// <param name="result">Результат.</param>
        /// <param name="jsonObject">JSON-объект.</param>
        protected override void FillValues(RootLink result, Jo jsonObject)
        {
            result.Engine = jsonObject.Engine;
        }
    }
}


text:
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateImportsTable extends Migration {
    public function up() {
        Schema::create('imports', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('space_id');
            $table->string('name');
            $table->string('file');
            $table->integer('status')->default(0);
            $table->string('column_happened_on')->nullable();
            $table->string('column_description')->nullable();
            $table->string('column_amount')->nullable();
            $table->timestamps();
            $table->softDeletes();

            // FKs
            $table->foreign('space_id')->references('id')->on('spaces');
        });
    }

    public function down() {
        Schema::table('imports', function ($table) {
            $table->dropForeign('imports_space_id_foreign');
        });

        Schema::dropIfExists('imports');
    }
}


text:
using Perspex.Controls;
using Xamarin.Forms.Internals;

namespace Xamarin.Forms.Platform.PerspexDesktop
{
    public class NativeViewWrapperRenderer : ViewRenderer<NativeViewWrapper, Control>
	{
		public override SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint)
		{
			if (Element?.GetDesiredSizeDelegate == null)
			{
				return base.GetDesiredSize(widthConstraint, heightConstraint);
			}

			// The user has specified a different implementation of GetDesiredSize
			SizeRequest? result = Element.GetDesiredSizeDelegate(this, widthConstraint, heightConstraint);

			// If the delegate returns a SizeRequest, we use it;
			// if it returns null, fall back to the default implementation
			return result ?? base.GetDesiredSize(widthConstraint, heightConstraint);
		}

		protected override Perspex.Size ArrangeOverride(Perspex.Size finalSize)
		{
			if (Element?.ArrangeOverrideDelegate == null)
			{
				return base.ArrangeOverride(finalSize);
			}

			// The user has specified a different implementation of ArrangeOverride
			Perspex.Size? result = Element.ArrangeOverrideDelegate(this, finalSize);

			// If the delegate returns a Size, we use it;
			// if it returns null, fall back to the default implementation
			return result ?? base.ArrangeOverride(finalSize);
		}

		protected Perspex.Size MeasureOverride()
		{
			return MeasureOverride(new Perspex.Size());
		}

		protected override Perspex.Size MeasureOverride(Perspex.Size availableSize)
		{
			if (Element?.MeasureOverrideDelegate == null)
			{
				return base.MeasureOverride(availableSize);
			}

			// The user has specified a different implementation of MeasureOverride
			Perspex.Size? result = Element.MeasureOverrideDelegate(this, availableSize);

			// If the delegate returns a Size, we use it;
			// if it returns null, fall back to the default implementation
			return result ?? base.MeasureOverride(availableSize);
		}

		protected override void OnElementChanged(ElementChangedEventArgs<NativeViewWrapper> e)
		{
			base.OnElementChanged(e);

			if (e.OldElement == null)
			{
				SetNativeControl(Element.NativeElement);
				//Control.LayoutUpdated += (sender, args) => { ((IVisualElementController)Element)?.InvalidateMeasure(InvalidationTrigger.MeasureChanged); };
			}
		}
	}
}


text:
package com.codepoetics.octarine.json.serialisation;

import com.fasterxml.jackson.core.JsonGenerator;

import java.io.IOException;
import java.util.Collection;

public final class ListSerialiser<T> implements SafeSerialiser<Collection<? extends T>> {
    public static <T> ListSerialiser<T> writingItemsWith(Serialiser<? super T> itemSerialiser) {
        return new ListSerialiser<>(itemSerialiser);
    }

    private final Serialiser<? super T> itemSerialiser;

    private ListSerialiser(Serialiser<? super T> itemSerialiser) {
        this.itemSerialiser = itemSerialiser;
    }

    @Override
    public void unsafeAccept(JsonGenerator j, Collection<? extends T> ts) throws IOException {
        j.writeStartArray();
        ts.forEach(t -> itemSerialiser.accept(j, t));
        j.writeEndArray();
    }
}


text:
<?php

namespace UWDOEM\Space\Test;

use UWDOEM\Space\Space;

class MockSpace extends Space
{
    protected static function makeConnection()
    {
        return new \UWDOEM\Connection\Test\MockConnection(
            "http://localhost/",
            getcwd() . "",
            getcwd() . "/test/test-certs/self.signed.test.certs.crt",
            ''
        );
    }
}


text:
<md-toolbar class="md-table-toolbar md-default" ng-if="!($ctrl.selected.length || $ctrl.filter.show) ">

Celebrities

        <md-button aria-label="filter-variant" ng-click="$ctrl.filter.show = true" class="md-icon-button">
            <md-icon style="fill: grey;"md-svg-icon="filter-variant"></md-icon>
        </md-button>
        <md-button aria-label="delete" ng-click="$ctrl.edit()" class="md-icon-button">
            <md-icon style="fill: grey;"md-svg-icon="pencil"></md-icon>
        </md-button>
        <md-button aria-label="plus" ng-click="$ctrl.add()" class="md-icon-button">
            <md-icon style="fill: grey;"md-svg-icon="plus"></md-icon>
        </md-button>

</md-toolbar>

<md-toolbar class="md-table-toolbar md-default" ng-if="$ctrl.selected.length">

Item seleccionado: {{$ctrl.formater($ctrl.selected[0]).name}}

        <md-button aria-label="delete" ng-click="$ctrl.edit()" class="md-icon-button">
            <md-icon style="fill: grey;"md-svg-icon="pencil"></md-icon>
        </md-button>
        <md-button aria-label="delete" ng-click="$ctrl.remove()" class="md-icon-button">
            <md-icon style="fill: grey;"md-svg-icon="delete"></md-icon>
        </md-button>

</md-toolbar>

<md-toolbar class="md-table-toolbar md-default" ng-show="$ctrl.filter.show && !$ctrl.selected.length">

        <md-input-container class="md-icon-float md-block" flex="70" style="margin-top: 30px;">
            <md-icon style="fill: grey;" md-svg-icon="magnify"></md-icon>
            <input
                    aria-label="filter"
                    ng-model="$ctrl.query.filter"
                    ng-model-options="{ debounce: 500 }"
            >
        </md-input-container>

        <md-button aria-label="delete" ng-click="$ctrl.removeFilter()" class="md-icon-button">
            <md-icon style="fill: grey;" md-svg-icon="close"></md-icon>
        </md-button>

</md-toolbar>

<md-table-container>

            Id
            Name
            Type
            Products

            {{item.$id}}
            {{$ctrl.formater(item).name}}
            {{item.type}}
            {{$ctrl.formater(item).products}}

</md-table-container>

<md-table-pagination
        md-limit="$ctrl.query.limit"
        md-limit-options="[5, 10, 15]"
        md-page="$ctrl.query.page"
        md-total="{{$ctrl.items.length}}"
        md-on-paginate="$ctrl.getItems" md-page-select>

</md-table-pagination>


text:
require 'rails_helper'

class Authentication < ActionController::Base
  include Authenticable
end

describe Authenticable do
  let(:authentication) { Authentication.new }

  subject { authentication }

 	describe "#current_user" do
    before do
      @user = FactoryGirl.create :user
      request.headers["Authorization"] = @user.auth_token
      allow(authentication).to receive(:request).and_return(request)
    end

    it "returns the user from the authorization header" do
     	expect(authentication.current_user.auth_token).to eql @user.auth_token
    end
  end

  describe "#authentica_with_token" do
  	before do
  		@user = FactoryGirl.create :user
       allow(authentication).to receive(:current_user).and_return(nil)
  		allow(response).to receive(:response_code).and_return(401)
  		allow(response).to receive(:body).and_return({ errors: "Not authenticated" }.to_json)
  		allow(authentication).to receive(:response).and_return(response)
  	end

  	it "render a json error message" do
  		expect(json_response[:errors]).to eql "Not authenticated"
  	end

  	it { should respond_with 401 }
  end

  describe "#user_signed_in?" do
    context "when there is a user on session" do
      before do
        @user = FactoryGirl.create :user
        allow(authentication).to receive(:current_user).and_return(@user)
      end

      it { should be_user_signed_in }
    end

    context "when there is not user on session" do
      before do
        @user = FactoryGirl.create :user
        allow(authentication).to receive(:current_user).and_return(nil)
      end

      it { should_not be_user_signed_in }
    end
  end
end


text:
namespace sentencepiece {
namespace unigram {
namespace {

double Digamma(double x) {
  double result = 0.0;
  for (; x < 7; ++x) result -= 1 / x;
  x -= 1.0 / 2.0;
  const double xx = 1.0 / x;
  const double xx2 = xx * xx;
  const double xx4 = xx2 * xx2;
  result += std::log(x) + (1.0 / 24.0) * xx2 - (7.0 / 960.0) * xx4 +
            (31.0 / 8064.0) * xx4 * xx2 - (127.0 / 30720.0) * xx4 * xx4;
  return result;
}

template <typename IT>
void ToLogProb(IT begin, IT end) {
  float sum = 0.0;
  for (auto it = begin; it != end; ++it) {
    sum += it->second;
  }
  float logsum = std::log(static_cast<double>(sum));
  for (auto it = begin; it != end; ++it) {
    it->second = std::log(static_cast<double>(it->second)) - logsum;
  }
}
}  // namespace

TrainerModel::TrainerModel(const TrainerSpec &trainer_spec,
                           const NormalizerSpec &normalizer_spec)
    : trainer_spec_(trainer_spec), normalizer_spec_(normalizer_spec) {}

TrainerModel::~TrainerModel() {}

const TrainerModel::SentencePieces &TrainerModel::GetSentencePieces() const {
  return sentencepieces_;
}

void TrainerModel::SetSentencePieces(SentencePieces &&sentencepieces) {
  sentencepieces_ = std::move(sentencepieces);
  CHECK(!sentencepieces_.empty());

  min_score_ = FLT_MAX;
  model_proto_data_.Clear();
  model_proto_ = &model_proto_data_;
  std::vector<std::pair<absl::string_view, int>> pieces;

  for (size_t i = 0; i < sentencepieces_.size(); ++i) {
    const absl::string_view w = sentencepieces_[i].first;  // piece
    const float score = sentencepieces_[i].second;         // score.
    CHECK(!std::isnan(score));
    pieces.emplace_back(w, i);
    min_score_ = std::min(min_score_, score);
    auto *piece = model_proto_data_.add_pieces();
    piece->set_piece(w.data(), w.size());
    piece->set_score(score);
  }

  BuildTrie(&pieces);
  CHECK(status().ok());
}

TrainerModel::SentencePieces Trainer::MakeSeedSentencePieces() const {
  return trainer_spec_.train_extremely_large_corpus()
             ? MakeSeedSentencePiecesInternal<int64>()
             : MakeSeedSentencePiecesInternal<int32>();
}

// Returns seed sentencepieces for EM training.
template <typename node_int_type>
TrainerModel::SentencePieces Trainer::MakeSeedSentencePiecesInternal() const {
  CHECK(!sentences_.empty());
  CHECK(!required_chars_.empty());

  // Pretokenizer applied only in training time.
  // Pretokenizer is used as a constraint of piece extractions.
  const auto *pretokenizer = SentencePieceTrainer::GetPretokenizerForTraining();

  // Merges all sentences into one array with 0x0000 delimiter.
  std::vector<char32> array;
  absl::flat_hash_map<std::string, int64> all_chars;
  constexpr char32 kSentenceBoundary = 0x0000;

  for (const auto &w : sentences_) {
    const auto ut = string_util::UTF8ToUnicodeText(
        pretokenizer ? pretokenizer->PreTokenize(w.first) : w.first);
    for (const auto &c : ut) {
      array.push_back(c);
      if (c != kUNKChar && c != kSentenceBoundary) {
        all_chars[string_util::UnicodeCharToUTF8(c)] += w.second;
      }
    }
    array.push_back(kSentenceBoundary);  // sentence boundary marker.
  }

  CHECK_LE(array.size(),
           static_cast<size_t>(std::numeric_limits<node_int_type>::max()))
      << "Input corpus too large, try with train_extremely_large_corpus=true";
  const node_int_type n = array.size();

  std::vector<node_int_type> SA(n);  // suffix array
  std::vector<node_int_type> L(n);   // left boundaries of internal node
  std::vector<node_int_type> R(n);   // right boundaries of internal node
  std::vector<node_int_type> D(n);   // depths of internal node

  // Makes a suffix array to extract all sub strings occurring
  // more than 2 times in the sentence.
  constexpr node_int_type kAlphabetSize = 0x110000;  // All UCS4 range.
  node_int_type node_num = 0;
  LOG(INFO) << "Making suffix array...";
  CHECK_EQ(0, esaxx(array.begin(), SA.begin(), L.begin(), R.begin(), D.begin(),
                    n, kAlphabetSize, node_num));

  LOG(INFO) << "Extracting frequent sub strings...";
  std::vector<std::pair<node_int_type, node_int_type>> substr_index;
  for (node_int_type i = 0; i < node_num; ++i) {
    const node_int_type offset = SA[L[i]];
    const node_int_type len = D[i];
    if (len <= 1) {
      continue;
    }
    const char32 *begin = &array[0] + offset;
    const char32 *end = &array[0] + offset + len;
    // Skips if a substring contains a sentence boundary.
    if (std::find(begin, end, kSentenceBoundary) != end) {
      continue;
    }
    const UnicodeText uw(begin, end);
    if (!IsValidSentencePiece(uw)) {
      continue;
    }

    // character-wise coverage is the default score.
    const node_int_type freq = R[i] - L[i];
    const node_int_type score = freq * len;
    substr_index.emplace_back(i, score);
  }

  // all_chars must be included in the seed sentencepieces.
  TrainerModel::SentencePieces seed_sentencepieces;
  for (const auto &it : Sorted(all_chars)) {
    seed_sentencepieces.emplace_back(it);
  }

  // Sort by the coverage of sub strings.
  for (const auto &p : Sorted(substr_index)) {
    const node_int_type offset = SA[L[p.first]];
    const node_int_type len = D[p.first];
    CHECK_GT(len, 0);
    const char32 *begin = &array[offset];
    const char32 *end = &array[offset + len];
    const UnicodeText uw(begin, end);
    CHECK(IsValidSentencePiece(uw));  // just in case.
    const std::string w = string_util::UnicodeTextToUTF8(uw);
    if (seed_sentencepieces.size() ==
        static_cast<size_t>(trainer_spec_.seed_sentencepiece_size())) {
      break;
    }
    CHECK(!port::ContainsKey(all_chars, w));
    seed_sentencepieces.emplace_back(w, p.second);
  }

  ToLogProb(seed_sentencepieces.begin(), seed_sentencepieces.end());

  LOG(INFO) << "Initialized " << seed_sentencepieces.size()
            << " seed sentencepieces";

  return seed_sentencepieces;
}

std::vector<float> Trainer::RunEStep(const TrainerModel &model, float *obj,
                                     int64 *num_tokens) const {
  std::vector<std::vector<float>> expected(trainer_spec_.num_threads());
  std::vector<float> objs(trainer_spec_.num_threads(), 0.0);
  std::vector<int64> ntokens(trainer_spec_.num_threads(), 0.0);

  auto pool = absl::make_unique<ThreadPool>(trainer_spec_.num_threads());
  pool->StartWorkers();

  int64 all_sentence_freq = 0;
  for (const auto &w : sentences_) {
    all_sentence_freq += w.second;
  }

  // Executes E step in parallel
  for (int n = 0; n < trainer_spec_.num_threads(); ++n) {
    pool->Schedule([&, n]() {
      Lattice lattice;
      expected[n].resize(model.GetPieceSize(), 0.0);
      for (size_t i = n; i < sentences_.size();
           i += trainer_spec_.num_threads()) {
        const std::string &w = sentences_[i].first;
        const int64 freq = sentences_[i].second;
        lattice.SetSentence(w);
        model.PopulateNodes(&lattice);
        const float Z = lattice.PopulateMarginal(freq, &expected[n]);
        ntokens[n] += lattice.Viterbi().first.size();
        CHECK(!std::isnan(Z))
            << "likelihood is NAN. Input sentence may be too long";
        objs[n] -= Z / all_sentence_freq;
      }
    });
  }
  pool.reset(nullptr);

  // Merges expectations
  for (int n = 1; n < trainer_spec_.num_threads(); ++n) {
    objs[0] += objs[n];
    ntokens[0] += ntokens[n];
    for (size_t k = 0; k < expected[0].size(); ++k) {
      expected[0][k] += expected[n][k];
    }
  }

  *obj = objs[0];
  *num_tokens = ntokens[0];
  CHECK(!std::isnan(*obj));

  return expected[0];
}

TrainerModel::SentencePieces Trainer::RunMStep(
    const TrainerModel &model, const std::vector<float> &expected) const {
  const auto &sentencepieces = model.GetSentencePieces();
  CHECK_EQ(sentencepieces.size(), expected.size());
  TrainerModel::SentencePieces new_sentencepieces;

  float sum = 0.0;
  for (size_t i = 0; i < expected.size(); ++i) {
    const float freq = expected[i];

    // Filter infrequent sentencepieces here.
    constexpr float kExpectedFrequencyThreshold = 0.5;
    if (freq < kExpectedFrequencyThreshold) {
      continue;
    }

    new_sentencepieces.emplace_back(sentencepieces[i].first, freq);
    sum += freq;
  }

  // Here we do not use the original EM, but use the
  // Bayesianified/DPified EM algorithm.
  // https://cs.stanford.edu/~pliang/papers/tutorial-acl2007-talk.pdf
  // This modification will act as a sparse prior.
  const float logsum = Digamma(sum);
  for (auto &w : new_sentencepieces) {
    w.second = Digamma(w.second) - logsum;
  }

  return new_sentencepieces;
}

TrainerModel::SentencePieces Trainer::PruneSentencePieces(
    const TrainerModel &model) const {
  const auto &sentencepieces = model.GetSentencePieces();

  Lattice lattice;
  std::vector<bool> always_keep(sentencepieces.size(), true);
  std::vector<std::vector<int>> alternatives(sentencepieces.size());

  // First, segments the current sentencepieces to know
  // how each sentencepiece is resegmented if this sentencepiece is removed
  // from the vocabulary.
  // To do so, we take the second best segmentation of sentencepiece[i].
  // alternatives[i] stores the sequence of second best sentencepieces.
  for (size_t i = 0; i < sentencepieces.size(); ++i) {
    const auto &w = sentencepieces[i];
    lattice.SetSentence(w.first);
    model.PopulateNodes(&lattice);
    const auto nbests = lattice.NBest(2, false, 0.0);
    if (nbests.size() == 1) {
      // No second-best result is found. always keep this sentencepiece.
      always_keep[i] = true;
      continue;
    } else if (nbests[0].first.size() >= 2) {
      // Can safely remove this sentencepiece if its Viterbi path is split.
      always_keep[i] = false;
    } else if (nbests[0].first.size() == 1) {
      always_keep[i] = true;
      for (const auto *node : nbests[1].first) {
        alternatives[i].push_back(node->id);
      }
    }
  }

  // Second, segments all sentences to compute likelihood
  // with a unigram language model. inverted[i] stores
  // the set of sentence index where the sentencepieces[i] appears.
  float vsum = 0.0;
  std::vector<float> freq(sentencepieces.size(), 0.0);
  std::vector<std::vector<int>> inverted(sentencepieces.size());
  {
    std::vector<float> vsums(trainer_spec_.num_threads(), 0.0);
    std::vector<std::vector<float>> freqs(trainer_spec_.num_threads());
    std::vector<std::vector<std::vector<int>>> inverteds(
        trainer_spec_.num_threads());

    auto pool = absl::make_unique<ThreadPool>(trainer_spec_.num_threads());
    pool->StartWorkers();
    for (int n = 0; n < trainer_spec_.num_threads(); ++n) {
      freqs[n].resize(sentencepieces.size(), 0.0);
      inverteds[n].resize(sentencepieces.size());

      pool->Schedule([&, n]() {
        Lattice lattice;
        for (size_t i = n; i < sentences_.size();
             i += trainer_spec_.num_threads()) {
          const auto &w = sentences_[i];
          lattice.SetSentence(w.first);
          model.PopulateNodes(&lattice);
          vsums[n] += w.second;
          for (const auto *node : lattice.Viterbi().first) {
            if (node->id >= 0) {
              freqs[n][node->id] += w.second;
              inverteds[n][node->id].push_back(i);
            }
          }
        }
      });
    }
    pool.reset(nullptr);

    for (int n = 0; n < trainer_spec_.num_threads(); ++n) {
      vsum += vsums[n];
      for (size_t i = 0; i < sentencepieces.size(); ++i) {
        freq[i] += freqs[n][i];
        std::copy(inverteds[n][i].begin(), inverteds[n][i].end(),
                  std::back_inserter(inverted[i]));
      }
    }
  }

  const float sum = std::accumulate(freq.begin(), freq.end(), 0.0);
  const float logsum = std::log(static_cast<double>(sum));
  std::vector<std::pair<int, float>> candidates;
  TrainerModel::SentencePieces new_sentencepieces;

  // Finally, computes how likely the LM likelihood is reduced if
  // the sentencepiece[i] is removed from the vocabulary.
  // Since the exact computation of loss is difficult, we compute the
  // loss approximately by assuming that all sentencepiece[i] in the sentences
  // are replaced with alternatives[i] when sentencepiece[i] is removed.
  for (size_t i = 0; i < sentencepieces.size(); ++i) {
    if (freq[i] == 0 || !always_keep[i]) {
      // not found in Viterbi path. Can remove this entry safely.
      continue;
    } else if (alternatives[i].empty()) {
      // no alternatives. Keeps this entry.
      new_sentencepieces.push_back(sentencepieces[i]);
    } else {
      float F = 0.0;  // the frequency of sentencepieces[i].
      for (const int n : inverted[i]) {
        F += sentences_[n].second;
      }
      F /= vsum;  // normalizes by all sentence frequency.

      // The logprob with the sentencepiece[i].
      const float logprob_sp = std::log(static_cast<double>(freq[i])) - logsum;

      // After removing the sentencepiece[i], its frequency freq[i] is
      // re-assigned to alternatives.
      // new_sum = current_sum - freq[i] + freq[i] * alternatives.size()
      //         = current_sum + freq[i] (alternatives - 1)
      const float logsum_alt = std::log(
          static_cast<double>(sum + freq[i] * (alternatives.size() - 1)));

      // The frequencies of altenatives are increased by freq[i].
      float logprob_alt = 0.0;
      for (const int n : alternatives[i]) {
        logprob_alt +=
            (std::log(static_cast<double>(freq[n] + freq[i])) - logsum_alt);
      }

      // loss: the diff of likelihood after removing the sentencepieces[i].
      const float loss = F * (logprob_sp - logprob_alt);
      candidates.emplace_back(i, loss);
    }
  }

  const int pruned_size =
      std::max<int>(desired_vocab_size_,
                    trainer_spec_.shrinking_factor() * sentencepieces.size());

  // Keeps trainer_spec_.shrinking_factor * sentencepieces.size() pieces.
  // shrinking_factor is 0.75 by default.
  for (const auto &w : Sorted(candidates)) {
    if (new_sentencepieces.size() == static_cast<size_t>(pruned_size)) {
      break;
    }
    new_sentencepieces.emplace_back(sentencepieces[w.first]);
  }

  return new_sentencepieces;
}

TrainerModel::SentencePieces Trainer::FinalizeSentencePieces(
    const TrainerModel &model) const {
  const auto &sentencepieces = model.GetSentencePieces();
  absl::flat_hash_map<std::string, float> final_sentencepieces;
  absl::flat_hash_map<std::string, float> sp(sentencepieces.begin(),
                                             sentencepieces.end());

  // required_chars_ must be included in the final sentencepieces.
  float min_score_penalty = 0.0;
  constexpr float kMinScorePenaltyDelta = 0.0001;
  for (const auto &w : Sorted(required_chars_)) {
    const std::string s = string_util::UnicodeCharToUTF8(w.first);
    if (port::ContainsKey(sp, s)) {
      final_sentencepieces[s] = sp[s];
    } else {
      // Add penalty to avoid required pieces from having the same score.
      // Since the required_chars_ is sorted, frequent pieces have
      // less penalties.
      final_sentencepieces[s] = model.min_score() + min_score_penalty;
      min_score_penalty += kMinScorePenaltyDelta;
    }
  }

  const int vocab_size_size = trainer_spec_.vocab_size() - meta_pieces_.size();
  CHECK_GT(vocab_size_size, 0);

  // Then keeps sentencepieces with higher scores.
  for (const auto &w : Sorted(sentencepieces)) {
    if (port::ContainsKey(final_sentencepieces, w.first)) {
      continue;
    }
    if (static_cast<size_t>(vocab_size_size) == final_sentencepieces.size()) {
      break;
    }
    final_sentencepieces[w.first] = w.second;
  }

  return Sorted(final_sentencepieces);
}

util::Status Trainer::Train() {
  RETURN_IF_ERROR(status());

  CHECK_EQ_OR_RETURN(TrainerSpec::UNIGRAM, trainer_spec_.model_type());
  CHECK_OR_RETURN(normalizer_spec_.escape_whitespaces());

  TrainerModel model(trainer_spec_, normalizer_spec_);

  RETURN_IF_ERROR(model.status());
  RETURN_IF_ERROR(LoadSentences());

  auto seed_sentencepieces = MakeSeedSentencePieces();
  model.SetSentencePieces(std::move(seed_sentencepieces));

  if (trainer_spec_.split_by_whitespace()) {
    SplitSentencesByWhitespace();
  }

  LOG(INFO) << "Using " << sentences_.size() << " sentences for EM training";

  desired_vocab_size_ = static_cast<size_t>(trainer_spec_.vocab_size() * 1.1);

  while (true) {
    // Sub-EM iteration.
    for (int iter = 0; iter < trainer_spec_.num_sub_iterations(); ++iter) {
      // Executes E step
      float objective = 0.0;
      int64 num_tokens = 0;
      const auto expected = RunEStep(model, &objective, &num_tokens);

      // Executes M step.
      auto new_sentencepieces = RunMStep(model, expected);
      model.SetSentencePieces(std::move(new_sentencepieces));

      LOG(INFO) << "EM sub_iter=" << iter << " size=" << model.GetPieceSize()
                << " obj=" << objective << " num_tokens=" << num_tokens
                << " num_tokens/piece="
                << 1.0 * num_tokens / model.GetPieceSize();
    }  // end of Sub EM iteration

    // Stops the iteration when the size of sentences reaches to the
    // desired symbol size.
    if (model.GetPieceSize() <= desired_vocab_size_) {
      break;
    }

    // Prunes pieces.
    auto new_sentencepieces = PruneSentencePieces(model);
    model.SetSentencePieces(std::move(new_sentencepieces));
  }  // end of EM iteration

  // Finally, adjusts the size of sentencepices to be |vocab_size|.
  final_pieces_ = FinalizeSentencePieces(model);

  return Save();
}
}  // namespace unigram
}  // namespace sentencepiece


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

<TITLE>
CbService.CbSensorStreamer
</TITLE>

<META NAME="date" CONTENT="2014-05-22">

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

      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

ca.cumulonimbus.pressurenetsdk

Class CbService.CbSensorStreamer

java.lang.Object
  ca.cumulonimbus.pressurenetsdk.CbService.CbSensorStreamer

Enclosing class:
CbService

public class CbService.CbSensorStreamer
extends java.lang.Object

Collect data from onboard sensors and store locally

Author:

jacob

Field Summary

 int
sensorId

Constructor Summary

CbService.CbSensorStreamer(int id,
                           Messenger reply)

Method Summary

 void
onAccuracyChanged(Sensor sensor,
                  int accuracy)

 void
onSensorChanged(SensorEvent event)

 void
startSendingData()

          Start collecting sensor data.

 void
stopSendingData()

          Stop collecting sensor data

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

sensorId

public int sensorId

Constructor Detail

CbService.CbSensorStreamer

public CbService.CbSensorStreamer(int id,
                                  Messenger reply)

Method Detail

startSendingData

public void startSendingData()

Start collecting sensor data.

Parameters:
m -

stopSendingData

public void stopSendingData()

Stop collecting sensor data

onAccuracyChanged

public void onAccuracyChanged(Sensor sensor,
                              int accuracy)

onSensorChanged

public void onSensorChanged(SensorEvent event)

      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
import React, { memo, useMemo } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import isEqual from 'react-fast-compare';
import { useIntl } from 'react-intl';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Accordion, AccordionToggle, AccordionContent } from '@strapi/design-system/Accordion';
import { IconButton } from '@strapi/design-system/IconButton';
import { FocusTrap } from '@strapi/design-system/FocusTrap';
import { Box } from '@strapi/design-system/Box';
import { Stack } from '@strapi/design-system/Stack';
import Trash from '@strapi/icons/Trash';
import ArrowDown from '@strapi/icons/ArrowDown';
import ArrowUp from '@strapi/icons/ArrowUp';
import { useContentTypeLayout } from '../../../../hooks';
import { getTrad } from '../../../../utils';
import FieldComponent from '../../../FieldComponent';
import Rectangle from './Rectangle';

const ActionStack = styled(Stack)`
  svg {
    path {
      fill: ${({ theme, expanded }) =>
        expanded ? theme.colors.primary600 : theme.colors.neutral600};
    }
  }
`;

const IconButtonCustom = styled(IconButton)`
  background-color: transparent;
`;

const StyledBox = styled(Box)`
  > div:first-child {
    box-shadow: ${({ theme }) => theme.shadows.tableShadow};
  }
`;

const AccordionContentRadius = styled(Box)`
  border-radius: 0 0 ${({ theme }) => theme.spaces[1]} ${({ theme }) => theme.spaces[1]};
`;

const Component = ({
  componentUid,
  formErrors,
  index,
  isOpen,
  isFieldAllowed,
  moveComponentDown,
  moveComponentUp,
  name,
  onToggle,
  removeComponentFromDynamicZone,
  showDownIcon,
  showUpIcon,
}) => {
  const { formatMessage } = useIntl();
  const { getComponentLayout } = useContentTypeLayout();
  const { icon, friendlyName } = useMemo(() => {
    const {
      info: { icon, displayName },
    } = getComponentLayout(componentUid);

    return { friendlyName: displayName, icon };
  }, [componentUid, getComponentLayout]);

  const handleMoveComponentDown = () => moveComponentDown(name, index);

  const handleMoveComponentUp = () => moveComponentUp(name, index);

  const handleRemove = () => removeComponentFromDynamicZone(name, index);

  const downLabel = formatMessage({
    id: getTrad('components.DynamicZone.move-down-label'),
    defaultMessage: 'Move component down',
  });
  const upLabel = formatMessage({
    id: getTrad('components.DynamicZone.move-up-label'),
    defaultMessage: 'Move component down',
  });
  const deleteLabel = formatMessage(
    {
      id: getTrad('components.DynamicZone.delete-label'),
      defaultMessage: 'Delete {name}',
    },
    { name: friendlyName }
  );

  const formErrorsKeys = Object.keys(formErrors);

  const fieldsErrors = formErrorsKeys.filter(errorKey => {
    const errorKeysArray = errorKey.split('.');

    if (`${errorKeysArray[0]}.${errorKeysArray[1]}` === `${name}.${index}`) {
      return true;
    }

    return false;
  });

  let errorMessage;

  if (fieldsErrors.length > 0) {
    errorMessage = formatMessage({
      id: getTrad('components.DynamicZone.error-message'),
      defaultMessage: 'The component contains error(s)',
    });
  }

  return (
    <Box>
      <Rectangle />
      <StyledBox hasRadius>
        <Accordion expanded={isOpen} onToggle={() => onToggle(index)} size="S" error={errorMessage}>
          <AccordionToggle
            startIcon={<FontAwesomeIcon icon={icon} />}
            action={
              <ActionStack horizontal spacing={0} expanded={isOpen}>
                {showDownIcon && (
                  <IconButtonCustom
                    noBorder
                    label={downLabel}
                    onClick={handleMoveComponentDown}
                    icon={<ArrowDown />}
                  />
                )}
                {showUpIcon && (
                  <IconButtonCustom
                    noBorder
                    label={upLabel}
                    onClick={handleMoveComponentUp}
                    icon={<ArrowUp />}
                  />
                )}
                {isFieldAllowed && (
                  <IconButtonCustom
                    noBorder
                    label={deleteLabel}
                    onClick={handleRemove}
                    icon={<Trash />}
                  />
                )}
              </ActionStack>
            }
            title={friendlyName}
            togglePosition="left"
          />
          <AccordionContent>
            <AccordionContentRadius background="neutral0">
              <FocusTrap onEscape={() => onToggle(index)}>
                <FieldComponent
                  componentUid={componentUid}
                  icon={icon}
                  name={`${name}.${index}`}
                  isFromDynamicZone
                />
              </FocusTrap>
            </AccordionContentRadius>
          </AccordionContent>
        </Accordion>
      </StyledBox>
    </Box>
  );
};

Component.propTypes = {
  componentUid: PropTypes.string.isRequired,
  formErrors: PropTypes.object.isRequired,
  index: PropTypes.number.isRequired,
  isFieldAllowed: PropTypes.bool.isRequired,
  isOpen: PropTypes.bool.isRequired,
  moveComponentDown: PropTypes.func.isRequired,
  moveComponentUp: PropTypes.func.isRequired,
  name: PropTypes.string.isRequired,
  onToggle: PropTypes.func.isRequired,
  removeComponentFromDynamicZone: PropTypes.func.isRequired,
  showDownIcon: PropTypes.bool.isRequired,
  showUpIcon: PropTypes.bool.isRequired,
};

export default memo(Component, isEqual);


text:
package com.leaf.gankio.utils;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.target.SimpleTarget;
import com.leaf.gankio.R;

/**
 * @author :  Leaf<br>
 * @date : 2016/6/8 12:10
 * @TODO : ...
 */

public class GlideBuilderTool {

    private GlideBuilderTool() {
    }

    private static class SingletonHolder {
        public final static GlideBuilderTool instance = new GlideBuilderTool();
    }

    public static GlideBuilderTool getInstance() {
        return SingletonHolder.instance;
    }

    public void loadImg(Context context, String url, ImageView imageView) {
        Glide.with(context).load(url)
                .centerCrop()
                .placeholder(R.mipmap.ic_default_load_bg)
                .error(R.mipmap.ic_default_fail_bg)
                //.diskCacheStrategy( DiskCacheStrategy.SOURCE )
                //.skipMemoryCache( true )
                .into(imageView);

        /*DiskCacheStrategy.NONE 什么都不缓存
        DiskCacheStrategy.SOURCE 仅仅只缓存原来的全分辨率的图像。在我们上面的例子中,将会只有一个 1000x1000 像素的图片
        DiskCacheStrategy.RESULT 仅仅缓存最终的图像,即,降低分辨率后的(或者是转换后的)
        DiskCacheStrategy.ALL 缓存所有版本的图像(默认行为)*/
    }

    /**
     * 加载第三方imgview
     *
     * @param context
     * @param url
     * @param imageView
     * @param placeholder
     */
    public void loadImgOfThird(Context context, String url, ImageView imageView, int placeholder) {
        Glide.with(context).load(url)
                .dontAnimate()
                .centerCrop()
                .placeholder(placeholder)
                //.diskCacheStrategy( DiskCacheStrategy.SOURCE )
                .into(imageView/*new SimpleTarget<GlideDrawable>() {
                    @Override
                    public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {

                    }

                    @Override
                    public void onLoadCleared(Drawable placeholder) {
                        super.onLoadCleared(placeholder);
                    }

                    @Override
                    public void onLoadFailed(Exception e, Drawable errorDrawable) {
                        super.onLoadFailed(e, errorDrawable);
                    }

                    @Override
                    public void onLoadStarted(Drawable placeholder) {
                        super.onLoadStarted(placeholder);
                    }
                }*/);
    }

    /**
     * 回掉
     *
     * @param context
     * @param url
     * @param placeholder
     * @param simpleTarget
     */
    public void loadImgOfThird(Context context, String url, int placeholder, SimpleTarget<GlideDrawable> simpleTarget) {
        Glide.with(context).load(url)
                .dontAnimate()
                .centerCrop()
                .placeholder(placeholder)
                .into(simpleTarget);
    }

    /**
     * 圆形Img
     *
     * @param context
     * @param url
     * @param imageView
     */
    public void loadCircleImg(final Context context, String url, final ImageView imageView) {
        Glide.with(context)
                .load(url)
                .placeholder(R.mipmap.ic_default_load_bg)
                .transform(new GlideCircleTransform(context))
                .crossFade()
                .into(imageView);

    }

    /**
     * 圆形头像
     *
     * @param context
     * @param url
     * @param imageView
     */
    public void loadCircleAvatar(final Context context, String url, final ImageView imageView) {
        Glide.with(context)
                .load(url)
                .placeholder(R.mipmap.mine_avatar_normal)
                .transform(new GlideCircleTransform(context))
                .crossFade()
                //.diskCacheStrategy( DiskCacheStrategy.SOURCE )
                .into(imageView);

    }

    /**
     * 清楚缓存
     *
     * @param context
     */
    public void clearMemory(Context context) {
        Glide.get(context).clearMemory();
    }

    /**
     * 清楚磁盘缓存
     *
     * @param context
     */
    public void clearDiskCache(Context context) {
        Glide.get(context).clearDiskCache();
    }
}


text:
function block_size = decide_max_block_size_RBM(para)

if para.useGPU == 1
    gpu = gpuDevice;
    GPU_max_memory =  gpu.FreeMemory/8; % This is the maximum number of double precision numbers that can be stored in the GPU
    % Compute how much training data can we put into GPU
    inputDim = para.layerSize(1);
    outputDim = para.layerSize(end);
    max_sample = GPU_max_memory / (inputDim + outputDim);
    block_size = max_sample / 5;   % Let's be conservative, don't use all the memory of GPU
else
    block_size = 1e5;
end


text:
import warnings

def warn_deprecated(method, deprecated_method_name):
    def deprecated_method(*args, **kwargs):
        warnings.warn("'%s' is deprecated, use '%s' instead." % (deprecated_method_name, method.__name__), DeprecationWarning, stacklevel=2)
        return method(*args, **kwargs)
    return deprecated_method

def deprecate_driver_class(cls, message):
    def new_init(self, *args, **kwargs):
        cls.__init__(self, *args, **kwargs)
        warnings.warn(message, DeprecationWarning, stacklevel=3)

    cls_dict = dict(cls.__dict__)
    cls_dict['__init__'] = new_init
    return type("Deprecated%s" % cls.__name__, (cls,), cls_dict)