text:
namespace Microsoft.OneDrive.Sdk
{
    using System.Collections.Generic;
    using System.Threading.Tasks;

    /// <summary>
    /// The type ChildrenCollectionRequest.
    /// </summary>
    public partial class ChildrenCollectionRequest : BaseRequest, IChildrenCollectionRequest
    {
        /// <summary>
        /// Constructs a new ChildrenCollectionRequest.
        /// </summary>
        /// <param name="requestUrl">The request URL.</param>
        /// <param name="oneDriveClient">The <see cref="IOneDriveClient"/> for handling requests.</param>
        /// <param name="options">Query option name value pairs for the request.</param>
        public ChildrenCollectionRequest(
            string requestUrl,
            IOneDriveClient oneDriveClient,
            IList<Option> options)
            : base(requestUrl, oneDriveClient, options)
        {
        }

        /// <summary>
        /// Adds the specified Item to the collection via POST.
        /// </summary>
        /// <param name="item">The Item to add.</param>
        /// <returns>The created Item.</returns>
        public Task<Item> AddAsync(Item item)
        {
            this.ContentType = "application/json";
            this.Method = "POST";
            return this.SendAsync<Item>(item);
        }

        /// <summary>
        /// Gets the collection page.
        /// </summary>
        /// <returns>The collection page.</returns>
        public async Task<IChildrenCollectionPage> GetAsync()
        {
            this.Method = "GET";
            var response = await this.SendAsync<ChildrenCollectionResponse>(null);
            if (response != null && response.Value != null && response.Value.CurrentPage != null)
            {
                if (response.AdditionalData != null)
                {
                    object nextPageLink;
                    response.AdditionalData.TryGetValue("@odata.nextLink", out nextPageLink);

                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        response.Value.InitializeNextPageRequest(
                            this.OneDriveClient,
                            nextPageLinkString);
                    }
                }

                return response.Value;
            }

            return null;
        }

        /// <summary>
        /// Adds the specified expand value to the request.
        /// </summary>
        /// <param name="value">The expand value.</param>
        /// <returns>The request object to send.</returns>
        public IChildrenCollectionRequest Expand(string value)
        {
            this.QueryOptions.Add(new QueryOption("expand", value));
            return this;
        }

        /// <summary>
        /// Adds the specified select value to the request.
        /// </summary>
        /// <param name="value">The select value.</param>
        /// <returns>The request object to send.</returns>
        public IChildrenCollectionRequest Select(string value)
        {
            this.QueryOptions.Add(new QueryOption("select", value));
            return this;
        }

        /// <summary>
        /// Adds the specified top value to the request.
        /// </summary>
        /// <param name="value">The top value.</param>
        /// <returns>The request object to send.</returns>
        public IChildrenCollectionRequest Top(int value)
        {
            this.QueryOptions.Add(new QueryOption("top", value.ToString()));
            return this;
        }
    }
}


text:
package core

import (
	"sync"
	"time"

	"github.com/mmcquillan/hex/models"
)

// State struct to control all things state
type State struct {
	updateLock *sync.Mutex
	States     map[string]models.State
}

// NewState function to initialize a state
func NewState(rules *map[string]models.Rule) (state *State) {
	state = &State{}
	state.updateLock = &sync.Mutex{}
	state.States = make(map[string]models.State)
	for _, rule := range *rules {
		state.States[rule.Id] = models.State{
			LastRun:  0,
			RunCount: 0,
			Success:  false,
			Running:  false,
		}
	}
	return state
}

// SetRunning function to mark if running or not
func (state State) SetRunning(ruleID string, running bool) {
	state.updateLock.Lock()
	defer state.updateLock.Unlock()
	s := state.States[ruleID]
	if running {
		s.Running = true
		s.RunCount = s.RunCount + 1
	} else {
		s.Running = false
		s.LastRun = time.Now().Unix()
	}
	state.States[ruleID] = s
}

// SetSuccess function to mark state success
func (state State) SetSuccess(ruleID string, success bool) {
	state.updateLock.Lock()
	defer state.updateLock.Unlock()
	s := state.States[ruleID]
	s.Success = success
	state.States[ruleID] = s
}

redpajama_set_name: RedPajamaGithub


text:
# 创建 Stub Content Provider

> 编写:[jdneo](https://github.com/jdneo) - 原文:<http://developer.android.com/training/sync-adapters/creating-stub-provider.html>

Sync Adapter 框架是设计成用来和设备数据一起工作的,而这些设备数据应该被灵活且安全的 Content Provider 框架管理。因此,Sync Adapter 框架会期望应用已经为它的本地数据定义了 Content Provider。如果 Sync Adapter 框架尝试去运行我们的 Sync Adapter,而我们的应用没有一个 Content Provider 的话,那么 Sync Adapter 将会崩溃。

如果我们正在开发一个新的应用,它将数据从服务器传输到一台设备上,那么我们务必考虑将本地数据存储于 Content Provider 中。除了它对于 Sync Adapter 的重要性之外,Content Provider 还可以提供许多安全上的好处,更何况它是专门为了在 Android 设备上处理数据存储而设计的。要学习如何创建一个 Content Provider,可以阅读:[Creating a Content Provider](http://developer.android.com/guide/topics/providers/content-provider-creating.html)。

然而,如果我们已经通过别的形式来存储本地数据,我们仍然可以使用 Sync Adapter 来处理数据传输。为了满足 Sync Adapter 框架对于 Content Provider 的要求,我们可以在应用中添加一个 Stub Content Provider。一个 Stub Content Provider 实现了 Content Provider 类,但是所有的方法都返回 `null` 或者 `0`。如果我们添加了一个 Stub Content Provider,那么无论数据存储机制是什么,我们都可以使用 Sync Adapter 来传输数据。

如果在我们的应用中已经有了一个 Content Provider,那么我们就不需要创建 Stub Content Provider 了。在这种情况下,我们可以略过这节课程,直接进入:[创建 Sync Adapter](create-sync-adapter.html)。如果你还没有创建 Content Provider,这节课将向你展示如何通过添加一个 Stub Content Provider,将你的 Sync Adapter 添加到框架中。

## 添加一个 Stub Content Provider

要为我们的应用创建一个 Stub Content Provider,首先继承 [ContentProvider](http://developer.android.com/reference/android/content/ContentProvider.html) 类,并且在所有需要重写的方法中,我们一律不进行任何处理而是直接返回。下面的代码片段展示了我们应该如何创建一个 Stub Content Provider:

```java
/*
 * Define an implementation of ContentProvider that stubs out
 * all methods
 */
public class StubProvider extends ContentProvider {
    /*
     * Always return true, indicating that the
     * provider loaded correctly.
     */
    @Override
    public boolean onCreate() {
        return true;
    }
    /*
     * Return an empty String for MIME type
     */
    @Override
    public String getType() {
        return new String();
    }
    /*
     * query() always returns no results
     *
     */
    @Override
    public Cursor query(
            Uri uri,
            String[] projection,
            String selection,
            String[] selectionArgs,
            String sortOrder) {
        return null;
    }
    /*
     * insert() always returns null (no URI)
     */
    @Override
    public Uri insert(Uri uri, ContentValues values) {
        return null;
    }
    /*
     * delete() always returns "no rows affected" (0)
     */
    @Override
    public int delete(Uri uri, String selection, String[] selectionArgs) {
        return 0;
    }
    /*
     * update() always returns "no rows affected" (0)
     */
    public int update(
            Uri uri,
            ContentValues values,
            String selection,
            String[] selectionArgs) {
        return 0;
    }
}
```

## 在 Manifest 清单文件中声明 Provider

Sync Adapter 框架会通过查看应用的 manifest 文件中是否声明了 provider,来验证我们的应用是否使用了 Content Provider。为了在 manifest 清单文件中声明我们的 Stub Content Provider,添加一个 [`<provider>`](http://developer.android.com/guide/topics/manifest/provider-element.html) 标签,并让它拥有下列属性字段:

`android:name="com.example.android.datasync.provider.StubProvider"`

  指定实现 Stub Content Provider 类的完整包名。

`android:authorities="com.example.android.datasync.provider"`

  指定 Stub Content Provider 的 URI Authority。用应用的包名加上字符串 `".provider"` 作为该属性字段的值。虽然我们在这里向系统声明了 Stub Content Provider,但是不会尝试访问 Provider 本身。

`android:exported="false"`

  确定其它应用是否可以访问 Content Provider。对于 Stub Content Provider 而言,由于没有让其它应用访问该 Provider 的必要,所以我们将该值设置为 `false`。该值并不会影响 Sync Adapter 框架和 Content Provider 之间的交互。

`android:syncable="true"`

  该标识指明 Provider 是可同步的。如果将这个值设置为 `true`,那么将不需要在代码中调用 setIsSyncable()。这一标识将会允许 Sync Adapter 框架和 Content Provider 进行数据传输,但是仅仅在我们显式地执行相关调用时,这一传输时才会进行。

下面的代码片段展示了我们应该如何将 [`<provider>`](http://developer.android.com/guide/topics/manifest/provider-element.html) 标签添加到应用的 manifest 清单文件中:

```xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.network.sync.BasicSyncAdapter"
    android:versionCode="1"
    android:versionName="1.0" >
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
    ...
    <provider
        android:name="com.example.android.datasync.provider.StubProvider"
        android:authorities="com.example.android.datasync.provider"
        android:exported="false"
        android:syncable="true"/>
    ...
    </application>
</manifest>
```

现在我们已经创建了所有 Sync Adapter 框架所需要的依赖项,接下来我们可以创建封装数据传输代码的组件了。该组件就叫做 Sync Adapter。在下节课中,我们将会展示如何将这一组件添加到应用中。


text:
<resources>
    <string name="app_name">北漂租房</string>
    <string name="headline">北漂租房搜索</string>
    <string name="action_settings">设置</string>
    <string name="title_activity_result">ResultActivity</string>
    <string name="search">搜索</string>
    <string name="title_update">"数据更新时间: "</string>
    <string name="subhead">聚合豆瓣小组租房信息</string>
    <string name="toast_loading_more">正在加载更多租房信息</string>
    <string name="title_activity_fav">收藏</string>
    <string name="action_fav">收藏</string>
    <string name="toast_save_succeed">收藏成功</string>
    <string name="action_delete">删除</string>
    <string name="SNACK_FAV">已添加到收藏列表</string>
    <string name="ACTION_UNDO">撤销</string>
    <string name="toast_network_error">网络错误</string>
    <string name="hint_searchview">输入地点</string>
    <string name="toast_searchview_tip">请输入地点</string>
</resources>


text:
def greet(name):
    print "Hello, {0}!".format(name)
print "What's your name?"
name = raw_input()
greet(name)


text:
require 'formula'

class Algol68g < Formula
  homepage 'http://www.xs4all.nl/~jmvdveer/algol.html'
  url 'http://jmvdveer.home.xs4all.nl/algol68g-2.8.tar.gz'
  sha1 '46b43b8db53e2a8c02e218ca9c81cf5e6ce924fd'

  depends_on 'gsl' => :optional

  def install
    system "./configure", "--prefix=#{prefix}"
    system "make install"
  end

  test do
    path = testpath/"hello.alg"
    path.write <<-EOS.undent
      print("Hello World")
    EOS

    output = `#{bin}/a68g #{path}`.strip
    assert_equal "Hello World", output
    assert_equal 0, $?.exitstatus
  end
end


text:
td.numeric {
    text-align: right;
}

td.numeric input {
    text-align: right;
}

table tr.summaryRow td
{
    font-weight: bold;
    background-color: #eee;
}

.css-form .ng-valid {

}

.css-form .ng-invalid {
    background-color: #fcc !important;
}

.css-form .ng-pristine {
}

.css-form .ng-dirty {
    background-color: #eef;
}

input.invoiceNumber {
    font-size: 27px;
}

.table-condensed th,
.table-condensed td {
    font-size: 12px;
}


text:
function foo() {
  return new Array(120 * 1024);
};
%PrepareFunctionForOptimization(foo);
foo()[0] = 0.1;
%OptimizeFunctionOnNextCall(foo);
foo();


text:
package gov.nih.nci.caintegrator.web.action.analysis.geneexpression;

import gov.nih.nci.caintegrator.domain.genomic.ReporterTypeEnum;
import gov.nih.nci.caintegrator.web.action.analysis.DisplayableQuery;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;

/**
 * Form used to store input values for Clinical Query Based GE Plots.
 */
public class GEPlotClinicalQueryBasedActionForm {

    private String geneSymbol;
    private String platformName;
    private String reporterType = ReporterTypeEnum.GENE_EXPRESSION_PROBE_SET.getValue();
    private List<DisplayableQuery> displayableQueries = new ArrayList<DisplayableQuery>();
    private Map<String, DisplayableQuery> displayableQueryMap = new HashMap<String, DisplayableQuery>();
    private List<String> selectedQueryNames = new ArrayList<String>();
    private List<String> unselectedQueryNames = new ArrayList<String>();
    private boolean exclusiveGroups = false;
    private boolean addPatientsNotInQueriesGroup = false;
    private boolean addControlSamplesGroup = false;
    private String controlSampleSetName;
    private boolean resetSelected = false;
    private List<String> controlSampleSets = new ArrayList<String>();

    // JSP Select List Options
    private Map<String, DisplayableQuery> selectedQueries = new HashMap<String, DisplayableQuery>();
    private SortedMap<String, DisplayableQuery> unselectedQueries = new TreeMap<String, DisplayableQuery>();

    /**
     * Clears all the variables to null.
     */
    public void clear() {
        geneSymbol = null;
        reporterType = ReporterTypeEnum.GENE_EXPRESSION_PROBE_SET.getValue();
        selectedQueryNames = new ArrayList<String>();
        unselectedQueryNames = new ArrayList<String>();
        exclusiveGroups = false;
        addPatientsNotInQueriesGroup = false;
        addControlSamplesGroup = false;
        selectedQueries.clear();
        unselectedQueries.clear();
        platformName = null;
        controlSampleSets = new ArrayList<String>();
    }

    /**
     * @return the selectedQueryNames
     */
    public List<String> getSelectedQueryNames() {
        return selectedQueryNames;
    }

    /**
     * @param selectedQueryNames the selectedQueryNames to set
     */
    public void setSelectedQueryNames(List<String> selectedQueryNames) {
        this.selectedQueryNames = selectedQueryNames;
    }

    /**
     * @return the unselectedQueryNames
     */
    public List<String> getUnselectedQueryNames() {
        return unselectedQueryNames;
    }
    /**
     * @param unselectedQueryNames the unselectedQueryNames to set
     */
    public void setUnselectedQueryNames(List<String> unselectedQueryNames) {
        this.unselectedQueryNames = unselectedQueryNames;
    }

    /**
     * @return the exclusiveGroups
     */
    public boolean isExclusiveGroups() {
        return exclusiveGroups;
    }

    /**
     * @param exclusiveGroups the exclusiveGroups to set
     */
    public void setExclusiveGroups(boolean exclusiveGroups) {
        this.exclusiveGroups = exclusiveGroups;
    }

    /**
     * @return the addPatientsNotInQueriesGroup
     */
    public boolean isAddPatientsNotInQueriesGroup() {
        return addPatientsNotInQueriesGroup;
    }

    /**
     * @param addPatientsNotInQueriesGroup the addPatientsNotInQueriesGroup to set
     */
    public void setAddPatientsNotInQueriesGroup(boolean addPatientsNotInQueriesGroup) {
        this.addPatientsNotInQueriesGroup = addPatientsNotInQueriesGroup;
    }

    /**
     * @return the selectedQueries
     */
    public Map<String, DisplayableQuery> getSelectedQueries() {
        return selectedQueries;
    }

    /**
     * @param selectedQueries the selectedQueries to set
     */
    public void setSelectedQueries(Map<String, DisplayableQuery> selectedQueries) {
        this.selectedQueries = selectedQueries;
    }

    /**
     * @return the unselectedQueries
     */
    public SortedMap<String, DisplayableQuery> getUnselectedQueries() {
        return unselectedQueries;
    }

    /**
     * @param unselectedQueries the unselectedQueries to set
     */
    public void setUnselectedQueries(SortedMap<String, DisplayableQuery> unselectedQueries) {
        this.unselectedQueries = unselectedQueries;
    }

    /**
     * @return the resetSelected
     */
    public boolean isResetSelected() {
        return resetSelected;
    }

    /**
     * @param resetSelected the resetSelected to set
     */
    public void setResetSelected(boolean resetSelected) {
        this.resetSelected = resetSelected;
    }

    /**
     * @return the geneSymbol
     */
    public String getGeneSymbol() {
        return geneSymbol;
    }

    /**
     * @param geneSymbol the geneSymbol to set
     */
    public void setGeneSymbol(String geneSymbol) {
        this.geneSymbol = geneSymbol;
    }

    /**
     * @return the reporterType
     */
    public String getReporterType() {
        return reporterType;
    }

    /**
     * @param reporterType the reporterType to set
     */
    public void setReporterType(String reporterType) {
        this.reporterType = reporterType;
    }

    /**
     * @return the addControlSamplesGroup
     */
    public boolean isAddControlSamplesGroup() {
        return addControlSamplesGroup;
    }

    /**
     * @param addControlSamplesGroup the addControlSamplesGroup to set
     */
    public void setAddControlSamplesGroup(boolean addControlSamplesGroup) {
        this.addControlSamplesGroup = addControlSamplesGroup;
    }

    /**
     * @return the controlSampleSetName
     */
    public String getControlSampleSetName() {
        return controlSampleSetName;
    }

    /**
     * @param controlSampleSetName the controlSampleSetName to set
     */
    public void setControlSampleSetName(String controlSampleSetName) {
        this.controlSampleSetName = controlSampleSetName;
    }

    /**
     * @return the displayableQueries
     */
    public List<DisplayableQuery> getDisplayableQueries() {
        return displayableQueries;
    }

    /**
     * @param displayableQueries the displayableQueries to set
     */
    public void setDisplayableQueries(List<DisplayableQuery> displayableQueries) {
        this.displayableQueries = displayableQueries;
    }

    /**
     * @return the displayableQueryMap
     */
    public Map<String, DisplayableQuery> getDisplayableQueryMap() {
        return displayableQueryMap;
    }

    /**
     * @param displayableQueryMap the displayableQueryMap to set
     */
    public void setDisplayableQueryMap(Map<String, DisplayableQuery> displayableQueryMap) {
        this.displayableQueryMap = displayableQueryMap;
    }

    /**
     * @return the platformName
     */
    public String getPlatformName() {
        return platformName;
    }

    /**
     * @param platformName the platformName to set
     */
    public void setPlatformName(String platformName) {
        this.platformName = platformName;
    }

    /**
     * @return the controlSampleSets
     */
    public List<String> getControlSampleSets() {
        return controlSampleSets;
    }

    /**
     * @param controlSampleSets the controlSampleSets to set
     */
    public void setControlSampleSets(List<String> controlSampleSets) {
        this.controlSampleSets = controlSampleSets;
    }
}


text:
package org.knopflerfish.service.console;

import java.io.PrintWriter;
import java.io.Reader;

/**
 * Interface for a command group service. This service will be used by the
 * console service to present the commands to the user.
 *

 * The service object must then be registered under the class name

 * org.knopflerfish.service.console.CommandGroup with the
 * property "groupName" set to the command group name.
 *
 * @see CommandGroupAdapter
 * @see ConsoleService
 * @author Gatespace AB
 */

public interface CommandGroup {

    /**
     * Property key for group name to use when registering a CommandGroup.
     */
    String GROUP_NAME = "groupName";

    /**
     * Returns a string with the command group name.
     *
     * @return Command group name.
     */
    String getGroupName();

    /**
     * Returns a string containing a short help text for the command group.
     *
     * @return Short command group help.
     */
    String getShortHelp();

    /**
     * Returns a string containing a long help text for the command group.
     *
     * @return Long command group help.
     */
    String getLongHelp();

    /**
     * Executes a command in the command group. The command and its arguments
     * are passed in the args parameter.
     *
     * @param args
     *            argument list
     * @param out
     *            output write for command to print result to
     * @param in
     *            input reader for command to read interactively
     * @param session
     *            a handle to command session or null if single command
     * @return Status from execution, 0 means okey
     */
    int execute(String[] args, Reader in, PrintWriter out,
                Session session);

}


text:
require 'travis/build/addons/deploy/conditions'
require 'travis/build/addons/deploy/config'

module Travis
  module Build
    class Addons
      class Deploy < Base
        class Script
          VERSIONED_RUNTIMES = %w(
            d
            dart
            elixir
            ghc
            go
            haxe
            jdk
            julia
            mono
            node
            otp_release
            perl
            php
            python
            r
            ruby
            rust
            scala
            smalltalk
          ).map(&:to_sym)

          attr_accessor :script, :sh, :data, :config, :allow_failure

          def initialize(script, sh, data, config)
            @script = script
            @sh = sh
            @data = data
            @config = config
            @silent = false
            @allow_failure = config.delete(:allow_failure)
          end

          def deploy
            if data.pull_request
              warning_message "the current build is a pull request."
              return
            end

            if conditions.empty?
              run
            else
              check_conditions_and_run
            end
          end

          private
            def check_conditions_and_run
              sh.if(conditions) do
                run
              end

              sh.else do
                warning_message_unless(repo_condition, "this repo's name does not match one specified in .travis.yml's deploy.on.repo: #{on[:repo]}")
                warning_message_unless(branch_condition, "this branch is not permitted")
                warning_message_unless(runtime_conditions, "this is not on the required runtime")
                warning_message_unless(custom_conditions, "a custom condition was not met")
                warning_message_unless(tags_condition, "this is not a tagged commit")
              end
            end

            def warning_message_unless(condition, message)
              return if negate_condition(condition) == ""

              sh.if(negate_condition(condition)) { warning_message(message) }
            end

            def on
              @on ||= begin
                on = config.delete(:on) || config.delete(true) || config.delete(:true) || {}
                on = { branch: on.to_str } if on.respond_to? :to_str
                on[:ruby] ||= on[:rvm] if on.include? :rvm
                on[:node] ||= on[:node_js] if on.include? :node_js
                on
              end
            end

            def conditions
              [
                repo_condition,
                branch_condition,
                runtime_conditions,
                custom_conditions,
                tags_condition,
              ].flatten.compact.map { |c| "(#{c})" }.join(" && ")
            end

            def repo_condition
              "$TRAVIS_REPO_SLUG = \"#{on[:repo]}\"" if on[:repo]
            end

            def branch_condition
              return if on[:all_branches] || on[:tags]

              branch_config = on[:branch].respond_to?(:keys) ? on[:branch].keys : on[:branch]

              branches  = Array(branch_config || default_branches)
              branches.map { |b| "$TRAVIS_BRANCH = #{b}" }.join(' || ')
            end

            def tags_condition
              case on[:tags]
              when true  then '"$TRAVIS_TAG" != ""'
              when false then '"$TRAVIS_TAG" = ""'
              end
            end

            def custom_conditions
              on[:condition]
            end

            def runtime_conditions
              (VERSIONED_RUNTIMES & on.keys).map { |runtime| "$TRAVIS_#{runtime.to_s.upcase}_VERSION = #{on[runtime].to_s.shellescape}" }
            end

            def run
              sh.with_errexit_off do
                script.stages.run_stage(:custom, :before_deploy)
                sh.fold('dpl.0') { install }
                cmd(run_command, echo: false, assert: false, timing: true)
                script.stages.run_stage(:custom, :after_deploy)
              end
            end

            def install(edge = config[:edge])
              edge = config[:edge]
              if edge.respond_to? :fetch
                src = edge.fetch(:source, 'travis-ci/dpl')
                branch = edge.fetch(:branch, 'master')
                build_gem_locally_from(src, branch)
              end
              command = "gem install dpl"
              command << "-*.gem --local" if edge == 'local' || edge.respond_to?(:fetch)
              command << " --pre" if edge
              cmd(command, echo: false, assert: !allow_failure, timing: true)
              sh.cmd "rm -f dpl-*.gem", echo: false, assert: false, timing: false
            end

            def run_command(assert = !allow_failure)
              return "dpl #{options} --fold" unless assert
              run_command(false) + "; " + die("failed to deploy")
            end

            def die(message)
              'if [ $? -ne 0 ]; then echo %p; travis_terminate 2; fi' % message
            end

            def default_branches
              default_branches = config.except(:edge).values.grep(Hash).map(&:keys).flatten(1).uniq.compact
              default_branches.any? ? default_branches : 'master'
            end

            def option(key, value)
              case value
              when Array      then value.map { |v| option(key, v) }
              when Hash       then option(key, value[data.branch.to_sym])
              when true       then "--#{key}"
              when nil, false then nil
              else "--%s=%p" % [key, value]
              end
            end

            def cmd(cmd, *args)
              sh.cmd('type rvm &>/dev/null || source ~/.rvm/scripts/rvm', echo: false, assert: false)
              sh.cmd("rvm $(travis_internal_ruby) --fuzzy do ruby -S #{cmd}", *args)
            end

            def options
              config.flat_map { |k,v| option(k,v) }.compact.join(" ")
            end

            def warning_message(message)
              sh.echo "Skipping a deployment with the #{config[:provider]} provider because #{message}", ansi: :yellow
            end

            def negate_condition(conditions)
              Array(conditions).flatten.compact.map { |condition| " ! #{condition}" }.join(" && ")
            end

            def build_gem_locally_from(source, branch)
              sh.echo "Building dpl gem locally with source #{source} and branch #{branch}", ansi: :yellow
              sh.cmd("gem uninstall -a -x dpl >& /dev/null",                echo: false, assert: !allow_failure, timing: false)
              sh.cmd("pushd /tmp >& /dev/null",                             echo: false, assert: !allow_failure, timing: true)
              sh.cmd("git clone https://github.com/#{source} #{source}",    echo: true,  assert: !allow_failure, timing: true)
              sh.cmd("pushd #{source} >& /dev/null",                        echo: false, assert: !allow_failure, timing: true)
              sh.cmd("git checkout #{branch}",                              echo: true,  assert: !allow_failure, timing: true)
              cmd("gem build dpl.gemspec",                                  echo: true,  assert: !allow_failure, timing: true)
              sh.cmd("mv dpl-*.gem $TRAVIS_BUILD_DIR >& /dev/null",         echo: false, assert: !allow_failure, timing: true)
              sh.cmd("popd >& /dev/null",                                   echo: false, assert: !allow_failure, timing: true)
              # clean up, so that multiple edge providers can be run
              sh.cmd("rm -rf $(dirname #{source})",                         echo: false, assert: !allow_failure, timing: true)
              sh.cmd("popd >& /dev/null",                                   echo: false, assert: !allow_failure, timing: true)
            ensure
              sh.cmd("test -e /tmp/dpl && rm -rf dpl", echo: false, assert: false, timing: true)
            end
        end
      end
    end
  end
end


text:
package com.cisco.oss.foundation.cluster.masterslave;

import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * Created by Yair Ogen (yaogen) on 15/09/2016.
 */
@Configuration
@PropertySource("classpath:master-slave.properties")
public class MasterSlaveConfiguration {
}


text:
package org.unidal.cat.plugin.event.model;

import org.unidal.cat.plugin.event.filter.EventHelper;
import org.unidal.cat.plugin.event.model.entity.EventName;
import org.unidal.cat.plugin.event.model.entity.EventReport;
import org.unidal.cat.plugin.event.model.entity.EventType;
import org.unidal.cat.plugin.event.model.entity.Machine;
import org.unidal.cat.plugin.event.model.entity.Range;
import org.unidal.cat.plugin.event.model.transform.DefaultMerger;

public class EventReportMerger extends DefaultMerger {
   private EventHelper m_helper;

   public EventReportMerger(EventHelper helper, EventReport eventReport) {
      super(eventReport);

      m_helper = helper;
   }

   @Override
   public void mergeMachine(Machine old, Machine other) {
      m_helper.mergeMachine(old, other);
   }

   @Override
   public void mergeName(EventName old, EventName other) {
      m_helper.mergeName(old, other);
   }

   @Override
   public void mergeRange(Range old, Range range) {
      old.setCount(old.getCount() + range.getCount());
      old.setFails(old.getFails() + range.getFails());
   }

   @Override
   public void mergeType(EventType old, EventType other) {
      m_helper.mergeType(old, other);
   }

   @Override
   public void visitEventReport(EventReport report) {
      super.visitEventReport(report);

      getEventReport().getDomainNames().addAll(report.getDomainNames());
      getEventReport().getIps().addAll(report.getIps());
   }
}


text:
#ifndef WF_STDLIB_STACKLIST_HDR
#define WF_STDLIB_STACKLIST_HDR
#include "wfStandard.h"
#include "wfNullPointer.h"

namespace wfPrivate {
	template <typename T>
	struct wfStackListNode {
		wfStackListNode(const T& data, wfStackListNode *below = wfNullPointer) :
			m_below(below),
			m_data (data)
		{ };

		wfStackListNode *m_below;
		T                m_data;
	};
};

/*
 * Struct: wfStackList
 * Standard LIFO Stack
 *
 * >#include "wfStackList.h"
 *
 * Parameters:
 *  T - The element data type to be stored in the stack.
 *
 * Remarks:
 *  This container unlike many containers in the Wayfroward standard
 *  library lacks iterators. If iterators are required use <wfSingleList>
 * (a LIFO singly linked list).
 */
template <typename T>
struct wfStackList {
	/*
	 * Constructor: wfStackList
	 *  Initializes the stack list.
	 */
	wfStackList() :
		m_topnode(wfNullPointer),
		m_length (0)
	{ }

	/*
	 * Destructor: wfStackList
	 *  Calls <PopBack> until the length is 0.  This effectivly deletes
	 *  all elements and frees memory.
	 */
	~wfStackList() {
		while (m_length > 0)
			PopBack();
	}

	/*
	 * Function: Length
	 *  Returns the current wfStackList length.
	 */
	size_t Length() const { return m_length; }

	/*
	 * Function: Empty
	 *  Returns true if the stack contains no nodes, otherwise false.
	 */
	bool Empty() const { return (m_length == 0); }

	/*
	 * Function: Top
	 * Returns a reference to the top-most node on the stack.
	 */
	T& Top() { return m_topnode->data; }

	/*
	 * Function: Top
	 * Returns a const reference to the top-mode node on the stack.
	 */
	const T& Top() const { return m_topnode->data; }

	/*
	 * Function: PushBack
	 *  Creates a new top node with the data specified by the argument
	 *  and inserts it the back.
	 *
	 * Parameters:
	 *  data - The data to push back
	 */
	void PushBack(const T& data) {
		wfPrivate::wfStackListNode<T> *tmp = new (reinterpret_cast<wfPrivate::wfStackListNode<T>*>(g_miscHeap.Alloc(sizeof(wfPrivate::wfStackListNode<T>)))) wfPrivate::wfStackListNode<T>(data, m_topnode);
		m_topnode                          = tmp;

		m_length ++;
	}

	/*
	 * Function: PopBack
	 *  Pops out the current top node.
	 */
	void PopBack() {
		wfPrivate::wfStackListNode<T> *tmp = m_topnode;
		m_topnode                          = tmp->m_below;

		tmp->~wfPrivate::wfStackListNode<T>();
		g_miscHeap.Free(tmp);
		m_length --;
	}

	/*
	 * Function: Clear
	 *  Calls *PopBack* until the <wfStackList> is empty.  This effectivly
	 *  frees all memory as well.
	 *
	 * Remarks:
	 *  *Clear* is functionally equivlant to:
	 *  (start code)
	 *  while (!Empty()) PopBack();
	 *  (end code)
	 */
	void Clear() {
		while (m_length > 0)
			PopBack();
	}
private:
	wfPrivate::wfStackListNode<T> *m_topnode;
	size_t                         m_length;
};

#endif


text:
import weka.classifiers.meta.FilteredClassifier;
import weka.classifiers.trees.HoeffdingTree;
import weka.core.*;
import weka.classifiers.trees.J48;
import weka.filters.unsupervised.attribute.Remove;
import java.util.Timer;

import java.io.*;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.*;

import static java.lang.System.out;

public class WekaTrain {

    private File file = null;
    private List<Data> queue = null;
    private int n;
    private Attribute[] attributeList = new Attribute[181];
    private TCPServer LhServer;
    private boolean processingGesture = false;

    public WekaTrain() {
        startServer();
        listNets();

        queue = new ArrayList();
        n = 100;

        createInstance();

        try {
            TimerTask timerTask = new readFileTask();
            Timer timer = new Timer(true);
            timer.scheduleAtFixedRate(timerTask, 0, 500);
            System.out.println("TimerTask started");
        }
        catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }

    public int sendGesture(){
        int GestureID = 0;

        if(processingGesture){
            return GestureID;
        }

        try {
            BufferedReader breader = null;
            breader = new BufferedReader(new FileReader("Data/combined_train.arff"));
            Instances trainData = new Instances(breader);
            trainData.setClassIndex(0);
            breader.close();

            Instances testData = insertIntoWeka(queue, "TestSet");
            testData.setClassIndex(0);

            // filter
            Remove rm = new Remove();
            //rm.setAttributeIndices("1");  // remove 1st attribute
            // classifier
//            HoeffdingTree ht = new HoeffdingTree();

            J48 j48 = new J48();
            j48.setUnpruned(true);        // using an unpruned J48
//             meta-classifier
            FilteredClassifier fc = new FilteredClassifier();
            fc.setFilter(rm);
            fc.setClassifier(j48);
            // train and make predictions
            fc.buildClassifier(trainData);

            for (int i = 0; i < testData.numInstances(); i++) {
                double pred = fc.classifyInstance(testData.instance(i));
                System.out.print("ID: " + testData.instance(i).value(0));
//                System.out.print(", actual: " + testData.classAttribute().value((int) testData.instance(i).classValue()));
                System.out.println(", predicted: " + testData.classAttribute().value((int) pred));

//                System.out.println(", data vals: " + testData.classAttribute().value());
                String left = "left";
                String right = "right";
                String up = "up";
                String down = "down";
//                String tiltl = "tiltl";
//                String tiltr = "tiltr";
                String idle = "idle";

                if(testData.classAttribute().value((int)pred).equals(left)){
                    System.out.print("Predicted: " + left);
                    GestureID = 1;
                    processingGesture = true;
                }
                else if(testData.classAttribute().value((int)pred).equals(right)){
                    System.out.print("Predicted: " + right);
                    GestureID = 2;
                    processingGesture = true;
                }
                else if(testData.classAttribute().value((int)pred).equals(up)){
                    System.out.print("Predicted: " + up);
                    GestureID = 3;
                    processingGesture = true;
                }
                else if(testData.classAttribute().value((int)pred).equals(down)){
                    System.out.print("Predicted: " + down);
                    GestureID = 4;
                    processingGesture = true;
                }
                else if(testData.classAttribute().value((int)pred).equals(idle)){
                    System.out.print("Predicted: " + idle);
                    GestureID = 5;
//                    processingGesture = false;
                }
                else{
                    System.out.print("failed to predict or not found");
                    GestureID = 0;
//                    processingGesture = false;
                }
            }
        }
        catch (IOException IOex){
            System.out.println("Failed to load: " + IOex.getMessage().toString());
        }
        catch (Exception ex){
            System.out.println("Failed to classify:" + ex.getMessage());
        }
        final String messageText = ""+ GestureID;
//        System.out.print("\n" + "input to android: (" + messageText +")");
        //messagesArea.append("\n" + "input to android: (" + messageText +")");

        if(GestureID != 0 && GestureID != 5){

            LhServer.sendMessage(messageText);
            Timer timer1 = new Timer();
            timer1.schedule(new TimerTask() {
                @Override
                public void run() {

                    if (processingGesture)
                    {
                        queue.clear();
                        processingGesture = false;
                        System.out.print("Gathering measurements again...!");
                    }
                }
            }, 4000);
        }

        return GestureID;
    }
    // List <Point3d> points
    public Instances insertIntoWeka(final List<Data> queue, final String name)
    {
        // Create numeric attributes "x" and "y" and "z"
        // Create vector of the above attributes
        FastVector attributes = new FastVector(0);

        for (int i = 0; i < attributeList.length; i++)
            attributes.addElement(attributeList[i]);

        // Create the empty datasets "wekaPoints" with above attributes
        Instances wekaPoints = new Instances(name, attributes, 0);

        // Create empty instance
        Instance inst = new weka.core.DenseInstance(181);
        inst.setValue(attributeList[0], "idle");

        int counter = 1;
        for (Iterator<Data> i = queue.iterator(); i.hasNext();)
        {
            // get the point3d
            Data p = i.next();

            // Set instance's values for the attributes "x", "y", and "z"
            inst.setValue(attributeList[counter++], p.AccX);
            inst.setValue(attributeList[counter++], p.AccY);
            inst.setValue(attributeList[counter++], p.AccZ);
            inst.setValue(attributeList[counter++], p.GyrX);
            inst.setValue(attributeList[counter++], p.GyrY);
            inst.setValue(attributeList[counter++], p.GyrZ);

        }

        // Set instance's dataset to be the dataset "wekaPoints"
        inst.setDataset(wekaPoints);

        // Add the Instance to Instances
        wekaPoints.add(inst);

        return wekaPoints;
    }

    private void read() {

        try(FileWriter fw = new FileWriter(file.getAbsolutePath(), true);
            BufferedWriter bw = new BufferedWriter(fw);
            PrintWriter out = new PrintWriter(bw))
        {
            out.println("string");

        } catch (IOException e) {
            System.out.println("Something went wrong");
        }
    }

    public class readFileTask extends TimerTask {

        public readFileTask() throws IOException {
        }
//        boolean running = true;
        boolean reachedEndOnce = false;
        Path path = Paths.get("Data/imu_Lab/log.csv");
        final String cvsSplitBy = ",";
        int lineCount = 0;
        int lastCount = 0;
        String line = "";

        public void run() {

            try (InputStream is = Files.newInputStream(path, StandardOpenOption.READ)) {
                InputStreamReader reader = new InputStreamReader(is, StandardCharsets.UTF_8);
                BufferedReader lineReader = new BufferedReader(reader);

                while ((line = lineReader.readLine()) != null) {

                    if (reachedEndOnce && lineCount > lastCount && !processingGesture)
                    {
                        String[] dataFromFile = line.split(cvsSplitBy);
                        Data d = new Data(
                                dataFromFile[0],
                                Double.parseDouble(dataFromFile[1]),
                                Double.parseDouble(dataFromFile[2]),
                                Double.parseDouble(dataFromFile[3]),
                                Double.parseDouble(dataFromFile[4]),
                                Double.parseDouble(dataFromFile[5]),
                                Double.parseDouble(dataFromFile[6]));

                        PushQueue(d);

                        if (queue.size() >= 30 && reachedEndOnce && !processingGesture && (lineCount+60) > lastCount)
                        {
                            sendGesture();
                        }
                    }

                    if (processingGesture)
                    {
                        queue.clear();
                    }

                    lineCount++;
                }

                lastCount = lineCount - 1;
                lineCount = 0;

                reachedEndOnce = true;

            } catch (IOException e) {
                e.printStackTrace();
            }
            //System.out.print("called gesture");
            //sendGesture();
//            if (queue.size() >= 30 && reachedEndOnce)
//            {
//                // System.out.print("called gesture");
//                sendGesture();
//                // System.out.println( queue.get(queue.size()-1) );
//            }
        }
    }

    public void PushQueue(Data d)
    {
        queue.add(d);

        if (queue.size() > 30)
            queue.remove(0);
    }

    public void createInstance(){

        FastVector fvNominalVal = new FastVector(5);
        fvNominalVal.addElement("left");
        fvNominalVal.addElement("right");
        fvNominalVal.addElement("up");
        fvNominalVal.addElement("down");
        fvNominalVal.addElement("idle");
        Attribute Lable = new Attribute("Lable", fvNominalVal);

        attributeList[0] = Lable;

        int index = 1;
        for(int i = 0; i < 180;){
            attributeList[i+1] = new Attribute("AccX" + (index));
            attributeList[i+2] = new Attribute("AccY" + (index));
            attributeList[i+3] = new Attribute("AccZ" + (index));
            attributeList[i+4] = new Attribute("GyrX" + (index));
            attributeList[i+5] = new Attribute("GyrY" + (index));
            attributeList[i+6] = new Attribute("GyrZ" + (index));
            System.out.print("i is: " + i);
            i += 6;
            index++;
        }
    }
    public void startServer(){
        LhServer = new TCPServer(new TCPServer.OnMessageReceived() {
            @Override
            //this method declared in the interface from TCPServer class is implemented here
            //this method is actually a callback method, because it will run every time when it will be called from
            //TCPServer class (at while)
            public void messageReceived(String message) {
                System.out.print("\n "+message);
                //messagesArea.append("\n "+message);
            }
        });
        LhServer.start();

    }
    public void listNets(){
        try {
            Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();

            for (NetworkInterface netint : Collections.list(nets))
                displayInterfaceInformation(netint);

        } catch (SocketException Se) {
            return;
        }
    }

    public void displayInterfaceInformation(NetworkInterface netint) throws SocketException {
        out.printf("Display name: %s\n", netint.getDisplayName());
        out.printf("Name: %s\n", netint.getName());
        Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
        for (InetAddress inetAddress : Collections.list(inetAddresses)) {

            out.printf("InetAddress: %s\n", inetAddress);
            System.out.print("InetAddress: %s\n" + inetAddress.toString());
            //messagesArea.append("InetAddress: %s\n" + inetAddress.toString());
        }
        out.printf("\n");
    }
}


text:
<md-toolbar class="md-toolbar-tools">

    <md-button ng-click="view.action.menu();" style="min-width:36px; width:36px; height:36px; margin:0; margin-right:5px;" hide-gt-md aria-label="Menu">
        <md-icon md-font-icon="material-icons" style="color:white;">menu</md-icon>
    </md-button>

        Notes

    <md-button ng-click="view.action.search();" style="min-width:36px; width:36px; height:36px; margin:0; margin-left:5px;" hide-gt-md aria-label="Search">
        <md-icon md-font-icon="material-icons" style="color:white;">search</md-icon>
    </md-button>

</md-toolbar>

<md-toolbar ng-show="searchBar" class="md-toolbar-tools" id="sbar">

    <md-button ng-click="view.action.search();" style="min-width:36px; width:36px; height:36px; margin:0; margin-right:5px;" hide-gt-md aria-label="Back">
        <md-icon md-font-icon="material-icons" style="color:white;">arrow_back</md-icon>
    </md-button>

    <md-input-container layout="row" layout-align="center center" class="search-container" flex>

        <input type="text" placeholder=" Search" class="search-bar" ng-model="searchBarValue">
    </md-input-container>

    <md-button ng-click="view.action.search();" style="min-width:36px; width:36px; height:36px; margin:0; margin-left:5px;" hide-gt-md aria-label="Settings">
        <md-icon md-font-icon="material-icons" style="color:white;">search</md-icon>
    </md-button>

</md-toolbar>

<md-content ng-show="ready == 1 && !save" layout="column" delay layout-align="center center" flex layout-padding layout-margin>

    <md-icon md-font-icon="material-icons" style="font-size:160px; min-height:80px; margin-bottom:15px;">error_outline</md-icon>

Oh dîtes donc !

Impossible de récupérer la liste des livres. Veuillez réessayer ultérieurement.

</md-content>

<md-content ng-show="!save && ready < 0" layout="column" delay layout-align="center center" flex layout-padding layout-margin>

    <md-icon md-font-icon="material-icons" style="font-size:160px; min-height:80px; margin-bottom:15px;">hourglass_empty</md-icon>

Connexion aux sites de l'INSA

</md-content>

<md-content ng-show="!save && ready == 0" layout="column" delay layout-align="center center" flex layout-padding layout-margin>

    <md-icon md-font-icon="material-icons" style="font-size:160px; min-height:80px; margin-bottom:15px;">file_download</md-icon>

Chargement de vos notes

</md-content>

<md-content ng-show="save" layout="column" md-scroll-y>

        <md-progress-linear class="md-warn" ng-show="ready <= 0" md-mode="indeterminate"></md-progress-linear>

                <md-icon md-font-icon="material-icons" style="font-size:32px; min-height:32px;">error_outline</md-icon>

Impossible de mettre à jour vos notes. Veuillez réessayer ultérieurement.

            <md-divider></md-divider>

        <md-card ng-repeat="semester in semesters">
            <md-card-header>
                <md-card-header-text>
                    Semestre 1
                     0">Semestre 2
                </md-card-header-text>
            </md-card-header>

            <md-divider></md-divider>

            <md-card-content style="padding:0;">

                    <md-divider ng-show="$index > 0"></md-divider>

                    <md-subheader class="md-no-sticky" style="text-align:center; font-size:14px;">{{course.title}} ({{course.coef}})</md-subheader>

                    <md-divider></md-divider>

Aucune note

{{note.noteTitle}}

{{note.note}}

{{note.avg}}

            </md-card-content>
        </md-card>

</md-content>


text:
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Author: Manuel Requena <manuel.requena@cttc.es>
 *         Nicola Baldo <nbaldo@cttc.es>
 */

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/mobility-module.h"
#include "ns3/lte-module.h"
#include "ns3/config-store.h"
#include "ns3/radio-bearer-stats-calculator.h"
#include "ns3/lte-global-pathloss-database.h"

#include <iomanip>
#include <string>

#include <ns3/log.h>

using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("LenaPathlossTraces");

int main (int argc, char *argv[])
{
  double enbDist = 20.0;
  double radius = 10.0;
  uint32_t numUes = 1;

  CommandLine cmd;
  cmd.AddValue ("enbDist", "distance between the two eNBs", enbDist);
  cmd.AddValue ("radius", "the radius of the disc where UEs are placed around an eNB", radius);
  cmd.AddValue ("numUes", "how many UEs are attached to each eNB", numUes);
  cmd.Parse (argc, argv);

  ConfigStore inputConfig;
  inputConfig.ConfigureDefaults ();

  // parse again so you can override default values from the command line
  cmd.Parse (argc, argv);

  // determine the string tag that identifies this simulation run
  // this tag is then appended to all filenames

  IntegerValue runValue;
  GlobalValue::GetValueByName ("RngRun", runValue);

  std::ostringstream tag;
  tag  << "_enbDist" << std::setw (3) << std::setfill ('0') << std::fixed << std::setprecision (0) << enbDist
       << "_radius"  << std::setw (3) << std::setfill ('0') << std::fixed << std::setprecision (0) << radius
       << "_numUes"  << std::setw (3) << std::setfill ('0')  << numUes
       << "_rngRun"  << std::setw (3) << std::setfill ('0')  << runValue.Get () ;

  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();

  // NOTE: the PropagationLoss trace source of the SpectrumChannel
  // works only for single-frequency path loss model.
  // e.g., it will work with the following models:
  // ns3::FriisPropagationLossModel,
  // ns3::TwoRayGroundPropagationLossModel,
  // ns3::LogDistancePropagationLossModel,
  // ns3::ThreeLogDistancePropagationLossModel,
  // ns3::NakagamiPropagationLossModel
  // ns3::BuildingsPropagationLossModel
  // etc.
  // but it WON'T work if you ONLY use SpectrumPropagationLossModels such as:
  // ns3::FriisSpectrumPropagationLossModel
  // ns3::ConstantSpectrumPropagationLossModel
  lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::Cost231PropagationLossModel"));

  // Create Nodes: eNodeB and UE
  NodeContainer enbNodes;
  NodeContainer ueNodes1, ueNodes2;
  enbNodes.Create (2);
  ueNodes1.Create (numUes);
  ueNodes2.Create (numUes);

  // Position of eNBs
  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
  positionAlloc->Add (Vector (enbDist, 0.0, 0.0));
  MobilityHelper enbMobility;
  enbMobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
  enbMobility.SetPositionAllocator (positionAlloc);
  enbMobility.Install (enbNodes);

  // Position of UEs attached to eNB 1
  MobilityHelper ue1mobility;
  ue1mobility.SetPositionAllocator ("ns3::UniformDiscPositionAllocator",
                                    "X", DoubleValue (0.0),
                                    "Y", DoubleValue (0.0),
                                    "rho", DoubleValue (radius));
  ue1mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
  ue1mobility.Install (ueNodes1);

  // Position of UEs attached to eNB 2
  MobilityHelper ue2mobility;
  ue2mobility.SetPositionAllocator ("ns3::UniformDiscPositionAllocator",
                                    "X", DoubleValue (enbDist),
                                    "Y", DoubleValue (0.0),
                                    "rho", DoubleValue (radius));
  ue2mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
  ue2mobility.Install (ueNodes2);

  // Create Devices and install them in the Nodes (eNB and UE)
  NetDeviceContainer enbDevs;
  NetDeviceContainer ueDevs1;
  NetDeviceContainer ueDevs2;
  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);

  // Attach UEs to a eNB
  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
  lteHelper->Attach (ueDevs2, enbDevs.Get (1));

  // Activate an EPS bearer on all UEs
  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
  EpsBearer bearer (q);
  lteHelper->ActivateDataRadioBearer (ueDevs1, bearer);
  lteHelper->ActivateDataRadioBearer (ueDevs2, bearer);

  Simulator::Stop (Seconds (0.5));

  // Insert RLC Performance Calculator
  std::string dlOutFname = "DlRlcStats";
  dlOutFname.append (tag.str ());
  std::string ulOutFname = "UlRlcStats";
  ulOutFname.append (tag.str ());

  lteHelper->EnableMacTraces ();
  lteHelper->EnableRlcTraces ();

  // keep track of all path loss values in two centralized objects
  DownlinkLteGlobalPathlossDatabase dlPathlossDb;
  UplinkLteGlobalPathlossDatabase ulPathlossDb;
  // we rely on the fact that LteHelper creates the DL channel object first, then the UL channel object,
  // hence the former will have index 0 and the latter 1
  Config::Connect ("/ChannelList/0/PathLoss",
                   MakeCallback (&DownlinkLteGlobalPathlossDatabase::UpdatePathloss, &dlPathlossDb));
  Config::Connect ("/ChannelList/1/PathLoss",
                    MakeCallback (&UplinkLteGlobalPathlossDatabase::UpdatePathloss, &ulPathlossDb));

  Simulator::Run ();

  // print the pathloss values at the end of the simulation
  std::cout << std::endl << "Downlink pathloss:" << std::endl;
  dlPathlossDb.Print ();
  std::cout << std::endl << "Uplink pathloss:" << std::endl;
  ulPathlossDb.Print ();

  Simulator::Destroy ();
  return 0;
}


text:
layout: post
title: AWS re:Invent - Gathering Machine Learning Training Data with Amazon Mechanical Turk
author: Kevin McGee
author_title: Production Lead
---

[AWS re:Invent](https://reinvent.awsevents.com/) is a learning conference hosted by [Amazon Web Services](https://aws.amazon.com/) for the global cloud computing community. The event features keynote announcements, training, certification opportunities and more than 1,000 technical sessions. This year, [Radiant Solutions](http://www.radiantsolutions.com/) was provided the opportunity to give one of those technical sessions on gathering machine learning training data for satellite imagery. I gave a tech talk on how we use [Amazon's Mechanical Turk](https://www.mturk.com/mturk/welcome) to gather massive amounts of high quality training data at scale. I described how we have Mechanical Turk workers use our crowdsourcing platform [Tomnod](https://www.tomnod.com/) to label DigitalGlobe's (https://www.digitalglobe.com) satellite imagery.

Below is a video recording of the talk at re:Invent. Even with an 8:30 a.m. start time, it was well attended and many questions were asked during Q&A. Our main takeaway from this is that the field of work we are in is very interesting and valuable to many conference attendees.

Thanks for watching,

Kevin McGee

![alt-text]({{ site.baseurl }}/images/banner2.png)


text:
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-62816309-1', 'auto');
  ga('send', 'pageview');

</script>


text:
import Ember from 'ember';
import RipplesMixin from '../mixins/ripples';
import LayoutRules from '../mixins/layout-rules';

var MdButtonComponent = Ember.Component.extend(LayoutRules, RipplesMixin, {

    tagName: 'button',

    classNames: ['md-button'],

    attributeBindings: ['disabled', 'href', 'type', 'target', 'action'],

    didInsertElement() {
        this._super(...arguments);

        const rs = this.get('rippleService');
        if(rs) rs.setupButton(this, this.$());

        //if (this.get('action')) {
        //  this.$().attr('md-has-action', true);
        //}
    },

    buttonClassNames: Ember.computed('classNames', function() {

        var classNames = '';

        this.get('classNames').forEach((cn) => {
            classNames = classNames + " " + (cn);
        });

        return classNames;

    }),

    click() {
        this.sendAction('action', this.get('param'));
    }

});

export default MdButtonComponent;


text:
//
//  WeiboCell.m
//  WJTableDemo
//
//  Created by Maxson-001 on 15/4/2.
//  Copyright (c) 2015年 WhoJun. All rights reserved.
//

#import "WeiboCell.h"
#import "UILabel+WJ.h"

/**
 *  t
 *  c
 */
@implementation WeiboCell

- (void)awakeFromNib {
    [super awakeFromNib];
//    [self.layer setShadowOffset:CGSizeMake(0, 1)];
//    [self.layer setShadowRadius:0.5];
//    [self.layer setShadowOpacity:0.2];
//    [self.layer setShadowColor:[UIColor blackColor].CGColor];
//    [self.toolView.layer setShadowOffset:CGSizeMake(0, 2)]
    [self.toolView.layer setShadowRadius:0.5];
    [self.toolView.layer setShadowOpacity:0.5];
    [self.toolView.layer setShadowOffset:CGSizeMake(0, 0.1)];

}

- (void)setData:(id)data {
    [super setData:data];
    [self.cView setData:data];
//    [self.userNameLabel setText:data[@"t"]];
//    CGFloat wx = [UIScreen mainScreen].applicationFrame.size.width - 10 - 40 - 10 - 10 - 22 - 10;
//    [self.userNameLabel sizeToLayoutFits:CGSizeMake(wx, 0) type:WJLabelLayoutWidth];
//    [self.contentLabel setText:data[@"c"]];
//    CGFloat w = [UIScreen mainScreen].applicationFrame.size.width - 20;
//    [self.contentLabel sizeToLayoutFits:CGSizeMake(w, CGFLOAT_MAX) type:WJLabelLayoutHeight];
}

+ (CGFloat)cellForHeightAtData:(id)data {
    //10                高度间距
    //10                头像间距
    //iPhone6p?40:30    头像高度
    //10                内容间距
    //x                 文本高度
    //10                底部与内容间距
    //44                底部按钮

//    CGFloat w = [UIScreen mainScreen].applicationFrame.size.width - 20;
//    CGSize size = [UILabel sizeToLayoutFits:CGSizeMake(w, CGFLOAT_MAX) text:data[@"c"] attrs:@{NSFontAttributeName:[UIFont systemFontOfSize:17]}];
//    return 114 + size.height;
    CGRect frame = [WeiboContentView viewRectForBounds:CGRectMake(0, 0, [UIScreen mainScreen].applicationFrame.size.width, CGFLOAT_MAX) data:data];
    return frame.size.height + 44;
}
@end


text:
import React from 'react';
import { Modal, Button, Input, FormControl, HStack } from 'native-base';

export function Example() {
  const [modalVisible, setModalVisible] = React.useState(false);
  const initialRef = React.useRef(null);
  const finalRef = React.useRef(null);
  return (
    <>
      <Modal
        isOpen={modalVisible}
        onClose={() => setModalVisible(false)}
        initialFocusRef={initialRef}
        finalFocusRef={finalRef}
      >
        <Modal.Content>
          <Modal.CloseButton />
          <Modal.Header>Contact Us</Modal.Header>
          <Modal.Body>
            <FormControl>
              <FormControl.Label>Name</FormControl.Label>
              <Input ref={initialRef} />
            </FormControl>
            <FormControl mt="3">
              <FormControl.Label>Email</FormControl.Label>
              <Input />
            </FormControl>
          </Modal.Body>
          <Modal.Footer>
            <Button.Group space={2}>
              <Button
                variant="ghost"
                colorScheme="blueGray"
                onPress={() => {
                  setModalVisible(false);
                }}
              >
                Cancel
              </Button>
              <Button
                onPress={() => {
                  setModalVisible(false);
                }}
              >
                Save
              </Button>
            </Button.Group>
          </Modal.Footer>
        </Modal.Content>
      </Modal>
      <HStack space="4" justifyContent="center" alignItems="center">
        <Button
          onPress={() => {
            setModalVisible(!modalVisible);
          }}
        >
          Open Modal
        </Button>
        <Input
          w="32"
          ref={finalRef}
          placeholder="Enter the OTP"
          _light={{ placeholderTextColor: 'blueGray.700' }}
          _dark={{ placeholderTextColor: 'blueGray.100' }}
        />
      </HStack>
    </>
  );
}


text:
/* ###
 * IP: GHIDRA
 * REVIEWED: YES
 *
 * 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 ghidra.util.state.analysis;

import ghidra.program.model.address.*;
import ghidra.program.model.listing.Program;
import ghidra.program.model.mem.MemoryAccessException;
import ghidra.program.model.pcode.PcodeOp;
import ghidra.program.model.pcode.Varnode;
import ghidra.util.state.VarnodeOperation;

public abstract class Switch {

	/**
	 * Returns address corresponding to the specified caseIndexValue.
	 * @param caseIndexValue index value for specific case
	 * @return case address
	 * @throws MemoryAccessException
	 * @throws AddressOutOfBoundsException
	 */
	abstract Address getCaseAddress(int caseIndexValue) throws MemoryAccessException, AddressOutOfBoundsException;

	/**
	 * Returns the Varnode or VarnodeOperation which corresponds to the case index value for a switch.
	 */
	abstract Varnode getIndexValue();

	/**
	 * Qualify IndirectJumpSwitch
	 * and return IndirectJumpSwitch object if qualified or null if not.
	 * @param program
	 * @param v potential input value which corresponds to a indirect destination
	 * @return IndirectJumpSwitch object or null if v failed qualification
	 */
	static Switch getIndirectJumpSwitch(Program program, Varnode v) {
		if (!(v instanceof VarnodeOperation)) {
			return null;
		}
		VarnodeOperation op = (VarnodeOperation)v;
		int opcode = op.getPCodeOp().getOpcode();
		if (opcode == PcodeOp.LOAD) {
			// Absolute address jump table
			TableEntry tableEntry = TableEntry.getTableEntry(program, op);
			if (tableEntry != null) {
				return tableEntry;
			}
			return null;
		}
		if (opcode == PcodeOp.INT_ADD) {
			// Relative jump offset table
			RelativeJumpTableSwitch relJumpTableSwitch = RelativeJumpTableSwitch.getRelativeJumpTableSwitch(program, op);
			if (relJumpTableSwitch != null) {
				return relJumpTableSwitch;
			}
			// Relative computed offset (fixed case size - e.g., PIC processors)
			return TableEntryAddress.getTableEntryAddress(program.getAddressFactory(), op);
		}
		return null;
	}

}


text:
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = useEventCallback;

var React = _interopRequireWildcard(require("react"));

var _useEnhancedEffect = _interopRequireDefault(require("./useEnhancedEffect"));

/**
 * https://github.com/facebook/react/issues/14099#issuecomment-440013892
 * @param {function} fn
 */
function useEventCallback(fn) {
  var ref = React.useRef(fn);
  (0, _useEnhancedEffect.default)(function () {
    ref.current = fn;
  });
  return React.useCallback(function () {
    return (0, ref.current).apply(void 0, arguments);
  }, []);
}


text:
package edu.harvard.econcs.turkserver.server;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

import javax.annotation.Nullable;

import org.apache.commons.configuration.Configuration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.inject.Inject;
import com.google.inject.name.Named;

import edu.harvard.econcs.turkserver.QuizMaterials;
import edu.harvard.econcs.turkserver.SessionCompletedException;
import edu.harvard.econcs.turkserver.SessionOverlapException;
import edu.harvard.econcs.turkserver.SimultaneousSessionsException;
import edu.harvard.econcs.turkserver.TooManyFailsException;
import edu.harvard.econcs.turkserver.TooManySessionsException;
import edu.harvard.econcs.turkserver.config.TSConfig;
import edu.harvard.econcs.turkserver.schema.Quiz;
import edu.harvard.econcs.turkserver.schema.Session;
import edu.harvard.econcs.turkserver.server.SessionRecord.SessionStatus;
import edu.harvard.econcs.turkserver.server.mysql.ExperimentDataTracker;

public class WorkerAuthenticator {
	protected final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());

	private final ExperimentDataTracker tracker;

	private final QuizFactory quizFactory;
	private final QuizPolicy quizPolicy;

	private List<String> specialWorkers = Collections.emptyList();

	/**
	 * Maximum number of HITs that the worker can accept concurrently
	 */
	private final int simultaneousSessionLimit;

	/**
	 * Maximum number of HITs in a set that a worker is allowed to do
	 */
	private final int totalSetLimit;

	@Inject
	public WorkerAuthenticator(
			ExperimentDataTracker tracker,
			@Nullable QuizFactory quizFactory,
			@Nullable QuizPolicy quizPolicy,
			Configuration conf
			) {
		this.tracker = tracker;

		this.quizFactory = quizFactory;
		this.quizPolicy = quizPolicy;

		this.simultaneousSessionLimit = conf.getInt(TSConfig.CONCURRENCY_LIMIT);
		this.totalSetLimit = conf.getInt(TSConfig.EXP_REPEAT_LIMIT);
	}

	@Inject(optional=true)
	public void setSpecialWorkers(
			@Named(TSConfig.EXP_SPECIAL_WORKERS)
			List<String> specialWorkers ) {
		this.specialWorkers = specialWorkers;
	}

	/**
	 * Check if a potential HIT is valid, and make sure it is in the tracker
	 * @param hitId
	 * @throws SessionCompletedException
	 */
	public void checkHITValid(String hitId, String workerId, Session existingRecord)
			throws SessionCompletedException, SessionOverlapException  {

		if( existingRecord == null ) {
			existingRecord = tracker.getStoredSessionInfo(hitId);
		}

		if( existingRecord == null ) {
			tracker.saveHITId(hitId);
		}
		else {
			// Check for pathologies with previously used HITs

			if( workerId.equals(existingRecord.getWorkerId()) ) {
				if( SessionRecord.status(existingRecord) == SessionStatus.COMPLETED ) {
					/* This session already had a previous assignment and
					 * it was assigned to this worker, must be a reconnect
					 */
					throw new SessionCompletedException();
				}
				else {
					logger.info("Session {} by worker {} is reconnecting", hitId, workerId);
				}
			}
			else if( !workerId.equals(existingRecord.getWorkerId()) &&
					( SessionRecord.status(existingRecord) == SessionStatus.COMPLETED ||
					SessionRecord.status(existingRecord) == SessionStatus.EXPERIMENT ) ) {
				// Prevent bugs from old, completed (but not submitted properly)
				// still-circulating HITs from being reused

				/* TODO until we get a notification receptor, this is the place to queue up
				 * an abandoned HIT in the database
				 *
				 * TODO someone returned a HIT after starting the experiment but didn't get to
				 * the submit stage.  We need to disable these HITs
				 *
				 * TODO check this by worker and possibly let someone re-take the HIT? (probably not)
				 */
				logger.info(String.format("Session %s was in experiment or completed with worker %s," +
						"but new worker %s tried to accept",
						hitId, existingRecord.getWorkerId(), workerId));

				throw new SessionOverlapException();
			}
		}
	}

	/**
	 * Check if a worker attempting to take a HIT is exceeding any session or total limits
	 *
	 * TODO fix this to accept workers that return and accept a different HIT for the same game
	 *
	 * @param hitId
	 * @param assignmentId
	 * @param workerId
	 */
	public void checkWorkerLimits(String hitId, String workerId, Session existingRecord)
	throws SimultaneousSessionsException, TooManySessionsException {
		if (existingRecord == null)	existingRecord = tracker.getStoredSessionInfo(hitId);

		/* This could be null if no other worker has taken the HIT yet
		 * will not be null if this session was disconnected after an experiment
		 */
		String prevWorkerId = existingRecord == null ? null : existingRecord.getWorkerId();

		Collection<Session> allSessions = tracker.getSetSessionInfoForWorker(workerId);

		// Return if no sessions so far in this set
		if( allSessions == null || allSessions.size() == 0 ) return;

		// Count how many sessions they have taken so far
		int currentlyAssigned = 0;
		for( Session otherRec : allSessions ) {
			if ( SessionRecord.status(otherRec) != SessionStatus.COMPLETED ) currentlyAssigned++;
		}

		logger.info(
				String.format("Worker %s already has %d other sessions (%d currently assigned)",
						workerId, allSessions.size(), currentlyAssigned));

		/* TODO do un-assigning so we can save the fact this worker took this session anyway
		 * since right now we don't want to record them as taking a session if they get an error below
		 */
		// saveAssignmentForSession(sessionID, assignmentId, workerId);

		// Check the following if this session is a new assignment
		if( specialWorkers.contains(workerId) ) {
			logger.info("Ignored limits for special worker " + workerId);
		}
		else if( !workerId.equals(prevWorkerId) ) {
			// Check sessions first before limit (games might not be yet finished)
			if( currentlyAssigned >= simultaneousSessionLimit )
				throw new SimultaneousSessionsException();

			if( allSessions.size() >= totalSetLimit )
				throw new TooManySessionsException();
		}
	}

	/**
	 * Does this worker need to take a quiz for the current set?
	 * @param workerId
	 * @return
	 */
	public boolean workerRequiresQuiz(String workerId) throws TooManyFailsException {
		if( quizPolicy == null ) return false;

		Collection<Quiz> results = tracker.getSetQuizRecords(workerId);

		if( !quizPolicy.requiresQuiz(results) ) return false;

		// See if we should let them have another try
		if( quizPolicy.overallFail(results) )
			throw new TooManyFailsException();

		return true;
	}

	/**
	 * After taking a quiz (and failing), should this worker be locked out?
	 * @param workerId
	 * @return
	 */
	public boolean tooManyFails(String workerId) {
		Collection<Quiz> results = tracker.getSetQuizRecords(workerId);

		return quizPolicy.overallFail(results);
	}

	public boolean quizPasses(Quiz qr) {
		return quizPolicy.quizPasses(qr);
	}

	public QuizMaterials getQuiz() {
		return quizFactory.getQuiz();
	}

	public int getConcurrentLimit() {
		return simultaneousSessionLimit;
	}

	/**
	 * Gets the maximum number of allowed tasks per set
	 * @return
	 */
	public int getSetLimit() {
		return totalSetLimit;
	}

}


text:
var isNodeJS = typeof window == "undefined" && typeof exports == "object";

if (isNodeJS) {
    // Setup MSL for Node.js.
    var MslSetup = require('msl-core/util/MslSetup.js');
    var NodeMslSetup = require('../../util/NodeMslSetup.js');
    MslSetup.execute(new NodeMslSetup());

    // Capture and output thrown errors.
    process.on('unhandledRejection', function(r) {
        console.log(r);
        if (r.stack) console.log(r.stack);
    });
}

jasmine.Env.prototype.parameterize = function(description, paramDefinitions, specDefinitions) {
  var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite);

  var parentSuite = this.currentSuite;
  if (parentSuite) {
    parentSuite.add(suite);
  } else {
    this.currentRunner_.add(suite);
  }

  this.currentSuite = suite;

  var declarationError = null;
  try {
      var paramList = paramDefinitions.call(suite);
      for (var i = 0; i < paramList.length; ++i) {
          var params = paramList[i];
          var paramDescription = JSON.stringify(params);
          var paramSpecDefinitions = function() {
              specDefinitions.apply(this, params);
          };
          describe(paramDescription, paramSpecDefinitions);
      }
  } catch(e) {
      declarationError = e;
  }

  if (declarationError) {
    this.it("encountered a declaration exception", function() {
      throw declarationError;
    });
  }

  this.currentSuite = parentSuite;

  return suite;
};

jasmine.Env.prototype.xparameterize = function(desc, paramDefinitions, specDefinitions) {
  return {
    execute: function() {
    }
  };
};

/**
 * Defines a parameterized suite of specifications.
 *
 * Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared
 * are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization
 * of setup in some tests.
 *
 * @example
 * // TODO: a simple suite
 *
 * // TODO: a simple suite with a nested describe block
 *
 * @param {String} description A string, usually the class under test.
 * @param {Function} paramDefinitions function that returns an array of parameter arrays.
 * @param {Function} specDefinitions function that defines several specs, accepting the parameters.
 */
var parameterize = function(description, paramDefinitions, specDefinitions) {
    return jasmine.getEnv().parameterize(description, paramDefinitions, specDefinitions);
};
if (isNodeJS) module.exports.parameterize = parameterize;

/**
 * Disables a parameterized suite of specifications.  Used to disable some suites in a file, or files, temporarily during development.
 *
 * @param {String} description A string, usually the class under test.
 * @param {Function} paramDefinitions function that returns an array of parameter arrays.
 * @param {Function} specDefinitions function that defines several specs, accepting the parameters.
 */
var xparameterize = function(description, paramDefinitions, specDefinitions) {
  return jasmine.getEnv().xparameterize(description, paramDefinitions, specDefinitions);
};
if (isNodeJS) module.exports.xparameterize = xparameterize;

/**
 * Matcher that checks that the expected exception was thrown by the actual.
 *
 * @param {Error} expected expected exception.
 * @param {number} messageId expected MSL message ID.
 */
jasmine.Matchers.prototype.toThrow = function(expected, messageId) {
  var MslException = require('msl-core/MslException.js');
  var MslError = require('msl-core/MslError.js');

  var result = false;
  var exception;
  if (typeof this.actual != 'function') {
    throw new Error('Actual is not a function');
  }
  try {
    this.actual();
  } catch (e) {
    exception = e;
  }
  if (exception) {
    result = (expected === jasmine.undefined ||
              (!(expected instanceof MslException) && this.env.equals_(exception.message || exception, expected.message || expected)) ||
               ((expected.name == 'MslException' || exception.name == expected.name) &&
                (expected.error == MslError.NONE || exception.error == expected.error) &&
                (messageId == undefined || messageId == null || exception.messageId == messageId)));
  }

  var not = this.isNot ? "not " : "";

  this.message = function() {
    if (exception && (expected === jasmine.undefined || !result)) {
      var expectedInfo;
      if (expected) {
          if (expected.name) {
              expectedInfo = expected.name;
              if (expected.error != MslError.NONE) expectedInfo += ' ' + expected.message;
              if (messageId != undefined && messageId != null) expectedInfo += ' [messageId:' + messageId + ']';
          } else {
              expectedInfo = expected;
          }
      }
      var exceptionInfo = exception;
      if (exception.name) {
          exceptionInfo = exception.name;
          if (exception.error != MslError.NONE) exceptionInfo += ' ' + exception.message;
          if (exception.messageId != undefined && exception.messageId != null) exceptionInfo += ' [messageId:' + exception.messageId + ']';
      }
      return ["Expected function " + not + "to throw ",
              (expectedInfo) ? expectedInfo : "an exception",
              ", but it threw ",
              exceptionInfo].join('');
    } else {
      return "Expected function to throw an exception.";
    }
  };
  if (exception)
      this.stack = exception.stack;

  return result;
};

/**
 * Override matcher function to include stack trace.
 *
 * @param {string} matcher name.
 * @param {function} matcher function.
 */
jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) {
  return function() {
    var matcherArgs = jasmine.util.argsToArray(arguments);
    var result = matcherFunction.apply(this, arguments);

    if (this.isNot) {
      result = !result;
    }

    if (this.reportWasCalled_) return result;

    var message;
    if (!result) {
      if (this.message) {
        message = this.message.apply(this, arguments);
        if (jasmine.isArray_(message)) {
          message = message[this.isNot ? 1 : 0];
        }
      } else {
        var englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); });
        message = "Expected " + jasmine.pp(this.actual) + (this.isNot ? " not " : " ") + englishyPredicate;
        if (matcherArgs.length > 0) {
          for (var i = 0; i < matcherArgs.length; i++) {
            if (i > 0) message += ",";
            message += " " + jasmine.pp(matcherArgs[i]);
          }
        }
        message += ".";
      }
    }
    var expectationResult = new jasmine.ExpectationResult({
      matcherName: matcherName,
      passed: result,
      expected: matcherArgs.length > 1 ? matcherArgs : matcherArgs[0],
      actual: this.actual,
      message: message,
    });
    if (this.stack) {
      expectationResult.trace = { stack: this.stack };
    }
    this.spec.addMatcherResult(expectationResult);
    return jasmine.undefined;
  };
};

/**
 * Override equals function to use equals methods on objects.
 *
 * @param {?} a first value.
 * @param {?} b second value.
 * @param {Array<?>} mismatchKeys out parameter that returns any mismatched
 *        keys.
 * @param {Array<?>} mismatchValues out parameter that returns any mismatched
 *        values.
 */
jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
    mismatchKeys = mismatchKeys || [];
    mismatchValues = mismatchValues || [];

    for (var i = 0; i < this.equalityTesters_.length; i++) {
      var equalityTester = this.equalityTesters_[i];
      var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
      if (result !== jasmine.undefined) return result;
    }

    if (a === b) return true;

    if (a === jasmine.undefined || a === null || b === jasmine.undefined || b === null) {
      return (a == jasmine.undefined && b == jasmine.undefined);
    }

    if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) {
      return a === b;
    }

    if (a instanceof Date && b instanceof Date) {
      return a.getTime() == b.getTime();
    }

    if (a.jasmineMatches) {
      return a.jasmineMatches(b);
    }

    if (b.jasmineMatches) {
      return b.jasmineMatches(a);
    }

    if (a instanceof jasmine.Matchers.ObjectContaining) {
      return a.matches(b);
    }

    if (b instanceof jasmine.Matchers.ObjectContaining) {
      return b.matches(a);
    }

    if (jasmine.isString_(a) && jasmine.isString_(b)) {
      return (a == b);
    }

    if (jasmine.isNumber_(a) && jasmine.isNumber_(b)) {
      return (a == b);
    }

    if (a instanceof RegExp && b instanceof RegExp) {
      return this.compareRegExps_(a, b, mismatchKeys, mismatchValues);
    }

    if (typeof a === "object" && typeof b === "object") {
      if (typeof a['equals'] === 'function')
          return a.equals(b);
      if (typeof b['equals'] === 'function')
          return b.equals(a);
      return this.compareObjects_(a, b, mismatchKeys, mismatchValues);
    }

    //Straight check
    return (a === b);
  };


text:
package com.google.protoeditor.psi;

import com.intellij.lang.ASTNode;

/**
 * TODO: need to be make this a reference
 */
public class ProtoImportValue extends AbstractProtoElement implements ProtoElement {

  public ProtoImportValue(ASTNode astNode) {
    super(astNode);
  }
}