text:
package com.zxq.activity;

import android.app.Activity;
import android.app.Dialog;
import android.content.*;
import android.os.Bundle;
import android.os.IBinder;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.zxq.app.XmppBroadcastReceiver;
import com.zxq.service.XmppService;
import com.zxq.util.*;
import com.zxq.xmpp.R;
import org.jivesoftware.smackx.packet.VCard;

/**
 * Created by zxq on 2014/9/15.
 */
public class RegisterActivity extends Activity {
    private ImageView actionBarBack;
    private TextView acitonBarTitle;

    private EditText inputAccount;
    private EditText inputPassword;
    private EditText inputAgainPassword;
    private Button btnRegister;
    private View.OnClickListener clickListener;

    private XmppService mXmppService;

    private String account = "";
    private String password = "";
    private String passwordAgain = "";

    XmppService.IRegisterCallBack iRegisterCallBack;

    ServiceConnection mServiceConnection = new ServiceConnection() {

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            mXmppService = ((XmppService.XXBinder) service).getService();
        }

        @Override
        public void onServiceDisconnected(ComponentName name) {
            mXmppService = null;
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        initView();
    }

    private void bindXMPPService() {
        LogUtil.i(RegisterActivity.class, "[SERVICE] Unbind");
        Intent mServiceIntent = new Intent(this, XmppService.class);
        bindService(mServiceIntent, mServiceConnection, Context.BIND_AUTO_CREATE + Context.BIND_DEBUG_UNBIND);
    }

    private void unbindXMPPService() {
        try {
            unbindService(mServiceConnection);
            LogUtil.i(RegisterActivity.class, "[SERVICE] Unbind");
        } catch (IllegalArgumentException e) {
            LogUtil.e(RegisterActivity.class, "Service wasn't bound!");
        }
    }

    private void initView() {
        actionBarBack = (ImageView) findViewById(R.id.actionbar_back);
        acitonBarTitle = (TextView) findViewById(R.id.actionbar_title);
        inputAccount = (EditText) findViewById(R.id.register_input_account);
        inputPassword = (EditText) findViewById(R.id.register_input_password);
        inputAgainPassword = (EditText) findViewById(R.id.register_input_password_again);
        btnRegister = (Button) findViewById(R.id.register_btn_register);
        acitonBarTitle.setText("用户注册");
        actionBarBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                RegisterActivity.this.finish();
            }
        });
        iRegisterCallBack = new XmppService.IRegisterCallBack() {
            @Override
            public void onRegisterResult(int resultCode) {
//此函数返回值解释 1:注册成功 0:服务器没有返回结果 2:这个账号已经存在 3.注册失败
                switch (resultCode) {
                    case 0:
                        RegisterActivity.this.runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                ToastUtil.showShort(RegisterActivity.this.getBaseContext(), "服务器没有响应,请重试!");
                            }
                        });
                        break;
                    case 1:
                        RegisterActivity.this.runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                ToastUtil.showShort(RegisterActivity.this.getBaseContext(), "注册成功!");
                                Intent intent = new Intent();
                                intent.putExtra(LoginActivity.RESULT_REGISTER_KEY, account);
                                setResult(LoginActivity.RESULT_REGISTER_SUCESS, intent);
                                finish();
                            }
                        });
                        break;
                    case 2:
                        RegisterActivity.this.runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                ToastUtil.showShort(RegisterActivity.this.getBaseContext(), "这个账号已存在!");
                            }
                        });
                        break;
                    case 3:
                        RegisterActivity.this.runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                ToastUtil.showShort(RegisterActivity.this.getBaseContext(), "注册失败!");
                            }
                        });
                        break;
                    default:
                        RegisterActivity.this.runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                ToastUtil.showShort(RegisterActivity.this.getBaseContext(), "未知异常!");
                            }
                        });
                        break;
                }
            }
        };
        clickListener = new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                account = inputAccount.getText().toString();
                password = inputPassword.getText().toString();
                passwordAgain = inputAgainPassword.getText().toString();
                int status = -1;
                if ("".equals(account.trim())) {
                    ToastUtil.showShort(RegisterActivity.this, "用户名不能为空!");
                    return;
                } else {
                    if ("".equals(password.trim())) {
                        ToastUtil.showShort(RegisterActivity.this, "密码不能为空!");
                        return;
                    } else {
                        if ("".equals(passwordAgain.trim())) {
                            ToastUtil.showShort(RegisterActivity.this, "确认密码不能为空!");
                            return;
                        } else {
                            if(password.length() < 6){
                                ToastUtil.showShort(RegisterActivity.this, "密码长度必须大于6位!");
                                return;
                            }else{
                                if (!password.equals(passwordAgain)) {
                                    ToastUtil.showShort(RegisterActivity.this, "密码与确认密码不一致!");
                                    return;
                                } else {
                                    mXmppService.registerAccount(account, password, iRegisterCallBack);
                                }
                            }
                        }
                    }
                }

            }
        };
        btnRegister.setOnClickListener(clickListener);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu_login, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.menu_login_server:
                final Dialog inputDialog = DialogUtil.getInputDialog(this);
                final EditText inputEditText = (EditText) inputDialog.findViewById(R.id.edit_login_server_input);
                String server = PreferenceUtils.getPrefString(this, PreferenceConstants.Server, "");
                inputEditText.setText(server);
                Button inputOkBtn = (Button) inputDialog.findViewById(R.id.btn_login_server_ok);
                Button inputCancelBtn = (Button) inputDialog.findViewById(R.id.btn_login_server_cancel);
                inputOkBtn.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        PreferenceUtils.setPrefString(RegisterActivity.this, PreferenceConstants.Server, inputEditText.getText().toString());
                        inputDialog.dismiss();
                    }
                });
                inputCancelBtn.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        inputDialog.dismiss();
                    }
                });
                inputDialog.show();
                break;
            default:
                break;
        }
        return super.onOptionsItemSelected(item);
    }

    @Override
    protected void onResume() {
        super.onResume();
        bindXMPPService();
    }

    @Override
    protected void onStop() {
        super.onStop();
    }

    @Override
    protected void onPause() {
        super.onPause();
        unbindXMPPService();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}


text:
<!DOCTYPE html>

<meta charset=utf-8 />
<title>Event Timing mouseleave.</title>

Outside target!

Target

redpajama_set_name: RedPajamaGithub


text:
layout:     post
title:      "safariii"
subtitle:   "no whales but lots of cheetahs!"
date:       2015-08-02
author:     "Rebecca Shira"
header-img: "img/3bffs.jpg"
category: travel
tags: [travel]
---

wow that was fun

best time of my lifeee

i love animals + finance


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mycologia 13(3): 133 (1921)

#### Original name
Russula redolens Burl.

### Remarks
null


text:
function [CC list_active] = calcCorrCoef(STrue,S,opts)
%==========================================================================
% Filename: calcCorrCoef.m (function).
%
% Description:  Calculates the correlation coefficient (CC) between the
%               true and estimated dipole activities. The CC is calculated
%               using the entire time series of all distributed dipoles, [1].
%
% Usage:        CC = calcCorrCoef(Strue,S,opts)
%
% Input:        STrue: Simulated dipole activities, Nd x Nt (dipole x time)
%               S:     Estimated dipole activities, Nd x Nt (dipole x time)
%               opts.
%                      .choice
%
% Output:       CC:    Sum of squared error score (Note its the log of the
%                      mean squared error).
%
% History:
%   - Created:  30/05/2008
%   - Modified:
%
% Special remarks:
%               [1]: J. Daunizeau and K.J. Friston, "A mesostate-space
%                    model for EEG and MEG", NeuroImage 38, 67-81, 2007.
%
% Copyright (C) Carsten Stahlhut, DTU IMM 2008
%==========================================================================

try choice = opts.choice; catch choice = 'maxDip'; end

Nd = size(S,1);

if strcmp(choice,'maxDip')
    [dummy imaxT] = max(sum(STrue.^2,2));
    [dummy imax] = max(sum(S.^2,2));

    Cmat = corrcoef([STrue(imaxT,:)' S(imax,:)']);
%     [dummy ii] = max(abs(Cmat(:)));
    CC = Cmat(1,2);
else
    try
        list_active = opts.list_active;
    catch
        list_active = find(sum(abs(STrue),2));
    end
    P = sum(STrue(list_active,:).^2,2);
    [dummy isort] = sort(P,'descend');
    list_active = list_active(isort);
    Nactive = sum(logical(list_active));

    CC = nan*ones(Nactive,Nd);
%     CC = nan*ones(Nd,1);
    for iac=1:Nactive
        for ii=1:Nd
            temp = corrcoef([STrue(list_active(iac),:)' S(ii,:)']);
            CC(iac,ii) = temp(1,2);
        end
    end
end


text:
class AddInspectionIdToInspections < ActiveRecord::Migration
  def change
    add_column :inspections, :inspection_id, :integer, :blank => false
  end
end


text:
<?php

/**
 * Interface for input validators used in ezcConsoleInput.
 *
 * An instance of this interface is used in {@link ezcConsoleInput} to validate
 * options and arguments.
 *
 * @package ConsoleTools
 * @version //autogen//
 *
 * @access private
 * @TODO Verify interface and make it public to replace the validation in
 *       {@link ezcConsoleInput}.
 */
interface ezcConsoleInputValidator
{
    /**
     * Validates the given options.
     *
     * May throw an exception that derives from {@link ezcConsoleException}.
     * Receives the array of $options defined for validation and $hasArguments
     * to indicates if arguments have been submitted in addition.
     *
     * @param array(ezcConsoleOption) $options
     * @param bool $hasArguments
     */
    public function validateOptions( array $options, $hasArguments );

    // @TODO: validateArguments();
}

?>


text:
<!DOCTYPE html>

  <title>Watch</title>
  <link rel="stylesheet" href="../stylesheets/default.css"/>
  <link rel="stylesheet" href="../stylesheets/watch.css"/>
  <link rel="stylesheet" href="../dependencies/material_design_google/icon.css"/>
  <link rel="stylesheet" href="../dependencies/material_design_google/material.red-orange.min.css"/>

          Published on

Comments have not yet been implemented in this version.


text:
// Copyright 2015 The Closure Library Authors. All Rights Reserved.
//
// 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.

/**
 * @fileoverview Simple freelist.
 *
 * An anterative to goog.structs.SimplePool, it imposes the requirement that the
 * objects in the list contain a "next" property that can be used to maintain
 * the pool.
 */

goog.provide('goog.async.FreeList');

/**
 * @template ITEM
 */
goog.async.FreeList = goog.defineClass(null, {
  /**
   * @param {function():ITEM} create
   * @param {function(ITEM):void} reset
   * @param {number} limit
   */
  constructor: function(create, reset, limit) {
    /** @private @const {number} */
    this.limit_ = limit;
    /** @private @const {function()} */
    this.create_ = create;
    /** @private @const {function(ITEM):void} */
    this.reset_ = reset;

    /** @private {number} */
    this.occupants_ = 0;
    /** @private {ITEM} */
    this.head_ = null;
  },

  /**
   * @return {ITEM}
   */
  get: function() {
    var item;
    if (this.occupants_ > 0) {
      this.occupants_--;
      item = this.head_;
      this.head_ = item.next;
      item.next = null;
    } else {
      item = this.create_();
    }
    return item;
  },

  /**
   * @param {ITEM} item An item available for possible future reuse.
   */
  put: function(item) {
    this.reset_(item);
    if (this.occupants_ < this.limit_) {
      this.occupants_++;
      item.next = this.head_;
      this.head_ = item;
    }
  },

  /**
   * Visible for testing.
   * @package
   * @return {number}
   */
  occupants: function() { return this.occupants_; }
});


text:
numParallelJobs=32

dirPath=$1
errFile=$(readlink -f ./grokit_error.json)

cd $dirPath

echo "Compiling the code"

# just in case the compiler is the intel compiler
# source /opt/intel/Compiler/11.1/056/bin/iccvars.sh intel64

[ -e Generated.so ] && rm Generated.so
make -k -j ${numParallelJobs} Generated.so

if [ $? != 0 ]; then
    errText=$(cat <<EOT
{
    "__type__" : "error",
    "message"  : "C++ Compilation failed"
}
EOT
)
    echo $errText > $errFile
    exit 2
fi


text:
#include <string>

#include "gtest/gtest.h"

#include "modules/common/configs/config_gflags.h"
#include "modules/common/time/time.h"
#include "modules/map/hdmap/hdmap_util.h"
#include "modules/planning/common/planning_context.h"
#include "modules/planning/common/planning_gflags.h"
#include "modules/planning/integration_tests/planning_test_base.h"
#include "modules/planning/tasks/traffic_decider/stop_sign.h"

namespace apollo {
namespace planning {

using apollo::common::PointENU;
using apollo::common::time::Clock;
using apollo::planning::StopSign;

/**
 * @class SunnyvaleBigLoopTest
 * @brief This is an integration test that uses the sunnyvale_big_loop map.
 *
 * sequence number allocation:
 *     0 -  99: stop sign
 *   100 - 199: keep clear
 *   200 - 299: crosswalk
 *   300 - 399: signal light
 *   400 - 499: change lane
 *   500 - 599: front vehicle
 *   600 - 699: destination
 */

class SunnyvaleBigLoopTest : public PlanningTestBase {
 public:
  virtual void SetUp() {
    FLAGS_use_navigation_mode = false;
    FLAGS_map_dir = "modules/map/data/sunnyvale_big_loop";
    FLAGS_test_base_map_filename = "base_map.bin";
    FLAGS_test_data_dir = "modules/planning/testdata/sunnyvale_big_loop_test";
    FLAGS_planning_upper_speed_limit = 12.5;

    ENABLE_RULE(TrafficRuleConfig::CROSSWALK, false);
    ENABLE_RULE(TrafficRuleConfig::DESTINATION, false);
    ENABLE_RULE(TrafficRuleConfig::KEEP_CLEAR, false);
    ENABLE_RULE(TrafficRuleConfig::PULL_OVER, false);
    ENABLE_RULE(TrafficRuleConfig::SIGNAL_LIGHT, false);
    ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, false);
  }
};

/*
 * stop_sign: adc proceed
 *   adc status: null => DRIVE
 *   decision: STOP
 */
TEST_F(SunnyvaleBigLoopTest, stop_sign_01) {
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, true);

  std::string seq_num = "1";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::SetUp();

  RUN_GOLDEN_TEST_DECISION(0);

  // check PlanningStatus value: DRIVE
  auto stop_sign_status = GetPlanningStatus()->stop_sign();
  EXPECT_TRUE(stop_sign_status.has_status() &&
              stop_sign_status.status() == StopSignStatus::DRIVE);
}

/*
 * stop_sign: adc stopped (speed and distance to stop_line)
 *   adc status: DRIVE => STOP
 *   decision: STOP
 */
TEST_F(SunnyvaleBigLoopTest, stop_sign_02) {
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, true);

  std::string seq_num = "2";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::SetUp();

  // set PlanningStatus: stop_status = DRIVE
  auto* stop_sign_status = GetPlanningStatus()->mutable_stop_sign();
  stop_sign_status->set_stop_sign_id("1017");
  stop_sign_status->set_status(StopSignStatus::DRIVE);

  RUN_GOLDEN_TEST_DECISION(0);

  // check PlanningStatus value: STOP
  EXPECT_TRUE(stop_sign_status->has_status() &&
              stop_sign_status->status() == StopSignStatus::STOP);
}

/*
 * stop_sign: adc stopped + wait_time < STOP_DURATION
 *   adc status: STOP => STOP
 *   decision: STOP
 */
TEST_F(SunnyvaleBigLoopTest, stop_sign_03) {
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, true);

  std::string seq_num = "2";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::SetUp();

  // set PlanningStatus: wait_time < STOP_DURATION
  auto* stop_sign_status = GetPlanningStatus()->mutable_stop_sign();
  stop_sign_status->set_stop_sign_id("1017");
  stop_sign_status->set_status(StopSignStatus::STOP);
  auto* stop_sign_config =
      PlanningTestBase::GetTrafficRuleConfig(TrafficRuleConfig::STOP_SIGN);
  double stop_duration = stop_sign_config->stop_sign().stop_duration();
  double wait_time = stop_duration - 0.5;
  double stop_start_time = Clock::NowInSeconds() - wait_time;
  stop_sign_status->set_stop_start_time(stop_start_time);

  RUN_GOLDEN_TEST_DECISION(0);

  // check PlanningStatus value: STOP
  EXPECT_TRUE(stop_sign_status->has_status() &&
              stop_sign_status->status() == StopSignStatus::STOP);
}

/*
 * stop_sign: adc stopped + wait time > STOP_DURATION
 *   adc status: STOP => STOP_DONE
 *   decision: CRUISE
 */
TEST_F(SunnyvaleBigLoopTest, stop_sign_04) {
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, true);

  std::string seq_num = "2";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::SetUp();

  RUN_GOLDEN_TEST_DECISION(0);

  // get config
  auto* stop_sign_config =
      PlanningTestBase::GetTrafficRuleConfig(TrafficRuleConfig::STOP_SIGN);
  stop_sign_config->mutable_stop_sign()->mutable_creep()->set_enabled(false);

  // update clock
  double stop_duration = stop_sign_config->stop_sign().stop_duration();
  // add 0.5 seconds as buffer time.
  std::chrono::duration<double> time_sec(Clock::NowInSeconds() + stop_duration +
                                         0.5);
  Clock::SetNow(std::chrono::duration_cast<std::chrono::nanoseconds>(time_sec));

  auto* stop_sign_status = GetPlanningStatus()->mutable_stop_sign();
  stop_sign_status->set_stop_sign_id("1017");
  stop_sign_status->set_status(StopSignStatus::STOP);

  RUN_GOLDEN_TEST_DECISION(1);

  // check PlanningStatus value: STOP_DONE
  EXPECT_TRUE(stop_sign_status->has_status() &&
              stop_sign_status->status() == StopSignStatus::STOP_DONE);
}

/*
 * stop_sign:
 * bag: 2018-01-24-11-32-28/2018-01-24-11-32-30_0.bag
 * step 1:
 *   adc decision: STOP
 * step 2:
 *   wait_time > STOP_DURATION
 *      other vehicles arrived at other stop sign later than adc
 *   adc status: STOP => STOP_DONE
 *   decision: CRUISE
 */
TEST_F(SunnyvaleBigLoopTest, stop_sign_05) {
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, true);

  std::string seq_num = "3";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::SetUp();

  // set configs
  auto* stop_sign_config =
      PlanningTestBase::GetTrafficRuleConfig(TrafficRuleConfig::STOP_SIGN);
  stop_sign_config->mutable_stop_sign()->mutable_creep()->set_enabled(false);

  RUN_GOLDEN_TEST_DECISION(0);

  // step 2

  seq_num = "4";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::UpdateData();

  // set PlanningStatus
  auto* stop_sign_status = GetPlanningStatus()->mutable_stop_sign();
  double stop_duration = stop_sign_config->stop_sign().stop_duration();
  double wait_time = stop_duration + 1;
  double stop_start_time = Clock::NowInSeconds() - wait_time;
  stop_sign_status->set_stop_start_time(stop_start_time);

  RUN_GOLDEN_TEST_DECISION(1);
}

/*
 * stop_sign:
 * bag: 2018-01-24-11-36-55/2018-01-24-11-36-57_0.bag
 * step 1:
 *   adc status: DRIVE
 *   adc decision: STOP
 * step 2:
 *   wait_time > STOP_DURATION,
 *      other vehicles arrived at other stop sign earlier than adc
 *   adc status: STOP => WAIT (i.e. waiting)
 *   decision: STOP
 * step 3:
 *   wait_time > STOP_DURATION,
 *     and other vehicles arrived at other stop sign earlier than adc GONE
 *   adc status: STOP => WAIT (with watch vehicle -> empty)
 *   decision: STOP
 * step 4:
 *   adc status: WAIT => STOP_DONE
 *   decision: CRUISE
 */
TEST_F(SunnyvaleBigLoopTest, stop_sign_06) {
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, true);

  std::string seq_num = "5";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::SetUp();

  // set config
  auto* stop_sign_config =
      PlanningTestBase::GetTrafficRuleConfig(TrafficRuleConfig::STOP_SIGN);
  stop_sign_config->mutable_stop_sign()->mutable_creep()->set_enabled(false);

  RUN_GOLDEN_TEST_DECISION(0);

  // step 2:
  // wait time is enough
  // but vehicles are still there (use the same data as previous test)

  seq_num = "6";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::UpdateData();

  // set PlanningStatus
  auto* stop_sign_status = GetPlanningStatus()->mutable_stop_sign();
  stop_sign_status->set_status(StopSignStatus::STOP);
  double stop_duration = stop_sign_config->stop_sign().stop_duration();
  double wait_time = stop_duration + 0.5;
  double stop_start_time = Clock::NowInSeconds() - wait_time;
  stop_sign_status->set_stop_start_time(stop_start_time);

  RUN_GOLDEN_TEST_DECISION(1);

  // check PlanningStatus value: WAIT
  EXPECT_TRUE(stop_sign_status->has_status() &&
              stop_sign_status->status() == StopSignStatus::WAIT);
  // check PlanningStatus value on watch vehicles
  // waiting for vehicle 4059 on lane 868_1_-1
  EXPECT_EQ(1, stop_sign_status->lane_watch_vehicles_size());
  auto lane_watch_vehicles = stop_sign_status->lane_watch_vehicles(0);
  EXPECT_EQ("868_1_-1", lane_watch_vehicles.lane_id());
  EXPECT_TRUE(lane_watch_vehicles.watch_vehicles_size() == 1 &&
              lane_watch_vehicles.watch_vehicles(0) == "4059");

  // step 3:
  // wait time is enough
  // previously watch vehicles are gone

  seq_num = "7";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::UpdateData();

  // set PlanningStatus
  stop_sign_status->set_status(StopSignStatus::WAIT);
  stop_start_time = Clock::NowInSeconds() - wait_time;
  stop_sign_status->set_stop_start_time(stop_start_time);

  RUN_GOLDEN_TEST_DECISION(2);

  // check PlanningStatus value: WAIT
  EXPECT_TRUE(stop_sign_status->has_status() &&
              stop_sign_status->status() == StopSignStatus::WAIT);
  // check PlanningStatus value on watch vehicles
  EXPECT_EQ(0, stop_sign_status->lane_watch_vehicles_size());

  // step 4:
  // WAIT(watched vehicle is empty) => STOP_DONE

  RUN_GOLDEN_TEST_DECISION(3);
  // check PlanningStatus value: STOP_DONE
  EXPECT_TRUE(stop_sign_status->has_status() &&
              stop_sign_status->status() == StopSignStatus::STOP_DONE);
}

/*
 * stop_sign:
 * bag:
 *    step 1/3: 22018-02-15-16-37-45/2018-02-15-16-40-46_3.bag
 *    step2:    22018-02-15-16-37-45/2018-02-15-16-41-46_4.bag
 * step 1:
 *   adc decision: STOP
 * step 2:
 *   pass stop sign
 * step 3:
 *   come back to the same stop sign 2nd time
 *   adc decision: STOP
 */
TEST_F(SunnyvaleBigLoopTest, stop_sign_07) {
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, true);

  std::string seq_num = "12";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::SetUp();

  // set config
  auto* stop_sign_config =
      PlanningTestBase::GetTrafficRuleConfig(TrafficRuleConfig::STOP_SIGN);
  stop_sign_config->mutable_stop_sign()->mutable_creep()->set_enabled(false);

  RUN_GOLDEN_TEST_DECISION(0);

  // check PlanningStatus value: DRIVE
  auto* stop_sign_status = GetPlanningStatus()->mutable_stop_sign();
  EXPECT_EQ("9762", stop_sign_status->stop_sign_id());
  EXPECT_TRUE(stop_sign_status->has_status() &&
              stop_sign_status->status() == StopSignStatus::DRIVE);
  EXPECT_FALSE(stop_sign_status->has_stop_start_time());
  // waiting for vehicle 4059 on lane 868_1_-1
  EXPECT_EQ(1, stop_sign_status->lane_watch_vehicles_size());
  auto lane_watch_vehicles = stop_sign_status->lane_watch_vehicles(0);
  EXPECT_EQ("1706a_1_-1", lane_watch_vehicles.lane_id());
  EXPECT_TRUE(lane_watch_vehicles.watch_vehicles_size() == 1 &&
              lane_watch_vehicles.watch_vehicles(0) == "12257");

  // step 2: pass stop sign
  seq_num = "13";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::UpdateData();

  RUN_GOLDEN_TEST_DECISION(1);

  // check PlanningStatus value: clear
  // to make sure everything is cleared for that stop sign
  EXPECT_FALSE(GetPlanningStatus()->has_stop_sign());

  // step 3: 2nd round

  seq_num = "12";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::SetUp();

  RUN_GOLDEN_TEST_DECISION(2);
}

/*
 * stop_sign:
 * bag: 2018-05-16-10-00-32/2018-05-16-10-00-32_10.bag
 * step 1:
 *   adc status: STOP
 *   adc decision: STOP
 * step 2:
 *   wait_time > STOP_DURATION,
 *   adc status: STOP => CREEP
 *   decision: STOP
 */
TEST_F(SunnyvaleBigLoopTest, stop_sign_08) {
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, true);

  std::string seq_num = "14";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::SetUp();

  // set config
  auto* stop_sign_config =
      PlanningTestBase::GetTrafficRuleConfig(TrafficRuleConfig::STOP_SIGN);
  stop_sign_config->mutable_stop_sign()->mutable_creep()->set_enabled(true);

  RUN_GOLDEN_TEST_DECISION(0);

  // step 2:
  // wait time is enough
  // but vehicles are still there (use the same data as previous test)

  // set PlanningStatus
  auto* stop_sign_status = GetPlanningStatus()->mutable_stop_sign();
  stop_sign_status->set_status(StopSignStatus::STOP);
  double stop_duration = stop_sign_config->stop_sign().stop_duration();
  double wait_time = stop_duration + 0.5;
  double stop_start_time = Clock::NowInSeconds() - wait_time;
  stop_sign_status->set_stop_start_time(stop_start_time);

  // set config
  stop_sign_config->mutable_stop_sign()
      ->mutable_creep()
      ->set_creep_distance_to_stop_line(1.0);
  stop_sign_config->mutable_stop_sign()
      ->mutable_creep()
      ->set_max_valid_stop_distance(1.0);

  RUN_GOLDEN_TEST_DECISION(1);

  // check PlanningStatus value: CREEP
  EXPECT_TRUE(stop_sign_status->has_status() &&
              stop_sign_status->status() == StopSignStatus::CREEP);

  // step 3: STOP_DONE

  // set config: to make it s valid stop for the same data file
  stop_sign_config->mutable_stop_sign()
      ->mutable_creep()
      ->set_max_valid_stop_distance(4.0);

  RUN_GOLDEN_TEST_DECISION(2);

  // check PlanningStatus value
  EXPECT_TRUE(stop_sign_status->has_status() &&
              stop_sign_status->status() == StopSignStatus::STOP_DONE);
}

/*
 * kee_clear: keep clear zone clear
 * bag: 2018-05-22-13-59-27/2018-05-22-14-09-29_10.bag
 * decision: not stopped by KEEP_CLEAR
 */
TEST_F(SunnyvaleBigLoopTest, keep_clear_01) {
  ENABLE_RULE(TrafficRuleConfig::CROSSWALK, false);
  ENABLE_RULE(TrafficRuleConfig::KEEP_CLEAR, true);
  ENABLE_RULE(TrafficRuleConfig::SIGNAL_LIGHT, false);
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, false);

  std::string seq_num = "101";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::SetUp();

  RUN_GOLDEN_TEST_DECISION(0);
}

/*
 * kee_clear: vehicle inside KEEP Clear zone, with speed and BLOCKING
 * bag: 2018-05-22-13-59-27/2018-05-22-14-13-29_14.bag
 * decision: STOP
 */
TEST_F(SunnyvaleBigLoopTest, keep_clear_02) {
  ENABLE_RULE(TrafficRuleConfig::CROSSWALK, false);
  ENABLE_RULE(TrafficRuleConfig::KEEP_CLEAR, true);
  ENABLE_RULE(TrafficRuleConfig::SIGNAL_LIGHT, false);
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, false);

  std::string seq_num = "102";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::SetUp();

  RUN_GOLDEN_TEST_DECISION(0);
}

/*
 * kee_clear: vehicle inside KEEP Clear zone, with speed and NOT BLOCKING
 * bag: 2018-05-22-13-59-27/2018-05-22-14-13-29_14.bag
 * decision: CRUISE
 */
TEST_F(SunnyvaleBigLoopTest, keep_clear_03) {
  ENABLE_RULE(TrafficRuleConfig::CROSSWALK, false);
  ENABLE_RULE(TrafficRuleConfig::KEEP_CLEAR, true);
  ENABLE_RULE(TrafficRuleConfig::SIGNAL_LIGHT, false);
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, false);

  std::string seq_num = "103";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::SetUp();

  RUN_GOLDEN_TEST_DECISION(0);
}

/*
 * crosswalk: pedestrian on crosswalk
 * bag: 2018-01-29-17-22-46/2018-01-29-17-31-47_9.bag
 * decision: STOP
 */
TEST_F(SunnyvaleBigLoopTest, crosswalk_01) {
  ENABLE_RULE(TrafficRuleConfig::CROSSWALK, true);
  ENABLE_RULE(TrafficRuleConfig::KEEP_CLEAR, false);
  ENABLE_RULE(TrafficRuleConfig::SIGNAL_LIGHT, false);
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, false);

  std::string seq_num = "200";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::SetUp();

  RUN_GOLDEN_TEST_DECISION(0);
}

/*
 * crosswalk: timeout on static pedestrian on crosswalk
 * bag: 2018-01-29-17-22-46/2018-01-29-17-31-47_9.bag
 * decision: STOP first, and then CRUISE
 */
TEST_F(SunnyvaleBigLoopTest, crosswalk_02) {
  ENABLE_RULE(TrafficRuleConfig::CROSSWALK, true);
  ENABLE_RULE(TrafficRuleConfig::KEEP_CLEAR, false);
  ENABLE_RULE(TrafficRuleConfig::SIGNAL_LIGHT, false);
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, false);

  std::string seq_num = "201";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  PlanningTestBase::SetUp();

  RUN_GOLDEN_TEST_DECISION(0);

  // check PlanningStatus value
  auto* crosswalk_status = GetPlanningStatus()->mutable_crosswalk();
  EXPECT_EQ("2832", crosswalk_status->crosswalk_id());
  EXPECT_EQ(1, crosswalk_status->stop_timers_size());
  EXPECT_EQ("11652", crosswalk_status->stop_timers(0).obstacle_id());

  // step 2:
  // timeout on static pesestrian

  // set PlanningStatus
  auto* crosswalk_config =
      PlanningTestBase::GetTrafficRuleConfig(TrafficRuleConfig::CROSSWALK);
  double stop_timeout = crosswalk_config->crosswalk().stop_timeout();
  double wait_time = stop_timeout + 0.5;
  for (int i = 0; i < crosswalk_status->stop_timers_size(); ++i) {
    auto stop_timer = crosswalk_status->mutable_stop_timers(i);
    if (stop_timer->obstacle_id() == "11652") {
      stop_timer->set_stop_time(Clock::NowInSeconds() - wait_time);
    }
  }

  RUN_GOLDEN_TEST_DECISION(1);
}

TEST_F(SunnyvaleBigLoopTest, traffic_light_green) {
  ENABLE_RULE(TrafficRuleConfig::CROSSWALK, false);
  ENABLE_RULE(TrafficRuleConfig::KEEP_CLEAR, false);
  ENABLE_RULE(TrafficRuleConfig::SIGNAL_LIGHT, true);
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, false);

  std::string seq_num = "300";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  FLAGS_test_traffic_light_file = seq_num + "_traffic_light.pb.txt";
  PlanningTestBase::SetUp();

  RUN_GOLDEN_TEST_DECISION(0);
}

TEST_F(SunnyvaleBigLoopTest, change_lane_abort_for_fast_back_vehicle) {
  ENABLE_RULE(TrafficRuleConfig::CROSSWALK, false);
  ENABLE_RULE(TrafficRuleConfig::KEEP_CLEAR, false);
  ENABLE_RULE(TrafficRuleConfig::SIGNAL_LIGHT, true);
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, false);

  std::string seq_num = "400";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  PlanningTestBase::SetUp();

  RUN_GOLDEN_TEST_DECISION(0);
}

/*
 * destination: stop on arriving destination when pull-over is disabled
 * bag: 2018-05-16-10-00-32/2018-05-16-10-00-32_10.bag
 * decision: STOP
 */
TEST_F(SunnyvaleBigLoopTest, destination_stop_01) {
  ENABLE_RULE(TrafficRuleConfig::CROSSWALK, false);
  ENABLE_RULE(TrafficRuleConfig::DESTINATION, true);
  ENABLE_RULE(TrafficRuleConfig::KEEP_CLEAR, false);
  ENABLE_RULE(TrafficRuleConfig::PULL_OVER, true);
  ENABLE_RULE(TrafficRuleConfig::SIGNAL_LIGHT, false);
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, false);

  std::string seq_num = "600";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  PlanningTestBase::SetUp();

  // set config
  auto* destination_config =
      PlanningTestBase::GetTrafficRuleConfig(TrafficRuleConfig::DESTINATION);
  destination_config->mutable_destination()->set_enable_pull_over(false);

  RUN_GOLDEN_TEST_DECISION(0);
}

/*
 * destination: pull-over on arriving destination
 * bag: 2018-05-16-10-00-32/2018-05-16-10-00-32_10.bag
 * decision: STOP
 */
TEST_F(SunnyvaleBigLoopTest, destination_pull_over_01) {
  ENABLE_RULE(TrafficRuleConfig::CROSSWALK, false);
  ENABLE_RULE(TrafficRuleConfig::DESTINATION, true);
  ENABLE_RULE(TrafficRuleConfig::KEEP_CLEAR, false);
  ENABLE_RULE(TrafficRuleConfig::PULL_OVER, true);
  ENABLE_RULE(TrafficRuleConfig::SIGNAL_LIGHT, false);
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, false);

  std::string seq_num = "601";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  PlanningTestBase::SetUp();

  // set config
  auto* destination_config =
      PlanningTestBase::GetTrafficRuleConfig(TrafficRuleConfig::DESTINATION);
  destination_config->mutable_destination()->set_enable_pull_over(true);
  destination_config->mutable_destination()->set_pull_over_plan_distance(35.0);

  auto* pull_over_config =
      PlanningTestBase::GetTrafficRuleConfig(TrafficRuleConfig::PULL_OVER);
  pull_over_config->mutable_pull_over()->set_plan_distance(35.0);
  pull_over_config->mutable_pull_over()->set_operation_length(10.0);

  RUN_GOLDEN_TEST_DECISION(0);

  // check PlanningStatus value: PULL OVER
  auto* planning_status = GetPlanningStatus();
  EXPECT_TRUE(planning_status->has_pull_over() &&
              planning_status->pull_over().in_pull_over());
  EXPECT_EQ(PullOverStatus::DESTINATION, planning_status->pull_over().reason());

  common::PointENU start_point_0 = planning_status->pull_over().start_point();
  common::PointENU stop_point_0 = planning_status->pull_over().stop_point();
  double stop_point_heading_0 =
      planning_status->pull_over().stop_point_heading();
  double status_set_time_0 = planning_status->pull_over().status_set_time();

  // check PULL OVER decision
  RUN_GOLDEN_TEST_DECISION(1);

  EXPECT_TRUE(planning_status->has_pull_over() &&
              planning_status->pull_over().in_pull_over());
  EXPECT_EQ(PullOverStatus::DESTINATION, planning_status->pull_over().reason());

  common::PointENU start_point_1 = planning_status->pull_over().start_point();
  common::PointENU stop_point_1 = planning_status->pull_over().stop_point();
  double stop_point_heading_1 =
      planning_status->pull_over().stop_point_heading();
  double status_set_time_1 = planning_status->pull_over().status_set_time();

  // start_point/stop_point/etc shall be the same among cycles
  EXPECT_DOUBLE_EQ(start_point_0.x(), start_point_1.x());
  EXPECT_DOUBLE_EQ(start_point_0.y(), start_point_1.y());
  EXPECT_DOUBLE_EQ(stop_point_0.x(), stop_point_1.x());
  EXPECT_DOUBLE_EQ(stop_point_0.y(), stop_point_1.y());
  EXPECT_DOUBLE_EQ(stop_point_heading_0, stop_point_heading_1);
  EXPECT_DOUBLE_EQ(status_set_time_0, status_set_time_1);
}

/*
 * destination: stop inlane while pull over fails
 * bag: 2018-05-16-10-00-32/2018-05-16-10-00-32_10.bag
 * decision: STOP
 */
TEST_F(SunnyvaleBigLoopTest, destination_pull_over_02) {
  ENABLE_RULE(TrafficRuleConfig::CROSSWALK, false);
  ENABLE_RULE(TrafficRuleConfig::DESTINATION, true);
  ENABLE_RULE(TrafficRuleConfig::KEEP_CLEAR, false);
  ENABLE_RULE(TrafficRuleConfig::PULL_OVER, true);
  ENABLE_RULE(TrafficRuleConfig::SIGNAL_LIGHT, false);
  ENABLE_RULE(TrafficRuleConfig::STOP_SIGN, false);

  std::string seq_num = "601";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  PlanningTestBase::SetUp();

  // set config
  auto* destination_config =
      PlanningTestBase::GetTrafficRuleConfig(TrafficRuleConfig::DESTINATION);
  destination_config->mutable_destination()->set_enable_pull_over(true);
  destination_config->mutable_destination()->set_pull_over_plan_distance(20.0);

  auto* pull_over_config =
      PlanningTestBase::GetTrafficRuleConfig(TrafficRuleConfig::PULL_OVER);
  pull_over_config->mutable_pull_over()->set_plan_distance(20.0);
  pull_over_config->mutable_pull_over()->set_operation_length(5.0);

  // step 1: pull over
  RUN_GOLDEN_TEST_DECISION(0);

  // check PlanningStatus value: PULL OVER
  auto* planning_status = GetPlanningStatus();
  EXPECT_TRUE(planning_status->has_pull_over() &&
              planning_status->pull_over().in_pull_over());
  EXPECT_EQ(PullOverStatus::DESTINATION, planning_status->pull_over().reason());

  // step 2: pull over failed, stop inlane

  // clear PlanningStatus
  planning_status->mutable_pull_over()->clear_status();
  // set destination point further to make inlane stop
  // be able to use this dest point stop fence so that the test result is fixed
  // instead of using adc's position which may differ for some reason
  planning_status->mutable_pull_over()->mutable_inlane_dest_point()->set_x(
      587163.741);
  planning_status->mutable_pull_over()->mutable_inlane_dest_point()->set_y(
      4141196.136);

  // set config
  pull_over_config->mutable_pull_over()->set_operation_length(21.0);
  pull_over_config->mutable_pull_over()->set_max_failure_count(1);
  pull_over_config->mutable_pull_over()->set_max_stop_deceleration(3.0);

  // check PULL OVER decision
  RUN_GOLDEN_TEST_DECISION(1);

  // check PlanningStatus value: PULL OVER  cleared
  EXPECT_FALSE(planning_status->has_pull_over());
}

/*
// TODO(all): this test need rewrite
TEST_F(SunnyvaleBigLoopTest, bypass_parked_bus) {
  ENABLE_RULE(TrafficRuleConfig::SIGNAL_LIGHT, false);
  ENABLE_RULE(TrafficRuleConfig::KEEP_CLEAR, false);

  double acc_lower_bound = FLAGS_longitudinal_acceleration_lower_bound;
  FLAGS_longitudinal_acceleration_lower_bound = -5.0;
  std::string seq_num = "500";
  FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
  FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
  FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
  FLAGS_test_prediction_file = seq_num + "_prediction.pb.txt";
  PlanningTestBase::SetUp();

  RUN_GOLDEN_TEST(0);
  FLAGS_longitudinal_acceleration_lower_bound = acc_lower_bound;
}
*/

}  // namespace planning
}  // namespace apollo

TMAIN;


text:
package science.atlarge.granula.modeller.platform.info;

import science.atlarge.granula.modeller.entity.BasicType;

import java.util.List;

/**
 * Created by wing on 16-3-15.
 */
public class SummaryInfo extends Info {
    String summary;

    public SummaryInfo() {
        this("unspecified");
    }

    public SummaryInfo(String name) {
        super(name, BasicType.SummaryInfo);
    }

    public void addSummary(String summary, List<Source> sources) {
        this.summary = summary;

        for (Source source : sources) {
            addSource(source);
        }
    }

    public String getSummary() {
        return summary;
    }

}


text:
/*
 * 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 com.facebook.presto.operator.aggregation;

import com.facebook.presto.metadata.MetadataManager;
import com.facebook.presto.metadata.Signature;
import com.facebook.presto.spi.Page;
import com.facebook.presto.spi.block.Block;
import com.facebook.presto.spi.block.BlockBuilder;
import com.facebook.presto.spi.block.BlockBuilderStatus;
import com.facebook.presto.spi.type.Type;
import com.facebook.presto.type.ArrayType;
import com.google.common.collect.ImmutableList;
import io.airlift.slice.Slices;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OperationsPerInvocation;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.VerboseMode;
import org.openjdk.jmh.runner.options.WarmupMode;

import java.util.Optional;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;

import static com.facebook.presto.metadata.FunctionKind.AGGREGATE;
import static com.facebook.presto.spi.type.BigintType.BIGINT;
import static com.facebook.presto.spi.type.BooleanType.BOOLEAN;
import static com.facebook.presto.spi.type.DoubleType.DOUBLE;
import static com.facebook.presto.spi.type.VarcharType.VARCHAR;
import static org.openjdk.jmh.annotations.Level.Invocation;

@SuppressWarnings("MethodMayBeStatic")
@State(Scope.Thread)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Fork(2)
@Warmup(iterations = 10, time = 2, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 10, time = 2, timeUnit = TimeUnit.SECONDS)
@BenchmarkMode(Mode.AverageTime)
public class BenchmarkArrayAggregation
{
    private static final int ARRAY_SIZE = 10_000_000;

    @Benchmark
    @OperationsPerInvocation(ARRAY_SIZE)
    public void arrayAggregation(BenchmarkData data)
            throws Throwable
    {
        data.getAccumulator().addInput(data.getPage());
    }

    @SuppressWarnings("FieldMayBeFinal")
    @State(Scope.Thread)
    public static class BenchmarkData
    {
        private String name = "array_agg";

        @Param({"BIGINT", "VARCHAR", "DOUBLE", "BOOLEAN"})
        private String type = "BIGINT";

        private Page page;
        private Accumulator accumulator;

        @Setup(Invocation)
        public void setup()
        {
            MetadataManager metadata = MetadataManager.createTestMetadataManager();
            Block block;
            Type elementType;
            switch (type) {
                case "BIGINT":
                    elementType = BIGINT;
                    break;
                case "VARCHAR":
                    elementType = VARCHAR;
                    break;
                case "DOUBLE":
                    elementType = DOUBLE;
                    break;
                case "BOOLEAN":
                    elementType = BOOLEAN;
                    break;
                default:
                    throw new UnsupportedOperationException();
            }
            ArrayType arrayType = new ArrayType(elementType);
            Signature signature = new Signature(name, AGGREGATE, arrayType.getTypeSignature(), elementType.getTypeSignature());
            InternalAggregationFunction function = metadata.getFunctionRegistry().getAggregateFunctionImplementation(signature);
            accumulator = function.bind(ImmutableList.of(0), Optional.empty()).createAccumulator();

            block = createChannel(ARRAY_SIZE, elementType);
            page = new Page(block);
        }

        private static Block createChannel(int arraySize, Type elementType)
        {
            BlockBuilder blockBuilder = elementType.createBlockBuilder(new BlockBuilderStatus(), arraySize);
            for (int i = 0; i < arraySize; i++) {
                if (elementType.getJavaType() == long.class) {
                    elementType.writeLong(blockBuilder, (long) i);
                }
                else if (elementType.getJavaType() == double.class) {
                    elementType.writeDouble(blockBuilder, ThreadLocalRandom.current().nextDouble());
                }
                else if (elementType.getJavaType() == boolean.class) {
                    elementType.writeBoolean(blockBuilder, ThreadLocalRandom.current().nextBoolean());
                }
                else if (elementType.equals(VARCHAR)) {
                    // make sure the size of a varchar is rather small; otherwise the aggregated slice may overflow
                    elementType.writeSlice(blockBuilder, Slices.utf8Slice(Long.toString(ThreadLocalRandom.current().nextLong() % 100)));
                }
                else {
                    throw new UnsupportedOperationException();
                }
            }
            return blockBuilder.build();
        }

        public Accumulator getAccumulator()
        {
            return accumulator;
        }

        public Page getPage()
        {
            return page;
        }
    }

    public static void main(String[] args)
            throws Throwable
    {
        // assure the benchmarks are valid before running
        BenchmarkData data = new BenchmarkData();
        data.setup();
        new BenchmarkArrayAggregation().arrayAggregation(data);

        Options options = new OptionsBuilder()
                .verbosity(VerboseMode.NORMAL)
                .warmupMode(WarmupMode.BULK)
                .include(".*" + BenchmarkArrayAggregation.class.getSimpleName() + ".*")
                .build();
        new Runner(options).run();
    }
}


text:
/* Minimal set of defines required for the Expat library */

#include "pyconfig.h"

/* pyconfig.h on Windows defines PREFIX instead of in the project file */
#ifdef PREFIX
# undef PREFIX
#endif

/* This value is provided via the setup.py script */
/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
#ifdef WORDS_BIGENDIAN
# define BYTEORDER 4321
#else
# define BYTEORDER 1234
#endif

/* Windows has memmove() available. */
#ifdef MS_WINDOWS
# define HAVE_MEMMOVE
#endif

/* Define to specify how much context to retain around the current parse
   point. */
#define XML_CONTEXT_BYTES 1024

/* Define to make parameter entity parsing functionality available. */
#define XML_DTD 1

/* Define to make XML Namespaces functionality available. */
#define XML_NS 1

/* On  Windows,  this  should  be  set  if  Expat is going to be linked
   statically with the code that calls it; this is required to get all the
   right MSVC magic annotations correct. This is ignored on other platforms.
*/
#define XML_STATIC 1

/* Define to provide document information in UTF-16 rather than the
   default UTF-8.
*/
#ifdef Py_USING_UNICODE
# define XML_UNICODE 1
# define XML_UNICODE_SIZE Py_UNICODE_SIZE
#endif


text:
svn-backup
==========

console application for create backups of SVN repositories, compress and upload them to DropBox


text:
module feathers.skins
{
	import Dictionary = flash.utils.Dictionary;

	/**
	 * Maps a component's states to values, perhaps for one of the component's
	 * properties such as a skin or text format.
	 */
	export class StateValueSelector
	{
		/**
		 * Constructor.
		 */
		constructor()
		{
		}

		/**
		 * @private
		 * Stores the values for each state.
		 */
		protected stateToValue:Dictionary = new Dictionary(true);

		/**
		 * If there is no value for the specified state, a default value can
		 * be used as a fallback.
		 */
		public defaultValue:Object;

		/**
		 * Stores a value for a specified state to be returned from
		 * getValueForState().
		 */
		public setValueForState(value:Object, state:Object):void
		{
			this.stateToValue[state] = value;
		}

		/**
		 * Clears the value stored for a specific state.
		 */
		public clearValueForState(state:Object):Object
		{
			var value:Object = this.stateToValue[state];
			delete this.stateToValue[state];
			return value;
		}

		/**
		 * Returns the value stored for a specific state.
		 */
		public getValueForState(state:Object):Object
		{
			return this.stateToValue[state];
		}

		/**
		 * Returns the value stored for a specific state. May generate a value,
		 * if none is present.
		 *
		 * @param target		The object receiving the stored value. The manager may query properties on the target to customize the returned value.
		 * @param state			The current state.
		 * @param oldValue		The previous value. May be reused for the new value.
		 */
		public updateValue(target:Object, state:Object, oldValue:Object = null):Object
		{
			var value:Object = this.stateToValue[state];
			if(!value)
			{
				value = this.defaultValue;
			}
			return value;
		}
	}
}


text:
/**
 *  3 Panel Facebook Style Layout
 *
 *  This is a sample three panel layout designed for Windows Phone 8 Silverlight.
 *  It is a rework of an example by Dan Ardelean (https://www.developer.nokia.com/Profile/?u=dan.ardelean)
 *  taken from the following page;
 *  http://sviluppomobile.blogspot.in/2013/08/add-lateral-menus-to-windows-phone.html
 *
 *  The changes that are implemented are as follows;
 *  - Change from Manipulation events to Pointer events
 *  - Adaptation to various phone screen sizes
 *  - Code cleanup
 *
 *  I'm not too good with the license stuff so it is free to use for anything you want.
 *  As a result this application is provided as is.
 *
 *  Cheers,
 *  Karn.
 */

using _3PanelLayout.Common;
using _3PanelLayout.Data;
using Windows.ApplicationModel.Resources;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;

// The Pivot Application template is documented at http://go.microsoft.com/fwlink/?LinkID=391641

namespace _3PanelLayout {
    public sealed partial class PivotPage : Page {
        private const string FirstGroupName = "FirstGroup";
        private const string SecondGroupName = "SecondGroup";

        private readonly NavigationHelper navigationHelper;
        private readonly ObservableDictionary defaultViewModel = new ObservableDictionary();
        private readonly ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView("Resources");

        #region Panel Definitions
        private static double PageWidth = Window.Current.Bounds.Width;
        private static double PageHeight = Window.Current.Bounds.Height;

        private static double LeftPanelPosition = 0;
        private static double CenterPanelPosition = -1 * Window.Current.Bounds.Width;
        private static double RightPanelPosition = -1 * Window.Current.Bounds.Width * 2;

        private static double InitialXPosition = 0;
        #endregion

        public PivotPage() {
            this.InitializeComponent();

            this.NavigationCacheMode = NavigationCacheMode.Required;

            this.navigationHelper = new NavigationHelper(this);
            this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
            this.navigationHelper.SaveState += this.NavigationHelper_SaveState;

            #region Panel components
            //Initialize components
            LeftPanel.Width = PageWidth;
            LeftPanel.Margin = new Thickness(0);

            CenterPanel.Width = PageWidth;
            CenterPanel.Margin = new Thickness(PageWidth, 0, 0, 0);

            RightPanel.Width = PageWidth;
            RightPanel.Margin = new Thickness(PageWidth * 2, 0, 0, 0);

            //Set initial view
            Canvas.SetLeft(LayoutRoot, CenterPanelPosition);
            #endregion

            //Make the statusbar sit over the app (comment out to see change in statusbar
            ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
        }

        /// <summary>
        /// Gets the <see cref="NavigationHelper"/> associated with this <see cref="Page"/>.
        /// </summary>
        public NavigationHelper NavigationHelper {
            get { return this.navigationHelper; }
        }

        /// <summary>
        /// Gets the view model for this <see cref="Page"/>.
        /// This can be changed to a strongly typed view model.
        /// </summary>
        public ObservableDictionary DefaultViewModel {
            get { return this.defaultViewModel; }
        }

        /// <summary>
        /// Populates the page with content passed during navigation. Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>.
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session. The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            var sampleDataGroup = await SampleDataSource.GetGroupAsync("Group-1");
            this.DefaultViewModel[FirstGroupName] = sampleDataGroup;
        }

        /// <summary>
        /// Preserves state associated with this page in case the application is suspended or the
        /// page is discarded from the navigation cache. Values must conform to the serialization
        /// requirements of <see cref="SuspensionManager.SessionState"/>.
        /// </summary>
        /// <param name="sender">The source of the event; typically <see cref="NavigationHelper"/>.</param>
        /// <param name="e">Event data that provides an empty dictionary to be populated with
        /// serializable state.</param>
        private void NavigationHelper_SaveState(object sender, SaveStateEventArgs e) {
            // TODO: Save the unique state of the page here.
        }

        #region NavigationHelper registration

        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e) {
            this.navigationHelper.OnNavigatedTo(e);
        }

        protected override void OnNavigatedFrom(NavigationEventArgs e) {
            this.navigationHelper.OnNavigatedFrom(e);
        }

        #endregion

        #region PANEL MANIPULATION HANDLER
        /// <summary>
        /// Sets InitialXPosition to the x position of the input relative to the the canvas element.
        /// </summary>
        private void canvas_PointerPressed(object sender, PointerRoutedEventArgs e) {
            InitialXPosition = e.GetCurrentPoint(canvas).Position.X;
        }

        /// <summary>
        /// Compares InitialXPosition to the x position of the pointer after it released and determines if the
        /// gesture is to the left or to the right. If the gesture is enough to be considered a swipe in the
        /// horizontal direction the appropriate panel is opened.
        /// </summary>
        private void canvas_PointerReleased(object sender, PointerRoutedEventArgs e) {
            if (e.GetCurrentPoint(canvas).Position.X - InitialXPosition < -50) {
                MoveRight(null, null);
            } else if (e.GetCurrentPoint(canvas).Position.X - InitialXPosition > 50) {
                MoveLeft(null, null);
            }
            e.Handled = true;
        }

        /// <summary>
        /// Get the current position of the canvas and move in the appropriate direction by passing the
        /// final position of the view to the MoveView function.
        /// </summary>
        private void MoveLeft(object sender, RoutedEventArgs e) {
            var currentPosition = Canvas.GetLeft(LayoutRoot);
            if (currentPosition == CenterPanelPosition) {
                MoveView(LeftPanelPosition);
            } else if (currentPosition == RightPanelPosition) {
                MoveView(CenterPanelPosition);
            }
        }

        /// <summary>
        /// Get the current position of the canvas and move in the appropriate direction by passing the
        /// final position of the view to the MoveView function.
        /// </summary>
        private void MoveRight(object sender, RoutedEventArgs e) {
            var currentPosition = Canvas.GetLeft(LayoutRoot);
            if (currentPosition == LeftPanelPosition) {
                MoveView(CenterPanelPosition);
            } else if (currentPosition == CenterPanelPosition) {
                MoveView(RightPanelPosition);
            }
        }

        /// <summary>
        /// Method that handles the movement of the cavas via a storyboard.
        /// </summary>
        /// <param name="left">Position that the panel is to be moved to.</param>
        void MoveView(double left) {
            ((Storyboard)canvas.Resources["moveAnimation"]).SkipToFill();
            ((DoubleAnimation)((Storyboard)canvas.Resources["moveAnimation"]).Children[0]).To = left;
            ((Storyboard)canvas.Resources["moveAnimation"]).Begin();
        }

        #endregion
    }
}


text:
package org.projectomakase.omakase.job.pipeline.transfer.delegate;

import org.projectomakase.omakase.job.pipeline.transfer.Transfer;
import org.projectomakase.omakase.job.pipeline.transfer.TransferFile;
import org.projectomakase.omakase.job.pipeline.transfer.TransferFileGroup;
import org.projectomakase.omakase.job.task.TaskGroup;
import org.projectomakase.omakase.pipeline.stage.PipelineContext;
import org.projectomakase.omakase.task.api.Task;
import org.projectomakase.omakase.task.spi.TaskOutput;

/**
 * Transfer Delegate implementations expose a facade from managing the different types of transfers e.g. Ingest, Export, Replication.
 *
 * @author Richard Lucas
 */
public interface TransferDelegate {

    /**
     * Initiates a transfer file group.
     *
     * @param transferFileGroup
     *         the {@link TransferFileGroup} to initiate
     * @return the initiated {@link TransferFileGroup}
     */
    TransferFileGroup initiateTransferFileGroup(TransferFileGroup transferFileGroup);

    /**
     * Completes a transfer file group.
     *
     * @param transferFileGroup
     *         the {@link TransferFileGroup} to complete
     * @param taskOutput
     *         the output of the task that performed the transfer
     * @return the completed {@link TransferFileGroup}
     */
    TransferFileGroup completeTransferFileGroup(TransferFileGroup transferFileGroup, TaskOutput taskOutput);

    /**
     * Aborts a transfer.
     *
     * @param transferFileGroup
     *         the {@link TransferFileGroup} to abort
     */
    void abortTransferFileGroup(TransferFileGroup transferFileGroup);

    /**
     * Updates the content repository.
     *
     * @param pipelineContext
     *         the pipeline context
     * @param transfer
     *         the transfer
     */
    void updateContentRepository(PipelineContext pipelineContext, Transfer transfer);

    /**
     * Cleans up the content repository.
     *
     * @param pipelineContext
     *         the pipeline context
     */
    void cleanupContentRepository(PipelineContext pipelineContext);

    /**
     * Creates the task that will perform the transfer.
     *
     * @param pipelineContext
     *         the pipeline context
     * @param transferFileGroup
     *         the transferFileGroup
     * @param taskGroup
     *         the task group the task belongs to
     * @return the created task.
     */
    Task createTask(PipelineContext pipelineContext, TransferFileGroup transferFileGroup, TaskGroup taskGroup);

}


text:
package com.intranet.bean;

import java.util.Date;

// Generated 14-sep-2013 7:16:37 by Hibernate Tools 4.0.0

/**
 * HorarioDTO generated by hbm2java
 */
public class HorarioDTO implements java.io.Serializable {

	private int idHorario;
	private AulaDTO aulaDTO;
	private CursoCompuestoDTO cursoCompuestoDTO;
	private String descHorario;
	private Date horaIniciio;
	private Date horaFin;

	public HorarioDTO() {
	}

	public HorarioDTO(AulaDTO aulaDTO, CursoCompuestoDTO cursoCompuestoDTO) {
		this.aulaDTO = aulaDTO;
		this.cursoCompuestoDTO = cursoCompuestoDTO;
	}

	public HorarioDTO(AulaDTO aulaDTO, CursoCompuestoDTO cursoCompuestoDTO,
			String descHorario, Date horaIniciio, Date horaFin) {
		this.aulaDTO = aulaDTO;
		this.cursoCompuestoDTO = cursoCompuestoDTO;
		this.descHorario = descHorario;
		this.horaIniciio = horaIniciio;
		this.horaFin = horaFin;
	}

	public int getIdHorario() {
		return this.idHorario;
	}

	public void setIdHorario(int idHorario) {
		this.idHorario = idHorario;
	}

	public AulaDTO getAulaDTO() {
		return this.aulaDTO;
	}

	public void setAulaDTO(AulaDTO aulaDTO) {
		this.aulaDTO = aulaDTO;
	}

	public CursoCompuestoDTO getCursoCompuestoDTO() {
		return this.cursoCompuestoDTO;
	}

	public void setCursoCompuestoDTO(CursoCompuestoDTO cursoCompuestoDTO) {
		this.cursoCompuestoDTO = cursoCompuestoDTO;
	}

	public String getDescHorario() {
		return this.descHorario;
	}

	public void setDescHorario(String descHorario) {
		this.descHorario = descHorario;
	}

	public Date getHoraIniciio() {
		return this.horaIniciio;
	}

	public void setHoraIniciio(Date horaIniciio) {
		this.horaIniciio = horaIniciio;
	}

	public Date getHoraFin() {
		return this.horaFin;
	}

	public void setHoraFin(Date horaFin) {
		this.horaFin = horaFin;
	}

}


text:
.class public Landroid/text/style/TtsSpan$DigitsBuilder;
.super Landroid/text/style/TtsSpan$SemioticClassBuilder;
.source "TtsSpan.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/text/style/TtsSpan;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x9
    name = "DigitsBuilder"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/text/style/TtsSpan$SemioticClassBuilder",
        "<",
        "Landroid/text/style/TtsSpan$DigitsBuilder;",
        ">;"
    }
.end annotation

# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 1435
    const-string/jumbo v0, "android.type.digits"

    invoke-direct {p0, v0}, Landroid/text/style/TtsSpan$SemioticClassBuilder;-><init>(Ljava/lang/String;)V

    .line 1434
    return-void
.end method

.method public constructor <init>(Ljava/lang/String;)V
    .locals 0
    .param p1, "digits"    # Ljava/lang/String;

    .prologue
    .line 1443
    invoke-direct {p0}, Landroid/text/style/TtsSpan$DigitsBuilder;-><init>()V

    .line 1444
    invoke-virtual {p0, p1}, Landroid/text/style/TtsSpan$DigitsBuilder;->setDigits(Ljava/lang/String;)Landroid/text/style/TtsSpan$DigitsBuilder;

    .line 1442
    return-void
.end method

# virtual methods
.method public setDigits(Ljava/lang/String;)Landroid/text/style/TtsSpan$DigitsBuilder;
    .locals 1
    .param p1, "digits"    # Ljava/lang/String;

    .prologue
    .line 1453
    const-string/jumbo v0, "android.arg.digits"

    invoke-virtual {p0, v0, p1}, Landroid/text/style/TtsSpan$DigitsBuilder;->setStringArgument(Ljava/lang/String;Ljava/lang/String;)Landroid/text/style/TtsSpan$Builder;

    move-result-object v0

    check-cast v0, Landroid/text/style/TtsSpan$DigitsBuilder;

    return-object v0
.end method


text:
@implementation AgreeAplicationApi{
    NSString *_ID;
    NSDictionary *_param;
}
-(instancetype)initWithID:(NSString *)ID{
    if(self=[super init]) {
        _ID =ID;
        _param=@{@"approved":@"1"};
    }
    return self;
}
-(id)responseJSONObject{
    return self.requestOperation.responseObject;
}
-(NSDictionary *)requestHeaderFieldValueDictionary{
    NSUserDefaults *user =[NSUserDefaults standardUserDefaults];
    NSString *base64LoginString =[user objectForKey:@"basekey"];
    if (!base64LoginString) {
        return nil;
    }
    return [[NSDictionary alloc] initWithObjects:@[base64LoginString] forKeys:@[@"Authorization"]];
}
-(NSString *)requestUrl{
    return [NSString stringWithFormat:@"/pods/application/%@",_ID];
    //http://112.80.40.185/wp-json/pods/application/<id> PUT
}
-(YTKRequestMethod)requestMethod{
    return YTKRequestMethodPut;
}
-(id)requestArgument{
    return _param;
}

@end


text: module.exports = require("./lib/nolu");


text:
SCRIPT_NAME=armaout
OUTPUT_FORMAT="a.out-arm-big"
HEADER_START_ADDR=0x8000
TEXT_START_ADDR=0x8000
NONPAGED_TEXT_START_ADDRESS=0x8000
TARGET_PAGE_SIZE=32768
ARCH=arm


text:
=============================
Timing sensitive environments
=============================

Overview
========

Timing sensitive environments include e.g. games.  In these environments
long blocking times are problematic.  Stop-and-go garbage collection is
also a potential issue.

This document describes suggested feature options for reducing Duktape
latency in timing sensitive environments.

Suggested feature options
=========================

* Use the default memory management settings (reference counting and
  mark-and-sweep) but enable ``DUK_OPT_NO_VOLUNTARY_GC`` to eliminate
  mark-and-sweep pauses.  Use explicit GC calls (either ``duk_gc()``
  from C or ``Duktape.gc()`` from Ecmascript) when possible to collect
  circular references.


text:
import { RenovateConfig, getConfig, getName } from '../../../../../test/util';
import type { PackageFile } from '../../../../manager/types';
import { getConfigDesc } from './config-description';

describe(getName(), () => {
  describe('getConfigDesc()', () => {
    let config: RenovateConfig;
    beforeEach(() => {
      jest.resetAllMocks();
      config = getConfig();
    });
    it('returns empty', () => {
      delete config.description;
      const res = getConfigDesc(config);
      expect(res).toMatchSnapshot();
    });
    it('returns a full list', () => {
      const packageFiles: Record<string, PackageFile[]> = {
        npm: [],
        dockerfile: [],
      };
      config.description = [
        'description 1',
        'description two',
        'something else',
        'this is Docker-only',
      ];
      const res = getConfigDesc(config, packageFiles);
      expect(res).toMatchSnapshot();
      expect(res.indexOf('Docker-only')).not.toBe(-1);
    });
    it('assignees, labels and schedule', () => {
      delete config.description;
      config.packageFiles = [];
      config.assignees = ['someone', '@someone-else'];
      config.labels = ['renovate', 'deps'];
      config.schedule = ['before 5am'];
      const res = getConfigDesc(config);
      expect(res).toMatchSnapshot();
    });
    it('contains the onboardingConfigFileName if set', () => {
      delete config.description;
      config.schedule = ['before 5am'];
      config.onboardingConfigFileName = '.github/renovate.json';
      const res = getConfigDesc(config);
      expect(res).toMatchSnapshot();
      expect(res.indexOf('`.github/renovate.json`')).not.toBe(-1);
      expect(res.indexOf('`renovate.json`')).toBe(-1);
    });
    it('falls back to "renovate.json" if onboardingConfigFileName is not set', () => {
      delete config.description;
      config.schedule = ['before 5am'];
      config.onboardingConfigFileName = undefined;
      const res = getConfigDesc(config);
      expect(res).toMatchSnapshot();
      expect(res.indexOf('`renovate.json`')).not.toBe(-1);
    });
    it('falls back to "renovate.json" if onboardingConfigFileName is not valid', () => {
      delete config.description;
      config.schedule = ['before 5am'];
      config.onboardingConfigFileName = 'foo.bar';
      const res = getConfigDesc(config);
      expect(res).toMatchSnapshot();
      expect(res.indexOf('`renovate.json`')).not.toBe(-1);
    });
  });
});


text:
from nova.scheduler.filters import type_filter
from nova.scheduler.solvers import constraints

class TypeAffinityConstraint(constraints.BaseFilterConstraint):
    """TypeAffinityConstraint doesn't allow more then one VM type per host."""
    host_filter_cls = type_filter.TypeAffinityFilter


text:
package com.faforever.client.events;

public class StageFocusChangeEvent {
  private final boolean oldValue;
  private final boolean newValue;

  public StageFocusChangeEvent(boolean oldValue, boolean newValue) {
    this.oldValue = oldValue;
    this.newValue = newValue;
  }

  public boolean isOldValue() {
    return oldValue;
  }

  public boolean isNewValue() {
    return newValue;
  }
}


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

<title>Uses of Class ca.ualberta.team7project.models.PreferenceModel</title>
<meta name="date" content="2014-04-06">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
ca.ualberta.team7project.models.PreferenceModel

Packages that use PreferenceModel

Package
Description

ca.ualberta.team7project.controllers

ca.ualberta.team7project.interfaces

ca.ualberta.team7project.models

ca.ualberta.team7project.views

Uses of PreferenceModel in ca.ualberta.team7project.controllers

Methods in ca.ualberta.team7project.controllers that return PreferenceModel

Modifier and Type
Method and Description

PreferenceModel
UserController.getUser()

Methods in ca.ualberta.team7project.controllers with parameters of type PreferenceModel

Modifier and Type
Method and Description

static void
UserController.setUser(PreferenceModel user)

Create a new user.

Uses of PreferenceModel in ca.ualberta.team7project.interfaces

Methods in ca.ualberta.team7project.interfaces with parameters of type PreferenceModel

Modifier and Type
Method and Description

void
UserListener.updateViews(PreferenceModel user)

Uses of PreferenceModel in ca.ualberta.team7project.models

Methods in ca.ualberta.team7project.models that return PreferenceModel

Modifier and Type
Method and Description

PreferenceModel
UserPersistenceModel.deserializeUser()

Deserializes a UserModel or returns null if none exist.

Methods in ca.ualberta.team7project.models with parameters of type PreferenceModel

Modifier and Type
Method and Description

void
UserPersistenceModel.serializeUser(PreferenceModel user)

Serialize the user to the filesystem with the filename set as the user name

Uses of PreferenceModel in ca.ualberta.team7project.views

Methods in ca.ualberta.team7project.views with parameters of type PreferenceModel

Modifier and Type
Method and Description

void
UserView.updateViews(PreferenceModel user)

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
namespace SmartBody {

SBReach::SBReach()
{
	_character = NULL;
	interpolatorType = "KNN";
	currentReachType = -1;
	reachTag = "default";
}

SBReach::SBReach(SBCharacter* character, std::string reTag)
{
	_character = character;
	interpolatorType = "KNN";
	currentReachType = -1;
	reachTag = reTag;
}

SBReach::~SBReach()
{
}

SBCharacter* SBReach::getCharacter()
{
	return _character;
}

SBReach* SBReach::copy()
{
	// ?????
	// ...
	// ...
	return NULL;
}

void SBReach::addMotion(std::string type, SBMotion* motion)
{
	if (!_character)
	{
		LOG("No character present, motion %s was not added to reach.", motion->getName().c_str());
		return;
	}

	int reachType = MeCtReachEngine::getReachType(type);
	if (reachType != -1)
	{
		//_character->addReachMotion(reachType,motion);
		TagMotion tagMotion = TagMotion(reachType, motion);
		if (reachMotionData.find(tagMotion) == reachMotionData.end())
		{
			reachMotionData.insert(tagMotion);
		}
	}
	else
	{
		LOG("Please use 'LEFT' or 'RIGHT'");
		return;
	}
}

void SBReach::removeMotion(std::string type, SBMotion* motion)
{
	if (!_character)
	{
		LOG("No character present, motion %s was not removed from reach.", motion->getName().c_str());
		return;
	}

	int reachType = MeCtReachEngine::getReachType(type);
	if (reachType != -1)
	{
		TagMotion tagMotion = TagMotion(reachType, motion);
		if (reachMotionData.find(tagMotion) != reachMotionData.end())
		{
			reachMotionData.erase(tagMotion);
		}
	}
	else
	{
		LOG("Please use 'LEFT' or 'RIGHT'");
		return;
	}
}

int SBReach::getNumMotions()
{
	if (!_character)
		return 0;

	return reachMotionData.size();
}

std::vector<std::string> SBReach::getMotionNames(std::string type)
{
	std::vector<std::string> motionNames;
	//MotionDataSet& motionSet = const_cast<MotionDataSet&>(_character->getReachMotionDataSet());
	MotionDataSet& motionSet = reachMotionData;
	MotionDataSet::iterator vi;
	for ( vi  = motionSet.begin();
		  vi != motionSet.end();
		  vi++)
	{
		SkMotion* motion = (*vi).second;
		motionNames.push_back(motion->getName());
	}
	return motionNames;

}
void SBReach::build(SBCharacter* character)
{
	if (!character)
		return;

	// create the reach engine if the character does not have one.
	//character->createReachEngine(this);
	createReachEngineMap();
	//ReachEngineMap* reMapPtr = &reachEngineMap;//character->getReachEngineMap(this->getReachTag());
	for (ReachEngineMap::iterator mi = reachEngineMap.begin();
		mi != reachEngineMap.end();
		mi++)
	{
		MeCtReachEngine* re = mi->second;
		if (re)
		{
			re->updateMotionExamples(reachMotionData, interpolatorType);
		}
	}
	character->setReach(this);
}

bool SBReach::isPawnAttached( std::string pawnName )
{
	if (!_character)
		return false;

	for (ReachEngineMap::iterator mi = reachEngineMap.begin();
		mi != reachEngineMap.end();
		mi++)
	{
		MeCtReachEngine* re = mi->second;
		if (re)
		{
			if (re->getReachData()->effectorState.attachedPawnName == pawnName)
			{
				return true;
			}
		}
	}
	return false;
}

void SBReach::setPointHandMotion( std::string type, SBMotion* pointMotion )
{
	if (!_character)
		return;
	MotionDataSet& pointMotionSet = pointHandData;
	int reachType = MeCtReachEngine::getReachType(type);
	if (reachType != -1)
	{
		TagMotion motion = TagMotion(reachType,pointMotion);
		pointMotionSet.insert(motion);
	}
	else
	{
		LOG("Please use 'LEFT' or 'RIGHT'");
		return;
	}

}

SBMotion* SBReach::getPointHandMotion( std::string type )
{
	MotionDataSet& pointMotionSet = pointHandData;
	int reachType = MeCtReachEngine::getReachType(type);
	SBMotion* sbMotion = SBReach::findTagMotion(reachType,pointMotionSet);
	return sbMotion;
}

void SBReach::setGrabHandMotion(std::string type, SBMotion* grabMotion)
{
	if (!_character)
		return;
	MotionDataSet& grabMotionSet = grabHandData;
	int reachType = MeCtReachEngine::getReachType(type);
	if (reachType != -1)
	{
		TagMotion motion = TagMotion(reachType,grabMotion);
		grabMotionSet.insert(motion);
	}
	else
	{
		LOG("Please use 'LEFT' or 'RIGHT'");
		return;
	}
}

SBMotion* SBReach::getGrabHandMotion(std::string type)
{
	MotionDataSet& grabMotionSet = grabHandData;
	int reachType = MeCtReachEngine::getReachType(type);
	SBMotion* sbMotion = SBReach::findTagMotion(reachType,grabMotionSet);
	return sbMotion;
}

void SBReach::setReleaseHandMotion(std::string type, SBMotion* releasebMotion)
{
	if (!_character)
		return;
	MotionDataSet& releaseMotionSet = releaseHandData;
	int reachType = MeCtReachEngine::getReachType(type);
	if (reachType != -1)
	{
		TagMotion motion = TagMotion(reachType,releasebMotion);
		releaseMotionSet.insert(motion);
	}
	else
	{
		LOG("Please use 'LEFT' or 'RIGHT'");
		return;
	}
}

SBMotion* SBReach::getReleaseHandMotion(std::string type)
{
	MotionDataSet& releaseMotionSet = releaseHandData;
	int reachType = MeCtReachEngine::getReachType(type);
	SBMotion* sbMotion = SBReach::findTagMotion(reachType,releaseMotionSet);
	return sbMotion;
}

void SBReach::setReachHandMotion(std::string type, SBMotion* reachMotion)
{
	if (!_character)
		return;
	MotionDataSet& reachMotionSet = reachHandData;
	int reachType = MeCtReachEngine::getReachType(type);
	if (reachType != -1)
	{
		TagMotion motion = TagMotion(reachType,reachMotion);
		reachMotionSet.insert(motion);
	}
	else
	{
		LOG("Please use 'LEFT' or 'RIGHT'");
		return;
	}
}

SBMotion* SBReach::getReachHandMotion(std::string type)
{
	MotionDataSet& reachMotionSet = reachHandData;
	int reachType = MeCtReachEngine::getReachType(type);
	SBMotion* sbMotion  = SBReach::findTagMotion(reachType,reachMotionSet);
	return sbMotion;
}

void SBReach::setInterpolatorType( std::string type )
{
	interpolatorType = type;
}

std::string& SBReach::getInterpolatorType()
{
	return interpolatorType;
}

SBMotion* SBReach::findTagMotion( int tag, const MotionDataSet& motionSet )
{
	MotionDataSet::const_iterator vi;
	for ( vi  = motionSet.begin();
		vi != motionSet.end();
		vi++)
	{
		TagMotion tagMotion = *vi;
		if (tagMotion.first == tag)
			return tagMotion.second;
	}
	return NULL;
}

void SBReach::createReachEngineMap()
{
	if (!_character)
		return;

	SmartBody::SBSkeleton* sbSkel = dynamic_cast<SmartBody::SBSkeleton*>(_character->getSkeleton());
	SmartBody::SBJoint* effector = sbSkel->getJointByMappedName("r_middle1");
	if (!effector)
		effector = sbSkel->getJointByMappedName("r_index1");

	if (!effector)
		effector = sbSkel->getJointByMappedName("r_wrist");

	if (effector && reachEngineMap.find(MeCtReachEngine::RIGHT_ARM) == reachEngineMap.end())
	{
		MeCtReachEngine* rengine = new MeCtReachEngine(_character,sbSkel);
		rengine->init(MeCtReachEngine::RIGHT_ARM,effector);
		reachEngineMap[MeCtReachEngine::RIGHT_ARM] = rengine;

		// 		MeCtReachEngine* rengineJump = new MeCtReachEngine(this,sbSkel);
		// 		rengineJump->init(MeCtReachEngine::RIGHT_JUMP,effector);
		// 		(*this->reachEngineMap)[MeCtReachEngine::RIGHT_JUMP] = rengineJump;
	}

	SmartBody::SBJoint* leftEffector = sbSkel->getJointByMappedName("l_middle1");

	if (!leftEffector)
		leftEffector = sbSkel->getJointByMappedName("l_index1");

	if (!leftEffector)
		leftEffector = sbSkel->getJointByMappedName("l_wrist");
	if (leftEffector && reachEngineMap.find(MeCtReachEngine::LEFT_ARM) == reachEngineMap.end())
	{
		MeCtReachEngine* rengine = new MeCtReachEngine(_character,sbSkel);
		rengine->init(MeCtReachEngine::LEFT_ARM,leftEffector);
		reachEngineMap[MeCtReachEngine::LEFT_ARM] = rengine;
		//MeCtReachEngine* rengineJump = new MeCtReachEngine(this,sbSkel);
		//rengineJump->init(MeCtReachEngine::LEFT_JUMP,effector);
		//(*this->reachEngineMap)[MeCtReachEngine::LEFT_JUMP] = rengineJump;
	}

}

MeCtReachEngine* SBReach::getReachEngine( const std::string& reachType )
{
	int reachID = MeCtReachEngine::getReachType(reachType);
	MeCtReachEngine* reachEngine = NULL;
	if (reachEngineMap.find(reachID) != reachEngineMap.end())
	{
		reachEngine = reachEngineMap[reachID];
	}
	return reachEngine;
}

}


text:
<?php
/**
 * Created by PhpStorm.
 * User : xin.zhang
 * Date : 15/8/24
 * Time : 下午4:24
 * Email: zhangxinmailvip@foxmail.com
 */

namespace Applications\Suiuu\Services;

use Applications\Suiuu\Db\BaseDb;
use Applications\Suiuu\Db\UserMessageDb;
use Applications\Suiuu\Entity\UserMessage;
use Applications\Suiuu\Entity\UserMessageSession;
use Applications\Suiuu\Entity\UserMessageSetting;

class UserMessageService extends BaseDb{

    public $userMessageDb;

    public function addUserMessage(UserMessage $userMessage)
    {
        //系统不能作为消息的收信人
        if($userMessage->receiveId=="SYSTEM"){
            throw new \Exception("Invalid User System Message");
        }
        $receiveSetting=$this->findUserMessageSettingByUserId($userMessage->receiveId);
        $conn=$this->getConnection();
        $conn->beginTrans();

        try{
            //1.获取是否有对应的两个 sessionKey
            $sessionKey=$this->getMessageSessionKey($userMessage->senderId,$userMessage->receiveId);

            $userMessage->sessionKey=$sessionKey;

            $this->userMessageDb=new UserMessageDb($conn);
            $refuseFlag=false;//是否屏蔽接受消息
            if($receiveSetting->status==UserMessageSetting::USER_MESSAGE_SETTING_STATUS_ALLOW_ALL){
                if(!empty($receiveSetting->shieldIds)){
                    $shieldArr=explode(",",$receiveSetting->shieldIds);
                    if(in_array($userMessage->senderId,$shieldArr)){$refuseFlag=true;}
                }
            }else if($receiveSetting->status==UserMessageSetting::USER_MESSAGE_SETTING_STATUS_REFUSE_ALL){
                $refuseFlag=true;
            }

            //如果收件方 屏蔽了 发件方  无需更新收件方session
            if(!$refuseFlag){
                $receiverMessageSession=$this->userMessageDb->findUserMessageSessionByKey($userMessage->receiveId,$sessionKey);
                //发信人 Session
                if($receiverMessageSession==null||$receiverMessageSession === false){
                    $receiverMessageSession=new UserMessageSession();
                    $receiverMessageSession->sessionKey=$sessionKey;
                    $receiverMessageSession->userId=$userMessage->receiveId;
                    $receiverMessageSession->relateId=$userMessage->senderId;
                    $receiverMessageSession->lastContentInfo=$userMessage->content;
                    $receiverMessageSession->lastConcatTime=$userMessage->sendTime;
                    $receiverMessageSession->isRead=0;
                    $receiverMessageSession->unReadCount=1;

                    $this->userMessageDb->addUserMessageSession($receiverMessageSession);
                }else{
                    $unReadCount=$receiverMessageSession['unReadCount']+1;
                    $this->userMessageDb->updateUserMessageSession($receiverMessageSession['sessionKey'],$userMessage->receiveId,$userMessage->content,$userMessage->sendTime,0,$unReadCount);
                }
            }else{
                //如果屏蔽了,那么要设置userMessage 屏蔽状态
                $userMessage->isShield=1;
            }
            //无论收信人是否屏蔽发信人 发信人的 Session 一定要更新
            $senderMessageSession=$this->userMessageDb->findUserMessageSessionByKey($userMessage->senderId,$sessionKey);
            if($senderMessageSession==null||$senderMessageSession === false){
                $senderMessageSession=new UserMessageSession();
                $senderMessageSession->sessionKey=$sessionKey;
                $senderMessageSession->userId=$userMessage->senderId;
                $senderMessageSession->relateId=$userMessage->receiveId;
                $senderMessageSession->lastContentInfo=$userMessage->content;
                $senderMessageSession->lastConcatTime=$userMessage->sendTime;

                $senderMessageSession->isRead=1;
                $senderMessageSession->unReadCount=0;

                $this->userMessageDb->addUserMessageSession($senderMessageSession);
            }else{
                $this->userMessageDb->updateUserMessageSession($senderMessageSession['sessionKey'],$userMessage->senderId,$userMessage->content,$userMessage->sendTime,1,0);
            }

            $this->userMessageDb->addUserMessage($userMessage);
            $conn->commitTrans();
            return $sessionKey;

        }catch (\Exception $e){
            $conn->rollBackTrans();
            throw $e;
        }finally{
            $this->closeLink();
        }
    }

    /**
     * 获取用户系统消息设置
     * @param $userId
     * @return array|bool|UserMessageSetting|mixed|null
     * @throws \Exception
     */
    public function findUserMessageSettingByUserId($userId)
    {
        if(empty($userId)){
            throw new \Exception("Invalid UserId");
        }
        $messageSetting=null;
        try{
            $conn=$this->getConnection();
            $this->userMessageDb=new UserMessageDb($conn);
            //判断是否存在消息设置,如果没有,添加默认
            $messageSetting=$this->userMessageDb->findUserMessageSettingByUserId($userId);
            $messageSetting=$this->arrayCastObject($messageSetting,UserMessageSetting::class);
            if($messageSetting==null){
                $messageSetting=new UserMessageSetting();
                $messageSetting->userId=$userId;
                $messageSetting->shieldIds="";
                $messageSetting->status=UserMessageSetting::USER_MESSAGE_SETTING_STATUS_ALLOW_ALL;//默认接收所有消息
                $this->userMessageDb->addUserMessageSetting($messageSetting);
                $messageSetting->settingId=$this->getLastInsertId();
            }

            if(!empty($messageSetting->shieldIds)){
                $shieldArr=explode(",",$messageSetting->shieldIds);
                $shieldIds="'".implode("','",$shieldArr)."'";
                $userBaseList=$this->userMessageDb->getUserBaseByUserIds($shieldIds);
                $messageSetting->userBaseList=$userBaseList;
            }
        }catch (\Exception $e){
            throw $e;
        }finally{
            $this->closeLink();
        }
        return $messageSetting;
    }

    /**
     * 生成SessionKey
     * @param $senderId
     * @param $receiveId
     * @return string
     */
    private function getMessageSessionKey($senderId,$receiveId)
    {
        //暂时修改为两个会话
        if($senderId>$receiveId){
            return md5($senderId.$receiveId);
        }else{
            return md5($receiveId.$senderId);
        }
    }

}


text:
{{{ "title": "IPS - CLI Install & Uninstall",
        "date": "02-19-2016",
        "author": "Client-Security",
        "attachments": [],
        "contentIsHTML": false,
        "sticky": false }}}

The IPS-API is a RESTful api.
IPS or Intrusion Prevention Service will require you to have two things:

* A server with Administration credentials.
* An account on the [CenturyLink Cloud Platform](https://www.ctl.io/)

For more information, please see the Prerequisites section on our [Getting Started](../Security/getting-started-with-ips.md) page.

### Supported Managed Operating Systems
Current supported operating systems can be found here [Operating System Support](../Security/supported-ips-oses.md)

### Install - Linux

Installs an IPS agent on your server.
The server needs the ability to make an outbound cURL command over port 443.
The cURL command will download a script and install the IPS agent.
Running the install requires root privileges.
The script will configure and activate the agent.
The agent will communicate with our security manager.
Billing subscription will be activated.

##### IPS Install Command

>curl https://api.client-security.ctl.io/ips/scripts/install.sh | sudo CLC_USERNAME=your.clc.account CLC_PASSWORD=your.clc.password CLOUD_PROVIDER=your.cloud.provider HOST_NAME=your.host.name bash

##### Content Properties

| **Name**      | **Type** | **Description**                                    | **REQ.**|
|---------------|----------|----------------------------------------------------|---------|
|CLC_USERNAME   |String    |A valid username with CenturyLink                   |Yes      |
|CLC_PASSWORD   |String    |The CenturyLink password linked to above User       |Yes      |
|CLOUD_PROVIDER |String    |The value for your cloud provider                   |No       |
|HOST_NAME      |String    |Value for server/VM name                            |No       |

* Hostname will default to a cli command >hostname -f

###### Cloud Provider Values

| **Name**      | **Description**                            |
|---------------|--------------------------------------------|
|CLC            |CenturyLink Cloud                           |
|CTL_DCC        |CenturyLink Dedicated Cloud Compute         |
|CTL_VPDC       |CenturyLink Virtual Private Data Center     |
|AWS            |Amazon Web Services                         |
|AZURE          |Microsoft Azure                             |
|OTHER          |Default value if none are submitted         |

### Uninstall - Linux

Uninstalls an IPS agent from your server.
This server needs the ability to make an outbound cURL command over port 443.
Running the uninstall requires root privileges.
This will remove the IPS agent from your server.
Billing subscription will be inactivated.

##### IPS Uninstall Command

>curl https://api.client-security.ctl.io/ips/scripts/uninstall.sh | sudo CLC_USERNAME=your.clc.account CLC_PASSWORD=your.clc.password bash

##### Content Properties

| **Name**      | **Type** | **Description**                                    | **REQ.**|
|---------------|----------|----------------------------------------------------|---------|
|CLC_USERNAME   |String    |A valid username with CenturyLink                   |Yes      |
|CLC_PASSWORD   |String    |The CenturyLink password linked to above User       |Yes      |

### Install - Windows
Installs an IPS agent on your server via a PowerShell script.
The server needs the ability to make an outbound call over port 443.
The command will download a PowerShell script and install the IPS agent.
Running the install requires Administrative privileges.
The script will configure and activate the agent.
The agent will communicate with our security manager.
Billing subscription will be activated.
Note: When the install completes, your RDP session may reset, at which time, you'll need to reconnect to your Windows VM.

##### IPS Install Commands

Command One

> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process

Command Two

> (New-Object System.Net.WebClient).DownloadFile("https://api.ts.client-security.ctl.io/ips/scripts/install.ps1","$env:temp\install.ps1") ; cd $env:temp ; .\install.ps1 -controlUser "your.clc.account" -controlUserPassword "your.clc.password" -accountAlias "your.clc.account,alias" -cloudProvider "your.cloud.provider"

##### Content Properties

| **Name**      | **Type** | **Description**                                     | **REQ.**|
|---------------|----------|-----------------------------------------------------|---------|
|controlUser   |String    |A valid username with CenturyLink                     |Yes      |
|controlUserPassword   |String    |The CenturyLink password linked to above User |Yes      |
|accountAlias      |String    |Your CenturyLink account alias                    |Yes       |
|cloudProvider |String    |The value for your cloud provider                     |No       |

###### Cloud Provider Values

| **Name**      | **Description**                            |
|---------------|--------------------------------------------|
|CLC            |CenturyLink Cloud                           |
|CTL_DCC        |CenturyLink Dedicated Cloud Compute         |
|CTL_VPDC       |CenturyLink Virtual Private Data Center     |
|AWS            |Amazon Web Services                         |
|AZURE          |Microsoft Azure                             |
|OTHER          |Default value if none are submitted         |

### Uninstall - Windows

Uninstalls an IPS agent from your server.
This server needs the ability to make an outbound call over port 443.
Running the uninstall requires Administrative privileges.
This will remove the IPS agent from your server.
Billing subscription will be inactivated.
Note: When the uninstall completes, your RDP session may reset, at which time, you'll need to reconnect to your Windows VM.

##### IPS Uninstall Commands

Command One

> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process

Command Two

> (New-Object System.Net.WebClient).DownloadFile("https://api.ts.client-security.ctl.io/ips/scripts/uninstall.ps1","$env:temp\uninstall.ps1") ; cd $env:temp ; .\uninstall.ps1 -controlUser "your.clc.account" -controlUserPassword "your.clc.password"

##### Content Properties

| **Name**      | **Type** | **Description**                                    | **REQ.**|
|---------------|----------|----------------------------------------------------|---------|
|controlUser   |String    |A valid username with CenturyLink                   |Yes      |
|controlUserPassword   |String    |The CenturyLink password linked to above User       |Yes      |

### Configuring IPS Notifications

Next step is to configure your IPS notifications. Please click [here](../Security/configuring-ips-notifications.md) for help with configuring your IPS notifications.


text:
import numpy as np

from bandstructure import Parameters
from bandstructure.system import DipolarSystem
from bandstructure.lattice import HoneycombLattice

def test_chern_number_dipolar_honeyomb():
    lattice = HoneycombLattice()

    params = Parameters({
        'lattice': lattice,
        'cutoff': 3,
        'tbar': 1,
        't': 0.54,
        'w': 3,
        'mu': 2.5
    })

    s = DipolarSystem(params)

    bbox = lattice.getKvectorsRhomboid(50)

    bandstructure = s.solve(bbox)

    chernNumbers = [bandstructure.getBerryFlux(n) / (2 * np.pi) for n in range(4)]
    np.testing.assert_almost_equal(chernNumbers, [1, 0, -3, 2], decimal=1)

    chernNumbers = [bandstructure.getBerryFlux(n, alternative_algorithm=True) / (2 * np.pi) for n in range(4)]
    np.testing.assert_almost_equal(chernNumbers, [1, 0, -3, 2], decimal=1)