text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

'use strict';

import should = require('should');
import http = require('http');
import assert = require('assert');
import * as msRest from 'ms-rest';

import reqOptClient = require('../Expected/AcceptanceTests/RequiredOptional/autoRestRequiredOptionalTestService');

var dummyToken = 'dummy12321343423';
var credentials = new msRest.TokenCredentials(dummyToken);

var clientOptions = {};
var baseUri = 'http://localhost:3000';

describe('nodejs', function () {

  describe('Swagger Required Optional BAT', function () {

    describe('Basic Required Optional Operations', function () {
      var testClient = new reqOptClient('', '', baseUri, clientOptions);

      it('should throw error on null path parameter', function (done) {
        testClient.implicit.getRequiredPath(null, function (error, result) {
          should.exist(error);
          error.message.should.containEql('pathParameter cannot be null or undefined and it must be of type string.');
          done();
        });
      });

      it('should accept null values for query parameters', function (done) {
        testClient.implicit.putOptionalQuery({ queryParameter: null }, function (error, result, request, response) {
          should.not.exist(error);
          response.statusCode.should.equal(200);
          done();
        });
      });
      it('should accept null values for optional header parameters', function (done) {
        testClient.implicit.putOptionalHeader({ queryParameter: null }, function (error, result, request, response) {
          should.not.exist(error);
          response.statusCode.should.equal(200);
          done();
        });
      });
      it('should accept null values for optional body parameters', function (done) {
        testClient.implicit.putOptionalBody({ bodyParameter: null }, function (error, result, request, response) {
          should.not.exist(error);
          response.statusCode.should.equal(200);
          done();
        });
      });
      it('should throw error on null values for required integer parameters', function (done) {
        testClient.explicit.postRequiredIntegerParameter(null, function (error, result) {
          should.exist(error);
          error.message.should.containEql('bodyParameter cannot be null or undefined and it must be of type number.');
          done();
        });
      });
      it('should accept null values for optional integer parameters', function (done) {
        testClient.explicit.postOptionalIntegerParameter({ bodyParameter: null }, function (error, result, request, response) {
          should.not.exist(error);
          response.statusCode.should.equal(200);
          done();
        });
      });
      it('should throw error on null values for required integer properties', function (done) {
        testClient.explicit.postRequiredIntegerProperty(<any>{ 'value': null }, function (error, result) {
          should.exist(error);
          error.message.should.containEql('value');
          error.message.should.containEql('cannot be null or undefined');
          done();
        });
      });
      it('should accept null values for optional integer properties', function (done) {
        testClient.explicit.postOptionalIntegerProperty({ value: null }, function (error, result, request, response) {
          should.not.exist(error);
          response.statusCode.should.equal(200);
          done();
        });
      });
      it('should throw error on null values for required integer header', function (done) {
        testClient.explicit.postRequiredIntegerHeader(null, function (error, result) {
          should.exist(error);
          error.message.should.containEql('headerParameter cannot be null or undefined and it must be of type number.');
          done();
        });
      });
      it('should accept null values for optional integer header', function (done) {
        testClient.explicit.postOptionalIntegerHeader({ headerParameter: null }, function (error, result, request, response) {
          should.not.exist(error);
          response.statusCode.should.equal(200);
          done();
        });
      });
      it('should throw error on null values for required string parameters', function (done) {
        testClient.explicit.postRequiredStringParameter(null, function (error, result) {
          should.exist(error);
          error.message.should.containEql('bodyParameter cannot be null or undefined and it must be of type string.');
          done();
        });
      });
      it('should accept null values for optional string parameters', function (done) {
        testClient.explicit.postOptionalStringParameter({ bodyParameter: null }, function (error, result, request, response) {
          should.not.exist(error);
          response.statusCode.should.equal(200);
          done();
        });
      });
      it('should throw error on null values for required string properties', function (done) {
        testClient.explicit.postRequiredStringProperty(<any>{ 'value': null }, function (error, result) {
          should.exist(error);
          error.message.should.containEql('value');
          error.message.should.containEql('cannot be null or undefined');
          done();
        });
      });
      it('should accept null values for optional string properties', function (done) {
        testClient.explicit.postOptionalStringProperty({ value: null }, function (error, result, request, response) {
          should.not.exist(error);
          response.statusCode.should.equal(200);
          done();
        });
      });
      it('should throw error on null values for required string header', function (done) {
        testClient.explicit.postRequiredStringHeader(null, function (error, result) {
          should.exist(error);
          error.message.should.containEql('headerParameter cannot be null or undefined and it must be of type string.');
          done();
        });
      });
      it('should accept null values for optional string header', function (done) {
        testClient.explicit.postOptionalStringHeader({ bodyParameter: null }, function (error, result, request, response) {
          should.not.exist(error);
          response.statusCode.should.equal(200);
          done();
        });
      });
      it('should throw error on null values for required class parameters', function (done) {
        testClient.explicit.postRequiredClassParameter(null, function (error, result) {
          should.exist(error);
          error.message.should.containEql('bodyParameter cannot be null or undefined.');
          done();
        });
      });
      it('should accept null values for optional class parameters', function (done) {
        testClient.explicit.postOptionalClassParameter({ bodyParameter: null }, function (error, result, request, response) {
          should.not.exist(error);
          response.statusCode.should.equal(200);
          done();
        });
      });
      it('should throw error on null values for required class properties', function (done) {
        testClient.explicit.postRequiredClassProperty(<any>{ 'value': null }, function (error, result) {
          should.exist(error);
          error.message.should.containEql('value');
          error.message.should.containEql('cannot be null or undefined');
          done();
        });
      });
      it('should accept null values for optional class properties', function (done) {
        testClient.explicit.postOptionalClassProperty({ value: null }, function (error, result, request, response) {
          should.not.exist(error);
          response.statusCode.should.equal(200);
          done();
        });
      });
      it('should throw error on null values for required array parameters', function (done) {
        testClient.explicit.postRequiredArrayParameter(null, function (error, result) {
          should.exist(error);
          error.message.should.containEql('bodyParameter cannot be null or undefined and it must be of type array.');
          done();
        });
      });
      it('should accept null values for optional array parameters', function (done) {
        testClient.explicit.postOptionalArrayParameter({ bodyParameter: null }, function (error, result, request, response) {
          should.not.exist(error);
          response.statusCode.should.equal(200);
          done();
        });
      });
      it('should throw error on null values for required array properties', function (done) {
        testClient.explicit.postRequiredArrayProperty(<any>{ 'value': null }, function (error, result) {
          should.exist(error);
          error.message.should.containEql('value');
          error.message.should.containEql('cannot be null or undefined');
          done();
        });
      });
      it('should accept null values for optional array properties', function (done) {
        testClient.explicit.postOptionalArrayProperty({ value: null }, function (error, result, request, response) {
          should.not.exist(error);
          response.statusCode.should.equal(200);
          done();
        });
      });
      it('should throw error on null values for required array header', function (done) {
        testClient.explicit.postRequiredArrayHeader(null, function (error, result) {
          should.exist(error);
          error.message.should.containEql('headerParameter cannot be null or undefined and it must be of type array.');
          done();
        });
      });
      it('should accept null values for optional array header', function (done) {
        testClient.explicit.postOptionalArrayHeader({ headerParameter: null }, function (error, result, request, response) {
          should.not.exist(error);
          response.statusCode.should.equal(200);
          done();
        });
      });
      it('should throw error on null global property in path', function (done) {
        testClient.requiredGlobalPath = null;
        testClient.implicit.getRequiredGlobalPath(function (error, result) {
          should.exist(error);
          error.message.should.containEql('this.client.requiredGlobalPath cannot be null or undefined and it must be of type string.');
          done();
        });
      });
      it('should throw error on null global property in query', function (done) {
        testClient.requiredGlobalQuery = null;
        testClient.implicit.getRequiredGlobalQuery(function (error, result) {
          should.exist(error);
          error.message.should.containEql('this.client.requiredGlobalQuery cannot be null or undefined and it must be of type string.');
          done();
        });
      });
      it('should accept null values for optional global property in query', function (done) {
        testClient.implicit.getOptionalGlobalQuery(function (error, result, request, response) {
          should.not.exist(error);
          response.statusCode.should.equal(200);
          done();
        });
      });
    });
  });
});


text:
ES5Harness.registerTest( {

    id: "15.4.4.15-8-b-i-24",

    path: "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-24.js",

    description: "Array.prototype.lastIndexOf when to be visited is the document host object",

    test: function testcase() {

        var targetObj = {};
        try {
            document[0] = targetObj;
            document[100] = "100";
            document[200] = "200";
            document.length = 200;
            return 0 === Array.prototype.lastIndexOf.call(document, targetObj) &&
                100 === Array.prototype.lastIndexOf.call(document, "100") &&
                -1 === Array.prototype.lastIndexOf.call(document, "200");
        } finally {
            delete document[0];
            delete document[100];
            delete document[200];
            delete document.length;
        }
    },

    precondition: function prereq() {
        return fnExists(Array.prototype.lastIndexOf);
    }

});

redpajama_set_name: RedPajamaGithub


text:
class Pops {

 public:

	Pops();
	~Pops();

	// . set m_pops to the popularity of each word in "words"
	// . m_pops[] is 1-1 with the words in "words"
	// . must have computed the word ids (words->m_wordIds must be valid)
	bool set ( class Words *words, long a, long b );

	// from 1 (min) to 1000 (max popularity)
	long *getPops ( ) { return m_pops; };

	// from 0.0 to 1.0
	float getNormalizedPop ( long i ) {
		return (float)m_pops[i]/(float)MAX_POP; };

	long *m_pops;
	long  m_popsSize; // in bytes
	char  m_localBuf [ POPS_BUF_SIZE ];
};

#endif


text:
from msrest.serialization import Model

class CsmUsageQuota(Model):
    """Usage of the quota resource.

    :param unit: Units of measurement for the quota resourse.
    :type unit: str
    :param next_reset_time: Next reset time for the resource counter.
    :type next_reset_time: datetime
    :param current_value: The current value of the resource counter.
    :type current_value: long
    :param limit: The resource limit.
    :type limit: long
    :param name: Quota name.
    :type name: ~azure.mgmt.web.models.LocalizableString
    """

    _attribute_map = {
        'unit': {'key': 'unit', 'type': 'str'},
        'next_reset_time': {'key': 'nextResetTime', 'type': 'iso-8601'},
        'current_value': {'key': 'currentValue', 'type': 'long'},
        'limit': {'key': 'limit', 'type': 'long'},
        'name': {'key': 'name', 'type': 'LocalizableString'},
    }

    def __init__(self, unit=None, next_reset_time=None, current_value=None, limit=None, name=None):
        self.unit = unit
        self.next_reset_time = next_reset_time
        self.current_value = current_value
        self.limit = limit
        self.name = name


text:
package org.terasology.logic.behavior.asset;

import org.terasology.assets.Asset;
import org.terasology.assets.AssetType;
import org.terasology.assets.ResourceUrn;
import org.terasology.assets.module.annotations.RegisterAssetType;

/**
 * The main Group asset class. This is the reference type
 * used by the asset manager to find all groups loaded
 * from .group files. The annotation below indicates that
 * all .group files will be under the assets/groups folder.
 * A factory class is used to assist the asset creation.
 * Using the Group asset is illustrated in the
 * WildAnimalsMadness module.
 */
@RegisterAssetType(folderName = "groups", factoryClass = GroupFactory.class)
public class Group extends Asset<GroupData> {

    private GroupData groupData;

    public Group(ResourceUrn urn, GroupData data, AssetType<?, GroupData> type) {
        super(urn, type);
        reload(data);
    }

    @Override
    protected void doReload(GroupData data) {
        this.groupData = data;
    }

    public GroupData getGroupData() {
        return groupData;
    }
}


text:
require 'net/http'
require 'json'
res = Net::HTTP.get_response(URI('http://worldcup.sfg.io/matches'))
results = JSON.parse(res.body)
for jogo in results
    if jogo['status'] == 'completed'
        puts "#{jogo['home_team']['country']} #{jogo['home_team']['goals']} vs #{jogo['away_team']['country']} #{jogo['away_team']['goals']}"
    end
end


text:
	<title>Basic Shader Particles</title>
	<link rel="stylesheet" type="text/css" href="./css/style.css">


text:
'use strict';

var fs           = require('fs');
var Promise      = require('../ext/promise');
var readFile     = Promise.denodeify(fs.readFile);
var writeFile    = Promise.denodeify(fs.writeFile);
var childProcess = require('child_process');
var jsdiff       = require('diff');
var quickTemp    = require('quick-temp');
var path         = require('path');

function EditFileDiff(options) {
  this.info = options.info;

  quickTemp.makeOrRemake(this, 'tmpDifferenceDir');
}

EditFileDiff.prototype.edit = function(){
  return Promise.hash({
    input:  this.info.render(),
    output: readFile(this.info.outputPath)
  })
    .then(invokeEditor.bind(this))
    .then(applyPatch.bind(this))
    .finally(cleanUp.bind(this));
};

function cleanUp() {
  quickTemp.remove(this, 'tmpDifferenceDir'); // jshint ignore:line
}

function applyPatch(resultHash) {
  /*jshint validthis:true */
  return Promise.hash({
    diffString: readFile(resultHash.diffPath),
    currentString: readFile(resultHash.outputPath)
  }).then(function(result){
    var appliedDiff = jsdiff.applyPatch(result.currentString.toString(), result.diffString.toString());

    if(!appliedDiff) {
      var message = 'Patch was not cleanly applied.';
      this.info.ui.write(message + ' Please choose another action.\n');
      throw new Error(message + '\n');
    }

    return writeFile(resultHash.outputPath, appliedDiff);
  }.bind(this));
}

function invokeEditor(result) {
  var info     = this.info; // jshint ignore:line
  var diff     = jsdiff.createPatch(info.outputPath, result.output.toString(), result.input);
  var diffPath = path.join(this.tmpDifferenceDir, 'currentDiff.diff'); // jshint ignore:line

  return new Promise(function(resolve, reject) {
    writeFile(diffPath, diff).then(function() {
      var editorArgs  = process.env.EDITOR.split(' ');
      var editor      = editorArgs.shift();
      var editProcess = childProcess.spawn(editor, [diffPath].concat(editorArgs), {stdio: 'inherit'});
      var results     = { outputPath: info.outputPath, diffPath: diffPath };

      editProcess.on('close', function(code){
        if (code === 0) {
          resolve(results);
        } else {
          reject();
        }
      });
    });
  });
}

module.exports = EditFileDiff;


text:
<?php

defined( '_JEXEC' ) or die('RESTRICTED');

require_once( WF_EDITOR_LIBRARIES .DS. 'classes' .DS. 'plugin.php' );

class WFArticlePlugin extends WFEditorPlugin
{

	public function __construct() {
		parent::__construct();
	}

	/**
	 * Returns a reference to a manager object
	 *
	 * This method must be invoked as:
	 * 		<pre>  $manager =FileManager::getInstance();</pre>
	 *
	 * @access	public
	 * @return	FileManager  The manager object.
	 * @since	1.5
	 */
	public function &getInstance(){
		static $instance;

		if ( !is_object( $instance ) ){
			$instance = new WFArticlePlugin();
		}
		return $instance;
	}

	/**
	 * Display the plugin
	 */
	public function display()
	{
		parent::display();

		$document = WFDocument::getInstance();

		$document->addScript(array('pagebreak'), 'plugins');
		//$document->addStyleSheet(array('pagebreak'), 'plugins');

		$tabs = WFTabs::getInstance(array(
    		'base_path' => WF_EDITOR_PLUGIN
		));
		// Add tabs
		$tabs->addTab('pagebreak');
	}
}
?>


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans default-autowire="byName" default-lazy-init="true">
	<!-- 规则引擎服务 -->
	<!--
		<bean id="ruleService"
		class="ins.framework.rule.DroolsRuleServiceImpl">
		<property name="ruleFiles" value="classpath:/rules/User.drl" />
		</bean>

	-->
	<bean id="ruleService"
		class="ins.framework.rule.ILogRuleServiceImpl">
	</bean>

</beans>


text:
package org.jug.brainmaster.model.response;

// function onMessage(promoState, raffleState, isGrandPrize, sequence, timer, voucherCode, name)
public class StatusResponse {
  private UserResponse currentParticipant;

  private String promoState;

  private String raffleState;
  // RAFFLE_RUNNING, RAFFLE_CLAIMING, RAFFLE_OTHERS_RUNNING, RAFFLE_OTHERS_CONGRATULATIONS

  private Integer sequence; // URUTAN HADIAH

  private Integer candidateSequence; // URUTAN PEMENANG

  private Integer timer;

  public StatusResponse() {

  }

  public StatusResponse(String promoState, String raffleState, Integer sequence,
      Integer candidateSequence, Integer timer, UserResponse currentParticipant) {
    this.promoState = promoState;
    this.raffleState = raffleState;
    this.candidateSequence = candidateSequence;
    this.sequence = sequence;
    this.timer = timer;
    this.currentParticipant = currentParticipant;
  }

  public Integer getCandidateSequence() {
    return candidateSequence;
  }

  public UserResponse getCurrentParticipant() {
    return currentParticipant;
  }

  public String getPromoState() {
    return promoState;
  }

  public String getRaffleState() {
    return raffleState;
  }

  public Integer getSequence() {
    return sequence;
  }

  public Integer getTimer() {
    return timer;
  }

  public void setCandidateSequence(Integer candidateSequence) {
    this.candidateSequence = candidateSequence;
  }

  public void setCurrentParticipant(UserResponse currentParticipant) {
    this.currentParticipant = currentParticipant;
  }

  public void setPromoState(String promoState) {
    this.promoState = promoState;
  }

  public void setRaffleState(String raffleState) {
    this.raffleState = raffleState;
  }

  public void setSequence(Integer sequence) {
    this.sequence = sequence;
  }

  public void setTimer(Integer timer) {
    this.timer = timer;
  }

  @Override
  public String toString() {
    return "StatusResponse{" + "currentParticipant=" + currentParticipant + ", promoState='"
        + promoState + '\'' + ", raffleState='" + raffleState + '\'' + ", sequence=" + sequence
        + ", candidateSequence=" + candidateSequence + ", timer=" + timer + '}';
  }
}


text:
from flask import Blueprint

aggregate = Blueprint('aggregate', __name__)

from . import views


text:
import Regular from 'regularjs';
import { IActionDispatcher, IStateFetcher } from './helper';

/**
 * Container component to provide store
 * @component StoreProvider
 */
const StoreProvider = Regular.extend({
  name: 'StoreProvider',
  template: '{#inc this.$body}',
  config(data) {
    if (!data.store) {
      throw Error('StoreProvider must provide store');
    }
  },
  modifyBodyComponent(component) {
    const store = this.data.store;
    // component can fetch data from store which
    // implement the DataFetcher interface
    if (component[IStateFetcher.$$name]) {
      if (typeof component.mapState !== 'function') {
        console.warn(`mapState method not found in component ${component.name}`);
        return;
      }

      const unsubscribe = store.subscribe(() => {
        if (component.$phase === 'destroyed') {
          return;
        }
        const state = store.getState();
        const returnValue = component.mapState(state);
        if (returnValue !== false) {
          component.$update();
        }
      });

      component.$on('$destroy', unsubscribe)
    }
    // component can dispatch action to store which
    // implement the ActionDispatcher interface
    if (component[IActionDispatcher.$$name]) {
      component.$dispatch = store.dispatch.bind(store);
    }
  },
});

export default StoreProvider;


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
	android:layout_height="fill_parent"
	android:orientation="vertical"
	 >
    <LinearLayout
        android:layout_margin="@dimen/nd3_margin_size"
	    android:layout_width="fill_parent"
		android:layout_height="0dip"
		android:layout_weight="1"  >
	    <ListView
	          android:id="@+id/nd_feedback_list"
			  android:layout_width="fill_parent"
			  android:layout_height="wrap_content"
			  android:headerDividersEnabled="false"
			  android:footerDividersEnabled="false"
			  android:divider="@drawable/nd3_horizontal_line"
			  android:fastScrollEnabled="true"
			  android:cacheColorHint="#00000000"
			  android:fadingEdge="none"
			  android:background="@drawable/nd3_bk1"
			  android:visibility="gone"
			  />
	    <TextView
	         android:id="@+id/nd_tips"
	         android:layout_width="fill_parent"
			 android:layout_height="wrap_content"
			 android:text="@string/nd_feedback_tips4"
			 android:background="@drawable/nd3_bk1"
			 android:gravity="center"
			 android:visibility="gone"
			 />
    </LinearLayout>

    <Button
        android:layout_margin="@dimen/nd3_margin_size"
	    android:id="@+id/nd_feedback"
	    android:layout_width="fill_parent"
	    android:layout_height="wrap_content"
	    android:background="@drawable/nd_blue"
	    android:text="@string/nd_feedback_i_fb"
	    android:layout_gravity="center"
	    android:textStyle="bold"
	    android:textSize="@dimen/nd3_pay_tip_text_size"
		android:textColor="@color/nd3_white"
	    />
</LinearLayout>


text:
import UsersInGroup from "./UsersInGroup";

export { UsersInGroup };

export default UsersInGroup;


text:
package com.innovaee.eorder.dao.hibernate;

import java.util.List;

import com.innovaee.eorder.dao.RoleDao;
import com.innovaee.eorder.entity.Role;
import com.innovaee.eorder.utils.Constants;

/**
 * @Title: HibernateRoleDao
 * @Description: 角色数据访问对象实现类
 *
 * @version V1.0
 */
public class HibernateRoleDao extends HibernateBaseDao<Role> implements RoleDao {

    /**
     * 根据角色名称查找角色
     *
     * @param roleName
     *            角色名称
     * @return 角色
     */
    public Role findRoleByRoleName(final String roleName) {
        final String hql = "from Role as role where role.roleName = ?";
        Object[] paras = { roleName };
        List<Role> roles = getPage(0, Constants.MAX_RECORD, hql, paras);

        if (null != roles && roles.size() > 0) {
            return roles.get(0);
        }
        return null;
    }
}


text:
<!DOCTYPE html>

		<title></title>

		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
		<meta name="description" content="">
		<meta name="keywords" content="">
		<meta name="author" content="">
		<meta name="theme-color" content="">

		<meta property="og:image" content=""/>
		<meta property="og:description" content=""/>
		<meta property="og:site_name" content=""/>
		<meta property="og:url" content=""/>
		<meta property="og:title" content=""/>

		<meta itemprop="name" content="">
		<meta itemprop="description" content="">
		<meta itemprop="image" content="">

		<meta name="twitter:card" content="summary_large_image">
		<meta name="twitter:domain" content="">
		<meta name="twitter:site" content="@">
		<meta name="twitter:title" content="">
		<meta name="twitter:description" content="">
		<meta name="twitter:creator" content="@">
		<meta name="twitter:image:src" content="">

			<meta name="mobile-web-app-capable" content="yes">
			<link rel="icon" sizes="192x192" href="img/icons/icon_192x192.png">
			<link rel="icon" sizes="128x128" href="img/icons/icon_128x128.png">

			<meta name="apple-mobile-web-app-title" content="">
			<meta name="apple-mobile-web-app-capable" content="yes">
			<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
			<link rel="apple-touch-icon" href="img/icons/icon_60x60.png">
			<link rel="apple-touch-icon" sizes="76x76" href="img/icons/icon_76x76.png">
			<link rel="apple-touch-icon" sizes="120x120" href="img/icons/icon_120x120.png">
			<link rel="apple-touch-icon" sizes="152x152" href="img/icons/icon_152x152.png">
			<link rel="apple-touch-icon" sizes="152x152" href="img/icons/icon_167x167.png">
			<link rel="apple-touch-icon" sizes="152x152" href="img/icons/icon_180x180.png">

			<meta name="msapplication-TileColor" content="">
			<meta name="application-name" content=""/>
			<meta name="msapplication-tooltip" content=""/>
			<meta name="msapplication-starturl" content="http://"/>
			<meta name="msapplication-square70x70logo" content="img/icon-70x70.png" />
			<meta name="msapplication-square150x150logo" content="img/icon-150x150.png" />
			<meta name="msapplication-square310x310logo" content="img/icon-310x310.png" />

		<link rel="publisher" href="https://plus.google.com/">

		<link rel="canonical" href="">
		<link rel="manifest" href="manifest.json">
		<link rel="shortcut icon" href="img/favicon.ico"/>

		<link rel="stylesheet" href="style/font-awesome.min.css">
		<link rel="stylesheet" href="style/animate.min.css">
		<link rel="stylesheet" href="style/kayros.css">
		<link rel="stylesheet" href="style/main.css">

Aegis Framework
				OREGANO


text:
(function(undefined) {

    var Image = require('./Image'),
        path = require('path'),
        fs = require('fs'),
        decree = require('decree'),
        defs = require('./defs'),
        util = require('./util'),
        encoder = require('bindings')('lwip_encoder'),
        lwip_image = require('bindings')('lwip_image'),
        normalizeColor = util.normalizeColor;

    var judges = {
        scale: decree(defs.args.scale),
        resize: decree(defs.args.resize),
        contain: decree(defs.args.contain),
        cover: decree(defs.args.cover),
        rotate: decree(defs.args.rotate),
        blur: decree(defs.args.blur),
        hslaAdjust: decree(defs.args.hslaAdjust),
        saturate: decree(defs.args.saturate),
        lighten: decree(defs.args.lighten),
        darken: decree(defs.args.darken),
        fade: decree(defs.args.fade),
        opacify: decree(defs.args.opacify),
        hue: decree(defs.args.hue),
        crop: decree(defs.args.crop),
        mirror: decree(defs.args.mirror),
        pad: decree(defs.args.pad),
        border: decree(defs.args.border),
        sharpen: decree(defs.args.sharpen),
        paste: decree(defs.args.paste),
        clone: decree(defs.args.clone),
        extract: decree(defs.args.extract),
        toBuffer: decree(defs.args.toBuffer),
        writeFile: decree(defs.args.writeFile),
        setPixel: decree(defs.args.setPixel),
        getPixel: decree(defs.args.getPixel)
    };

    Image.prototype.__lock = function() {
        if (!this.__locked) this.__locked = true;
        else throw Error("Another image operation already in progress");
    };

    Image.prototype.__release = function() {
        this.__locked = false;
    };

    Image.prototype.getMetadata = function() {
        return this.__metadata;
    };

    Image.prototype.setMetadata = function(data) {
        if (typeof data != "string" && data != null) {
            throw Error("Metadata must be a string or null");
        }

        this.__metadata = data;
        return data;
    };

    Image.prototype.width = function() {
        return this.__lwip.width();
    };

    Image.prototype.height = function() {
        return this.__lwip.height();
    };

    Image.prototype.size = function() {
        return {
            width: this.__lwip.width(),
            height: this.__lwip.height()
        };
    };

    Image.prototype.getPixel = function() {
        var args = judges.getPixel(arguments),
            left = args[0],
            top = args[1];

        if (left >= this.width() || top >= this.height())
            throw Error("Coordinates exceed dimensions of image");

        var rgba = this.__lwip.getPixel(left, top);

        return {
            r: rgba[0],
            g: rgba[1],
            b: rgba[2],
            a: rgba[3]
        };
    };

    Image.prototype.scale = function() {
        this.__lock();
        var that = this;
        judges.scale(
            arguments,
            function(wRatio, hRatio, inter, callback) {
                hRatio = hRatio || wRatio;
                var width = +wRatio * that.width(),
                    height = +hRatio * that.height();
                that.__lwip.resize(width, height, defs.interpolations[inter], function(err) {
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    Image.prototype.resize = function() {
        this.__lock();
        var that = this;
        judges.resize(
            arguments,
            function(width, height, inter, callback) {
                height = height || width;
                that.__lwip.resize(+width, +height, defs.interpolations[inter], function(err) {
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    Image.prototype.contain = function() {
        var that = this;
        judges.contain(
            arguments,
            function(width, height, color, inter, callback) {
                var s = Math.min(width / that.width(), height / that.height());
                that.scale(s, s, inter, function(err){
                    if (err) return callback(err);
                    var padX = (width - that.width()) / 2,
                        padY = (height - that.height()) / 2;
                    that.pad(
                        Math.ceil(padX),
                        Math.ceil(padY),
                        Math.floor(padX),
                        Math.floor(padY),
                        color,
                        callback
                    );
                });
            }
        );
    };

    Image.prototype.cover = function() {
        var that = this;
        judges.cover(
            arguments,
            function(width, height, inter, callback) {
                var s = Math.max(width / that.width(), height / that.height());
                that.scale(s, s, inter, function(err){
                    if (err) return callback(err);
                    that.crop(width, height, callback);
                });
            }
        );
    };

    Image.prototype.rotate = function() {
        this.__lock();
        var that = this;
        judges.rotate(
            arguments,
            function(degs, color, callback) {
                color = normalizeColor(color);
                if (color.a < 100) that.__trans = true;
                that.__lwip.rotate(+degs, +color.r, +color.g, +color.b, +color.a, function(err) {
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    Image.prototype.blur = function() {
        this.__lock();
        var that = this;
        judges.blur(
            arguments,
            function(sigma, callback) {
                that.__lwip.blur(+sigma, function(err) {
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    Image.prototype.hslaAdjust = function() {
        this.__lock();
        var that = this;
        judges.hslaAdjust(
            arguments,
            function(hs, sd, ld, ad, callback) {
                that.__lwip.hslaAdj(+hs, +sd, +ld, +ad, function(err) {
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    Image.prototype.saturate = function() {
        this.__lock();
        var that = this;
        judges.saturate(
            arguments,
            function(delta, callback) {
                that.__lwip.hslaAdj(0, +delta, 0, 0, function(err) {
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    Image.prototype.lighten = function() {
        this.__lock();
        var that = this;
        judges.lighten(
            arguments,
            function(delta, callback) {
                that.__lwip.hslaAdj(0, 0, +delta, 0, function(err) {
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    Image.prototype.darken = function() {
        this.__lock();
        var that = this;
        judges.darken(
            arguments,
            function(delta, callback) {
                that.__lwip.darken(delta, function(err) {
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    Image.prototype.fade = function() {
        this.__lock();
        var that = this;
        judges.fade(
            arguments,
            function(delta, callback) {
                that.__lwip.hslaAdj(0, 0, 0, -delta, function(err) {
                    if (+delta > 0) that.__trans = true;
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    Image.prototype.opacify = function() {
        this.__lock();
        var that = this;
        judges.opacify(
            arguments,
            function(callback) {
                that.__lwip.opacify(function(err) {
                    that.__trans = false;
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    Image.prototype.hue = function() {
        this.__lock();
        var that = this;
        judges.hue(
            arguments,
            function(shift, callback) {
                that.__lwip.hslaAdj(+shift, 0, 0, 0, function(err) {
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    Image.prototype.crop = function() {
        this.__lock();
        var that = this;
        judges.crop(
            arguments,
            function(left, top, right, bottom, callback) {
                if (!right && !bottom) {
                    var size = that.size(),
                        width = left,
                        height = top;
                    left = 0 | (size.width - width) / 2;
                    top = 0 | (size.height - height) / 2;
                    right = left + width - 1;
                    bottom = top + height - 1;
                }
                that.__lwip.crop(left, top, right, bottom, function(err) {
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    Image.prototype.mirror = function() {
        this.__lock();
        var that = this;
        judges.mirror(
            arguments,
            function(axes, callback) {
                var xaxis = false,
                    yaxis = false;
                if ('x' === axes) xaxis = true;
                if ('y' === axes) yaxis = true;
                if ('xy' === axes || 'yx' === axes) {
                    xaxis = true;
                    yaxis = true;
                }
                that.__lwip.mirror(xaxis, yaxis, function(err) {
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    // mirror alias:
    Image.prototype.flip = Image.prototype.mirror;

    Image.prototype.pad = function() {
        this.__lock();
        var that = this;
        judges.pad(
            arguments,
            function(left, top, right, bottom, color, callback) {
                color = normalizeColor(color);
                if (color.a < 100) that.__trans = true;
                that.__lwip.pad(+left, +top, +right, +bottom, +color.r, +color.g, +color.b, +color.a, function(err) {
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    Image.prototype.border = function() {
        this.__lock();
        var that = this;
        judges.border(
            arguments,
            function(width, color, callback) {
                color = normalizeColor(color);
                if (color.a < 100) that.__trans = true;
                // we can just use image.pad...
                that.__lwip.pad(+width, +width, +width, +width, +color.r, +color.g, +color.b, +color.a, function(err) {
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    Image.prototype.sharpen = function() {
        this.__lock();
        var that = this;
        judges.sharpen(
            arguments,
            function(amplitude, callback) {
                that.__lwip.sharpen(+amplitude, function(err) {
                    that.__release();
                    callback(err, that);
                });
            },
            function(err) {
                that.__release();
                throw err;
            }
        );
    };

    Image.prototype.paste = function() {
        this.__lock();
        var that = this;
        try{
            judges.paste(
                arguments,
                function(left, top, img, callback) {
                    // first we retrieve what we need (buffer, dimensions, ...)
                    // synchronously so that the pasted image doesn't have a chance
                    // to be changed
                    var pixbuff = img.__lwip.buffer(),
                        width = img.__lwip.width(),
                        height = img.__lwip.height();
                    if (left + width > that.__lwip.width() || top + height > that.__lwip.height())
                        throw Error("Pasted image exceeds dimensions of base image");
                    that.__lwip.paste(+left, +top, pixbuff, +width, +height, function(err) {
                        that.__release();
                        callback(err, that);
                    });
                }
            );
        } catch(err){
            that.__release();
            throw err;
        }
    };

    Image.prototype.setPixel = function() {
        this.__lock();
        var that = this;
        try{
            judges.setPixel(
                arguments,
                function(left, top, color, callback) {
                    if (left >= that.width() || top >= that.height())
                        throw Error("Coordinates exceed dimensions of image");
                    color = normalizeColor(color);
                    if (color.a < 100) that.__trans = true;
                    that.__lwip.setPixel(+left, +top, +color.r, +color.g, +color.b, +color.a, function(err) {
                        that.__release();
                        callback(err, that);
                    });
                }
            );
        } catch(err){
            that.__release();
            throw err;
        }
    };

    Image.prototype.clone = function() {
        // no need to lock the image. we don't modify the memory buffer.
        // just copy it.
        var that = this;
        judges.clone(
            arguments,
            function(callback) {
                // first we retrieve what we need (buffer, dimensions, ...)
                // synchronously so that the original image doesn't have a chance
                // to be changed (remember, we don't lock it); and only then call
                // the callback asynchronously.
                var pixbuff = that.__lwip.buffer(),
                    width = that.__lwip.width(),
                    height = that.__lwip.height(),
                    trans = that.__trans;
                setImmediate(function() {
                    callback(null, new Image(pixbuff, width, height, trans));
                });
            }
        );
    };

    Image.prototype.extract = function() {
        // no need to lock the image. we don't modify the memory buffer.
        // just copy it and then crop it.
        var that = this;
        judges.extract(
            arguments,
            function(left, top, right, bottom, callback) {
                // first we retrieve what we need (buffer, dimensions, ...)
                // synchronously so that the original image doesn't have a chance
                // to be changed (remember, we don't lock it); then we crop it and
                // only call the callback asynchronously.
                var pixbuff = that.__lwip.buffer(),
                    width = that.__lwip.width(),
                    height = that.__lwip.height(),
                    trans = that.__trans,
                    eximg = new Image(pixbuff, width, height, trans);
                eximg.__lwip.crop(left, top, right, bottom, function(err) {
                    callback(err, eximg);
                });
            }
        );
    };

    Image.prototype.toBuffer = function() {
        this.__lock();
        var that = this;
        try{
            judges.toBuffer(
                arguments,
                function(type, params, callback) {
                    if (type === 'jpg' || type === 'jpeg') {
                        util.normalizeJpegParams(params);
                        return encoder.jpeg(
                            that.__lwip.buffer(),
                            that.__lwip.width(),
                            that.__lwip.height(),
                            params.quality,
                            encoderCb
                        );
                    } else if (type === 'png') {
                        util.normalizePngParams(params);
                        return encoder.png(
                            that.__lwip.buffer(),
                            that.__lwip.width(),
                            that.__lwip.height(),
                            params.compression,
                            params.interlaced,
                            params.transparency === 'auto' ? that.__trans : params.transparency,
                            that.__metadata,
                            encoderCb
                        );
                    } else if (type === 'gif') {
                        util.normalizeGifParams(params);
                        return encoder.gif(
                            that.__lwip.buffer(),
                            that.__lwip.width(),
                            that.__lwip.height(),
                            util.getClosest2Exp(params.colors),
                            params.colors,
                            params.interlaced,
                            params.transparency === 'auto' ? that.__trans : params.transparency,
                            params.threshold,
                            encoderCb
                        );
                    } else throw Error('Unknown type \'' + type + '\'');

                    function encoderCb(err, buffer) {
                        that.__release();
                        callback(err, buffer);
                    }
                }
            );
        } catch (err){
            that.__release();
            throw err;
        }
    };

    Image.prototype.writeFile = function() {
        var that = this;
        judges.writeFile(
            arguments,
            function(outpath, type, params, callback) {
                type = type || path.extname(outpath).slice(1).toLowerCase();
                that.toBuffer(type, params, function(err, buffer) {
                    if (err) return callback(err);
                    fs.writeFile(outpath, buffer, {
                        encoding: 'binary'
                    }, callback);
                });
            }
        );
    };

})(void 0);


text:
package psidev.psi.mi.jami.xml.cache;

/**
 * The location of an object with id in an entry
 *
 * @author Marine Dumousseau (marine@ebi.ac.uk)
 * @version $Id$
 * @since
30/06/14

 */
public class EntryLocation {

    private int id;
    private int entryId;

    /**
     *
Constructor for EntryLocation.

     *
     * @param entryId a int.
     * @param id a int.
     */
    public EntryLocation(int entryId, int id){
         this.id = id;
        this.entryId = entryId;
    }

    /**
     *
Getter for the field id.

     *
     * @return a int.
     */
    public int getId() {
        return id;
    }

    /**
     *
Getter for the field entryId.

     *
     * @return a int.
     */
    public int getEntryId() {
        return entryId;
    }

    /** {@inheritDoc} */
    @Override
    public boolean equals( Object o ) {
        if ( this == o ) {
            return true;
        }
        if ( !( o instanceof EntryLocation ) ) {
            return false;
        }

        final EntryLocation location = ( EntryLocation ) o;

        if ( location.getEntryId() != getEntryId() ) {
            return false;
        }

        return location.getId() == getId();
    }

    /** {@inheritDoc} */
    @Override
    public int hashCode() {
        int code = 37;

        code = 37 * code + getEntryId();
        code = 37 * code + getId();

        return code;
    }
}


text:
package com.cango.palmcartreasure.baseAdapter;

/**
 * Author: Othershe
 * Time: 2016/8/29 10:48
 */
public interface OnBaseItemClickListener<T> {
    void onItemClick(BaseHolder viewHolder, T data, int position);
}


text:
package org.heroesunlimited

import io.gatling.core.Predef._
import io.gatling.http.Predef._

import scala.concurrent.duration._

class HeroSimulation extends Simulation {
  var baseUrl = "http://localhost:8100"
  val sessionHeaders = Map("Content-Type" -> "application/json")

  val httpProtocol = http
    .baseUrl(baseUrl)
    .headers(sessionHeaders)

  val csvPath = getClass.getResource("/herodata/heroes.csv")
  val csvFeeder = csv(csvPath.getPath)

  val scn = scenario("Hero Simulation Scenario")
    .feed(csvFeeder.random)
    .exec(
      http("Simple Build a Hero")
        .get("/api/players/name/${player_name}"))
    .pause(10)
    .exec(
      http("Building with Character Class")
        .get("/api/players/name/${player_name}/class/${player_class}")
    )
    .pause(10)
    .exec(
      http("Building a Complete Character")
        .get("/api/players/name/${player_name}/class/${player_class}/race/${player_race}/gender/${player_gender}")
    )

  setUp(
    scn.inject(
      rampUsersPerSec(50) to 100 during (2 minutes)
    ).protocols(httpProtocol))
}


text:
/* authd/authd/bucket_test.go */
package main

import (
	"testing"
)

const (
	DefaultNamespace = "namespace.authd.bazaar.technology"
)

func Test_AllowApiKey(t *testing.T) {

	key,_ := GenerateApiKey(DefaultNamespace)

	b := NewBucket("foo")
	ok,err := b.AllowApiKey(key)
	if !ok {
		t.Fatalf("expected to work")
	}
	if err != nil {
		t.Fatalf(err.Error())
	}
}

func Test_AllowApiKeyAgain(t *testing.T) {

	key,_ := GenerateApiKey(DefaultNamespace)

	b := NewBucket("foo")
	ok,err := b.AllowApiKey(key)
	if !ok {
		t.Fatalf("expected to work")
	}
	if err != nil {
		t.Fatalf(err.Error())
	}

	ok,err = b.AllowApiKey(key)
	if ok {
		t.Fatalf("expected to fail")
	}
	if err == nil {
		t.Fatalf("expected error")
	}
}

func Test_GlobalAccess(t *testing.T) {

	key,_ := GenerateApiKey(DefaultNamespace)

	b := NewBucket("foo")
	if !b.HasGlobalAccess() {

		t.Fatalf("expected to have global access")
	}

	ok,err := b.AllowApiKey(key)
	if !ok {
		t.Fatalf("expected to work")
	}
	if err != nil {
		t.Fatalf(err.Error())
	}

	if b.HasGlobalAccess() {

		t.Fatalf("expected not to have global access")
	}
}


text:
package enumeratum.values

import cats.Show
import ciris.ConfigDecoder
import enumeratum.internal.TypeName

object Ciris {
  final def enumConfigDecoder[ValueType, EntryType <: ValueEnumEntry[ValueType]](
    `enum`: ValueEnum[ValueType, EntryType]
  )(
    implicit decoder: ConfigDecoder[String, ValueType],
    typeName: TypeName[EntryType],
    show: Show[ValueType]
  ): ConfigDecoder[String, EntryType] =
    decoder.mapOption(typeName.value)(`enum`.withValueOpt)
}


text:
body, ul {
	font-family: Constantina, Georgia, 'Nimbus Roman No9 L', serif;
	font-size: 16px;
	margin: 0;
	padding: 0;
}

#wrapper .menu {
	list-style-type: none;
	margin-left: 15px;
	margin-top: 15px;
}

#wrapper .menu li {
	background-color: #b6ff00;
	margin-bottom: 10px;
	width: 150px;
	text-align: center;
	padding: 10px 10px;
	border-radius: 15px;
	position: relative;
}

#wrapper .menu li a {
	color: black;
	text-decoration: none;
}

#wrapper .menu li:hover a {
	text-decoration: underline;
}

#wrapper .menu li:hover .content {
	display: block;
}

#wrapper .menu li .content {
	display: none;
}

#wrapper .menu li .content {
	position: absolute;
	left: 170px;
	top: 0;
}

#wrapper .menu li .content .sub-menu {
	list-style-type: none;
}

#wrapper .menu li .content .sub-menu li {
	background-color: #008000;
	padding: 20px;
	width: 500px;
	text-align: left;
	border-radius: 10px;
}

#wrapper .menu li .content .sub-menu li a {
	text-decoration: none;
	color: white;
}

#wrapper .menu li .content .sub-menu li img {
	display: none;
	width: 500px;
	border-radius: 10px;
	margin-top: 10px;
}

#wrapper .menu li .content .sub-menu li a:hover + img {
	display: block;
}

#wrapper .menu li .content .sub-menu li a:hover {
	text-decoration: underline;
}


text:
package microsoft.exchange.webservices.data;

import javax.xml.stream.XMLStreamException;
import java.util.ArrayList;

/**
 * Represents an extended property.
 */
public final class ExtendedProperty extends ComplexProperty {

  /**
   * The property definition.
   */
  private ExtendedPropertyDefinition propertyDefinition;

  /**
   * The value.
   */
  private Object value;

  /**
   * Initializes a new instance.
   */
  protected ExtendedProperty() {
  }

  /**
   * Initializes a new instance.
   *
   * @param propertyDefinition The definition of the extended property.
   * @throws Exception the exception
   */
  protected ExtendedProperty(ExtendedPropertyDefinition propertyDefinition)
      throws Exception {
    this();
    EwsUtilities.validateParam(propertyDefinition, "propertyDefinition");
    this.propertyDefinition = propertyDefinition;
  }

  /**
   * Tries to read element from XML.
   *
   * @param reader The reader.
   * @return true, if successful
   * @throws Exception the exception
   */
  @Override
  protected boolean tryReadElementFromXml(EwsServiceXmlReader reader)
      throws Exception {

    if (reader.getLocalName().equals(XmlElementNames.ExtendedFieldURI)) {
      this.propertyDefinition = new ExtendedPropertyDefinition();
      this.propertyDefinition.loadFromXml(reader);
      return true;
    } else if (reader.getLocalName().equals(XmlElementNames.Value)) {
      EwsUtilities.EwsAssert(this.getPropertyDefinition() != null,
          "ExtendedProperty.TryReadElementFromXml",
          "PropertyDefintion is missing");
      String stringValue = reader.readElementValue();
      this.value = MapiTypeConverter.convertToValue(this
          .getPropertyDefinition().getMapiType(), stringValue);
      return true;
    } else if (reader.getLocalName().equals(XmlElementNames.Values)) {
      EwsUtilities.EwsAssert(this.getPropertyDefinition() != null,
          "ExtendedProperty.TryReadElementFromXml",
          "PropertyDefintion is missing");

      StringList stringList = new StringList(XmlElementNames.Value);
      stringList.loadFromXml(reader, reader.getLocalName());
      this.value = MapiTypeConverter.convertToValue(this
          .getPropertyDefinition().getMapiType(), stringList
          .iterator());
      return true;
    } else {
      return false;
    }
  }

  /**
   * Writes elements to XML.
   *
   * @param writer the writer
   * @throws ServiceXmlSerializationException    the service xml serialization exception
   * @throws javax.xml.stream.XMLStreamException the xML stream exception
   */
  @Override
  protected void writeElementsToXml(EwsServiceXmlWriter writer)
      throws ServiceXmlSerializationException, XMLStreamException {
    this.getPropertyDefinition().writeToXml(writer);

    if (MapiTypeConverter.isArrayType(this.getPropertyDefinition()
        .getMapiType())) {
      ArrayList<?> array = (ArrayList<?>) this.getValue();
      writer
          .writeStartElement(XmlNamespace.Types,
              XmlElementNames.Values);
      for (int index = 0; index < array.size(); index++) {
        writer.writeElementValue(XmlNamespace.Types,
            XmlElementNames.Value, MapiTypeConverter
                .convertToString(this.getPropertyDefinition()
                    .getMapiType(), array.get(index)));
      }
      writer.writeEndElement();
    } else {
      writer.writeElementValue(XmlNamespace.Types, XmlElementNames.Value,
          MapiTypeConverter.convertToString(this
              .getPropertyDefinition().getMapiType(), this
              .getValue()));
    }
  }

  /**
   * Gets the definition of the extended property.
   *
   * @return The definition of the extended property.
   */
  public ExtendedPropertyDefinition getPropertyDefinition() {
    return this.propertyDefinition;
  }

  /**
   * Gets the value of the extended property.
   *
   * @return the value
   */
  public Object getValue() {
    return this.value;
  }

  /**
   * Sets the value of the extended property.
   *
   * @param val value of the extended property
   * @throws Exception the exception
   */
  public void setValue(Object val) throws Exception {
    EwsUtilities.validateParam(val, "value");
    if (this.canSetFieldValue(this.value, MapiTypeConverter.changeType(this
        .getPropertyDefinition().getMapiType(), val))) {
      this.value = MapiTypeConverter.changeType(this
          .getPropertyDefinition().getMapiType(), val);
      this.changed();
    }
  }

  /**
   * Gets the string value.
   *
   * @return String
   */
  private String getStringValue() {
    if (MapiTypeConverter.isArrayType(this.getPropertyDefinition()
        .getMapiType())) {
      ArrayList<?> array = (ArrayList<?>) this.getValue();
      if (array == null) {
        return null;
      } else {
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        for (int index = 0; index < array.size(); index++) {
          sb.append(MapiTypeConverter.convertToString(this
              .getPropertyDefinition().getMapiType(), array
              .get(index)));
          sb.append(",");
        }
        sb.append("]");

        return sb.toString();
      }
    } else {
      return MapiTypeConverter.convertToString(this
          .getPropertyDefinition().getMapiType(), this.getValue());
    }
  }

  /**
   * Determines whether the specified <see cref="T:System.Object"/> is equal
   * to the current <see cref="T:System.Object"/> true if the specified <see
   * cref="T:System.Object"/> is equal to the current <see
   * cref="T:System.Object"/>
   *
   * @param obj the obj
   * @return boolean
   */
  @Override
  public boolean equals(Object obj) {

    if (obj instanceof ExtendedProperty) {
      ExtendedProperty other = (ExtendedProperty) obj;
      if (other.getPropertyDefinition().equals(
          this.getPropertyDefinition())) {
        return this.getStringValue().equals(other.getStringValue());
      } else {
        return false;
      }
    } else {
      return false;
    }
  }

  /**
   * Serves as a hash function for a particular type.
   *
   * @return int
   */
  @Override
  public int hashCode() {
    String printableName = this.getPropertyDefinition() != null ? this
        .getPropertyDefinition().getPrintableName() : "";
    String stringVal = this.getStringValue();
    return (printableName + stringVal).hashCode();
  }
}


text:
from __future__ import absolute_import, division, print_function

from tests.core import mock
from trakt import Trakt

from httmock import HTTMock
import pytest

def test_likes():
    with HTTMock(mock.fixtures, mock.unknown):
        with Trakt.configuration.auth('mock', 'mock'):
            likes = Trakt['users'].likes()
            assert likes is not None

            likes = list(likes)

    assert len(likes) == 3

    assert likes[0].keys == [
        ('trakt', 1519)
    ]

    assert likes[1].keys == [
        ('trakt', '1238362'),
        ('slug', 'star-wars-machete')
    ]

    assert likes[2].keys == [
        ('trakt', '840781'),
        ('slug', 'star-wars-timeline')
    ]

def test_likes_invalid_response():
    with HTTMock(mock.fixtures, mock.unknown):
        likes = Trakt['users'].likes()

    assert likes is None

def test_likes_invalid_type():
    with HTTMock(mock.fixtures, mock.unknown):
        with pytest.raises(ValueError):
            likes = Trakt['users'].likes('invalid')
            assert likes is not None

            likes = list(likes)


text:
/**
 */
package Changes.impl;

import Changes.AttributeCollectionDeletion;
import Changes.ChangesPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 *
 * An implementation of the model object 'Attribute Collection Deletion'.
 *
 *

 * The following features are implemented:
 *

 *

 *
{@link Changes.impl.AttributeCollectionDeletionImpl#getDeletedValue Deleted Value}

 *

 *
 * @generated
 */
public class AttributeCollectionDeletionImpl extends CollectionDeletionImpl implements AttributeCollectionDeletion {
	/**
	 * The default value of the '{@link #getDeletedValue() Deleted Value}' attribute.
	 *
	 *
	 * @see #getDeletedValue()
	 * @generated
	 * @ordered
	 */
	protected static final String DELETED_VALUE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getDeletedValue() Deleted Value}' attribute.
	 *
	 *
	 * @see #getDeletedValue()
	 * @generated
	 * @ordered
	 */
	protected String deletedValue = DELETED_VALUE_EDEFAULT;

	/**
	 *
	 *
	 * @generated
	 */
	protected AttributeCollectionDeletionImpl() {
		super();
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ChangesPackage.Literals.ATTRIBUTE_COLLECTION_DELETION;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public String getDeletedValue() {
		return deletedValue;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public void setDeletedValue(String newDeletedValue) {
		String oldDeletedValue = deletedValue;
		deletedValue = newDeletedValue;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ChangesPackage.ATTRIBUTE_COLLECTION_DELETION__DELETED_VALUE, oldDeletedValue, deletedValue));
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ChangesPackage.ATTRIBUTE_COLLECTION_DELETION__DELETED_VALUE:
				return getDeletedValue();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ChangesPackage.ATTRIBUTE_COLLECTION_DELETION__DELETED_VALUE:
				setDeletedValue((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ChangesPackage.ATTRIBUTE_COLLECTION_DELETION__DELETED_VALUE:
				setDeletedValue(DELETED_VALUE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ChangesPackage.ATTRIBUTE_COLLECTION_DELETION__DELETED_VALUE:
				return DELETED_VALUE_EDEFAULT == null ? deletedValue != null : !DELETED_VALUE_EDEFAULT.equals(deletedValue);
		}
		return super.eIsSet(featureID);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (deletedValue: ");
		result.append(deletedValue);
		result.append(')');
		return result.toString();
	}

} //AttributeCollectionDeletionImpl


text:
-- =============================================
-- Author:		Bruno Domingues
-- Create date: 2017-10-27 19:43
-- Description: Este procedimento atualiza a flag de férias pertencente a um dia.
-- =============================================
CREATE PROCEDURE [dbo].[day_update_vacation]
	@day_id INT
   ,@is_vacation BIT
AS
BEGIN
	SET NOCOUNT OFF;

    UPDATE dbo.[day]
	SET
		is_vacation = @is_vacation
	   ,last_update_datetime = SYSDATETIMEOFFSET()
	WHERE day_id = @day_id
END


text:
import {Connection} from 'typeorm';

import {AnimalList} from './animal-list.entity';
import {ANIMAL_LIST_REPOSITORY_TOKEN} from './constants';
import {DB_CONNECTION_TOKEN} from '../database/constants';

export const animalListProviders = [
  {
    provide: ANIMAL_LIST_REPOSITORY_TOKEN,
    useFactory: (connection: Connection) => {
      return connection.getRepository(AnimalList);
    },
    inject: [DB_CONNECTION_TOKEN]
  }
];


text:
#ifndef __IO_CONFIG_OVERRIDE_H__
#define __IO_CONFIG_OVERRIDE_H__

#include "sam3u2c.h"
#include "daplink.h"

// This GPIO configuration is only valid for the SAM3U2C HIC
COMPILER_ASSERT(DAPLINK_HIC_ID == DAPLINK_HIC_ID_SAM3U2C);

// DAP LED
#define PIN_DAP_LED_PORT           PIOA
#define PIN_DAP_LED_BIT            29
#define PIN_DAP_LED                (1UL << PIN_DAP_LED_BIT)

// MSD LED
#define PIN_MSD_LED_PORT           PIOA
#define PIN_MSD_LED_BIT            29
#define PIN_MSD_LED                (1UL << PIN_MSD_LED_BIT)

// CDC LED
#define PIN_CDC_LED_PORT           PIOA
#define PIN_CDC_LED_BIT            29
#define PIN_CDC_LED                (1UL << PIN_CDC_LED_BIT)

// Non-Forwarded Reset in PIN - Not used

// Forwarded Reset in PIN
#define PIN_RESET_IN_FWRD_PORT     PIOA
#define PIN_RESET_IN_FWRD_BIT      25
#define PIN_RESET_IN_FWRD          (1UL << PIN_RESET_IN_FWRD_BIT)

// support for dynamic assignment of SWD signals
extern Pio *pin_nreset_port;            // GPIO port for nRESET signal
extern Pio *pin_swclk_port;             // GPIO port for SWCLK signal
extern Pio *pin_swdio_port;             // GPIO port for SWDIO signal
extern unsigned long pin_nreset_bit;    // GPIO pin for nRESET signal
extern unsigned long pin_swclk_bit;     // GPIO pin for SWCLK signal
extern unsigned long pin_swdio_bit;     // GPIO pin for SWDIO signal
extern unsigned long pin_nreset;        // GPIO mask for nRESET signal
extern unsigned long pin_swclk;         // GPIO mask for SWCLK signal
extern unsigned long pin_swdio;         // GPIO msak for SWDIO signal

// dynamic nRESET OUT Pin
#define PIN_nRESET_PORT            pin_nreset_port
#define PIN_nRESET_BIT             pin_nreset_bit
#define PIN_nRESET                 pin_nreset

// dynamic SWCLK/TCK Pin
#define PIN_SWCLK_PORT             pin_swclk_port
#define PIN_SWCLK_BIT              pin_swclk_bit
#define PIN_SWCLK                  pin_swclk

// dynamic SWDIO/TMS In/Out Pin
#define PIN_SWDIO_PORT             pin_swdio_port
#define PIN_SWDIO_BIT              pin_swdio_bit
#define PIN_SWDIO                  pin_swdio

// internal nRESET OUT Pin
#define PIN_OB_nRESET_PORT          PIOA
#define PIN_OB_nRESET_BIT           4
#define PIN_OB_nRESET               (1UL << PIN_OB_nRESET_BIT)

// internal SWCLK/TCK Pin
#define PIN_OB_SWCLK_PORT           PIOA
#define PIN_OB_SWCLK_BIT            17
#define PIN_OB_SWCLK                (1UL << PIN_OB_SWCLK_BIT)

// internal SWDIO/TMS In/Out Pin
#define PIN_OB_SWDIO_PORT           PIOA
#define PIN_OB_SWDIO_BIT            18
#define PIN_OB_SWDIO                (1UL << PIN_OB_SWDIO_BIT)

// external nRESET OUT Pin
#define PIN_EXT_nRESET_PORT         PIOB
#define PIN_EXT_nRESET_BIT          17
#define PIN_EXT_nRESET              (1UL << PIN_EXT_nRESET_BIT)

// external SWCLK/TCK Pin
#define PIN_EXT_SWCLK_PORT          PIOB
#define PIN_EXT_SWCLK_BIT           10
#define PIN_EXT_SWCLK               (1UL << PIN_EXT_SWCLK_BIT)

// external SWDIO/TMS In/Out Pin
#define PIN_EXT_SWDIO_PORT          PIOB
#define PIN_EXT_SWDIO_BIT           9
#define PIN_EXT_SWDIO               (1UL << PIN_EXT_SWDIO_BIT)

// shield nRESET OUT Pin
#define PIN_SH_nRESET_PORT          PIOB
#define PIN_SH_nRESET_BIT           22
#define PIN_SH_nRESET               (1UL << PIN_SH_nRESET_BIT)

// shield SWCLK/TCK Pin
#define PIN_SH_SWCLK_PORT           PIOB
#define PIN_SH_SWCLK_BIT            20
#define PIN_SH_SWCLK                (1UL << PIN_SH_SWCLK_BIT)

// shield SWDIO/TMS In/Out Pin
#define PIN_SH_SWDIO_PORT           PIOB
#define PIN_SH_SWDIO_BIT            19
#define PIN_SH_SWDIO                (1UL << PIN_SH_SWDIO_BIT)

// TDI Pin - Not used

// SWO/TDO Pin - Not used

#endif


text:
package com.yy.cloud.core.sysbase;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;

import com.yy.cloud.core.sysbase.data.domain.YYSystemdictionary;

/**
 * ClassName: Application

 * Function: TODO ADD FUNCTION.

 * Reason: TODO ADD REASON -- Optional.

 * date: May 31, 2016 10:02:11 PM

 *
 * @author chenxj
 * @version
 * @since JDK 1.8
 */
@SpringBootApplication
@ComponentScan
@EnableDiscoveryClient
//@EnableZuulProxy
//@EnableHystrix
public class Application {

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

	@Autowired
	private RepositoryRestMvcConfiguration repositoryRestConfiguration;

	@PostConstruct
	public void postConstructConfiguration() {
		// repositoryRestConfiguration.objectMapper().registerModule(new
		// Jackson2HalModule());

		repositoryRestConfiguration.config().exposeIdsFor(YYSystemdictionary.class);
	}

}


text:
package com.intellij.usages.impl;

import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.CustomShortcutSet;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.IconLoader;
import com.intellij.usageView.UsageViewBundle;
import com.intellij.usages.UsageView;
import com.intellij.usages.rules.ImportFilteringRule;
import com.intellij.usages.rules.UsageFilteringRule;
import com.intellij.usages.rules.UsageFilteringRuleProvider;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.List;

/**
 * @author yole
 */
public class ImportUsageFilteringRuleProvider implements UsageFilteringRuleProvider {
  @NotNull
  public UsageFilteringRule[] getActiveRules(@NotNull final Project project) {
    final List<UsageFilteringRule> rules = new ArrayList<UsageFilteringRule>();
    if (!ImportFilteringUsageViewSetting.getInstance().SHOW_IMPORTS) {
      ContainerUtil.addAll(rules, Extensions.getExtensions(ImportFilteringRule.EP_NAME));
    }
    return rules.toArray(new UsageFilteringRule[rules.size()]);
  }

  @NotNull
  public AnAction[] createFilteringActions(@NotNull final UsageView view) {
    final UsageViewImpl impl = (UsageViewImpl)view;
    if (view.getPresentation().isCodeUsages()) {
      final JComponent component = view.getComponent();
      final ShowImportsAction showImportsAction = new ShowImportsAction(impl);
      showImportsAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.CTRL_DOWN_MASK)), component);

      impl.scheduleDisposeOnClose(new Disposable() {
        public void dispose() {
          showImportsAction.unregisterCustomShortcutSet(component);
        }
      });
      return new AnAction[] { showImportsAction };
    }
    else {
      return AnAction.EMPTY_ARRAY;
    }
  }

  private static class ShowImportsAction extends RuleAction {
    private ShowImportsAction(UsageViewImpl view) {
      super(view, UsageViewBundle.message("action.show.import.statements"), IconLoader.getIcon("/actions/showImportStatements.png"));
    }

    protected boolean getOptionValue() {
      return ImportFilteringUsageViewSetting.getInstance().SHOW_IMPORTS;
    }

    protected void setOptionValue(boolean value) {
      ImportFilteringUsageViewSetting.getInstance().SHOW_IMPORTS = value;
    }
  }
}