text:
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
// Licensed under the Apache License, Version 2.0.

using System;
using System.IO;
using ImageMagick;
using Xunit;

namespace Magick.NET.Tests
{
    public partial class MagickImageCollectionTests
    {
        public partial class ThePingMethod
        {
            public class WithByteArray
            {
                [Fact]
                public void ShouldThrowExceptionWhenArrayIsNull()
                {
                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentNullException>("data", () => images.Ping((byte[])null));
                    }
                }

                [Fact]
                public void ShouldThrowExceptionWhenArrayIsEmpty()
                {
                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentException>("data", () => images.Ping(Array.Empty<byte>()));
                    }
                }

                [Fact]
                public void ShouldResetTheFormatAfterReading()
                {
                    var settings = new MagickReadSettings
                    {
                        Format = MagickFormat.Png,
                    };

                    var bytes = File.ReadAllBytes(Files.CirclePNG);

                    using (var images = new MagickImageCollection())
                    {
                        images.Ping(bytes, settings);

                        Assert.Equal(MagickFormat.Unknown, images[0].Settings.Format);
                        Assert.Throws<InvalidOperationException>(() => images[0].GetPixelsUnsafe());
                    }
                }
            }

            public class WithByteArrayAndOffset
            {
                [Fact]
                public void ShouldThrowExceptionWhenArrayIsNull()
                {
                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentNullException>("data", () => images.Ping(null, 0, 0));
                    }
                }

                [Fact]
                public void ShouldThrowExceptionWhenArrayIsEmpty()
                {
                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentException>("data", () => images.Ping(Array.Empty<byte>(), 0, 0));
                    }
                }

                [Fact]
                public void ShouldThrowExceptionWhenOffsetIsNegative()
                {
                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentException>("offset", () => images.Ping(new byte[] { 215 }, -1, 0));
                    }
                }

                [Fact]
                public void ShouldThrowExceptionWhenCountIsZero()
                {
                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentException>("count", () => images.Ping(new byte[] { 215 }, 0, 0));
                    }
                }

                [Fact]
                public void ShouldThrowExceptionWhenCountIsNegative()
                {
                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentException>("count", () => images.Ping(new byte[] { 215 }, 0, -1));
                    }
                }

                [Fact]
                public void ShouldPingImage()
                {
                    using (var images = new MagickImageCollection())
                    {
                        var fileBytes = File.ReadAllBytes(Files.SnakewarePNG);
                        var bytes = new byte[fileBytes.Length + 10];
                        fileBytes.CopyTo(bytes, 10);

                        images.Ping(bytes, 10, bytes.Length - 10);
                        Assert.Single(images);
                        Assert.Throws<InvalidOperationException>(() => images[0].GetPixelsUnsafe());
                    }
                }
            }

            public class WithByteArrayAndOffsetAndMagickReadSettings
            {
                [Fact]
                public void ShouldThrowExceptionWhenArrayIsNull()
                {
                    var settings = new MagickReadSettings();

                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentNullException>("data", () => images.Ping(null, 0, 0, settings));
                    }
                }

                [Fact]
                public void ShouldThrowExceptionWhenArrayIsEmpty()
                {
                    var settings = new MagickReadSettings();

                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentException>("data", () => images.Ping(Array.Empty<byte>(), 0, 0, settings));
                    }
                }

                [Fact]
                public void ShouldThrowExceptionWhenOffsetIsNegative()
                {
                    var settings = new MagickReadSettings();

                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentException>("offset", () => images.Ping(new byte[] { 215 }, -1, 0, settings));
                    }
                }

                [Fact]
                public void ShouldThrowExceptionWhenCountIsZero()
                {
                    var settings = new MagickReadSettings();

                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentException>("count", () => images.Ping(new byte[] { 215 }, 0, 0, settings));
                    }
                }

                [Fact]
                public void ShouldThrowExceptionWhenCountIsNegative()
                {
                    var settings = new MagickReadSettings();

                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentException>("count", () => images.Ping(new byte[] { 215 }, 0, -1, settings));
                    }
                }

                [Fact]
                public void ShouldPingImage()
                {
                    var settings = new MagickReadSettings();

                    var fileBytes = File.ReadAllBytes(Files.SnakewarePNG);
                    var bytes = new byte[fileBytes.Length + 10];
                    fileBytes.CopyTo(bytes, 10);

                    using (var images = new MagickImageCollection())
                    {
                        images.Ping(bytes, 10, bytes.Length - 10, settings);
                        Assert.Single(images);
                        Assert.Throws<InvalidOperationException>(() => images[0].GetPixelsUnsafe());
                    }
                }

                [Fact]
                public void ShouldNotThrowExceptionWhenSettingsIsNull()
                {
                    var bytes = File.ReadAllBytes(Files.CirclePNG);

                    using (var images = new MagickImageCollection())
                    {
                        images.Ping(bytes, 0, bytes.Length, null);
                        Assert.Throws<InvalidOperationException>(() => images[0].GetPixelsUnsafe());
                    }
                }
            }

            public class WithByteArrayAndMagickReadSettings
            {
                [Fact]
                public void ShouldNotThrowExceptionWhenSettingsIsNull()
                {
                    var bytes = File.ReadAllBytes(Files.SnakewarePNG);

                    using (var images = new MagickImageCollection())
                    {
                        images.Ping(bytes, null);

                        Assert.Single(images);
                        Assert.Throws<InvalidOperationException>(() => images[0].GetPixelsUnsafe());
                    }
                }
            }

            public class WithFileInfo
            {
                [Fact]
                public void ShouldThrowExceptionWhenFileInfoIsNull()
                {
                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentNullException>("file", () => images.Ping((FileInfo)null));
                    }
                }
            }

            public class WithFileInfoAndMagickReadSettings
            {
                [Fact]
                public void ShouldNotThrowExceptionWhenSettingsIsNull()
                {
                    var file = new FileInfo(Files.SnakewarePNG);

                    using (var images = new MagickImageCollection())
                    {
                        images.Ping(file, null);

                        Assert.Single(images);
                        Assert.Throws<InvalidOperationException>(() => images[0].GetPixelsUnsafe());
                    }
                }
            }

            public class WithFileName
            {
                [Fact]
                public void ShouldThrowExceptionWhenFileNameIsNull()
                {
                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentNullException>("fileName", () => images.Ping((string)null));
                    }
                }

                [Fact]
                public void ShouldThrowExceptionWhenFileNameIsEmpty()
                {
                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentException>("fileName", () => images.Ping(string.Empty));
                    }
                }

                [Fact]
                public void ShouldThrowExceptionWhenFileNameIsInvalid()
                {
                    using (var images = new MagickImageCollection())
                    {
                        var exception = Assert.Throws<MagickBlobErrorException>(() => images.Ping(Files.Missing));

                        Assert.Contains("error/blob.c/OpenBlob", exception.Message);
                    }
                }

                [Fact]
                public void ShouldResetTheFormatAfterReading()
                {
                    var settings = new MagickReadSettings
                    {
                        Format = MagickFormat.Png,
                    };

                    using (var images = new MagickImageCollection())
                    {
                        images.Ping(Files.CirclePNG, settings);

                        Assert.Equal(MagickFormat.Unknown, images[0].Settings.Format);
                        Assert.Throws<InvalidOperationException>(() => images[0].GetPixelsUnsafe());
                    }
                }
            }

            public class WithFileNameAndMagickReadSettings
            {
                [Fact]
                public void ShouldNotThrowExceptionWhenFileNameSettingsIsNull()
                {
                    using (var images = new MagickImageCollection())
                    {
                        images.Ping(Files.SnakewarePNG, null);

                        Assert.Single(images);
                        Assert.Throws<InvalidOperationException>(() => images[0].GetPixelsUnsafe());
                    }
                }

                [Fact]
                public void ShouldUseTheReadSettings()
                {
                    var settings = new MagickReadSettings
                    {
                        FontFamily = "Courier New",
                        FillColor = MagickColors.Gold,
                        FontPointsize = 80,
                        Format = MagickFormat.Text,
                        TextGravity = Gravity.Center,
                    };

                    using (var images = new MagickImageCollection())
                    {
                        images.Ping(Files.ImageMagickTXT, settings);

                        Assert.Equal(2, images.Count);
                    }
                }
            }

            public class WithStream
            {
                [Fact]
                public void ShouldThrowExceptionWhenStreamIsNull()
                {
                    using (var images = new MagickImageCollection())
                    {
                        Assert.Throws<ArgumentNullException>("stream", () => images.Ping((Stream)null));
                    }
                }

                [Fact]
                public void ShouldResetTheFormatAfterReading()
                {
                    var settings = new MagickReadSettings
                    {
                        Format = MagickFormat.Png,
                    };

                    using (var stream = File.OpenRead(Files.CirclePNG))
                    {
                        using (var images = new MagickImageCollection())
                        {
                            images.Ping(stream, settings);

                            Assert.Equal(MagickFormat.Unknown, images[0].Settings.Format);
                            Assert.Throws<InvalidOperationException>(() => images[0].GetPixelsUnsafe());
                        }
                    }
                }
            }

            public class WithStreamAndMagickReadSettings
            {
                [Fact]
                public void ShouldNotThrowExceptionWhenStreamSettingsIsNull()
                {
                    using (var stream = File.OpenRead(Files.SnakewarePNG))
                    {
                        using (var images = new MagickImageCollection())
                        {
                            images.Ping(stream, null);

                            Assert.Single(images);
                            Assert.Throws<InvalidOperationException>(() => images[0].GetPixelsUnsafe());
                        }
                    }
                }
            }
        }
    }
}


text:
"""This package is deprecated. Please use `airflow.utils`."""
from __future__ import annotations

import warnings

from airflow.exceptions import RemovedInAirflow3Warning
from airflow.utils.deprecation_tools import add_deprecated_classes

warnings.warn(
    "This module is deprecated. Please use `airflow.utils`.",
    RemovedInAirflow3Warning,
    stacklevel=2
)

__deprecated_classes = {
    'gcp_field_sanitizer': {
        'GcpBodyFieldSanitizer': 'airflow.providers.google.cloud.utils.field_sanitizer.GcpBodyFieldSanitizer',
        'GcpFieldSanitizerException': (
            'airflow.providers.google.cloud.utils.field_sanitizer.GcpFieldSanitizerException'
        ),
    },
    'gcp_field_validator': {
        'GcpBodyFieldValidator': 'airflow.providers.google.cloud.utils.field_validator.GcpBodyFieldValidator',
        'GcpFieldValidationException': (
            'airflow.providers.google.cloud.utils.field_validator.GcpFieldValidationException'
        ),
        'GcpValidationSpecificationException': (
            'airflow.providers.google.cloud.utils.field_validator.GcpValidationSpecificationException'
        ),
    },
    'mlengine_operator_utils': {
        'create_evaluate_ops': (
            'airflow.providers.google.cloud.utils.mlengine_operator_utils.create_evaluate_ops'
        ),
    },
    'mlengine_prediction_summary': {
        'JsonCoder': 'airflow.providers.google.cloud.utils.mlengine_prediction_summary.JsonCoder',
        'MakeSummary': 'airflow.providers.google.cloud.utils.mlengine_prediction_summary.MakeSummary',
    },
    'sendgrid': {
        'import_string': 'airflow.utils.module_loading.import_string',
    },
    'weekday': {
        'WeekDay': 'airflow.utils.weekday.WeekDay',
    },
}

add_deprecated_classes(__deprecated_classes, __name__)

redpajama_set_name: RedPajamaGithub


text:
{% if messages %}
    {% for message in messages %}

            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                ×
            </button>
            »» {{ message }}

    {% endfor %}
{% endif %}


text:
/**
 layer 构建
*/

var pkg = require('./package.json');

var gulp = require('gulp');
var uglify = require('gulp-uglify');
var minify = require('gulp-minify-css');
var rename = require('gulp-rename');
var header = require('gulp-header');
var del = require('del');

var task = {
  layer: function() {
    gulp.src('./src/**/*.css')
    .pipe(minify({
      compatibility: 'ie7'
    }))
    .pipe(gulp.dest('./dist'));

    return gulp.src('./src/layer.js').pipe(uglify({
      output: {
        ascii_only: true //escape Unicode characters in strings and regexps
      }
    }))
     .pipe(header('/*! <%= pkg.realname %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> License */\n ;', {pkg: pkg}))
    .pipe(gulp.dest('./dist'));

  }
  ,mobile: function() {
    return gulp.src('./src/mobile/layer.js').pipe(uglify({
      output: {
        ascii_only: true //escape Unicode characters in strings and regexps
      }
    }))
     .pipe(header('/*! <%= pkg.realname %> mobile-v<%= pkg.mobile %> <%= pkg.description %> <%= pkg.license %> License */\n ;', {pkg: pkg}))
    .pipe(gulp.dest('./dist/mobile'));
  }
  ,other: function(){
    gulp.src('./src/**/*.{png,gif}').pipe(rename({}))
    .pipe(gulp.dest('./dist'));
  }
};

gulp.task('clear', function(cb){ //清理
  return del(['./dist/*'], cb);
});
gulp.task('layer', task.minjs); //压缩PC版本
gulp.task('mobile', task.mincss); //压缩Mobile文件
gulp.task('other', task.other); //移动一些配件

//发行版本目录
var releaseDir = './release/zip/layer-v' + pkg.version;
var release = releaseDir + '/layer';

//打包发行版
gulp.task('clearZip', function(cb){ //清理
  return del([releaseDir], cb);
});
gulp.task('r', ['clearZip'], function(){
  gulp.src('./release/doc/**/*')
  .pipe(gulp.dest(releaseDir));

  return gulp.src([
    './dist/**/*'
    ,'!./dist/**/moon'
    ,'!./dist/**/moon/*'
  ])
  .pipe(gulp.dest(release));
});

//全部
gulp.task('default', ['clear'], function(){
  for(var key in task){
    task[key]();
  }
});


text:
require 'test_helper'

class CommentTest < ActiveSupport::TestCase
  def setup
    @comment = comments(:user_tom_comment_under_review)
  end

  test "validate empty comment" do
    comment = Comment.new
    assert comment.invalid?
    assert comment.errors[:content].any?
  end

  test "validate comment content maxlength" do
    content = ""
    10.times do
      content = @comment.content + content
    end
    @comment.content = content
    assert @comment.valid?
    assert @comment.errors[:content].empty?
    @comment.content = @comment.content + "a"
    assert @comment.invalid?
    assert @comment.errors[:content].any?
  end

end


text:
//Copyright 2016-2017 Beate Ottenwälder
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.

package routing

import (
	golook "github.com/ottenwbe/golook/broker/runtime/core"
	"github.com/ottenwbe/golook/utils"
	log "github.com/sirupsen/logrus"
)

type (
	/*Source represents the source of a message. This source has an id which is typically incremented and a system name*/
	Source struct {
		ID     int    `json:"id"`
		System string `json:"system"`
		//TODO key instead of system
	}

	/*Destination represents the destination in form of a key.*/
	Destination struct {
		Key Key `json:"key"`
	}

	/*Params definition*/
	Params string

	/*RequestMessage represents the generic request from a peer to the next*/
	RequestMessage struct {
		Src    Source      `json:"source"`
		Dst    Destination `json:"destination"`
		Method string      `json:"method"`
		Params Params      `json:"params"`
	}

	/*ResponseMessage represents the generic response to a given request message. The corresponding request can be identified by the RequestSrc field.*/
	ResponseMessage struct {
		RequestSrc  Source `json:"receiver_source"`
		ResponseSrc Source `json:"response_source"`
		Params      Params `json:"params"`
	}
)

/*
NewRequestMessage is the factory function for request messages
*/
func NewRequestMessage(key Key, reqID int, method string, params interface{}) (*RequestMessage, error) {
	p, err := utils.MarshalS(params)
	if err != nil {
		return nil, err
	}
	return &RequestMessage{
		Method: method,
		Params: Params(p),
		Dst:    Destination{Key: key},
		Src:    Source{ID: reqID, System: golook.GolookSystem.UUID},
	}, nil
}

/*
NewResponseMessage is the factory function for response messages
*/
func NewResponseMessage(src Source, params interface{}) (*ResponseMessage, error) {
	p, err := utils.MarshalS(params)
	if err != nil {
		return nil, err
	}
	return &ResponseMessage{
		RequestSrc:  src,
		ResponseSrc: Source{ID: 0, System: golook.GolookSystem.UUID},
		Params:      Params(p),
	}, nil
}

/*
Unmarshal a parameter.
*/
func (p Params) Unmarshal(v interface{}) error {
	log.Debugf("Unmarshalling: %s", string(p))
	err := utils.Unmarshal(string(p), v)
	return err
}

/*
GetEncapsulated returns the encapsulated content of a (rpc) message. To this end, v is an in/out parameter.

Example:
m, _ := NewRequestMessage("method", "msg")
var s string
m.GetEncapsulated(&s)
*/
func (m *RequestMessage) GetEncapsulated(v interface{}) error {
	return utils.Unmarshal(string(m.Params), v)
}


text:
// These values are ordered so that SelectionState.POINT has the highest value.
// As Path#_selectedSegmentState is the addition of all segment's states, and is
// used to see if all segments are fully selected, meaning they are set to
// SelectionState.POINT.
var SelectionState = {
	HANDLE_IN: 1,
	HANDLE_OUT: 2,
	POINT: 4
};


text:
layout: post
title: "Top 10 Movies Fit For Friday the 13th"
categories: top10s
excerpt: "Top 10"
comments: false
share: true
---

# 10. Halloween

![](http://cdn.bloody-disgusting.com/wp-content/uploads/2016/10/halloween-poster-face.jpg)

Friday the 13th; a spooky time for all. Some people even stay home because of the pending doom that lies awaiting for them if they leave their house. So to capture this eerie and overall frightening day, I think Halloween is a good start. Yes, I know, this movie is probably more appropriate for Halloween. Because, well, the name is Halloween. Maybe that is why it is not higher on the list. But it is a good horror flick. It is also based on the true story of Michael Myers, who killed people then made Wayne's World. Very chilling indeed.

# 9. Cabin in the Woods

![](http://www.thterrortime.com/wp-content/uploads/2016/04/Cabin-in-the-woods.jpg)

Now I have never seen this movie, but I heard it was good. I really haven't seen many horror films (personally the genre is silly to me) so I needed to fill out this list somehow. If you want to get freaked out on the 13th and have a few laughs, this movie will do the trick. Or at least I think so. Or so I've been told. Or whatever. Just watch it. And tell me about it later.

# 8. Saw

![](http://static.tvtropes.org/pmwiki/pub/images/saw12.jpg)

I have actually seen this one, and it's pretty damn good. It has a nice eerie feel to it, a lot of mystery, and I can honestly say I did NOT expect the ending. Also, unlike the subsequent Saw movies, this one builds suspense and tension with cleverness and not just with simple unabashed gore or disgusting situations.

# 7. Love Actually

![](https://www.uphe.com/sites/default/files/2015/04/Love-Actually-Gallery-2.jpg)

There is nothing more frightening to me than people thinking this movie is good. It is simply awful in every single way. The characters are all idiots, the situations are completely moronic, and it is overall one of the stupidest films I have ever seen. Ever!! The fact this movie has a following scares the living hell out of me. And every time I see bits and pieces of it, I am reminded of that.

# 6. Freaks

![](http://gonewiththetwins.com/new/wp-content/uploads/2014/08/freaks.jpg)

If you are a horror movie aficionado, you have to see Freaks. The premise in itself is not terrifying; just a bunch of circus freaks wandering around on camera. But the thing is that they are real freaks. REAL FREAKS! I know, huh. It is really weird seeing this. And seeing them try to act is also very off-putting. This entire film makes me uneasy, from beginning to end. In fact, I don't even remember what it is about; think there is some love story in there or something. But I will not forget the feeling this movie gives me. There is no substitution for authenticity.

# 5. Texas Chainsaw Massacre

![](https://vignette.wikia.nocookie.net/cinemorgue/images/a/ab/Sfsg.jpg/revision/latest?cb=20161006212350)

I saw this movie for the first time at a local theater here in Seattle about 3 years ago. I thought it was just going to be a simple B slasher movie that is forgettable. Boy was I wrong. Texas Chainsaw Massacre is completely unforgettable. Credited for being the first of its kind, this movie is super creepy from beginning to end. The grainy picture quality, the uneven acting, and the sheer madness of the entire situation, Texas Chainsaw Massacre entertains and surprises you at every turn. Even though since this film there have been tons of slasher films, none match the unearthly quality of this guy.

# 4. Nightmare on Elm Street

![](https://www.music-bazaar.com/album-images/vol14/650/650471/2498098-big/A-Nightmare-On-Elm-Street-Original-Soundtrack-cover.jpg)

When I was a kid, I loved Freddy Kruger. I mean who wouldn't? Pedophile janitor of an elementary school who was burned to death by the parents who now haunts the dreams of teenagers....what's not to like? Anyway, Freddy is a great character. His well-defined look (hat and sweater), his weapon of choice (razor blade hands, that is pretty cool), his wisecracking dialogue, Freddy is an iconic figure in the horror genre. And to be fair, the first movie in the series is pretty good. But even though the series quickly becomes very schlocky after Wes Craven's first installment, the character of Freddy maintains intriguing.

# 3. Evil Dead 2

![](http://horror.wpengine.netdna-cdn.com/wp-content/uploads/2017/05/evil_dead_ii_xlg.jpg)

Now here is a movie perfect for the 13th. Is there anything more insane, campy, self-aware, and all around fun than the Evil Dead series? I mean the fact that Bruce Campbell has not received an Oscar nod is criminal to me. Even though all the movies that Sam Raimi touched with his Evil Dead magic are good, we all can agree his magnum opus in this franchise is Evil Dead 2. From beginning to end, this movie does not stop with the fun; I mean needless gore AND goofy acting? Yes please.

# 2. Friday the 13th

![](http://leglesscorpse.us/wp-content/uploads/2017/01/FridayThe13thPoster.jpg)

How can I make a 'Movies for Friday the 13th' list without including a movie actually named Friday the 13th? Well, I can't. Now don't get me wrong, this movie is terrible. The original one released in 1980 is the best of the lot, but that is like saying you are the world's tallest midget. The original premise is that boy (Jason) drowned at camp and the mother became a serial killer on the campgrounds for years. Then 7 sequels later, Jason is in space murdering people. Go figure. Yes, this movie sucks, and not the 'so bad it's good' way. No, it just sucks. It is slow, the acting is bad, the writing is lame, and there is zero tension throughout the film. But again, this is a list about the most appropriate movies for Friday the 13th, so by default it had to rank high.

# 1. Lord of the Rings

![](https://vignette.wikia.nocookie.net/lotr/images/8/87/Ringstrilogyposter.jpg/revision/latest?cb=20070806215413)

What else? This movie is the best for ALL occasions. Need I say more?


text:
@interface RCCSLeaveMessageItem : NSObject
//信息名
@property (nonatomic, copy) NSString *title;
//信息名对应的 key 值,在用户填了信息之后,需要把信息和此 key 对应构成字典
@property (nonatomic, copy) NSString *name;
//输入区域是单行还是多行:@"text" 单行;@"textarea":多行
@property (nonatomic, copy) NSString *type;
//输入区域默认提示信息
@property (nonatomic, copy) NSString *defaultText;
//是否是必填项
@property (nonatomic, assign) BOOL required;
//需要验证的类型
@property (nonatomic, copy) NSString *verification;
//验证后提示信息
@property (nonatomic, strong) NSArray *message;
//最大字数限制
@property (nonatomic, assign) int max;

+ (instancetype)modelWithDic:(NSDictionary *)dic;
- (instancetype)initWithDic:(NSDictionary *)dic;
@end


text:
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("CsomInspector.Core")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("dstarkowski.eu")]
[assembly: AssemblyProduct("CsomInspector.Core")]
[assembly: AssemblyCopyright("Copyright ©  2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("19449c78-0c36-4afa-99e5-6f5f7de11e10")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]


text:
author: jeffatwood
comments: true
date: 2011-10-08 11:29:10+00:00
layout: post
redirect_from: /2011/10/improved-global-email-notifications
hero:
slug: improved-global-email-notifications
title: Improved Global Email Notifications
wordpress_id: 10021
tags:
- company
- community
- design
---

Our track record on email notifications has been mixed at best. Since early 2009, we've had some forms of email notification, including:

  * A checkbox under each question you own, asking if you want email notifications _for that specific question_.

  * A long since removed "oh, you've been away for 7 days, so we will mail you any new comments and answers to your questions as a courtesy" [feature](http://blog.stackoverflow.com/2009/02/now-showing-email-notifications/).

The one remaining option, an email opt-in checkbox at the bottom of every question you've asked, seemed more and more nonsensical as time went on and the network grew from 4 sites to [60+ sites](http://stackexchange.com/sites). There's no sane way to remember if you have ticked this checkbox on every question on every Stack Exchange site.

So we're simplifying. **Email notifications are now tied to your [global inbox](http://blog.stackoverflow.com/2010/09/new-global-inbox/)**.

To turn on email notifications, open [your profile page](http://stackoverflow.com/users/current) by clicking your name as it appears at the top of any Stack Exchange site, and look for the "preferences" option at the top.

![](https://i.stack.imgur.com/UZX4g.png)

In the settings, you can confirm your email address -- we'll validate it in this case to make sure the emails will arrive -- and specify whether you want emails delivered **daily, weekly, or every 3 hours**.

![](https://i.stack.imgur.com/BnDOh.png)

Bear in mind that we will only email you if you have not checked your global inbox in that time interval. Meaning, if you select the default of "daily", and you don't click to expand your global inbox on _any Stack Exchange site_ for a full 24 hour period... you'll then get an email delivered to you with the contents of your global inbox. And if you don't check for _another 24_ hours, you will get another email, and so forth.

![](/images/wordpress/global-inbox-email-example.png)

(This also offers a more aggressive "every 3 hours" option which satisfied a major outstanding request for our previous email notification support -- which was not only per question, but at best sent every 24-36 hours, and often much later depending on the timing.)

If you're worried nobody will be able to find this link buried in their profile, fret not. There is a reminder at the bottom of every single question you own, if you haven't enabled global inbox email notifications yet:

![](/images/wordpress/global-inbox-email-question-reminder.png)

Clicking that will expand the same settings inline, letting you opt in without visiting your preferences. (And no, we did not turn this on by default for anyone, even if they had previously enabled email notification for some of their particular questions; global inbox email notifications are 100% opt-in.)

One big advantage of this approach is its simplicity. If the message goes in your global inbox _for any Stack Exchange site_, you can be notified of it via email. That means:

  * Answers to your questions

  * Comments on your posts

  * Comment @name replies to you

  * [Chat room](http://chat.stackexchange.com) @name mentions

  * Some careers notifications, if you are participating on [careers](http://careers.stackoverflow.com)

  * Meta posts for community moderators

... and so on. No more worrying about per-site email options; everything is handled at the network level across all Stack Exchange sites.

We're still tweaking the layout of this mail a bit, but we believe it's a big step forward over what we had in place for email before. Give it a shot and let us know what you think!

Oh, and if email is your thing, don't forget we have a set of [nifty "best of the week" email newsletters](http://stackexchange.com/newsletters) you can subscribe to for any Stack Exchange site, too!


text:
package com.merakianalytics.orianna.types.dto.staticdata;

import java.util.Map;

import com.merakianalytics.orianna.types.dto.DataObject;

public class MapData extends DataObject {
    private static final long serialVersionUID = 7757088225452549417L;
    private Map<String, MapDetails> data;
    private String version, platform, locale, type;

    /*
     * (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(final Object obj) {
        if(this == obj) {
            return true;
        }
        if(obj == null) {
            return false;
        }
        if(getClass() != obj.getClass()) {
            return false;
        }
        final MapData other = (MapData)obj;
        if(data == null) {
            if(other.data != null) {
                return false;
            }
        } else if(!data.equals(other.data)) {
            return false;
        }
        if(locale == null) {
            if(other.locale != null) {
                return false;
            }
        } else if(!locale.equals(other.locale)) {
            return false;
        }
        if(platform == null) {
            if(other.platform != null) {
                return false;
            }
        } else if(!platform.equals(other.platform)) {
            return false;
        }
        if(type == null) {
            if(other.type != null) {
                return false;
            }
        } else if(!type.equals(other.type)) {
            return false;
        }
        if(version == null) {
            if(other.version != null) {
                return false;
            }
        } else if(!version.equals(other.version)) {
            return false;
        }
        return true;
    }

    /**
     * @return the data
     */
    public Map<String, MapDetails> getData() {
        return data;
    }

    /**
     * @return the locale
     */
    public String getLocale() {
        return locale;
    }

    /**
     * @return the platform
     */
    public String getPlatform() {
        return platform;
    }

    /**
     * @return the type
     */
    public String getType() {
        return type;
    }

    /**
     * @return the version
     */
    public String getVersion() {
        return version;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + (data == null ? 0 : data.hashCode());
        result = prime * result + (locale == null ? 0 : locale.hashCode());
        result = prime * result + (platform == null ? 0 : platform.hashCode());
        result = prime * result + (type == null ? 0 : type.hashCode());
        result = prime * result + (version == null ? 0 : version.hashCode());
        return result;
    }

    /**
     * @param data
     *        the data to set
     */
    public void setData(final Map<String, MapDetails> data) {
        this.data = data;
    }

    /**
     * @param locale
     *        the locale to set
     */
    public void setLocale(final String locale) {
        this.locale = locale;
    }

    /**
     * @param platform
     *        the platform to set
     */
    public void setPlatform(final String platform) {
        this.platform = platform;
    }

    /**
     * @param type
     *        the type to set
     */
    public void setType(final String type) {
        this.type = type;
    }

    /**
     * @param version
     *        the version to set
     */
    public void setVersion(final String version) {
        this.version = version;
    }
}


text:
layout: post
title: "gcube - software defined storage"
subtitle: "NVRAMOS'16 day1 at DAMO session 1"
date: 2016-10-20 13:30:00
author: "Seongjin Lee"
comments: true
---

Talk by Dongin Shin, CTO http://g-cube.kr/?lang=ko

There are more than 30 companies that they claim to work on software defined storage (SDS). But, all uses different definitions---there are more than 300 different definitions of SDS in the web.

GCUBE's definition of SDS
* _스토리지 컨트롤러 펌웨어를 가져와 리눅스에서 가상 머신으로 실행한다_
* _스토리지 어레이를 범용 서버 하드웨어에서 실행한다_

They try to distinguish data plane and control plane of storage system to improve the performance. Use some of the computation power to manage the storage system.

Some of the other efforts are to optimize the openstack object store. They added compressiong for small sized chunks, and use deduplication mechanism (rabin finger printing).

One of the question they recieved in the talk was how are they surviving. Their answer was "주경야경", work day and night, attract and receive investments, develop the products that sell.

The other question was about workload characteristics that works well for deduplication. They didn't have a answer for the question, they were looking for it.


text:
# find

> Find files under the given directory tree, recursively.

- Find files by extension:

`find {{root_path}} -name {{'*.py'}}`

- Find files matching path pattern:

`find {{root_path}} -path {{'**/lib/**/*.py'}}`

- Run a command for each file, use {} within the command to access the filename:

`find {{root_path}} -name {{'*.py'}} -exec {{wc -l {} }}\;`

- Find files modified since a certain time:

`find {{root_path}} -name {{'*.py'}} -mtime {{-1d}}`

- Find files using case insensitive name matching, of a certain size:

`find {{root_path}} -size +500k -size -10MB -iname {{'*.TaR.gZ'}}`

- Delete files by name, older than a certain number of days:

`find {{root_path}} -name {{'*.py'}} -mtime {{-180d}} -delete`

- Find empty files or directories:

`find {{root_path}} -empty`

- Find files matching more than one search criteria:

`find {{root_path}} -name {{'*.py'}} -or -name {{'*.r}}`


text:
@echo off
rem Copyright (C) 2012 The Android Open Source Project
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem      http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.

rem don't modify the caller's environment
setlocal

rem Set up prog to be the path of this script, including following symlinks,
rem and set up progdir to be the fully-qualified pathname of its directory.
set prog=%~f0

rem Change current directory and drive to where the script is, to avoid
rem issues with directories containing whitespaces.
cd /d %~dp0

rem Get the CWD as a full path with short names only (without spaces)
for %%i in ("%cd%") do set prog_dir=%%~fsi

rem Check we have a valid Java.exe in the path.
set java_exe=
call plugins\uiautomatorviewer\find_java.bat
if not defined java_exe goto :EOF

set jarfile=uiautomatorviewer.jar
set frameworkdir=.

if exist %frameworkdir%\%jarfile% goto JarFileOk
    set frameworkdir=plugins\uiautomatorviewer

if exist %frameworkdir%\%jarfile% goto JarFileOk
    set frameworkdir=..\framework

:JarFileOk

set jarpath=%frameworkdir%\%jarfile%

if not defined ANDROID_SWT goto QueryArch
    set swt_path=%ANDROID_SWT%
    goto SwtDone

:QueryArch

    for /f "delims=" %%a in ('"%java_exe%" -jar %frameworkdir%\archquery.jar') do set swt_path=%frameworkdir%\%%a

:SwtDone

if exist "%swt_path%" goto SetPath
    echo SWT folder '%swt_path%' does not exist.
    echo Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.
    exit /B

:SetPath
set javaextdirs=%swt_path%;%frameworkdir%

echo "%java_exe%" "-Djava.ext.dirs=%javaextdirs%" "-Dcom.android.uiautomator.bindir=%prog_dir%" -jar %jarpath% %*
call "%java_exe%" "-Djava.ext.dirs=%javaextdirs%" "-Dcom.android.uiautomator.bindir=%prog_dir%" -jar %jarpath% %*


text:
set -eu

## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
. "$(dirname "$THIS_SCRIPT")/../../../resources/build/build-utils.sh"
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
## END STANDARD BUILD SCRIPT INCLUDE

EX_USAGE=64

display_usage ( ) {
  echo "Usage: $0 [-test] [-publish-to-npm]"
  echo "       $0 -help"
  echo
  echo "  -help               displays this screen and exits"
  echo "  -test               runs tests"
  echo "  -publish-to-npm     publishes the current version to the npm package index"
  echo "  -dry-run            do test, etc, but don't actually publish"
}

################################ Main script ################################

run_tests=0
install_dependencies=1
should_publish=0
npm_dist_tag=
should_dry_run=0

# Process command-line arguments
while [[ $# -gt 0 ]] ; do
  key="$1"
  case $key in
    -help|-h)
      display_usage
      exit
      ;;
    -dry-run)
      should_dry_run=1
      ;;
    -test)
      run_tests=1
      install_dependencies=0
      ;;
    -version)
      echo "Warning: -version is now ignored"
      ;;
    -tier)
      echo "Warning: -tier is now ignored"
      ;;
    -publish-to-npm)
      should_publish=1
      ;;
    *)
      echo "$0: invalid option: $key"
      display_usage
      exit $EX_USAGE
  esac
  shift # past the processed argument
done

# Dry run settings
if (( should_dry_run )); then
  DRY_RUN=--dry-run
else
  DRY_RUN=
fi

# Check that we're doing any task at all!
if (( !run_tests )) && (( !should_publish )); then
  echo "$0: Must do at least one of: -test, -publish-npm" >&2
  display_usage
  exit $EX_USAGE
fi

# Check if Node.JS/npm is installed.
type npm >/dev/null ||\
    fail "Build environment setup error detected!  Please ensure Node.js is installed!"

if (( install_dependencies )) ; then
  npm install || fail "Could not download dependencies."
fi

if (( run_tests )); then
  npm test || fail "Tests failed"
fi

if (( should_publish )); then
  if [[ $TIER == stable ]]; then
    npm_dist_tag=latest
  else
    npm_dist_tag=$TIER
  fi

  set_npm_version

  # Note: In either case, npm publish MUST be given --access public to publish
  # a package in the @keymanapp scope on the public npm package index.
  #
  # See `npm help publish` for more details.
  echo "Publishing $DRY_RUN npm package with tag $npm_dist_tag"
  npm publish $DRY_RUN --access public --tag $npm_dist_tag || fail "Could not publish $npm_dist_tag release."
fi


text:
def factors(number)
  dividend = number
  divisors = []
  while dividend > 0 do
    divisors << number / dividend if number % dividend == 0
    dividend -= 1
  end
  # begin
  # end until dividend == 0
  divisors
end

puts factors(1)

# Alyssa noticed that this will fail if the input is 0, or a negative number,
# and asked Alan to change the loop.
# How can you make this work without using begin/end/until?
# Note that we're not looking to find the factors for 0 or negative numbers,
# but we just want to handle it gracefully instead of raising an exception
# or going into an infinite loop.
#
# Bonus 1
# What is the purpose of the number % dividend == 0 ?
#
# Bonus 2
# What is the purpose of the second-to-last line in the method (the divisors before the method's end)?


text:
layout: post
date: 2016-02-14
title: "Pronovias BLENDA Sleeveless Cathedral Train Aline/Princess"
category: Pronovias
tags: [Pronovias,Aline/Princess ,Strapless,Cathedral Train,Sleeveless,Tulle]
---
### Pronovias BLENDA
Just **$369.99**
###   Sleeveless Cathedral Train Aline/Princess

BRANDS	Pronovias

Silhouette	Aline/Princess

Neckline	Strapless

Hemline/Train	Cathedral Train

Sleeve	Sleeveless

Fabric	Tulle

Buy it: [https://www.readybrides.com/en/pronovias/4343-pronovias-blenda.html](https://www.readybrides.com/en/pronovias/4343-pronovias-blenda.html)


text:
title: Define custom commands
description: Learn how to extend Nightwatch capabilities by adding custom commands.
summary_image: https://nightwatchjs.org/img/banner.png
---

Define custom commands

### Overview
Most of the time you will need to extend the Nightwatch commands to suit your own application needs. To do so, create a new folder (e.g. `nightwatch/commands`) and start defining your own commands inside, each in its own file.

Then specify the path to that folder in the `nightwatch.json` file, as the `custom_commands_path` property.

nightwatch.json

{
  "custom_commands_path" : "nightwatch/commands"
}

The command name is the name of the file itself.

### Define a custom command

There are two main ways in which you can define a custom command:

#### 1) Class-style commands
This is the recommended style of writing custom commands and it's also how most of the Nightwatch's own commands are written. Your command module needs to export a class constructor with a `command` instance method representing the command function.

All Nightwatch commands are asynchronous which means that custom commands must signal the completion (in the `command` method). This can be achieved in two ways:
1. returning a `Promise`
2. emitting a "complete" event (in this case the class needs to inherit from Node's `EventEmitter`)

Returning a `Promise` is the recommended way. Class-based `command` methods are run in the context (the value of `this`) of the class instance. The `browser` object is available via `this.api`.

The example below performs the equivalent of the `.pause()` command. Note the two variations regarding the completion.

##### The return value
You can also specify a return value, either as the argument with which the Promise will resolve, or as an argument to the "complete" event call.

##### Completion via a Promise

nightwatch/commands/customPause.js

module.exports = class CustomPause {
  command(ms, cb) {
    // If we don't pass the milliseconds, the client will
    // be suspended indefinitely
    if (!ms) {
      return;
    }

    const returnValue = {
      value: 'something'
    };

    return new Promise((resolve) => {
      setTimeout(() => {
        // if we have a callback, call it right before the complete event
        if (cb) {
          cb.call(this.api);
        }

        resolve(returnValue);
      }, ms);
    });
  }
}

The `command` method can also be `async`. In this case, you only need to return a value because `async` methods return a Promise already.

Here's another example:

nightwatch/commands/customCommand.js

module.exports = class CustomCommand {
  async command() {
    let returnValue;
    try {
      returnValue = await anotherAsyncFunction();
    } catch (err) {
      console.error('An error occurred', err);
      returnValue = {
        status: -1,
        error: err.message
      }
    }

    return returnValue;
  }
}

##### Completion via the "complete" event

nightwatch/commands/customPause.js

const Events = require('events');

module.exports = class CustomPause extends Events {
  command(ms, cb) {
    // If we don't pass the milliseconds, the client will
    // be suspended indefinitely
    if (!ms) {
      return;
    }

    const returnValue = {
      value: 'something'
    };

    setTimeout(() => {
      // if we have a callback, call it right before the complete event
      if (cb) {
        cb.call(this.api);
      }

      // This also works: this.complete(returnValue)
      this.emit('complete', returnValue);
    }, ms);
  }
}

### Using Nightwatch protocol actions
Since **v1.4**, you can also directly use the protocol actions (via `this.transportActions`) which Nightwatch uses for its own built-in APIs. These are direct HTTP mappings to [Selenium JsonWire](https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol) or [W3C Webdriver](https://www.w3.org/TR/webdriver/) protocol endpoints, depending on which one is currently in use.

Here's an example:

nightwatch/commands/customCommand.js

module.exports = class CustomCommand {
  async command() {
    let returnValue;

    // list all the avaialble transport actions
    // console.log(this.transportActions);

    try {
      returnValue = await this.transportActions.getCurrentUrl();
    } catch (err) {
      console.error('An error occurred', err);
      returnValue = {
        status: -1,
        error: err.message
      }
    }

    return returnValue;
  }
}

### Directly calling Selenium/Webdriver endpoints
Also, since **v1.4** you can (via `this.httpRequest(options)`) directly call the HTTP endpoints available on the Selenium/Webdriver server from custom commands.
This can be a convenient way to extend the provided API protocol, since it is using the same [HTTP request](https://github.com/nightwatchjs/nightwatch/blob/main/lib/http/request.js) interface as for the other protocol actions.

It can be especially useful when using a service which provides additional endpoints, like [Appium](http://appium.io/).

Here's an example:

nightwatch/commands/customCommand.js

module.exports = class CustomCommand {
  async command() {
    let returnValue;

    try {
      returnValue = await this.httpRequest({
        // the pathname of the endpoint to call
        path: '/session/:sessionId/url',

        // the current Selenium/Webdriver sessionId
        sessionId: this.api.sessionId,

        // host and port are normally not necessary, since it is the current Webdriver hostname/port
        //host: '',
        //port: '',

        // the body of the request
        data: {
          url: 'http://localhost/test_url'
        },

        method: 'POST'
      });
    } catch (err) {
      console.error('An error occurred', err);
      returnValue = {
        status: -1,
        error: err.message
      }
    }

    return returnValue;
  }
}

#### 2. Function-style commands
This is a simpler form in which commands can be defined, however they are also quite limited.

The command module needs to export a `command` function, which needs to call at least one Nightwatch api method (such as `.execute()`). This is due to a limitation of how the asynchronous queueing system of commands works. You can also wrap everything in a `.perform()` call. Client commands like `execute` and `perform` are available via `this`.

nightwatch/commands/customCommand.js

module.exports.command = function(file, callback) {
  var self = this;
  var imageData;
  var fs = require('fs');

  try {
    var originalData = fs.readFileSync(file);
    var base64Image = new Buffer(originalData, 'binary').toString('base64');
    imageData = 'data:image/jpeg;base64,' + base64Image;
  } catch (err) {
    console.log(err);
    throw "Unable to open file: " + file;
  }

  this.execute(function(data) {
    // execute application specific code
    App.resizePicture(data);
    return true;
  },
  [imageData], // arguments array to be passed
  function(result) {
    if (typeof callback === "function") {
      callback.call(self, result);
    }
  });

  return this;
};

The example above defines a command (e.g. resizePicture.js) which loads an image file as `data-URI` and calls a method named `resizePicture` (via `.execute()`), defined inside the application.

With this command, the test will look something like:

tests/sampleTest.js

module.exports = {
  "testing resize picture" : function (browser) {
    browser
      .url("http://app.host")
      .waitForElementVisible("body")
      .resizePicture("/var/www/pics/moon.jpg")
      .assert.element(".container .picture-large")
      .end();
  }
};

### Using async/await
You can also use ES6 `async`/`await` syntax inside function-style custom commands. Here's another custom command example:

module.exports = {
  command: async function () {
    this.url('http://nightwatchjs.org');
    this.waitForElementVisible('section#index-container');

    const result = await this.elements('css selector', '#index-container ul.features li');
    this.assert.strictEqual(result.value.length, 7, 'Feature elements number is correct');
  }
};

### Recommended content
- [Define custom assertions](https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-assertions.html)

      ←

          Back
          Override device dimensions

          Next Page
          Define custom assertions

        →


text:
"""
This module contains the base classes for the dashboard and dashboard modules.
"""
from django.conf import settings
from django.db import models

user_model = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')

class DashboardPreferences(models.Model):
    """
    This model represents the dashboard preferences for a user.
    """
    user = models.ForeignKey(user_model)
    data = models.TextField()
    dashboard_id = models.CharField(max_length=100)

    def __unicode__(self):
        return "%s dashboard preferences" % self.user.username

    class Meta:
        db_table = 'admin_tools_dashboard_preferences'
        unique_together = ('user', 'dashboard_id',)
        ordering = ('user',)


text:
import { Joi } from './base'

const bulkAction = Joi.object().keys({
    before: Joi.func().default(() => undefined),
    action: Joi.func().required(),
    after: Joi.func().default(() => undefined),
    description: Joi.string(),
    modalConfirm: Joi.object({
        message: Joi.string().isRequired,
        labelConfirm: Joi.string(),
        labelCancel: Joi.string(),
        modalType: Joi.string(),
    }),
})

const bulkActions = Joi.object().pattern(/.*/, bulkAction)

export default bulkActions


text:
import multi_part
import urllib2
import base64

def post_build(results_zip, url=None):
    print 'POSTING BUILD, PLEASE WAIT'

    auth = tuple(open('./config/auth.txt').read().split(':'))

    theurl = url or 'http://pygame-testify.net/upload_results/index.py'

    req = urllib2.Request(theurl)

    base64string = base64.encodestring('%s:%s' % auth)[:-1]
    authheader =  "Basic %s" % base64string

    req.add_header("Authorization", authheader)

    opener = urllib2.build_opener(multi_part.MultipartPostHandler)
    params = { "results_file" : open(results_zip, "rb") }

    return opener.open(req, params).read()

if __name__ == '__main__':
    print post_build ('output/build.zip')


text:
namespace blink {
namespace {

using Result = BytesConsumer::Result;
using ::testing::_;
using ::testing::DoAll;
using ::testing::InSequence;
using ::testing::Return;
using Checkpoint = ::testing::StrictMock<::testing::MockFunction<void(int)>>;
using MockBytesConsumer = BytesConsumerTestUtil::MockBytesConsumer;

String toString(const Vector<char>& v) {
  return String(v.data(), v.size());
}

PassRefPtr<EncodedFormData> complexFormData() {
  RefPtr<EncodedFormData> data = EncodedFormData::create();

  data->appendData("foo", 3);
  data->appendFileRange("/foo/bar/baz", 3, 4, 5);
  data->appendFileSystemURLRange(KURL(KURL(), "file:///foo/bar/baz"), 6, 7, 8);
  std::unique_ptr<BlobData> blobData = BlobData::create();
  blobData->appendText("hello", false);
  auto size = blobData->length();
  RefPtr<BlobDataHandle> blobDataHandle =
      BlobDataHandle::create(std::move(blobData), size);
  data->appendBlob(blobDataHandle->uuid(), blobDataHandle);
  Vector<char> boundary;
  boundary.append("\0", 1);
  data->setBoundary(boundary);
  return data.release();
}

class NoopClient final : public GarbageCollectedFinalized<NoopClient>,
                         public BytesConsumer::Client {
  USING_GARBAGE_COLLECTED_MIXIN(NoopClient);

 public:
  void onStateChange() override {}
};

class FormDataBytesConsumerTest : public ::testing::Test {
 public:
  FormDataBytesConsumerTest() : m_page(DummyPageHolder::create()) {}

 protected:
  Document* getDocument() { return &m_page->document(); }

  std::unique_ptr<DummyPageHolder> m_page;
};

TEST_F(FormDataBytesConsumerTest, TwoPhaseReadFromString) {
  auto result = (new BytesConsumerTestUtil::TwoPhaseReader(
                     new FormDataBytesConsumer("hello, world")))
                    ->run();
  EXPECT_EQ(Result::Done, result.first);
  EXPECT_EQ("hello, world", toString(result.second));
}

TEST_F(FormDataBytesConsumerTest, TwoPhaseReadFromStringNonLatin) {
  constexpr UChar cs[] = {0x3042, 0};
  auto result = (new BytesConsumerTestUtil::TwoPhaseReader(
                     new FormDataBytesConsumer(String(cs))))
                    ->run();
  EXPECT_EQ(Result::Done, result.first);
  EXPECT_EQ("\xe3\x81\x82", toString(result.second));
}

TEST_F(FormDataBytesConsumerTest, TwoPhaseReadFromArrayBuffer) {
  constexpr unsigned char data[] = {0x21, 0xfe, 0x00, 0x00, 0xff, 0xa3,
                                    0x42, 0x30, 0x42, 0x99, 0x88};
  DOMArrayBuffer* buffer = DOMArrayBuffer::create(data, WTF_ARRAY_LENGTH(data));
  auto result = (new BytesConsumerTestUtil::TwoPhaseReader(
                     new FormDataBytesConsumer(buffer)))
                    ->run();
  Vector<char> expected;
  expected.append(data, WTF_ARRAY_LENGTH(data));

  EXPECT_EQ(Result::Done, result.first);
  EXPECT_EQ(expected, result.second);
}

TEST_F(FormDataBytesConsumerTest, TwoPhaseReadFromArrayBufferView) {
  constexpr unsigned char data[] = {0x21, 0xfe, 0x00, 0x00, 0xff, 0xa3,
                                    0x42, 0x30, 0x42, 0x99, 0x88};
  constexpr size_t offset = 1, size = 4;
  DOMArrayBuffer* buffer = DOMArrayBuffer::create(data, WTF_ARRAY_LENGTH(data));
  auto result =
      (new BytesConsumerTestUtil::TwoPhaseReader(new FormDataBytesConsumer(
           DOMUint8Array::create(buffer, offset, size))))
          ->run();
  Vector<char> expected;
  expected.append(data + offset, size);

  EXPECT_EQ(Result::Done, result.first);
  EXPECT_EQ(expected, result.second);
}

TEST_F(FormDataBytesConsumerTest, TwoPhaseReadFromSimpleFormData) {
  RefPtr<EncodedFormData> data = EncodedFormData::create();
  data->appendData("foo", 3);
  data->appendData("hoge", 4);

  auto result = (new BytesConsumerTestUtil::TwoPhaseReader(
                     new FormDataBytesConsumer(getDocument(), data)))
                    ->run();
  EXPECT_EQ(Result::Done, result.first);
  EXPECT_EQ("foohoge", toString(result.second));
}

TEST_F(FormDataBytesConsumerTest, TwoPhaseReadFromComplexFormData) {
  RefPtr<EncodedFormData> data = complexFormData();
  MockBytesConsumer* underlying = MockBytesConsumer::create();
  BytesConsumer* consumer =
      FormDataBytesConsumer::createForTesting(getDocument(), data, underlying);
  Checkpoint checkpoint;

  const char* buffer = nullptr;
  size_t available = 0;

  InSequence s;
  EXPECT_CALL(checkpoint, Call(1));
  EXPECT_CALL(*underlying, beginRead(&buffer, &available))
      .WillOnce(Return(Result::Ok));
  EXPECT_CALL(checkpoint, Call(2));
  EXPECT_CALL(*underlying, endRead(0)).WillOnce(Return(Result::Ok));
  EXPECT_CALL(checkpoint, Call(3));

  checkpoint.Call(1);
  ASSERT_EQ(Result::Ok, consumer->beginRead(&buffer, &available));
  checkpoint.Call(2);
  EXPECT_EQ(Result::Ok, consumer->endRead(0));
  checkpoint.Call(3);
}

TEST_F(FormDataBytesConsumerTest, EndReadCanReturnDone) {
  BytesConsumer* consumer = new FormDataBytesConsumer("hello, world");
  const char* buffer = nullptr;
  size_t available = 0;
  ASSERT_EQ(Result::Ok, consumer->beginRead(&buffer, &available));
  ASSERT_EQ(12u, available);
  EXPECT_EQ("hello, world", String(buffer, available));
  EXPECT_EQ(BytesConsumer::PublicState::ReadableOrWaiting,
            consumer->getPublicState());
  EXPECT_EQ(Result::Done, consumer->endRead(available));
  EXPECT_EQ(BytesConsumer::PublicState::Closed, consumer->getPublicState());
}

TEST_F(FormDataBytesConsumerTest, DrainAsBlobDataHandleFromString) {
  BytesConsumer* consumer = new FormDataBytesConsumer("hello, world");
  RefPtr<BlobDataHandle> blobDataHandle = consumer->drainAsBlobDataHandle();
  ASSERT_TRUE(blobDataHandle);

  EXPECT_EQ(String(), blobDataHandle->type());
  EXPECT_EQ(12u, blobDataHandle->size());
  EXPECT_FALSE(consumer->drainAsFormData());
  const char* buffer = nullptr;
  size_t available = 0;
  EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &available));
  EXPECT_EQ(BytesConsumer::PublicState::Closed, consumer->getPublicState());
}

TEST_F(FormDataBytesConsumerTest, DrainAsBlobDataHandleFromArrayBuffer) {
  BytesConsumer* consumer =
      new FormDataBytesConsumer(DOMArrayBuffer::create("foo", 3));
  RefPtr<BlobDataHandle> blobDataHandle = consumer->drainAsBlobDataHandle();
  ASSERT_TRUE(blobDataHandle);

  EXPECT_EQ(String(), blobDataHandle->type());
  EXPECT_EQ(3u, blobDataHandle->size());
  EXPECT_FALSE(consumer->drainAsFormData());
  const char* buffer = nullptr;
  size_t available = 0;
  EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &available));
  EXPECT_EQ(BytesConsumer::PublicState::Closed, consumer->getPublicState());
}

TEST_F(FormDataBytesConsumerTest, DrainAsBlobDataHandleFromSimpleFormData) {
  FormData* data = FormData::create(UTF8Encoding());
  data->append("name1", "value1");
  data->append("name2", "value2");
  RefPtr<EncodedFormData> inputFormData = data->encodeMultiPartFormData();

  BytesConsumer* consumer =
      new FormDataBytesConsumer(getDocument(), inputFormData);
  RefPtr<BlobDataHandle> blobDataHandle = consumer->drainAsBlobDataHandle();
  ASSERT_TRUE(blobDataHandle);

  EXPECT_EQ(String(), blobDataHandle->type());
  EXPECT_EQ(inputFormData->flattenToString().utf8().length(),
            blobDataHandle->size());
  EXPECT_FALSE(consumer->drainAsFormData());
  const char* buffer = nullptr;
  size_t available = 0;
  EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &available));
  EXPECT_EQ(BytesConsumer::PublicState::Closed, consumer->getPublicState());
}

TEST_F(FormDataBytesConsumerTest, DrainAsBlobDataHandleFromComplexFormData) {
  RefPtr<EncodedFormData> inputFormData = complexFormData();

  BytesConsumer* consumer =
      new FormDataBytesConsumer(getDocument(), inputFormData);
  RefPtr<BlobDataHandle> blobDataHandle = consumer->drainAsBlobDataHandle();
  ASSERT_TRUE(blobDataHandle);

  EXPECT_FALSE(consumer->drainAsFormData());
  const char* buffer = nullptr;
  size_t available = 0;
  EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &available));
  EXPECT_EQ(BytesConsumer::PublicState::Closed, consumer->getPublicState());
}

TEST_F(FormDataBytesConsumerTest, DrainAsFormDataFromString) {
  BytesConsumer* consumer = new FormDataBytesConsumer("hello, world");
  RefPtr<EncodedFormData> formData = consumer->drainAsFormData();
  ASSERT_TRUE(formData);
  EXPECT_EQ("hello, world", formData->flattenToString());

  EXPECT_FALSE(consumer->drainAsBlobDataHandle());
  const char* buffer = nullptr;
  size_t available = 0;
  EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &available));
  EXPECT_EQ(BytesConsumer::PublicState::Closed, consumer->getPublicState());
}

TEST_F(FormDataBytesConsumerTest, DrainAsFormDataFromArrayBuffer) {
  BytesConsumer* consumer =
      new FormDataBytesConsumer(DOMArrayBuffer::create("foo", 3));
  RefPtr<EncodedFormData> formData = consumer->drainAsFormData();
  ASSERT_TRUE(formData);
  EXPECT_TRUE(formData->isSafeToSendToAnotherThread());
  EXPECT_EQ("foo", formData->flattenToString());

  EXPECT_FALSE(consumer->drainAsBlobDataHandle());
  const char* buffer = nullptr;
  size_t available = 0;
  EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &available));
  EXPECT_EQ(BytesConsumer::PublicState::Closed, consumer->getPublicState());
}

TEST_F(FormDataBytesConsumerTest, DrainAsFormDataFromSimpleFormData) {
  FormData* data = FormData::create(UTF8Encoding());
  data->append("name1", "value1");
  data->append("name2", "value2");
  RefPtr<EncodedFormData> inputFormData = data->encodeMultiPartFormData();

  BytesConsumer* consumer =
      new FormDataBytesConsumer(getDocument(), inputFormData);
  EXPECT_EQ(inputFormData, consumer->drainAsFormData());
  EXPECT_FALSE(consumer->drainAsBlobDataHandle());
  const char* buffer = nullptr;
  size_t available = 0;
  EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &available));
  EXPECT_EQ(BytesConsumer::PublicState::Closed, consumer->getPublicState());
}

TEST_F(FormDataBytesConsumerTest, DrainAsFormDataFromComplexFormData) {
  RefPtr<EncodedFormData> inputFormData = complexFormData();

  BytesConsumer* consumer =
      new FormDataBytesConsumer(getDocument(), inputFormData);
  EXPECT_EQ(inputFormData, consumer->drainAsFormData());
  EXPECT_FALSE(consumer->drainAsBlobDataHandle());
  const char* buffer = nullptr;
  size_t available = 0;
  EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &available));
  EXPECT_EQ(BytesConsumer::PublicState::Closed, consumer->getPublicState());
}

TEST_F(FormDataBytesConsumerTest, BeginReadAffectsDraining) {
  const char* buffer = nullptr;
  size_t available = 0;
  BytesConsumer* consumer = new FormDataBytesConsumer("hello, world");
  ASSERT_EQ(Result::Ok, consumer->beginRead(&buffer, &available));
  EXPECT_EQ("hello, world", String(buffer, available));

  ASSERT_EQ(Result::Ok, consumer->endRead(0));
  EXPECT_FALSE(consumer->drainAsFormData());
  EXPECT_FALSE(consumer->drainAsBlobDataHandle());
  EXPECT_EQ(BytesConsumer::PublicState::ReadableOrWaiting,
            consumer->getPublicState());
}

TEST_F(FormDataBytesConsumerTest, BeginReadAffectsDrainingWithComplexFormData) {
  MockBytesConsumer* underlying = MockBytesConsumer::create();
  BytesConsumer* consumer = FormDataBytesConsumer::createForTesting(
      getDocument(), complexFormData(), underlying);

  const char* buffer = nullptr;
  size_t available = 0;
  Checkpoint checkpoint;

  InSequence s;
  EXPECT_CALL(checkpoint, Call(1));
  EXPECT_CALL(*underlying, beginRead(&buffer, &available))
      .WillOnce(Return(Result::Ok));
  EXPECT_CALL(*underlying, endRead(0)).WillOnce(Return(Result::Ok));
  EXPECT_CALL(checkpoint, Call(2));
  // drainAsFormData should not be called here.
  EXPECT_CALL(checkpoint, Call(3));
  EXPECT_CALL(*underlying, drainAsBlobDataHandle(_));
  EXPECT_CALL(checkpoint, Call(4));
  // |consumer| delegates the getPublicState call to |underlying|.
  EXPECT_CALL(*underlying, getPublicState())
      .WillOnce(Return(BytesConsumer::PublicState::ReadableOrWaiting));
  EXPECT_CALL(checkpoint, Call(5));

  checkpoint.Call(1);
  ASSERT_EQ(Result::Ok, consumer->beginRead(&buffer, &available));
  ASSERT_EQ(Result::Ok, consumer->endRead(0));
  checkpoint.Call(2);
  EXPECT_FALSE(consumer->drainAsFormData());
  checkpoint.Call(3);
  EXPECT_FALSE(consumer->drainAsBlobDataHandle());
  checkpoint.Call(4);
  EXPECT_EQ(BytesConsumer::PublicState::ReadableOrWaiting,
            consumer->getPublicState());
  checkpoint.Call(5);
}

TEST_F(FormDataBytesConsumerTest, SetClientWithComplexFormData) {
  RefPtr<EncodedFormData> inputFormData = complexFormData();

  MockBytesConsumer* underlying = MockBytesConsumer::create();
  BytesConsumer* consumer = FormDataBytesConsumer::createForTesting(
      getDocument(), inputFormData, underlying);
  Checkpoint checkpoint;

  InSequence s;
  EXPECT_CALL(checkpoint, Call(1));
  EXPECT_CALL(*underlying, setClient(_));
  EXPECT_CALL(checkpoint, Call(2));
  EXPECT_CALL(*underlying, clearClient());
  EXPECT_CALL(checkpoint, Call(3));

  checkpoint.Call(1);
  consumer->setClient(new NoopClient());
  checkpoint.Call(2);
  consumer->clearClient();
  checkpoint.Call(3);
}

TEST_F(FormDataBytesConsumerTest, CancelWithComplexFormData) {
  RefPtr<EncodedFormData> inputFormData = complexFormData();

  MockBytesConsumer* underlying = MockBytesConsumer::create();
  BytesConsumer* consumer = FormDataBytesConsumer::createForTesting(
      getDocument(), inputFormData, underlying);
  Checkpoint checkpoint;

  InSequence s;
  EXPECT_CALL(checkpoint, Call(1));
  EXPECT_CALL(*underlying, cancel());
  EXPECT_CALL(checkpoint, Call(2));

  checkpoint.Call(1);
  consumer->cancel();
  checkpoint.Call(2);
}

}  // namespace
}  // namespace blink


text:
'use strict'

/**
 * pratice NOde.js project
 *
 * @author Iceee.Xu <iceee.xu@gmail.com>
 */

 import mongoose from 'mongoose';

 module.exports = function (done) {

   const Schema = mongoose.Schema;
   const ObjectId = Schema.ObjectId;

   const User = new Schema({
     name: {type: String, unique: true},
     email: {type: String, unique: true},
     password: {type: String},
     nickname: {type: String},
     about: {type: String}
   });

   $.mongodb.model('User', User);
   $.model.User = $.mongodb.model('User');

   done();
 }


text:
package main

import (
	"fmt"
	"os"
	"os/user"
	"syscall"
)

func getUID(path string) string {
	if dir, err := os.Stat(path); err == nil {
		if stat, ok := dir.Sys().(*syscall.Stat_t); ok {
			return fmt.Sprintf("%d", stat.Uid)
		}
	}
	return ""
}

func createUser(username, uid string) error {
	useradd := config.Section("Accounts").Key("useradd_cmd").MustString("useradd -m -s /bin/bash -p * {user}")
	if uid != "" {
		useradd = fmt.Sprintf("%s -u %s", useradd, uid)
	}
	return runCmd(createUserGroupCmd(useradd, username, ""))
}

func addUserToGroup(user, group string) error {
	gpasswdadd := config.Section("Accounts").Key("gpasswd_add_cmd").MustString("gpasswd -a {user} {group}")
	return runCmd(createUserGroupCmd(gpasswdadd, user, group))
}

func userExists(name string) (bool, error) {
	if _, err := user.Lookup(name); err != nil {
		return false, err
	}
	return true, nil
}


text:
itk_fetch_module(Montage
"Reconstruction of 3D volumetric dataset from a collection of 2D slices"
  MODULE_COMPLIANCE_LEVEL 3
  GIT_REPOSITORY ${git_protocol}://github.com/InsightSoftwareConsortium/ITKMontage.git
  GIT_TAG 21f8eb99ae350f4c0d271da149fea2adeda7d6e1
  )


text:
/**
 *
 */
package org.ebayopensource.turmeric.services.soatestap1caching.AdvertisingUniqueIDServiceV2Consumer;

import java.util.HashMap;
import java.util.Map;

import com.ebay.soaframework.common.cachepolicy.BaseCachePolicyProvider;
import com.ebay.soaframework.common.cachepolicy.CacheContext;
import com.ebay.soaframework.common.cachepolicy.CacheKey;
import com.ebay.soaframework.common.cachepolicy.ResponseWrapper;
import com.ebay.soaframework.common.exceptions.ServiceException;

/**
 * @author rarekatla
 *
 */
public class SOATestCacheProvider extends BaseCachePolicyProvider {

	Map<CacheKey, ResponseWrapper> m_cache = new HashMap<CacheKey, ResponseWrapper>();

	protected enum STATUS {
		UNINITIALIZED, INIT_FAILED, INIT_SUCCESS
	}

	protected STATUS m_status = STATUS.UNINITIALIZED;

	@Override
	public void insert(CacheContext cacheContext) throws ServiceException {
		CacheKey key = cacheContext.getCacheKey();
		if (key == null)
			key = m_desc.generateCacheKey(cacheContext);
		if (key != null) {
			synchronized (m_cache) {
				m_cache.put(key, new ResponseWrapper(
						cacheContext.getResponse(), cacheContext.getTTL()
								* 1000 + System.currentTimeMillis()));
			}
		}

	}

	@SuppressWarnings("unchecked")
	@Override
	public <T> T lookup(CacheContext cacheContext) throws ServiceException {
		CacheKey key = m_desc.generateCacheKey(cacheContext);
		if (key != null) {
			cacheContext.setCacheKey(key);
			if (m_cache == null)
				m_cache = new HashMap<CacheKey, ResponseWrapper>();

			ResponseWrapper wrapper = m_cache.get(key);
			if (wrapper != null)
				return (T) wrapper.getResponse();
			else
				return null;
		} else {
			return null;
		}
	}
	@Override
	public void invalidate() throws ServiceException {
		m_cache = new HashMap<CacheKey, ResponseWrapper>();
		m_status = STATUS.UNINITIALIZED;

	}

	public Map<CacheKey, ResponseWrapper> getCache() {

		return m_cache;

	}

}


text:
// Copyright 2016, Catlike Coding, http://catlikecoding.com
using UnityEngine;

namespace CatlikeCoding.NumberFlow.Functions.Cubemap {

	internal static class CubemapUtils {

		internal static Vector3 GetDirection (Diagram diagram) {
			Vector2 uv = diagram.uv;
			uv.x = uv.x * 2f - 1f;
			uv.y = uv.y * 2f - 1f;
			Vector3 dir;
			switch (diagram.cubemapDirection) {
			case CubemapFace.PositiveX:
				dir.x = 1f;
				dir.y = -uv.y;
				dir.z = -uv.x;
				break;
			case CubemapFace.NegativeX:
				dir.x = -1f;
				dir.y = -uv.y;
				dir.z = uv.x;
				break;
			case CubemapFace.PositiveY:
				dir.x = uv.x;
				dir.y = 1f;
				dir.z = uv.y;
				break;
			case CubemapFace.NegativeY:
				dir.x = uv.x;
				dir.y = -1f;
				dir.z = -uv.y;
				break;
			case CubemapFace.PositiveZ:
				dir.x = uv.x;
				dir.y = -uv.y;
				dir.z = 1f;
				break;
			default:
				dir.x = -uv.x;
				dir.y = -uv.y;
				dir.z = -1f;
				break;
			}
			return NormalizeDir(dir);
		}

		internal static void GetCrossDirection (Value output, Diagram diagram) {
			Vector3 dir = GetDirection(diagram);
			float delta = diagram.derivativeDelta;
			if (diagram.derivativeDirection <= DiagramDerivativeDirection.NegativeX) {
				if (diagram.derivativeDirection == DiagramDerivativeDirection.NegativeX) {
					delta = -delta;
				}
				switch (diagram.cubemapDirection) {
				case CubemapFace.PositiveX:
				case CubemapFace.NegativeX:
					dir.x += delta * NorSin(dir.z, dir.y, dir.x);
					dir.z -= delta * dir.x;
					break;
				case CubemapFace.PositiveY:
					dir.x += delta * dir.y;
					dir.y -= delta * NorSin(dir.x, dir.z, dir.y);
					break;
				case CubemapFace.NegativeY:
					dir.x -= delta * dir.y;
					dir.y += delta * NorSin(dir.x, dir.z, dir.y);
					break;
				default:
					dir.x += delta * dir.z;
					dir.z -= delta * NorSin(dir.x, dir.y, dir.z);
					break;
				}
			}
			else {
				if (diagram.derivativeDirection == DiagramDerivativeDirection.PositiveY) {
					delta = -delta;
				}
				switch (diagram.cubemapDirection) {
				case CubemapFace.PositiveX:
					dir.x -= delta * NorSin(dir.y, dir.z, dir.x);
					dir.y += delta * dir.x;
					break;
				case CubemapFace.NegativeX:
					dir.x += delta * NorSin(dir.y, dir.z, dir.x);
					dir.y -= delta * dir.x;
					break;
				case CubemapFace.PositiveY:
				case CubemapFace.NegativeY:
					dir.y += delta * NorSin(dir.z, dir.x, dir.y);
					dir.z -= delta * dir.y;
					break;
				case CubemapFace.PositiveZ:
					dir.y += delta * dir.z;
					dir.z -= delta * NorSin(dir.y, dir.x, dir.z);
					break;
				default:
					dir.y -= delta * dir.z;
					dir.z += delta * NorSin(dir.y, dir.x, dir.z);
					break;
				}
			}
			output.Vector3 = NormalizeDir(dir);
		}

		static float NorSin (float x, float y, float cos) {
			return x * Mathf.Sqrt(1f - cos * cos) / Mathf.Sqrt(x * x + y * y);
		}

		static Vector3 NormalizeDir (Vector3 d) {
			float magnitude = Mathf.Sqrt(d.x * d.x + d.y * d.y + d.z * d.z);
			d.x /= magnitude;
			d.y /= magnitude;
			d.z /= magnitude;
			return d;
		}
	}

	public sealed class Direction : Function {

		protected override void Configure () {
			name = "Cubemap";
			menuName = "Coordinates/Cubemap Direction";
			type = FunctionType.Coordinate;
			returnType = ValueType.Vector3;
		}

		public override void ComputeCoordinate (Value output, Diagram diagram) {
			if (diagram.derivativeDirection == DiagramDerivativeDirection.None) {
				output.Vector3 = CubemapUtils.GetDirection(diagram);
			}
			else {
				CubemapUtils.GetCrossDirection(output, diagram);
			}
		}
	}

	public sealed class NormalCross : Function {

		protected override void Configure () {
			name = "Normal";
			menuName = "Vector3/Normals/Cubemap";
			type = FunctionType.Custom;
			returnType = ValueType.Vector3;
			propertyNames = new string[] { "Cubemap", "Height" };
			propertyTypes = new ValueType[] { ValueType.Vector3, ValueType.Float };
		}

		internal override void ComputeCustom (DiagramNode node) {
			Diagram diagram = node.Diagram;
			int oldPixelIndex = diagram.currentPixelIndex;
			DiagramDerivativeDirection oldDirection = diagram.derivativeDirection;

			Value cubemapValue = node.argumentValues[0];
			Value heightValue = node.argumentValues[1];

			diagram.currentPixelIndex -= 10;
			diagram.derivativeDirection = DiagramDerivativeDirection.NegativeX;
			node.ComputeArgumentNodes();
			Vector3 x = cubemapValue.Vector3 * heightValue.Float;

			diagram.currentPixelIndex -= 10;
			diagram.derivativeDirection = DiagramDerivativeDirection.PositiveX;
			node.ComputeArgumentNodes();
			x -= cubemapValue.Vector3 * heightValue.Float;

			diagram.currentPixelIndex -= 10;
			diagram.derivativeDirection = DiagramDerivativeDirection.NegativeY;
			node.ComputeArgumentNodes();
			Vector3 y = cubemapValue.Vector3 * heightValue.Float;

			diagram.currentPixelIndex -= 10;
			diagram.derivativeDirection = DiagramDerivativeDirection.PositiveY;
			node.ComputeArgumentNodes();
			y-= cubemapValue.Vector3 * heightValue.Float;

			node.computedValue.Vector3 = Vector3.Cross(y, x).normalized;

			diagram.currentPixelIndex = oldPixelIndex;
			diagram.derivativeDirection = oldDirection;
		}
	}
}


text:
package com.ojs.capabilities.playerCapability;

import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.webkit.WebView;
import android.widget.RelativeLayout;

public class PlayerCapabilityActivity extends Activity {

	protected static final String TAG = PlayerCapabilityActivity.class.getSimpleName();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		RelativeLayout r = new RelativeLayout(getApplicationContext());

		setContentView(r);

		p("PlayerCapabilityActivity created!");

		try {

			Bundle b = getIntent().getExtras();
			String url = b.getString("url_to_show");
			WebView myWebView = new WebView(getApplicationContext());
			myWebView.loadUrl(url);
			setTitle(getClass().getSimpleName());
			setContentView(myWebView);

			p("the end");
		} catch (Exception e) {
			p(e.toString());
		}

	}

	private void p(String s) {
		Log.d(TAG, s);
	}

}


text:
/*global documents: true define: true */
/*!
 * Aloha Editor
 * Author & Copyright (c) 2011 Gentics Software GmbH
 * aloha-sales@gentics.com
 * Licensed under the terms of http://www.aloha-editor.com/license.html
 *
 * Author : Nicolas Karageuzian - http://nka.me
 */
define([
	'jquery',
    'util/class',
	'i18n!image/nls/i18n',
	'i18n!aloha/nls/i18n',
	'ui/ui',
	'ui/scopes',
    'ui/button',
    'ui/toggleButton',
    'ui/port-helper-attribute-field'
],
function (
	jQuery,
	Class,
	i18n,
	i18nCore,
	Ui,
	Scopes,
	Button,
	ToggleButton,
	AttributeField
) {
	'use strict';

	var $ = jQuery;
	var GENTICS = window.GENTICS;
	var Aloha = window.Aloha;

	/**
     * Toolbar elements for Image plugin
     *
     * @class MyClass
     */
	return Class.extend({
        /**
         * Empty constructor
         *
         * @method
         * @constructor
         */
		_constructor: function () {

		},

         /**
          * Initialize Floating menu buttons according to plugin config
          */
        init: function (plugin) {
			plugin.floatingMenuControl = this;
			this.plugin = plugin;

			Scopes.createScope(plugin.name, 'Aloha.empty');

			this._addUIInsertButton();
			this._addUIMetaButtons();
			this._addUIResetButton();
			this._addUIAlignButtons();
			this._addUIMarginButtons();
			this._addUICropButtons();
			this._addUIResizeButtons();
			this._addUIAspectRatioToggleButton();

//			 TODO fix the function and reenable this button
//			this._addNaturalSizeButton();
		},

		/**
		 * Adds the aspect ratio toggle button to the floating menu
		 */
		_addUIAspectRatioToggleButton: function () {
			var plugin = this.plugin;

			this._imageCnrRatioButton = Ui.adopt("imageCnrRatio", ToggleButton, {
				tooltip: i18n.t('button.toggle.tooltip'),
				icon: 'aloha-icon-cnr-ratio',
				scope: plugin.name,
				click: function(){
					plugin.toggleKeepAspectRatio();
				}
			});

			// If the setting has been set to a number or false we need to activate the
			// toggle button to indicate that the aspect ratio will be preserved.
			if (plugin.settings.fixedAspectRatio !== false) {
				this._imageCnrRatioButton.setState(true);
				plugin.keepAspectRatio = true;
			}
		},

		/**
		 * Adds the reset button to the floating menu for the given tab
		 */
		_addUIResetButton: function () {
			var plugin = this.plugin;

			this._imageCnrResetButton = Ui.adopt("imageCnrReset", Button, {
				tooltip: i18n.t('Reset'),
				icon: 'aloha-icon-cnr-reset',
				scope: plugin.name,
				click: function(){
					plugin.reset();
				}
			});
		},

		/**
		 * Adds the insert button to the floating menu
		 */
		_addUIInsertButton: function () {
			var plugin = this.plugin;

			this._insertImageButton = Ui.adopt("insertImage", Button, {
				tooltip: i18n.t('button.addimg.tooltip'),
				icon: 'aloha-button aloha-image-insert',
				scope: 'Aloha.continuoustext',
				click: function(){
					plugin.insertImg();
				}
			});
		},

        /**
         * Adds the ui meta fields (search, title) to the floating menu.
         */
		_addUIMetaButtons: function () {
			var plugin = this.plugin;

			this.imgSrcField = AttributeField({
				label: i18n.t('field.img.src.label'),
				labelClass: 'aloha-image-input-label',
				tooltip: i18n.t('field.img.src.tooltip'),
				name: 'imageSource',
				scope: plugin.name
			});
			this.imgSrcField.setTemplate( '{name}
{url}' );
			this.imgSrcField.setObjectTypeFilter(plugin.objectTypeFilter);

			this.imgTitleField = AttributeField({
				label: i18n.t('field.img.title.label'),
				labelClass: 'aloha-image-input-label',
				tooltip: i18n.t('field.img.title.tooltip'),
				name: 'imageTitle',
				scope: plugin.name
			});
			this.imgTitleField.setObjectTypeFilter();
		},

		/**
		 * Adds the ui align buttons to the floating menu
		 */
		_addUIAlignButtons: function () {
			var plugin = this.plugin;

			this._imageAlignLeftButton = Ui.adopt("imageAlignLeft", Button, {
				tooltip: i18n.t('button.img.align.left.tooltip'),
				icon: 'aloha-img aloha-image-align-left',
				scope: plugin.name,
				click : function () {
					var el = jQuery(plugin.getPluginFocus());
					el.add(el.parent()).css('float', 'left');
				}
			});

			this._imageAlignRightButton = Ui.adopt("imageAlignRight", Button, {
				tooltip: i18n.t('button.img.align.right.tooltip'),
				icon: 'aloha-img aloha-image-align-right',
				scope: plugin.name,
				click : function () {
					var el = jQuery(plugin.getPluginFocus());
					el.add(el.parent()).css('float', 'right');
				}
			});

			this._imageAlignNoneButton = Ui.adopt("imageAlignNone", Button, {
				tooltip: i18n.t('button.img.align.none.tooltip'),
				icon: 'aloha-img aloha-image-align-none',
				scope: plugin.name,
				click : function () {
					var el = jQuery(plugin.getPluginFocus());
					el.add(el.parent()).css({
						'float': 'none',
						display: 'inline-block'
					});
				}
			});
		},

		/**
		 * Adds the ui margin buttons to the floating menu
		 */
		_addUIMarginButtons: function () {
			var plugin = this.plugin;

			this._imageIncPaddingButton = Ui.adopt("imageIncPadding", Button, {
				tooltip: i18n.t('padding.increase'),
				icon: 'aloha-img aloha-image-padding-increase',
				scope: plugin.name,
				click: function () {
					jQuery(plugin.getPluginFocus()).increase('padding');
				}
			});

			this._imageDecPaddingButton = Ui.adopt("imageDecPadding", Button, {
				tooltip: i18n.t('padding.decrease'),
				icon: 'aloha-img aloha-image-padding-decrease',
				scope: plugin.name,
				click: function () {
					jQuery(plugin.getPluginFocus()).decrease('padding');
				}
			});
		},

		/**
		 * Adds the crop buttons to the floating menu
		 */
		_addUICropButtons: function () {
			var plugin = this.plugin;

			Scopes.createScope('Aloha.img', ['Aloha.global']);

			this._imageCropButton = Ui.adopt("imageCropButton", ToggleButton, {
				tooltip: i18n.t('Crop'),
				icon: 'aloha-icon-cnr-crop',
				scope: plugin.name,
				click: function () {
					if (this.getState()) {
						plugin.crop();
					} else {
						plugin.endCrop();
					}
				}
			});
		},

        /**
         * Adds the resize buttons to the floating menu
         */
		_addUIResizeButtons: function () {
			var plugin = this.plugin;

			// Manual resize fields
			this.imgResizeHeightField = AttributeField({
				label:  i18n.t('height'),
				labelClass: 'aloha-image-input-label',
				name: "imageResizeHeight",
				width: 50,
				scope: plugin.name
			});
			this.imgResizeHeightField.maxValue = plugin.settings.maxHeight;
			this.imgResizeHeightField.minValue = plugin.settings.minHeight;

			this.imgResizeWidthField = AttributeField({
				label:  i18n.t('width'),
				labelClass: 'aloha-image-input-label',
				name: "imageResizeWidth",
				width: 50,
				scope: plugin.name
			});
			this.imgResizeWidthField.maxValue = plugin.settings.maxWidth;
			this.imgResizeWidthField.minValue = plugin.settings.minWidth;
 		},

		/**
		 * Adds the natural size button to the floating menu
		 */
		/*
		  TODO currently deactivated see TODO at call site above.
		_addNaturalSizeButton: function () {
			var plugin = this.plugin;

			this._imageNaturalSizeButton = Ui.adopt("imageNaturalSize", Button, {
				icon: 'aloha-img aloha-image-size-natural',
				label: i18n.t('size.natural'),
				scope: plugin.name,
				click: function () {
					plugin.resetSize();
				}
			});
		},
		*/

		/**
		 * Sets the scope
		 */
		setScope: function () {
			Scopes.setScope(this.plugin.name);
		},

		/**
		 * Redraws UI
		 */
		doLayout: function () {
			// Implementation was removed while porting this plugin to
			// the jqueryui toolbar because it seems to be a hack that
			// is not needed with the new implementation.
		}
    });
});


text:
<?php

namespace ZendTest\Validator;

use Zend\Validator\Identical;

/**
 * @group      Zend_Validator
 */
class IdenticalTest extends \PHPUnit_Framework_TestCase
{
    /** @var Identical */
    public $validator;

    public function setUp()
    {
        $this->validator = new Identical;
    }

    public function testTokenInitiallyNull()
    {
        $this->assertNull($this->validator->getToken());
    }

    public function testCanSetToken()
    {
        $this->testTokenInitiallyNull();
        $this->validator->setToken('foo');
        $this->assertEquals('foo', $this->validator->getToken());
    }

    public function testCanSetTokenViaConstructor()
    {
        $validator = new Identical('foo');
        $this->assertEquals('foo', $validator->getToken());
    }

    public function testValidatingWhenTokenNullReturnsFalse()
    {
        $this->assertFalse($this->validator->isValid('foo'));
    }

    public function testValidatingWhenTokenNullSetsMissingTokenMessage()
    {
        $this->testValidatingWhenTokenNullReturnsFalse();
        $messages = $this->validator->getMessages();
        $this->assertTrue(array_key_exists('missingToken', $messages));
    }

    public function testValidatingAgainstTokenWithNonMatchingValueReturnsFalse()
    {
        $this->validator->setToken('foo');
        $this->assertFalse($this->validator->isValid('bar'));
    }

    public function testValidatingAgainstTokenWithNonMatchingValueSetsNotSameMessage()
    {
        $this->testValidatingAgainstTokenWithNonMatchingValueReturnsFalse();
        $messages = $this->validator->getMessages();
        $this->assertTrue(array_key_exists('notSame', $messages));
    }

    public function testValidatingAgainstTokenWithMatchingValueReturnsTrue()
    {
        $this->validator->setToken('foo');
        $this->assertTrue($this->validator->isValid('foo'));
    }

    /**
     * @group ZF-6953
     */
    public function testValidatingAgainstEmptyToken()
    {
        $this->validator->setToken('');
        $this->assertTrue($this->validator->isValid(''));
    }

    /**
     * @group ZF-7128
     */
    public function testValidatingAgainstNonStrings()
    {
        $this->validator->setToken(true);
        $this->assertTrue($this->validator->isValid(true));
        $this->assertFalse($this->validator->isValid(1));

        $this->validator->setToken(array('one' => 'two', 'three'));
        $this->assertTrue($this->validator->isValid(array('one' => 'two', 'three')));
        $this->assertFalse($this->validator->isValid(array()));
    }

    public function testValidatingTokenArray()
    {
        $validator = new Identical(array('token' => 123));
        $this->assertTrue($validator->isValid(123));
        $this->assertFalse($validator->isValid(array('token' => 123)));
    }

    public function testValidatingNonStrictToken()
    {
        $validator = new Identical(array('token' => 123, 'strict' => false));
        $this->assertTrue($validator->isValid('123'));

        $validator->setStrict(true);
        $this->assertFalse($validator->isValid(array('token' => '123')));
    }

    public function testEqualsMessageTemplates()
    {
        $validator = $this->validator;
        $this->assertAttributeEquals($validator->getOption('messageTemplates'),
                                     'messageTemplates', $validator);
    }

    public function testEqualsMessageVariables()
    {
        $validator = $this->validator;
        $this->assertAttributeEquals($validator->getOption('messageVariables'),
                                     'messageVariables', $validator);
    }

    public function testValidatingStringTokenInContext()
    {
        $this->validator->setToken('email');

        $this->assertTrue($this->validator->isValid(
            'john@doe.com',
            array('email' => 'john@doe.com')
        ));

        $this->assertFalse($this->validator->isValid(
            'john@doe.com',
            array('email' => 'harry@hoe.com')
        ));

        $this->assertFalse($this->validator->isValid(
            'harry@hoe.com',
            array('email' => 'john@doe.com')
        ));
    }

    public function testValidatingArrayTokenInContext()
    {
        $this->validator->setToken(array('user' => 'email'));

        $this->assertTrue($this->validator->isValid(
            'john@doe.com',
            array(
                'user' => array(
                    'email' => 'john@doe.com'
                )
            )
        ));

        $this->assertFalse($this->validator->isValid(
            'john@doe.com',
            array(
                'user' => array(
                    'email' => 'harry@hoe.com'
                )
            )
        ));

        $this->assertFalse($this->validator->isValid(
            'harry@hoe.com',
            array(
                'user' => array(
                    'email' => 'john@doe.com'
                )
            )
        ));
    }

    public function testCanSetLiteralParameterThroughConstructor()
    {
        $validator = new Identical(array('token' => 'foo', 'literal' => true));
        // Default is false
        $validator->setLiteral(true);
        $this->assertTrue($validator->getLiteral());
    }

    public function testLiteralParameterDoesNotAffectValidationWhenNoContextIsProvided()
    {
        $this->validator->setToken(array('foo' => 'bar'));

        $this->validator->setLiteral(false);
        $this->assertTrue($this->validator->isValid(array('foo' => 'bar')));

        $this->validator->setLiteral(true);
        $this->assertTrue($this->validator->isValid(array('foo' => 'bar')));
    }

    public function testLiteralParameterWorksWhenContextIsProvided()
    {
        $this->validator->setToken(array('foo' => 'bar'));
        $this->validator->setLiteral(true);

        $this->assertTrue($this->validator->isValid(
            array('foo' => 'bar'),
            array('foo' => 'baz') // Provide a context to make sure the literal parameter will work
        ));
    }
}


text:
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_COLLECTION_SUPPORT_HEAP_LINKED_STACK_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_COLLECTION_SUPPORT_HEAP_LINKED_STACK_H_

#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/heap_allocator_impl.h"
#include "third_party/blink/renderer/platform/heap/visitor.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/type_traits.h"

namespace blink {

// HeapLinkedStack<> is an Oilpan-managed stack that avoids pre-allocation
// of memory and heap fragmentation.
//
// The API was originally implemented on the call stack by LinkedStack<>
// (now removed: https://codereview.chromium.org/2761853003/).
// See https://codereview.chromium.org/17314010 for the original use-case.
template <typename T>
class HeapLinkedStack final : public GarbageCollected<HeapLinkedStack<T>> {
 public:
  HeapLinkedStack() { CheckType(); }

  inline wtf_size_t size() const;
  inline bool IsEmpty() const;

  inline void Push(const T&);
  inline const T& Peek() const;
  inline void Pop();

  void Trace(Visitor* visitor) const {
    visitor->Trace(head_);
  }

 private:
  class Node final : public GarbageCollected<Node> {
   public:
    Node(const T&, Node*);

    void Trace(Visitor* visitor) const {
      visitor->Trace(data_);
      visitor->Trace(next_);
    }

    T data_;
    Member<Node> next_;
  };

  static void CheckType() {
    static_assert(WTF::IsMemberType<T>::value,
                  "HeapLinkedStack supports only Member.");
  }

  Member<Node> head_;
  wtf_size_t size_ = 0;
};

template <typename T>
HeapLinkedStack<T>::Node::Node(const T& data, Node* next)
    : data_(data), next_(next) {}

template <typename T>
bool HeapLinkedStack<T>::IsEmpty() const {
  return !head_;
}

template <typename T>
void HeapLinkedStack<T>::Push(const T& data) {
  head_ = MakeGarbageCollected<Node>(data, head_);
  ++size_;
}

template <typename T>
const T& HeapLinkedStack<T>::Peek() const {
  return head_->data_;
}

template <typename T>
void HeapLinkedStack<T>::Pop() {
  DCHECK(head_);
  DCHECK(size_);
  head_ = head_->next_;
  --size_;
}

template <typename T>
wtf_size_t HeapLinkedStack<T>::size() const {
  return size_;
}

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_COLLECTION_SUPPORT_HEAP_LINKED_STACK_H_


text:
layout: default
title: titles.associations-foundations-and-firms
permalink: /associations-foundations-and-firms/
color: "#3F51B5"
---

 {% include general/top-section.html %}

 {% include assocations-foundations-and-firms/assocations-foundations-and-firms.html %}


text:
package azzaoui.sociadee;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;

/**
 * Created by Youssef Azzaoui on 29/02/2016.
 * youssef.azzaoui@epfl.ch
 */
public class PicturePagerAdapter extends PagerAdapter {

    Context mContext;
    LayoutInflater mLayoutInflater;
    Drawable[] mResources ;
    public  ImageView[] mImageViews;
    public PicturePagerAdapter(Context context) {
        mContext = context;
        mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public int getCount() {
        return mResources.length;
    }

    public void setResources(Drawable[] mResources)
    {
        this.mResources = mResources;
        mImageViews = new ImageView[mResources.length];
    }

    public void updateResource(Drawable d , int pos)
    {
            mResources[pos] = d;
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == ((FrameLayout) object);
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        View itemView = mLayoutInflater.inflate(R.layout.pager_picture_item, container, false);

        ImageView imageView = (ImageView) itemView.findViewById(R.id.mainPicture);
        imageView.setImageDrawable(mResources[position]);

        if(mImageViews != null)
            mImageViews[position] = imageView;

        container.addView(itemView);

        return itemView;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView((FrameLayout) object);
    }
}