text:
namespace QuickAccent
{
    partial class FormQuickAccent
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormQuickAccent));
            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this.toolStripMenuItemSettings = new System.Windows.Forms.ToolStripMenuItem();
            this.toolStripMenuItemExit = new System.Windows.Forms.ToolStripMenuItem();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.checkBoxStartOnWindowsStart = new System.Windows.Forms.CheckBox();
            this.checkBoxEnableHotkey = new System.Windows.Forms.CheckBox();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.buttonEdit = new System.Windows.Forms.Button();
            this.buttonDelete = new System.Windows.Forms.Button();
            this.buttonNew = new System.Windows.Forms.Button();
            this.listViewAccents = new System.Windows.Forms.ListView();
            this.columnHeaderDisplayName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeaderAccent = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeaderAltCode = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeaderShiftDisplayName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeaderShiftAccent = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeaderAltCodeShift = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeaderShow = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeaderTags = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.SuspendLayout();
            //
            // toolStripSeparator1
            //
            this.toolStripSeparator1.Name = "toolStripSeparator1";
            this.toolStripSeparator1.Size = new System.Drawing.Size(6, 6);
            //
            // toolStripMenuItemSettings
            //
            this.toolStripMenuItemSettings.Name = "toolStripMenuItemSettings";
            this.toolStripMenuItemSettings.Size = new System.Drawing.Size(32, 19);
            //
            // toolStripMenuItemExit
            //
            this.toolStripMenuItemExit.Name = "toolStripMenuItemExit";
            this.toolStripMenuItemExit.Size = new System.Drawing.Size(32, 19);
            //
            // groupBox1
            //
            this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.groupBox1.Controls.Add(this.checkBoxStartOnWindowsStart);
            this.groupBox1.Controls.Add(this.checkBoxEnableHotkey);
            this.groupBox1.Location = new System.Drawing.Point(12, 12);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(660, 89);
            this.groupBox1.TabIndex = 1;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "General Settings";
            //
            // checkBoxStartOnWindowsStart
            //
            this.checkBoxStartOnWindowsStart.AutoSize = true;
            this.checkBoxStartOnWindowsStart.Location = new System.Drawing.Point(18, 47);
            this.checkBoxStartOnWindowsStart.Name = "checkBoxStartOnWindowsStart";
            this.checkBoxStartOnWindowsStart.Size = new System.Drawing.Size(220, 17);
            this.checkBoxStartOnWindowsStart.TabIndex = 1;
            this.checkBoxStartOnWindowsStart.Text = "Start Quick Accent when Windows starts";
            this.checkBoxStartOnWindowsStart.UseVisualStyleBackColor = true;
            this.checkBoxStartOnWindowsStart.CheckedChanged += new System.EventHandler(this.checkBoxStartOnWindowsStart_CheckedChanged);
            //
            // checkBoxEnableHotkey
            //
            this.checkBoxEnableHotkey.AutoSize = true;
            this.checkBoxEnableHotkey.Location = new System.Drawing.Point(18, 24);
            this.checkBoxEnableHotkey.Name = "checkBoxEnableHotkey";
            this.checkBoxEnableHotkey.Size = new System.Drawing.Size(333, 17);
            this.checkBoxEnableHotkey.TabIndex = 0;
            this.checkBoxEnableHotkey.Text = "Allow the menu to be opened with the Windows Key + Q shortcut";
            this.checkBoxEnableHotkey.UseVisualStyleBackColor = true;
            this.checkBoxEnableHotkey.CheckedChanged += new System.EventHandler(this.checkBoxEnableHotkey_CheckedChanged);
            //
            // groupBox2
            //
            this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.groupBox2.Controls.Add(this.buttonEdit);
            this.groupBox2.Controls.Add(this.buttonDelete);
            this.groupBox2.Controls.Add(this.buttonNew);
            this.groupBox2.Controls.Add(this.listViewAccents);
            this.groupBox2.Location = new System.Drawing.Point(12, 107);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(660, 360);
            this.groupBox2.TabIndex = 2;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Accents";
            //
            // buttonEdit
            //
            this.buttonEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.buttonEdit.Location = new System.Drawing.Point(417, 331);
            this.buttonEdit.Name = "buttonEdit";
            this.buttonEdit.Size = new System.Drawing.Size(75, 23);
            this.buttonEdit.TabIndex = 4;
            this.buttonEdit.Text = "Edit...";
            this.buttonEdit.UseVisualStyleBackColor = true;
            this.buttonEdit.Click += new System.EventHandler(this.buttonEdit_Click);
            //
            // buttonDelete
            //
            this.buttonDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.buttonDelete.Location = new System.Drawing.Point(498, 331);
            this.buttonDelete.Name = "buttonDelete";
            this.buttonDelete.Size = new System.Drawing.Size(75, 23);
            this.buttonDelete.TabIndex = 3;
            this.buttonDelete.Text = "Delete";
            this.buttonDelete.UseVisualStyleBackColor = true;
            this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click);
            //
            // buttonNew
            //
            this.buttonNew.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.buttonNew.Location = new System.Drawing.Point(579, 331);
            this.buttonNew.Name = "buttonNew";
            this.buttonNew.Size = new System.Drawing.Size(75, 23);
            this.buttonNew.TabIndex = 1;
            this.buttonNew.Text = "New...";
            this.buttonNew.UseVisualStyleBackColor = true;
            this.buttonNew.Click += new System.EventHandler(this.buttonNew_Click);
            //
            // listViewAccents
            //
            this.listViewAccents.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.listViewAccents.CheckBoxes = true;
            this.listViewAccents.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnHeaderDisplayName,
            this.columnHeaderAccent,
            this.columnHeaderAltCode,
            this.columnHeaderShiftDisplayName,
            this.columnHeaderShiftAccent,
            this.columnHeaderAltCodeShift,
            this.columnHeaderShow,
            this.columnHeaderTags});
            this.listViewAccents.FullRowSelect = true;
            this.listViewAccents.GridLines = true;
            this.listViewAccents.Location = new System.Drawing.Point(6, 19);
            this.listViewAccents.Name = "listViewAccents";
            this.listViewAccents.Size = new System.Drawing.Size(648, 306);
            this.listViewAccents.TabIndex = 0;
            this.listViewAccents.UseCompatibleStateImageBehavior = false;
            this.listViewAccents.View = System.Windows.Forms.View.Details;
            this.listViewAccents.VirtualMode = true;
            this.listViewAccents.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.listViewAccents_RetrieveVirtualItem);
            //
            // columnHeaderDisplayName
            //
            this.columnHeaderDisplayName.Text = "Display Name";
            this.columnHeaderDisplayName.Width = 120;
            //
            // columnHeaderAccent
            //
            this.columnHeaderAccent.Text = "Accent";
            this.columnHeaderAccent.Width = 80;
            //
            // columnHeaderAltCode
            //
            this.columnHeaderAltCode.Text = "Alt Code";
            this.columnHeaderAltCode.Width = 80;
            //
            // columnHeaderShiftDisplayName
            //
            this.columnHeaderShiftDisplayName.Text = "Display Name (Shift)";
            this.columnHeaderShiftDisplayName.Width = 120;
            //
            // columnHeaderShiftAccent
            //
            this.columnHeaderShiftAccent.Text = "Accent (Shift)";
            this.columnHeaderShiftAccent.Width = 80;
            //
            // columnHeaderAltCodeShift
            //
            this.columnHeaderAltCodeShift.Text = "Alt Code (Shift)";
            this.columnHeaderAltCodeShift.Width = 80;
            //
            // columnHeaderShow
            //
            this.columnHeaderShow.Text = "Show in Menu";
            this.columnHeaderShow.Width = 100;
            //
            // columnHeaderTags
            //
            this.columnHeaderTags.Text = "Tags";
            this.columnHeaderTags.Width = 200;
            //
            // FormQuickAccent
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(684, 479);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox1);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "FormQuickAccent";
            this.Text = "Quick Accent";
            this.Load += new System.EventHandler(this.FormQuickAccent_Load);
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.groupBox2.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSettings;
        private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemExit;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.GroupBox groupBox2;
        private System.Windows.Forms.Button buttonDelete;
        private System.Windows.Forms.Button buttonNew;
        private System.Windows.Forms.ListView listViewAccents;
        private System.Windows.Forms.ColumnHeader columnHeaderAccent;
        private System.Windows.Forms.ColumnHeader columnHeaderAltCode;
        private System.Windows.Forms.ColumnHeader columnHeaderDisplayName;
        private System.Windows.Forms.ColumnHeader columnHeaderShow;
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
        private System.Windows.Forms.Button buttonEdit;
        private System.Windows.Forms.ColumnHeader columnHeaderShiftDisplayName;
        private System.Windows.Forms.ColumnHeader columnHeaderShiftAccent;
        private System.Windows.Forms.ColumnHeader columnHeaderAltCodeShift;
        private System.Windows.Forms.ColumnHeader columnHeaderTags;
        private System.Windows.Forms.CheckBox checkBoxEnableHotkey;
        private System.Windows.Forms.CheckBox checkBoxStartOnWindowsStart;
    }
}


text:
class GeometryExpression
  # do *not* change this class definition
  Epsilon = 0.00001
end

class GeometryValue
  # do *not* change methods in this class definition
  # you can add methods if you wish

  private
  # some helper methods that may be generally useful
  def real_close(r1,r2)
    (r1 - r2).abs < GeometryExpression::Epsilon
  end
  def real_close_point(x1,y1,x2,y2)
    real_close(x1,x2) && real_close(y1,y2)
  end
  # two_points_to_line could return a Line or a VerticalLine
  def two_points_to_line(x1,y1,x2,y2)
    if real_close(x1,x2)
      VerticalLine.new x1
    else
      m = (y2 - y1).to_f / (x2 - x1)
      b = y1 - m * x1
      Line.new(m,b)
    end
  end

  public
  # we put this in this class so all subclasses can inherit it:
  # the intersection of self with a NoPoints is a NoPoints object
  def intersectNoPoints np
    np # could also have NoPoints.new here instead
  end

  # we put this in this class so all subclasses can inhert it:
  # the intersection of self with a LineSegment is computed by
  # first intersecting with the line containing the segment and then
  # calling the result's intersectWithSegmentAsLineResult with the segment
  def intersectLineSegment seg
    line_result = intersect(two_points_to_line(seg.x1,seg.y1,seg.x2,seg.y2))
    line_result.intersectWithSegmentAsLineResult seg
  end

  Epsilon = 0.00001
end

class NoPoints < GeometryValue
  # do *not* change this class definition: everything is done for you
  # (although this is the easiest class, it shows what methods every subclass
  # of geometry values needs)
  # However, you *may* move methods from here to a superclass if you wish to

  # Note: no initialize method only because there is nothing it needs to do
  def eval_prog env
    self # all values evaluate to self
  end
  def preprocess_prog
    self # no pre-processing to do here
  end
  def shift(dx,dy)
    self # shifting no-points is no-points
  end
  def intersect other
    other.intersectNoPoints self # will be NoPoints but follow double-dispatch
  end
  def intersectPoint p
    self # intersection with point and no-points is no-points
  end
  def intersectLine line
    self # intersection with line and no-points is no-points
  end
  def intersectVerticalLine vline
    self # intersection with line and no-points is no-points
  end
  # if self is the intersection of (1) some shape s and (2)
  # the line containing seg, then we return the intersection of the
  # shape s and the seg.  seg is an instance of LineSegment
  def intersectWithSegmentAsLineResult seg
    self
  end
end

class Point < GeometryValue
  # *add* methods to this class -- do *not* change given code and do not
  # override any methods

  # Note: You may want a private helper method like the local
  # helper function inbetween in the ML code
  attr_reader :x, :y
  def initialize(x,y)
    @x = x
    @y = y
  end

  def eval_prog env
    self
  end

  def preprocess_prog
    self
  end

  def shift(dx, dy)
    Point.new(@x + dx, @y + dy)
  end

  def intersect other
    other.intersectPoint self # first dispatch
  end

  # second dispatch
  def intersectPoint p
    # intersect with point and point
    if real_close_point(p.x, p.y, self.x, self.y)
      self
    else
      NoPoints.new
    end
  end

  def intersectLine line
    # intersect with point and line
    if real_close(@y, line.m * @x + line.b)
      self
    else
      NoPoints.new
    end
  end

  def intersectVerticalLine vline
    # intersect with point and vertical line
    if real_close(@x, vline.x)
      self
    else
      NoPoints.new
    end
  end

  def intersectWithSegmentAsLineResult seg
    # helper function
    def inbetween(v, end1, end2)
      (end1 - Epsilon <= v && v <= end2 + Epsilon) || (end2 - Epsilon <= v && v <= end1 + Epsilon)
    end
    if inbetween(@x, seg.x1, seg.x2) && inbetween(@y, seg.y1, seg.y2)
      Point.new(@x, @y)
    else
      NoPoints.new
    end
  end
end

class Line < GeometryValue
  # *add* methods to this class -- do *not* change given code and do not
  # override any methods
  attr_reader :m, :b
  def initialize(m,b)
    @m = m
    @b = b
  end

  def eval_prog env
    self
  end

  def preprocess_prog
    self
  end

  def shift(dx, dy)
    Line.new(@m, @b + dy - @m * dx)
  end

  def intersect other
    other.intersectLine self
  end

  def intersectPoint p
    # intersect with line and point
    self.intersect p # we have already solved it
  end

  def intersectLine line
    if real_close(line.m, self.m)
      if real_close(line.b, self.b)
        self # same line
      else
        NoPoints.new # parallel line
      end
    else
      x = (line.b - self.b) / (self.m - line.m)
      y = self.m * x + self.b
      Point.new(x, y)
    end
  end

  def intersectVerticalLine vline
    Point.new(vline.x, @m * vline.x + @b)
  end

  def intersectWithSegmentAsLineResult seg
    # segment seg is on line self
    seg
  end
end

class VerticalLine < GeometryValue
  # *add* methods to this class -- do *not* change given code and do not
  # override any methods
  attr_reader :x
  def initialize x
    @x = x
  end

  def eval_prog env
    self
  end

  def preprocess_prog
    self
  end

  def shift(dx, dy)
    VerticalLine.new(@x + dx)
  end

  def intersect other
    other.intersectVerticalLine self
  end

  def intersectPoint p
    self.intersect p
  end

  def intersectLine line
    self.intersect line
  end

  def intersectVerticalLine vline
    if real_close(vline.x, self.x)
      self # Same line
    else
      NoPoints.new
    end
  end

  def intersectWithSegmentAsLineResult seg
    # segment seg is on vertical line self
    seg
  end
end

class LineSegment < GeometryValue
  # *add* methods to this class -- do *not* change given code and do not
  # override any methods
  # Note: This is the most difficult class.  In the sample solution,
  #  preprocess_prog is about 15 lines long and
  # intersectWithSegmentAsLineResult is about 40 lines long
  attr_reader :x1, :y1, :x2, :y2
  def initialize (x1,y1,x2,y2)
    @x1 = x1
    @y1 = y1
    @x2 = x2
    @y2 = y2
  end

  def eval_prog env
    self
  end

  def preprocess_prog
    if real_close_point(@x1, @y1, @x2, @y2)
      Point.new(@x1, @y1)
    else
      if real_close(@x1, @x2) && @y1 > @y2
        LineSegment.new(@x2, @y2, @x1, @y1) # switch the order of two end points
      else
        if !real_close(@x1, @x2) && x1 > x2
          LineSegment.new(@x2, @y2, @x1, @y1) # switch the order of two end points
        else
          LineSegment.new(@x1, @y1, @x2, @y2)
        end
      end
    end
  end

  def shift(dx, dy)
    LineSegment.new(@x1 + dx, @y1 + dy, @x2 + dx, @y2 + dy)
  end

  def intersect other
    other.intersectLineSegment self
  end

  def intersectPoint p
    self.intersect p
  end

  def intersectLine line
    self.intersect line
  end

  def intersectVerticalLine vline
    self.intersect vline
  end

  def intersectWithSegmentAsLineResult seg
    # segment seg and segment self are on the same line
    x1start, y1start, x1end, y1end = seg.x1, seg.y1, seg.x2, seg.y2
    x2start, y2start, x2end, y2end = self.x1, self.y1, self.x2, self.y2
    if real_close(x1start, x1end)
      # the segments are on a vertical line
      # let segment a start at or below start of segment b
      segA, segB = self, seg
      if y1start < y2start
        segA, segB = seg, self
      end
      aXstart, aYstart, aXend, aYend = segA.x1, segA.y1, segA.x2, segA.y2
      bXstart, bYstart, bXend, bYend = segB.x1, segB.y1, segB.x2, segB.y2
      if real_close(aYend, bYstart)
        Point.new(aXend, aYend) # just touching
      else
        if aYend < bYstart
          NoPoints.new # disjoint
        else
          if aYend > bYend
            LineSegment.new(bXstart, bYstart, bXend, bYend) # b inside a
          else
            LineSegment.new(bXstart, bYstart, aXend, aYend) # overlapping
          end
        end
      end
    else
      # the segments are on a (non-vertical) line
      # let segment a start at or to the left of start of segment b
      segA, segB = self, seg
      if x1start < x2start
        segA, segB = seg, self
      end
      aXstart, aYstart, aXend, aYend = segA.x1, segA.y1, segA.x2, segA.y2
      bXstart, bYstart, bXend, bYend = segB.x1, segB.y1, segB.x2, segB.y2
      if real_close(aXend, bXstart)
        Point.new(aXend, aYend) # just touching
      else
        if aXend < bXstart
          NoPoints.new # disjoint
        else
          if aXend > bXend
            LineSegment.new(bXstart, bYstart, bXend, bYend) # b inside a
          else
            LineSegment.new(bXstart, bYstart, aXend, aYend) # overlapping
          end
        end
      end
    end
  end
end

# Note: there is no need for getter methods for the non-value classes

class Intersect < GeometryExpression
  # *add* methods to this class -- do *not* change given code and do not
  # override any methods
  def initialize(e1,e2)
    @e1 = e1
    @e2 = e2
  end

  def eval_prog env
    v1 = @e1.eval_prog(env)
    v2 = @e2.eval_prog(env)
    v1.intersect(v2)
  end

  def preprocess_prog
    Intersect.new(@e1.preprocess_prog, @e2.preprocess_prog)
  end
end

class Let < GeometryExpression
  # *add* methods to this class -- do *not* change given code and do not
  # override any methods
  # Note: Look at Var to guide how you implement Let
  def initialize(s,e1,e2)
    @s = s
    @e1 = e1
    @e2 = e2
  end

  def eval_prog env
    # environment is an array of two-elements array, like [["v1", 1], ["v2", 3]]
    env2 = env.clone # shallow copy of environment
    env2.insert(0, [@s, @e1.eval_prog(env2)]) # insert at the beginning
    @e2.eval_prog(env2)
  end

  def preprocess_prog
    Let.new(@s, @e1.preprocess_prog, @e2.preprocess_prog)
  end
end

class Var < GeometryExpression
  # *add* methods to this class -- do *not* change given code and do not
  # override any methods
  def initialize s
    @s = s
  end
  def eval_prog env # remember: do not change this method
    pr = env.assoc @s
    raise "undefined variable" if pr.nil?
    pr[1]
  end

  def preprocess_prog
    self
  end
end

class Shift < GeometryExpression
  # *add* methods to this class -- do *not* change given code and do not
  # override any methods
  def initialize(dx,dy,e)
    @dx = dx
    @dy = dy
    @e = e
  end

  def eval_prog env
    vv = @e.eval_prog(env)
    vv.shift(@dx, @dy)
  end

  def preprocess_prog
    Shift.new(@dx, @dy, @e.preprocess_prog)
  end
end

redpajama_set_name: RedPajamaGithub


text:
$(function () {
    $('.setting').on('change', 'input[type="radio"]', function (e) {
        console.log('tried to change a setting!');
        var input = e.target;
        var name = input.name;
        var value = input.id;
        var project = Delta.project.id;
        var data = {};

        data[name] = value === "Enabled";

        $.post(project + '/settings', data, function () {
            // show flash - TBD
        });
    });

    if (window.location.search.indexOf('autorefresh') !== -1) {
        setTimeout(function () {
            window.location.reload();
        }, 5000);
    }
});


text:
package com.lspooo.plugin.statistics.ui;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;

import com.lspooo.plugin.common.common.BroadcastIntent;
import com.lspooo.plugin.common.common.adapter.BaseQuickAdapter;
import com.lspooo.plugin.common.common.dialog.ECAlertDialog;
import com.lspooo.plugin.common.common.menu.ActionMenu;
import com.lspooo.plugin.common.common.menu.OverflowSubMenuHelper;
import com.lspooo.plugin.common.common.menu.RXContentMenuHelper;
import com.lspooo.plugin.common.common.toast.ToastUtil;
import com.lspooo.plugin.common.presenter.presenter.BasePresenter;
import com.lspooo.plugin.common.tools.DateStyle;
import com.lspooo.plugin.common.tools.DateUtil;
import com.lspooo.plugin.common.ui.CommonActivity;
import com.lspooo.plugin.statistics.R;
import com.lspooo.plugin.statistics.R2;
import com.lspooo.plugin.statistics.common.Constant;
import com.lspooo.plugin.statistics.dao.bean.DBTeaEmployeeTools;
import com.lspooo.plugin.statistics.dao.bean.DBTeaRecordTools;
import com.lspooo.plugin.statistics.dao.bean.TeaEmployee;
import com.lspooo.plugin.statistics.dao.bean.TeaRecord;
import com.lspooo.plugin.statistics.ui.adapter.TeaRecordListAdapter;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * Created by LSP on 2017/10/11.
 */

public class TeaEmployeeDetailActivity extends CommonActivity{

    private RecyclerView mRecyclerView;
    private TeaRecordListAdapter mAdapter;
    private View statisticsLayout;
    private View filterLayout;
    private TextView filterBtn;
    private TextView cancelBtn;
    private View timeLayout;
    private TextView nameTv;
    private TextView startTimeTv;
    private TextView endTimeTv;
    private TextView totalCountTv;
    private TextView totalWeightTv;

    private TeaEmployee employee;
    private OverflowSubMenuHelper mOverflowHelper;
    private RXContentMenuHelper mMenuHelper;

    private List<TeaRecord> recordList = new ArrayList<>();
    private long filterStart = 0;
    private long filterEnd = 0;

    private boolean isFilter = false;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        long id = getIntent().getLongExtra("id", -1);
        if (id == -1){
            ToastUtil.error("该采茶工不存在!");
            finish();
            return;
        }
        employee = DBTeaEmployeeTools.getInstance().queryTeaEmployee(id);
        if (employee == null){
            ToastUtil.error("该采茶工不存在!");
            finish();
            return;
        }
        initView();
        loadTeaRecord();
    }

    private void initView() {
        setActionBarTitle("采茶数据统计");
        setActionMenuItem(0, R.drawable.ic_more_white, new MenuItem.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
                initOverflowSubMenuAction();
                return true;
            }
        });

        statisticsLayout = findViewById(R.id.statisticsLayout);
        filterLayout = findViewById(R.id.filterLayout);
        filterBtn = (TextView) findViewById(R.id.filterBtn);
        filterBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (recordList.size() <= 0){
                    return;
                }
                Intent intent = new Intent(TeaEmployeeDetailActivity.this, DateFilterSelectActivity.class);
                startActivityForResult(intent, 0x1);
            }
        });
        cancelBtn = (TextView) findViewById(R.id.cancelBtn);
        cancelBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                filterStart = 0;
                filterEnd = 0;
                isFilter = false;
                loadTeaRecord();
            }
        });
        timeLayout = findViewById(R.id.timeLayout);
        nameTv = (TextView) findViewById(R.id.nameTv);
        startTimeTv = (TextView) findViewById(R.id.startTimeTv);
        endTimeTv = (TextView) findViewById(R.id.endTimeTv);
        totalCountTv = (TextView) findViewById(R.id.totalCountTv);
        totalWeightTv = (TextView) findViewById(R.id.totalWeightTv);
        findViewById(R.id.addRecordBtn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(TeaEmployeeDetailActivity.this, InputTeaRecordActivity.class);
                intent.putExtra("employeeId", employee.getId());
                startActivity(intent);
            }
        });

        mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
        mRecyclerView.setHasFixedSize(true);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(this));

        mAdapter = new TeaRecordListAdapter(R.layout.layout_tea_record_item, recordList, false);
        mRecyclerView.setAdapter(mAdapter);
        mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {

            }
        });
        mAdapter.setOnItemLongClickListener(new BaseQuickAdapter.OnItemLongClickListener() {
            @Override
            public boolean onItemLongClick(BaseQuickAdapter adapter, View view, int position) {
                TeaRecord record = recordList.get(position);
                if (position >= recordList.size()){
                    return true;
                }
                if (record == null){
                    return true;
                }
                showMenu(record);
                return true;
            }
        });
        nameTv.setText(employee.getId() + ". " + employee.getName());
    }

    private void initOverflowSubMenuAction() {
        if(mOverflowHelper == null) {
            mOverflowHelper = new OverflowSubMenuHelper(TeaEmployeeDetailActivity.this);
            mOverflowHelper.setOnActionMenuItemSelectedListener(new ActionMenu.OnActionMenuItemSelectedListener() {
                @Override
                public void OnActionMenuSelected(MenuItem menu, int position) {
                    switch (menu.getItemId()){
                        case 0:
                            Intent intent = new Intent(TeaEmployeeDetailActivity.this, InputTeaRecordActivity.class);
                            intent.putExtra(Constant.EXTRA_TEA_RECORD_TYPE, Constant.TYPE_ADD);
                            intent.putExtra("employeeId", employee.getId());
                            startActivity(intent);
                            break;
                        case 1:
                            ECAlertDialog dialog = new ECAlertDialog.Builder(TeaEmployeeDetailActivity.this)
                                    .setTitle(R.string.app_dialog_title)
                                    .setMessage(R.string.confirm_delete_tea_employee)
                                    .setPositiveButton(R.string.app_dialog_confirm, new DialogInterface.OnClickListener() {
                                        @Override
                                        public void onClick(DialogInterface dialog, int which) {

                                        }
                                    }).setPositiveColor(Color.RED)
                                    .setNegativeButton(R.string.app_dialog_cancel, null)
                                    .create();
                            if (dialog != null) {
                                dialog.show();
                            }
                            break;
                    }
                }
            });
            mOverflowHelper.setOnCreateActionMenuListener(new ActionMenu.OnCreateActionMenuListener() {
                @Override
                public void OnCreateActionMenu(ActionMenu menu) {
                    menu.add(0, R.string.add_tea_record);
                    menu.add(1, R.string.del_tea_employee);
                }
            });
        }
        mOverflowHelper.tryShow();
    }

    private void loadTeaRecord(){
        recordList.clear();
        List<TeaRecord> result;
        if (isFilter){
            result = DBTeaRecordTools.getInstance().queryTeaRecord(employee.getId(), filterStart + "", filterEnd + "");
        } else{
            result = DBTeaRecordTools.getInstance().queryTeaRecord(employee.getId());
        }
        if (result != null && result.size() > 0){
            recordList.addAll(result);
            mAdapter.notifyDataSetChanged();
        }
        initTeaStatisticLayout();
    }

    private void initTeaStatisticLayout(){

        if (recordList.size() > 0){
            totalCountTv.setText("采茶次数:" + recordList.size() + "次");
            Double sum = 0.0;
            for (TeaRecord record : recordList){
                BigDecimal a = new BigDecimal(String.valueOf(record.getWeight()));
                BigDecimal b = new BigDecimal(String.valueOf(sum));
                BigDecimal c = b.add(a);
                sum = c.doubleValue();
            }
            totalWeightTv.setText("采茶重量总计:" + sum + "斤");
            totalWeightTv.setVisibility(View.VISIBLE);
            filterLayout.setVisibility(View.VISIBLE);
        } else{
            totalWeightTv.setVisibility(View.GONE);
            if (isFilter){
                totalCountTv.setText("此段时间内该员工没有过采茶记录...");
                filterLayout.setVisibility(View.VISIBLE);
            } else{
                totalCountTv.setText("该员工尚未有过采茶记录...");
                filterLayout.setVisibility(View.GONE);
            }
        }

        if (isFilter){
            timeLayout.setVisibility(View.VISIBLE);
            cancelBtn.setVisibility(View.VISIBLE);
            startTimeTv.setText(DateUtil.DateToString(DateUtil.StringToDate(filterStart + "", DateStyle.YYYYMMDD), DateStyle.YYYY_MM_DD));
            endTimeTv.setText(DateUtil.DateToString(DateUtil.StringToDate(filterEnd + "", DateStyle.YYYYMMDD), DateStyle.YYYY_MM_DD));
        } else{
            timeLayout.setVisibility(View.INVISIBLE);
            cancelBtn.setVisibility(View.GONE);
        }
    }

    private void showMenu(final TeaRecord record){
        if (mMenuHelper == null){
            mMenuHelper = new RXContentMenuHelper(this);
        }
        mMenuHelper.setOnCreateActionMenuListener(new ActionMenu.OnCreateActionMenuListener() {
            @Override
            public void OnCreateActionMenu(ActionMenu menu) {
                menu.add(1 , R.string.app_modify);
                menu.add(2 , R.string.app_del);
            }
        });
        mMenuHelper.setOnActionMenuItemSelectedListener(new ActionMenu.OnActionMenuItemSelectedListener() {
            @Override
            public void OnActionMenuSelected(MenuItem menu, int position) {
                switch (menu.getItemId()){
                    case 1:
                        Intent intent = new Intent(TeaEmployeeDetailActivity.this, InputTeaRecordActivity.class);
                        intent.putExtra(Constant.EXTRA_TEA_RECORD_TYPE, Constant.TYPE_MODIFY);
                        intent.putExtra("record", record);
                        startActivity(intent);
                        break;
                    case 2:
                        ECAlertDialog dialog = new ECAlertDialog.Builder(TeaEmployeeDetailActivity.this)
                                .setTitle(R.string.app_dialog_title)
                                .setMessage(R.string.confirm_delete_tea_record)
                                .setPositiveButton(R.string.app_dialog_confirm, new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        recordList.remove(record);
                                        mAdapter.notifyDataSetChanged();
                                        initTeaStatisticLayout();
                                        DBTeaRecordTools.getInstance().delete(record);
                                    }
                                }).setPositiveColor(Color.RED)
                                .setNegativeButton(R.string.app_dialog_cancel, null)
                                .create();
                        if (dialog != null) {
                            dialog.show();
                        }
                        break;
                    default:
                        break;
                }
            }
        });
        mMenuHelper.show();
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 0x1){
            if (resultCode != RESULT_OK || data == null){
                return;
            }
            filterStart = data.getLongExtra("startDate", -1);
            filterEnd = data.getLongExtra("endDate", -1);
            isFilter = true;
            loadTeaRecord();
        }
    }

    @Override
    protected String[] getReceiverAction() {
        return new String[]{BroadcastIntent.ACTION_SYNC_TEA_RECORD};
    }

    @Override
    protected void onHandleReceiver(Context context, Intent intent) {
        super.onHandleReceiver(context, intent);
        if (BroadcastIntent.ACTION_SYNC_TEA_RECORD.equals(intent.getAction())){
            loadTeaRecord();
        }
    }

    @Override
    public BasePresenter getPresenter() {
        return null;
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_tea_employee_detail;
    }

}


text:
//
//  More_ViewController.m
//  LIUMING-Finance
//
//  Created by A-XIU on 2017/6/19.
//  Copyright © 2017年 XIU. All rights reserved.
//

#import "More_ViewController.h"

@interface More_ViewController ()

@end

@implementation More_ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self setUpTabbarItem];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)setUpTabbarItem{
    self.tabBarItem.title = @"更多";
    self.tabBarItem.image = [UIImage imageNamed:@"更多"];
    self.tabBarItem.selectedImage = [[UIImage imageNamed:@"更多1"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

}
/*
 #pragma mark - Navigation

 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end


text:
module.exports = [
    'AM',
    'Account',
    'Account Authenticated',
    'Account access is temporarily limited. Please check your inbox for more details.',
    'Account balance:',
    'Accounts List',
    'Acknowledge',
    'Action',
    'Add +/– to define a barrier offset. For example, +0.005 means a barrier that\'s 0.005 higher than the entry spot.',
    'Adjust trade parameters',
    'Admin',
    'Advanced',
    'Amount',
    'Amount in',
    'Apply now as a professional investor',
    'Apr',
    'April',
    'Are you sure that you want to permanently delete the token',
    'Are you sure that you want to permanently revoke access to the application',
    'Are you sure you want to create a fiat account in [_1]?',
    'Are you sure you want to create your [_1] account now?',
    'Are you sure you want to deposit in [_1]?',
    'Are you sure?',
    'Asian Down',
    'Asian Up',
    'Asset',
    'Audit',
    'Audit Page',
    'Aug',
    'August',
    'Available Currencies',
    'Available Markets',
    'Average',
    'Balance',
    'Barrier',
    'Barrier Change',
    'Bid',
    'Binary Coin',
    'Bitcoin',
    'Browser',
    'Buy',
    'Buy price',
    'Call Spread',
    'Cancel',
    'Change',
    'Change Password',
    'Chart is not available for this underlying.',
    'Charting for this underlying is delayed',
    'Checked',
    'Checking',
    'Click OK to proceed.',
    'Click here to open a Financial Account',
    'Click here to open a Real Account',
    'Close',
    'Close Time',
    'Close-Low',
    'Closed Bid',
    'Closes',
    'Commodities',
    'Compressing Image',
    'Connecting to server',
    'Connection error: Please check your internet connection.',
    'Continue trading',
    'Contract',
    'Contract Confirmation',
    'Contract Details',
    'Contract Ends',
    'Contract Information',
    'Contract Result',
    'Contract Starts',
    'Contract Type',
    'Contract has not started yet',
    'Contract will be sold at the prevailing market price when the request is received by our servers. This price may differ from the indicated price.',
    'Counterparty',
    'Country of Residence',
    'Create',
    'Create Account',
    'Create [_1] account',
    'Credit/Debit',
    'Crypto',
    'Currency',
    'Current',
    'Current Time',
    'Current password',
    'Date',
    'Date and Time',
    'Dec',
    'December',
    'Delete',
    'Demo Account',
    'Demo Accounts',
    'Demo Advanced',
    'Demo Standard',
    'Demo Synthetic Indices',
    'Deposit',
    'Deposits and withdrawals have been disabled on your account. Please check your email for more details.',
    'Description',
    'Details',
    'Digit',
    'Digit Differs',
    'Digit Even',
    'Digit Matches',
    'Digit Odd',
    'Digit Over',
    'Digit Under',
    'Disable',
    'Do you want this to be a fiat account or crypto account? Please choose one:',
    'Do you wish to continue?',
    'Does Not Touch',
    'Don\'t want to trade in [_1]? You can open another cryptocurrency account.',
    'Driving licence',
    'Duration',
    'Email address',
    'Enable',
    'End Time',
    'Ends Between',
    'Ends Outside',
    'Entry Spot',
    'Equals',
    'Ether',
    'Ether Classic',
    'Even/Odd',
    'Exclude time cannot be for more than 5 years.',
    'Exclude time cannot be less than 6 months.',
    'Excluded from the website until',
    'Exit Spot',
    'Exit Spot Time',
    'Expiry date is required for [_1].',
    'Failed',
    'Feb',
    'February',
    'Fiat',
    'File ([_1]) size exceeds the permitted limit. Maximum allowed file size: [_2]',
    'Final price',
    'Financial Account',
    'Finish',
    'First line of home address',
    'Forex',
    'Fr',
    'Friday',
    'From account: ',
    'Front Side',
    'Gaming',
    'Get [_1]',
    'Go to statement',
    'Goes Outside',
    'Guide',
    'High',
    'High Barrier',
    'High Tick',
    'High-Close',
    'High-Low',
    'Higher',
    'Higher or equal',
    'Higher/Lower',
    'Hint: it would take approximately [_1][_2] to crack this password.',
    'Hour',
    'I want to reapply',
    'ID number is required for [_1].',
    'IP Address',
    'Identity card',
    'In the EU, financial binary options are only available to professional investors.',
    'In/Out',
    'Indicates required field',
    'Indicative',
    'Indices',
    'Insufficient balance.',
    'Invalid document format.',
    'Invalid email address.',
    'Invalid verification code.',
    'Investment',
    'Investor password',
    'Jan',
    'January',
    'Jul',
    'July',
    'Jun',
    'June',
    'Jurisdiction',
    'Last Login',
    'Last Used',
    'Litecoin',
    'Loss',
    'Low',
    'Low Barrier',
    'Low Tick',
    'Lower',
    'Lower or equal',
    'MT5 withdrawals have been disabled on your account. Please check your email for more details.',
    'Main password',
    'Mar',
    'March',
    'Matches/Differs',
    'Maximum Payout',
    'Maximum Profit',
    'Maximum multiplier of 1000.',
    'Maximum payout',
    'May',
    'Minimum of [_1] characters required.',
    'Minute',
    'Mo',
    'Monday',
    'More information can be found in an email sent to you.',
    'Multiplier',
    'Name',
    'Net profit',
    'Network status',
    'Never',
    'Never Used',
    'New password',
    'New token created.',
    'Next',
    'Not',
    'Not announced for this currency.',
    'Note',
    'Note:',
    'Note: You are limited to one fiat currency account. The currency of your fiat account can be changed before you deposit into your fiat account for the first time or create an MT5 account. You may also open one account for each supported cryptocurrency.',
    'Nov',
    'November',
    'Now',
    'Oct',
    'October',
    'Offline',
    'Online',
    'Only Downs',
    'Only Ups',
    'Only Ups/Only Downs',
    'Only [_1] are allowed.',
    'Only letters, numbers, space, and hyphen are allowed.',
    'Only letters, numbers, space, and these special characters are allowed: [_1]',
    'Only letters, numbers, space, hyphen, period, and apostrophe are allowed.',
    'Only letters, numbers, space, underscore, and hyphen are allowed for ID number ([_1]).',
    'Only letters, space, hyphen, period, and apostrophe are allowed.',
    'Only numbers, hyphens, and spaces are allowed.',
    'Open a Financial Account',
    'Open a Real Account',
    'Opens',
    'Over/Under',
    'PM',
    'Passport',
    'Password is not strong enough.',
    'Password should have lower and uppercase letters with numbers.',
    'Payment Agent services are not available in your country or in your preferred currency.',
    'Payments',
    'Payout',
    'Payout Range',
    'Pending',
    'Percentage',
    'Permissions',
    'Please [_1]accept the updated Terms and Conditions[_2] to lift your deposit and trading limits.',
    'Please [_1]accept the updated Terms and Conditions[_2].',
    'Please [_1]complete your account profile[_2] to lift your withdrawal and trading limits.',
    'Please [_1]deposit[_2] to your account.',
    'Please [_1]log in[_2] or [_3]sign up[_4] to view this page.',
    'Please accept the terms and conditions.',
    'Please check your email for further instructions.',
    'Please check your email for the password reset link.',
    'Please choose a currency',
    'Please complete the [_1]Real Account form[_2] to verify your age as required by the [_3]UK Gambling[_4] Commission (UKGC).',
    'Please complete the [_1]financial assessment form[_2] to lift your withdrawal and trading limits.',
    'Please complete your [_1]personal details[_2] before you proceed.',
    'Please confirm that all the information above is true and complete.',
    'Please confirm that you are not a politically exposed person.',
    'Please ensure that you have the Telegram app installed on your device.',
    'Please enter a valid Login ID.',
    'Please reapply once the required criteria has been fulfilled.',
    'Please reload the page',
    'Please select',
    'Please select a country',
    'Please select a valid time.',
    'Please select at least one scope',
    'Please select the checkbox.',
    'Please select the currency for this account:',
    'Please set [_1]country of residence[_2] before upgrading to a real-money account.',
    'Please set the [_1]currency[_2] of your account.',
    'Please set your [_1]30-day turnover limit[_2] to remove deposit limits.',
    'Please submit your [_1]proof of address[_2].',
    'Please submit your [_1]proof of identity and proof of address[_2].',
    'Please submit your [_1]proof of identity[_2].',
    'Postal Code/ZIP',
    'Potential Payout',
    'Potential Profit',
    'Potential Profit/Loss',
    'Predict the direction
and purchase',
    'Previous',
    'Profit',
    'Profit/Loss',
    'Purchase',
    'Purchase Price',
    'Purchase Time',
    'Purchase request sent',
    'Put Spread',
    'Read',
    'Real',
    'Real Account',
    'Real Advanced',
    'Real Standard',
    'Real Synthetic Indices',
    'Real-Money Account',
    'Real-Money Accounts',
    'Ref.',
    'Reference ID',
    'Remaining Time',
    'Resale not offered',
    'Reset Barrier',
    'Reset Call',
    'Reset Password',
    'Reset Put',
    'Reset Time',
    'Return',
    'Reverse Side',
    'Revoke access',
    'Rise/Fall',
    'Sa',
    'Sale Date',
    'Sale Price',
    'Saturday',
    'Scopes',
    'Search...',
    'Select Asset',
    'Select Trade Type',
    'Select date',
    'Select payment agent',
    'Select your market and underlying asset',
    'Select your trade type',
    'Selected Tick',
    'Sell',
    'Sell at market',
    'Sep',
    'September',
    'Session duration limit cannot be more than 6 weeks.',
    'Set Currency',
    'Settles',
    'Should be [_1]',
    'Should be a valid number.',
    'Should be between [_1] and [_2]',
    'Should be less than [_1]',
    'Should be more than [_1]',
    'Should start with letter or number, and may contain hyphen and underscore.',
    'Sign out',
    'Sign up',
    'Sorry, account signup is not available in your country.',
    'Sorry, an error occurred while processing your account.',
    'Sorry, an error occurred while processing your request.',
    'Sorry, but binary options trading is not available in your financial account.',
    'Sorry, this feature is available to virtual accounts only.',
    'Sorry, this feature is not available in your jurisdiction.',
    'Spot',
    'Spot Time',
    'Spot Time (GMT)',
    'Stake',
    'Standard',
    'Start Time',
    'State/Province',
    'Status',
    'Stays Between',
    'Step',
    'Stocks',
    'Su',
    'Submitted',
    'Submitting',
    'Successful',
    'Sunday',
    'Synthetic Indices',
    'Target',
    'Telephone',
    'Tether',
    'Th',
    'Thank you for signing up! Please check your email to complete the registration process.',
    'Thank you, we\'ll get back to you within 24 hours',
    'The [_1] password of account number [_2] has been changed.',
    'The email address provided is already in use. If you forgot your password, please try our password recovery tool or contact our customer service.',
    'The maximum number of tokens ([_1]) has been reached.',
    'The password you entered is one of the world\'s most commonly used passwords. You should not be using this password.',
    'The reset time is [_1]',
    'The server endpoint is: [_2]',
    'The two passwords that you entered do not match.',
    'There was an error',
    'There was some invalid character in an input field.',
    'Therefore your current immediate maximum withdrawal (subject to your account having sufficient funds) is [_1] [_2] (or equivalent in other currency).',
    'Therefore your current immediate maximum withdrawal (subject to your account having sufficient funds) is [_1] [_2].',
    'This account is disabled',
    'This account is excluded until [_1]',
    'This contract lost',
    'This contract won',
    'This feature is not relevant to virtual-money accounts.',
    'This field is required.',
    'This is a staging server - For testing purposes only',
    'This is your [_1] account.',
    'This page is only available to logged out clients.',
    'Thursday',
    'Tick',
    'Ticks history returned an empty array.',
    'Time is in the wrong format.',
    'Time out cannot be in the past.',
    'Time out cannot be more than 6 weeks.',
    'Time out must be after today.',
    'Timed out until',
    'To account: ',
    'Today',
    'Token',
    'Top up error',
    'Top-up successful',
    'Total Cost',
    'Total Profit/Loss',
    'Touches',
    'Town/City',
    'Trade',
    'Trading Contracts for Difference (CFDs) on Synthetic Indices may not be suitable for everyone. Please ensure that you fully understand the risks involved, including the possibility of losing all the funds in your MT5 account. Gambling can be addictive – please play responsibly.',
    'Trading and deposits have been disabled on your account. Kindly [_1]contact customer support[_2] for assistance.',
    'Trading is unavailable at this time.',
    'Transaction ID',
    'Transaction performed by [_1] (App ID: [_2])',
    'Try our [_1]Synthetic Indices[_2].',
    'Try our other markets.',
    'Tu',
    'Tuesday',
    'Type',
    'Unable to read file [_1]',
    'Understood',
    'Unknown OS',
    'Up to [_1] decimal places are allowed.',
    'Up/Down',
    'Upcoming Events',
    'Upgrade now',
    'Verification code is wrong. Please use the link sent to your email.',
    'Verify Reset Password',
    'View',
    'View chart',
    'Virtual',
    'Waiting for contract settlement.',
    'Waiting for entry tick.',
    'Waiting for exit tick.',
    'We',
    'Wednesday',
    'When you click "OK" you will be excluded from trading on the site until the selected date.',
    'Withdraw',
    'Withdrawals have been disabled on your account. Please check your email for more details.',
    'Yes',
    'Yes I\'m sure',
    'Yes, I\'m sure',
    'You are categorised as a professional client.',
    'You are categorised as a retail client. Apply to be treated as a professional trader.',
    'You are limited to one fiat account. You can change the currency of your fiat account anytime before you make a first-time deposit or create an MT5 account.',
    'You can [_1]set a new currency[_2] before you deposit for the first time or create an MT5 account.',
    'You can close this window without interrupting your trade.',
    'You can no longer change the currency because you\'ve created an MT5 account.',
    'You can no longer change the currency because you\'ve made a first-time deposit.',
    'You can top up your demo account with an additional [_1] if your balance is [_2] or less.',
    'You can top up your virtual account with an additional [_1] if your balance is [_2] or less.',
    'You did not change anything.',
    'You have already withdrawn [_1] [_2].',
    'You have already withdrawn the equivalent of [_1] [_2] in aggregate over the last [_3] days.',
    'You have already withdrawn the equivalent of [_1] [_2].',
    'You have insufficient funds in your Binary account, please add funds.',
    'You have not granted access to any applications.',
    'You have reached the limit.',
    'You have reached the rate limit of requests per second. Please try later.',
    'You have reached the withdrawal limit.',
    'You have sold this contract at [_1] [_2]',
    'You have successfully changed your account currency from [_1] to [_2].',
    'You have successfully disabled two-factor authentication for your account.',
    'You have successfully enabled two-factor authentication for your account.',
    'You may open one account for each supported cryptocurrency.',
    'You should enter [_1] characters.',
    'You will be redirected to a third-party website which is not owned by Binary.com.',
    'You will not be able to change your fiat account\'s currency after creating this MT5 account. Are you sure you want to proceed?',
    'You will not be able to change your fiat account\'s currency after making this deposit. Are you sure you want to proceed?',
    'Your [_1] day withdrawal limit is currently [_2] [_3] (or equivalent in other currency).',
    'Your [_1]proof of address[_2] has expired.',
    'Your [_1]proof of address[_2] has not been verified. Please check your email for details.',
    'Your [_1]proof of identity[_2] has expired.',
    'Your [_1]proof of identity[_2] has not been verified. Please check your email for details.',
    'Your [_1]proof of identity[_3] and [_2]proof of address[_3] have expired.',
    'Your [_1]proof of identity[_3] and [_2]proof of address[_3] have not been verified. Please check your email for details.',
    'Your account has no Login/Logout activity.',
    'Your account has no trading activity.',
    'Your account is fully authenticated and your withdrawal limits have been lifted.',
    'Your account is restricted. Kindly [_1]contact customer support[_2] for assistance.',
    'Your application to be treated as a professional client is being processed.',
    'Your cashier is locked.',
    'Your changes have been updated successfully.',
    'Your changes have been updated.',
    'Your demo account balance is currently [_1] or less. You may top up your account with an additional [_2].',
    'Your fiat account\'s currency is currently set to [_1].',
    'Your fiat account\'s currency is set to [_1].',
    'Your password has been successfully reset. Please log into your account using your new password.',
    'Your professional client request is [_1]not approved[_2].',
    'Your request to transfer [_1] [_2] from [_3] to [_4] has been successfully processed.',
    'Your request to withdraw [_1] [_2] from your account [_3] to Payment Agent [_4] account has been successfully processed.',
    'Your session duration limit will end in [_1] seconds.',
    'Your settings have been updated successfully.',
    'Your token has expired or is invalid. Please click here to restart the verification process.',
    'Your token has expired or is invalid. Please click [_1]here[_2] to restart the verification process.',
    'Your trading statistics since [_1].',
    'Your transaction reference is',
    'Your transaction reference number is [_1]',
    'Your virtual account balance is currently [_1] or less. You may top up your account with an additional [_2].',
    'Your web browser ([_1]) is out of date and may affect your trading experience. Proceed at your own risk. [_2]Update browser[_3]',
    'Your withdrawal limit is [_1] [_2] (or equivalent in other currency).',
    'Your withdrawal limit is [_1] [_2].',
    '[_1] Account',
    '[_1] Account [_2]',
    '[_1] Please click the link below to restart the password recovery process.',
    '[_1] and [_2] cannot be the same.',
    '[_1] days [_2] hours [_3] minutes',
    '[_1] deposit from [_2] to account number [_3] is done. Transaction ID: [_4]',
    '[_1] has been credited into your MT5 Demo Account: [_2].',
    '[_1] has been credited into your Virtual Account: [_2].',
    '[_1] requires your browser\'s web storage to be enabled in order to function properly. Please enable it or exit private browsing mode.',
    '[_1] withdrawal from account number [_2] to [_3] is done. Transaction ID: [_4]',
    '[_1]Manage your accounts[_2]',
    '[_1]No, change my fiat account\'s currency now[_2]',
    'day',
    'days',
    'details',
    'for account [_1]',
    'hour',
    'hours',
    'letters',
    'million',
    'minute',
    'minutes',
    'numbers',
    'second',
    'seconds',
    'space',
    'thousand',
    'tick',
    'ticks',
    'years',
    '{SPAIN ONLY}However, Binary Investments (Europe) Ltd has assessed your knowledge and experience and deems the product appropriate for you.',
    '{SPAIN ONLY}This is a product with leverage. You should be aware that losses may be higher than the amount initially paid to purchase the product.',
    '{SPAIN ONLY}You are about to purchase a product that is not simple and may be difficult to understand: Contracts for Difference and Forex. As a general rule, the CNMV considers that such products are not appropriate for retail clients, due to their complexity.',
];


text:
package label // import "bldy.build/build/label"
import (
	"errors"
	"fmt"
	"path"
	"regexp"
	"strings"

	"github.com/google/skylark"
)

var (
	ErrInvalidLabel = errors.New("label couldn't be parsed")
)

// Label represents a perforce label
// we plan on adding more providers
type Label string

func New(pkg, name string) Label {
	return Label(fmt.Sprintf("//%s:%s", pkg, name))
}

func (l Label) Repo() string {
	if f, err := l.Split(); err == nil {
		if r, ok := f["repo"]; ok {
			return r
		}
	}
	return ""
}

func (l Label) Package() string {
	if f, err := l.Split(); err == nil {
		if r, ok := f["package"]; ok {
			return r
		}
	}
	return ""
}

func (l Label) Name() string {
	if f, err := l.Split(); err == nil {
		if r, ok := f["target"]; ok {
			return r
		}
	}
	return ""
}

func (l Label) IsAbs() bool {
	return strings.HasPrefix(string(l), "//")
}

func Package(s string) *string {
	x := s
	return &x
}

func (l Label) Valid() error {
	_, err := l.Split()
	return err
}

func Parse(s string) (Label, error) {
	l := Label(s)
	_, err := l.Split()
	return l, err
}

// Split splits an label.Label into package and label pair
//
// 	<label> := //<package name>:<target name>
//
// 	<package name> :=
//
//	https://docs.bazel.build/versions/master/build-ref.html#package-names-package-name
//
//	The name of a package is the name of the directory containing its BUILD file,
//	relative to the top-level directory of the source tree. For example: my/app.
//	Package names must be composed entirely of characters drawn from the
//	set A-Z, a–z, 0–9, '/', '-', '.', and '_', and cannot start with a slash.
//
//	For a language with a directory structure that is significant to its module system
//	(e.g. Java), it is important to choose directory names that are valid identifiers in the language.
//
//	Although Bazel allows a package at the build root (e.g. //:foo), this is not advised
//	and projects should attempt to use more descriptively named packages.
//
//	Package names may not contain the substring //, nor end with a slash.
//
// 	<target name> :=
//
// 	https://docs.bazel.build/versions/master/build-ref.html#name
//
//	Target names must be composed entirely of characters drawn from
//	the set a–z, A–Z, 0–9, and the punctuation symbols _/.+-=,@~.
//	Do not use .. to refer to files in other packages; use //packagename:filename instead.
//	Filenames must be relative pathnames in normal form, which
//	means they must neither start nor end with a slash (e.g. /foo and foo/ are forbidden)
//	nor contain multiple consecutive slashes as path separators (e.g. foo//bar).
//	Similarly, up-level references (..) and current-directory references (./) are forbidden.
//	The sole exception to this rule is that a target name may consist of exactly '.'.
//
//	While it is common to use / in the name of a file target, we recommend
//	that you avoid the use of / in the names of rules. Especially when the shorthand form
//	of a label is used, it may confuse the reader. The label //foo/bar/wiz is always a
//	shorthand for //foo/bar/wiz:wiz, even if there is no such package foo/bar/wiz;
//	it never refers to //foo:bar/wiz, even if that target exists.
//
//	However, there are some situations where use of a slash is convenient, or sometimes
//	even necessary. For example, the name of certain rules must match their principal
//	source file, which may reside in a subdirectory of the package.
func (l Label) Split() (map[string]string, error) {
	var (
		fullLabel   = regexp.MustCompile("(@(?P<repo>[[:alnum:]-_.]*[[:alnum:]-_./]*))?//(?P<package>[[:alnum:]-_.]*[[:alnum:]-_./]*):(?P<target>[[:alnum:]_/.+-=,@~.]*)+")
		packageOnly = regexp.MustCompile("//(?P<package>[[:alnum:]-_.][[:alnum:]-_./]+)")
		targetOnly  = regexp.MustCompile(":?(?P<target>[[:alnum:]_/?.+-=,@~.]*)+")

		//filename
		fileName = regexp.MustCompile(`((?P<package>\A[[:alnum:]]+[[:alnum:]/]+)/)*(?P<target>[[:alnum:]]+.[[:alnum:]]+)`)
		file     = regexp.MustCompile(`(?P<target>[[:alnum:]]+.[[:alnum:]]+)`)
	)
	s := string(l)
	_ = targetOnly.MatchString(s)
	matches := [][]string{}
	names := []string{}

	switch {
	case fullLabel.MatchString(s):
		matches = fullLabel.FindAllStringSubmatch(s, 1)
		names = fullLabel.SubexpNames()
		break
	case packageOnly.MatchString(s):
		matches = packageOnly.FindAllStringSubmatch(s, 1)
		names = packageOnly.SubexpNames()
		break
	case targetOnly.MatchString(s):
		matches = targetOnly.FindAllStringSubmatch(s, 1)
		names = targetOnly.SubexpNames()
		break
	case fileName.MatchString(s):
		matches = fileName.FindAllStringSubmatch(s, 1)
		names = fileName.SubexpNames()
		break
	case file.MatchString(s):
		matches = fileName.FindAllStringSubmatch(s, 1)
		names = fileName.SubexpNames()
	default:
		return nil, ErrInvalidLabel
	}
	if len(matches) < 1 {
		return nil, ErrInvalidLabel
	}
	parts := matches[0]
	frags := make(map[string]string)
	for i, match := range names {
		frags[match] = parts[i]
	}
	if _, ok := frags["target"]; !ok {
		if pkg, ok := frags["package"]; ok {
			_, frags["target"] = path.Split(pkg)
		} else {
			return nil, fmt.Errorf("label in incorrect format %q", s)
		}
	}

	return frags, nil
}

func (l Label) Type() string        { return "label" }
func (l Label) Freeze()             {}
func (l Label) Truth() skylark.Bool { return skylark.Bool(true) }
func (l Label) Hash() (uint32, error) {
	s := l.String()
	var h uint32
	for i := 0; i < len(s); i++ {
		h ^= uint32(s[i])
		h *= 16777619
	}
	return h, nil
}
func (l Label) String() string {

	return string(l)
}

func (l Label) Attr(attr string) (skylark.Value, error) {
	if attr == "name" {
		attr = "target"
	}
	if frags, err := l.Split(); err == nil {
		if a, ok := frags[attr]; ok {
			return skylark.String(a), nil
		}
	}

	return nil, fmt.Errorf("label(%q) has no attribute called %q", l, attr)
}

func (l Label) AttrNames() []string { panic("not implemented") }


text:
package main

import (
	"log"

	"github.com/hashicorp/terraform/helper/schema"
	"github.com/hashicorp/terraform/terraform"
	"github.com/roblox/terraform-provider-maas/internal/provider"
)

// Provider creates the schema for the provider config
func Provider() terraform.ResourceProvider {
	log.Println("[DEBUG] Initializing the MAAS provider")
	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"api_key": {
				Type:        schema.TypeString,
				Required:    true,
				Description: "The api key for API operations",
				DefaultFunc: schema.EnvDefaultFunc("MAAS_API_KEY", ""),
			},
			"api_url": {
				Type:        schema.TypeString,
				Required:    true,
				Description: "The MAAS server URL. ie: http://1.2.3.4:80/MAAS",
			},
			"api_version": {
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "2.0",
				Description: "The MAAS API version. Currently: 1.0",
			},
		},

		ResourcesMap: map[string]*schema.Resource{
			"maas_instance":           resourceMAASInstance(),
			"maas_interface_physical": provider.ResourceNetworkInterfacePhysical(),
			"maas_interface_link":     provider.ResourceNetworkInterfaceLink(),
			"maas_server":             provider.ResourceServer(),
		},

		DataSourcesMap: map[string]*schema.Resource{
			"maas_subnet":          provider.DataSubnet(),
			"maas_rack_controller": provider.DataRackController(),
		},

		ConfigureFunc: providerConfigure,
	}
}

// providerConfigure loads in the provider configuration
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
	log.Println("[DEBUG] Configuring the MAAS provider")
	config := Config{
		APIKey: d.Get("api_key").(string),
		APIURL: d.Get("api_url").(string),
		APIver: d.Get("api_version").(string),
	}
	return config.Client()
}


text:
package mobi.qishui.libflingcirclemenu;

import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.v4.view.GestureDetectorCompat;
import android.support.v4.view.MotionEventCompat;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.widget.Scroller;

import java.util.List;

/**
 * Created by qishui on 2015/9/28.
 * Fling circle menu layout
 */
public class FlingCircleMenuLayout extends ViewGroup {
    private List<View> childViewsList;
    private float downX;
    private float downY;
    private float offsetAngle;
    private float preOffsetAngle;
    private float lastAngle;
    private View firstView;
    private GestureDetectorCompat detectorCompat;
    private Scroller mScroller;
    private float flingAngle;
    private boolean flingClockWise;

    public FlingCircleMenuLayout(Context context) {
        super(context);
        initData();
    }

    public FlingCircleMenuLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        initData();
    }

    public FlingCircleMenuLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initData();
    }

    public void setChildViewsList(List<View> childViewsList) {
        this.childViewsList = childViewsList;
        for (View view : this.childViewsList) {
            addView(view);
        }

        firstView = getChildAt(0);
        requestLayout();
    }

    private void initData() {
        GestureDetector.SimpleOnGestureListener gestureListener = new FlingListener();
        detectorCompat = new GestureDetectorCompat(getContext(), gestureListener);
        mScroller = new Scroller(getContext());
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        measureChildren(widthMeasureSpec, heightMeasureSpec);

        int minHeight = 100;
        int minWidth = 100;

        setMeasuredDimension(resolveSize(minWidth, widthMeasureSpec), resolveSize(minHeight,
                heightMeasureSpec));
    }

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        int count = getChildCount();
        float eachAngle = (float) (2 * Math.PI / count);
        for (int i = 0; i < count; i++) {
            View thisView = getChildAt(i);
            float thisAngle = i * eachAngle + offsetAngle + lastAngle + flingAngle;

            int anchor = thisView.getMeasuredWidth() > thisView.getMeasuredHeight() ?
                    thisView.getMeasuredWidth() : thisView.getMeasuredHeight();

            float x = (float) (Math.cos(thisAngle) *
                    ((getMeasuredWidth() - anchor) / 2.0f))
                    + getMeasuredWidth() / 2.0f
                    - thisView.getMeasuredWidth() / 2;
            float y = getMeasuredHeight() / 2.0f
                    - (float) (Math.sin(thisAngle) *
                    ((getMeasuredHeight() - anchor) / 2.0f))
                    - thisView.getMeasuredHeight() / 2;

            thisView.layout((int) x, (int) y, (int) x + thisView.getMeasuredWidth(), (int) y +
                    getMeasuredHeight());
        }
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        mScroller.forceFinished(true);
        int type = MotionEventCompat.getActionMasked(ev);
        float currentX = MotionEventCompat.getX(ev, 0);
        float currentY = MotionEventCompat.getY(ev, 0);

        switch (type) {
            case MotionEvent.ACTION_DOWN:
                downX = currentX;
                downY = currentY;

                float x = firstView.getX() + firstView.getMeasuredWidth() / 2.0f;
                float y = firstView.getY() + firstView.getMeasuredHeight() / 2.0f;

                lastAngle = (float) getRelativeAngle(x, y);
                break;
            case MotionEvent.ACTION_MOVE:
                float distance = getDistance(downX, downY, currentX, currentY);
                if (distance > ViewConfiguration.getTouchSlop()) {
                    return true;
                }
                break;
            case MotionEvent.ACTION_UP:

                break;
        }

        return false;
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        flingAngle = 0;

        boolean revl = detectorCompat.onTouchEvent(event);
        if (revl) {
            return revl;
        }

        int type = MotionEventCompat.getActionMasked(event);
        float currentX = MotionEventCompat.getX(event, 0);
        float currentY = MotionEventCompat.getY(event, 0);

        double deltaAngle = getRelativeAngle(currentX, currentY) - getRelativeAngle(downX, downY);
        preOffsetAngle = offsetAngle;
        offsetAngle = (float) deltaAngle;

        switch (type) {
            case MotionEvent.ACTION_MOVE:
                requestLayout();
                break;
        }

        return true;
    }

    private double getRelativeAngle(float x, float y) {
        float mCos = (x - getMeasuredWidth() / 2.0f) / getDistance(x, y, getMeasuredWidth() / 2.0f,
                getMeasuredHeight() / 2.0f);
        double angleR = Math.acos(mCos);
//        double angleD = Math.toDegrees(angleR);
        if (y > getMeasuredHeight() / 2.0f) {
            angleR = 2*Math.PI - angleR;
        }
        return angleR;
    }

    private float getDistance(float x1, float y1, float x2, float y2) {
        double distance = Math.hypot(x1 - x2, y1 - y2);
        return (float) distance;
    }

    class FlingListener extends GestureDetector.SimpleOnGestureListener {
        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
            flingClockWise = offsetAngle <= preOffsetAngle;
            mScroller.fling(0, 0, (int) velocityX, (int) velocityY, -10000, 10000, -10000, 10000);
            requestLayout();
            return true;
        }
    }

    @Override
    public void computeScroll() {
        if (mScroller.computeScrollOffset()) {
            int x = mScroller.getCurrX();
            int y = mScroller.getCurrY();
            float distance = getDistance(x, y, 0, 0);

            float radius = getMeasuredWidth() / 2.0f;
            float radian = distance / radius;
            if (flingClockWise) {
                radian = -radian;
            }
            flingAngle = radian;
            requestLayout();
        }
    }

    @Override
    protected Parcelable onSaveInstanceState() {
        Parcelable superState = super.onSaveInstanceState();
        SavedState ss = new SavedState(superState);
        ss.stateToSave = lastAngle + offsetAngle;
        return ss;
    }

    @Override
    protected void onRestoreInstanceState(Parcelable state) {
        if (!(state instanceof SavedState)) {
            super.onRestoreInstanceState(state);
            return;
        }
        SavedState ss = (SavedState) state;
        super.onRestoreInstanceState(ss.getSuperState());

        lastAngle = ss.stateToSave;
    }

    static class SavedState extends BaseSavedState {
        float stateToSave;

        SavedState(Parcelable superState) {
            super(superState);
        }

        private SavedState(Parcel in) {
            super(in);
            this.stateToSave = in.readFloat();
        }

        @Override
        public void writeToParcel(Parcel out, int flags) {
            super.writeToParcel(out, flags);
            out.writeFloat(this.stateToSave);
        }

        //required field that makes Parcelables from a Parcel
        public static final Parcelable.Creator<SavedState> CREATOR =
                new Parcelable.Creator<SavedState>() {
                    public SavedState createFromParcel(Parcel in) {
                        return new SavedState(in);
                    }

                    public SavedState[] newArray(int size) {
                        return new SavedState[size];
                    }
                };
    }
}


text:
from m5.SimObject import SimObject
from m5.params import *
from m5.proxy import *

class Platform(SimObject):
    type = 'Platform'
    abstract = True
    cxx_header = "dev/platform.hh"
    cxx_class = 'gem5::Platform'

    system = Param.System(Parent.any, "system")

    # for platforms using device trees to set properties of CPU nodes
    def annotateCpuDeviceNode(self, cpu, state):
        pass


text:
using UnityEngine;
using System.Collections.Generic;

public class TransitionPredatorPursuitToAttack : Transition
{
    #region implemented abstract members of Transition

    public override Transition Init(GameObject gameObject, IDictionary<string, State> states)
    {
        IsTriggered = false;
        TargetState = states ["Attack"];
        Action = new TransitionActionPredatorPursuitToAttack().Init(gameObject);
        return this;
    }

    #endregion

}


text:
<?php declare(strict_types = 1);

namespace Achse\Math\Interval\DateTimeImmutable;

use Achse\Math\Interval\Boundary;

final class DateTimeImmutableBoundary extends Boundary
{

    public function __construct($element, bool $state)
    {
        $this->validateElement($element, DateTimeImmutable::class);

        parent::__construct($element, $state);
    }

    public function getValue(): DateTimeImmutable
    {
        /** @var DateTimeImmutable $value */
        $value = parent::getValue();

        return $value;
    }

}


text:
layout: post
title: Acquiring Baseball Stats from the NCAA with R
tags: [R, web-scraping, research-notebook, baseball, baseballr, NCAA]
---

In the latest release of my [baseballr](https://billpetti.github.io/baseballr/) package I've included a function that makes it easy for a user to pull data from the [NCAA's website](http://stats.ncaa.org) for baseball teams across the three major divisions (I, II, III).

The function, ncaa_scrape, requires the user to pass the function three parameters:

`school_id`: Numerical code used by the NCAA for each school
`year`: A four-digit year
`type`: Whether to pull data for batters or pitchers

For the latter two, the inputs are easy. The issue for most will be knowing what the `school_id `is that the NCAA website uses for the school they are interested in. To help, I decided to include a massive lookup table in the package so a user could easily identify the necessary school_id.

I thought it would be helpful to walk through how I built that file and then show how to use the ncaa_scrape function to start acquiring actual statistics.

You can read the rest at [The Hardball Times](http://www.hardballtimes.com/research-notebook-acquiring-baseball-stats-from-the-ncaa-with-r/).


text:
#include <zephyr/ztest.h>
#include <zephyr/kernel.h>
#include <errno.h>
#include <zephyr/sys/errno_private.h>

/**
 * @brief Test the thread context
 *
 * @defgroup kernel_threadcontext_tests Thread Context Tests
 *
 * @ingroup all_tests
 *
 * @{
 * @}
 */
#define N_THREADS 2
#define STACK_SIZE (384 + CONFIG_TEST_EXTRA_STACK_SIZE)

static K_THREAD_STACK_ARRAY_DEFINE(stacks, N_THREADS, STACK_SIZE);
static struct k_thread threads[N_THREADS];

K_THREAD_STACK_DEFINE(eno_stack, STACK_SIZE);
struct k_thread eno_thread;

static int errno_values[N_THREADS + 1] = {
	0xbabef00d,
	0xdeadbeef,
	0xabad1dea,
};

struct result {
	void *q;
	int pass;
};

struct result result[N_THREADS];

struct k_fifo fifo;

static void errno_thread(void *_n, void *_my_errno, void *_unused)
{
	int n = POINTER_TO_INT(_n);
	int my_errno = POINTER_TO_INT(_my_errno);

	errno = my_errno;

	k_msleep(30 - (n * 10));
	if (errno == my_errno) {
		result[n].pass = TC_PASS;
	}

	zassert_equal(errno, my_errno);

	k_fifo_put(&fifo, &result[n]);
}

/**
 * @brief Verify thread context
 *
 * @ingroup kernel_threadcontext_tests
 *
 * @details Check whether variable value per-thread are saved during
 *	context switch
 */
ZTEST(common_errno, test_thread_context)
{
	int rv = TC_PASS, test_errno;

	k_fifo_init(&fifo);

	errno = errno_values[N_THREADS];
	test_errno = errno;

	for (int ii = 0; ii < N_THREADS; ii++) {
		result[ii].pass = TC_FAIL;
	}

	/**TESTPOINT: thread- threads stacks are separate */
	for (int ii = 0; ii < N_THREADS; ii++) {
		k_thread_create(&threads[ii], stacks[ii], STACK_SIZE,
				errno_thread, INT_TO_POINTER(ii),
				INT_TO_POINTER(errno_values[ii]), NULL,
				K_PRIO_PREEMPT(ii + 5), 0, K_NO_WAIT);
	}

	for (int ii = 0; ii < N_THREADS; ii++) {
		struct result *p = k_fifo_get(&fifo, K_MSEC(100));

		if (!p || (p->pass != TC_PASS)) {
			rv = TC_FAIL;
		}
	}

	zassert_equal(errno, test_errno);

	if (errno != errno_values[N_THREADS]) {
		rv = TC_FAIL;
	}

	/* Make sure all the test thread end. */
	for (int ii = 0; ii < N_THREADS; ii++) {
		k_thread_join(&threads[ii], K_FOREVER);
	}

	if (rv != TC_PASS) {
		ztest_test_fail();
	}
}

#define ERROR_ANY 0xfc

void thread_entry_user(void *p1, void *p2, void *p3)
{
#ifdef CONFIG_ARCH_POSIX
	/* The errno in native posix will be handled by native
	 * operation system, so we skip it.
	 */
	ztest_test_skip();
#else
	int got_errno;

	/* assign the error number to C standard errno */
	errno = ERROR_ANY;

	/* got errno zephyr stored */
	got_errno = *(z_errno());

	zassert_equal(errno, got_errno, "errno is not corresponding.");
#endif
}

/**
 * @brief Verify errno works well
 *
 * @details Check whether a C standard errno can be stored successfully,
 *  no matter it is using tls or not.
 *
 * @ingroup kernel_threadcontext_tests
 */
ZTEST_USER(common_errno, test_errno)
{
	k_tid_t tid;
	uint32_t perm = K_INHERIT_PERMS;

	if (k_is_user_context()) {
		perm = perm | K_USER;
	}

	tid = k_thread_create(&eno_thread, eno_stack, STACK_SIZE,
				thread_entry_user, NULL, NULL, NULL,
				K_PRIO_PREEMPT(1), perm,
				K_NO_WAIT);

	k_thread_join(tid, K_FOREVER);
}


text:
<?php

namespace Base\Http\Request;

interface Request
{
	const POST = 'post';
	const GET = 'get';

  public function getUri();
  public function getMethod();
  public function getParameters();
}


text:
namespace mongo {
namespace driver {
namespace model {

replace_one::replace_one(bson::document::view criteria, bson::document::view replacement)
    : _criteria(std::move(criteria)), _replacement(std::move(replacement)) {}

replace_one& replace_one::upsert(bool upsert) {
    _upsert = upsert;

    return *this;
}

replace_one& replace_one::write_concern(class write_concern wc) {
    _write_concern = std::move(wc);
    return *this;
}

const bson::document::view& replace_one::criteria() const { return _criteria; }

const bson::document::view& replace_one::replacement() const { return _replacement; }

const optional<bool>& replace_one::upsert() const { return _upsert; }

const optional<class write_concern>& replace_one::write_concern() const { return _write_concern; }

}  // namespace model
}  // namespace driver
}  // namespace mongo


text:
<?php
namespace Cnab\Retorno\Cnab240;

class HeaderLote extends \Cnab\Format\Linha
{
	public function __construct($codigo_banco)
    {
        $yamlLoad = new \Cnab\Format\YamlLoad($codigo_banco);
        $yamlLoad->load($this, 'cnab240', 'header_lote');
	}
}


text:
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Tests.Visual.Multiplayer;

namespace osu.Game.Tests.OnlinePlay
{
    [HeadlessTest]
    public class StatefulMultiplayerClientTest : MultiplayerTestScene
    {
        [Test]
        public void TestUserAddedOnJoin()
        {
            var user = new APIUser { Id = 33 };

            AddRepeatStep("add user multiple times", () => Client.AddUser(user), 3);
            AddAssert("room has 2 users", () => Client.Room?.Users.Count == 2);
        }

        [Test]
        public void TestUserRemovedOnLeave()
        {
            var user = new APIUser { Id = 44 };

            AddStep("add user", () => Client.AddUser(user));
            AddAssert("room has 2 users", () => Client.Room?.Users.Count == 2);

            AddRepeatStep("remove user multiple times", () => Client.RemoveUser(user), 3);
            AddAssert("room has 1 user", () => Client.Room?.Users.Count == 1);
        }
    }
}


text:
package com.simbest.cores.utils;

import java.beans.PropertyDescriptor;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.ParameterizedType;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import java.util.Set;

import javax.persistence.Id;

import com.google.common.collect.Lists;
import org.apache.commons.beanutils.PropertyUtils;

import com.google.common.collect.Sets;
import com.simbest.cores.app.model.ProcessModel;
import com.simbest.cores.app.service.impl.ProcessAdapterService;
import com.simbest.cores.exceptions.Exceptions;
import com.simbest.cores.model.GenericModel;
import com.simbest.cores.utils.annotations.ProcessProperty;
import com.simbest.cores.utils.annotations.Unique;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class ObjectUtil extends org.apache.commons.lang.ObjectUtils {
    public transient final Log log = LogFactory.getLog(getClass());

	/**
	 * 判断对象的所有属性是否均为空
	 *
	 * @param obj
	 * @return
	 */
	public static boolean isEmpty(Object obj) {
		for (PropertyDescriptor pd : PropertyUtils.getPropertyDescriptors(obj)) {
			try{
				if (!pd.getName().equals("class")&& pd.getReadMethod()!=null && !pd.getReadMethod().getName().equals("isEmpty")) {
					try {
						Field f = getIndicateField(obj, pd.getName());
						if (!f.isAnnotationPresent(javax.persistence.Transient.class)) {
							Object value = pd.getReadMethod().invoke(obj);
							if (value instanceof Collection) {
								if (((Collection<?>) value).size() != 0)
									return false;
							} else if (value instanceof Map) {
								if (((Map<?, ?>) value).size() != 0)
									return false;
							} else if (value != null)
								return false;
						}
					} catch (IllegalAccessException | InvocationTargetException e) {
						return false;
					}
				}
			}catch(Exception e){
				Exceptions.printException(e);
			}
		}
		return true;
	}

	/**
	 * 获取ProcessAdapterService子类中持久化对象的主键Id字段
	 *
	 * @param clazz
	 * @return
	 */
	public static Field getProcessServiceIdField(
			@SuppressWarnings("rawtypes") Class<? extends ProcessAdapterService> clazz) {
		Field id = null;
		Class<?> processClass = (Class<?>) ((ParameterizedType) clazz
				.getGenericSuperclass()).getActualTypeArguments()[0];
		for (Field field : processClass.getSuperclass().getDeclaredFields()) {
			if (field.isAnnotationPresent(Id.class)) {
				id = field;
				break;
			}
		}
		return id;
	}

	/**
	 * 获取持久化对象的主键Id字段
	 *
	 * @param obj
	 * @return
	 */
    public static Field getIdField(Object obj) {
		Field id = null;
		for (Field field : getAllFields(obj.getClass())) {
			if (field.isAnnotationPresent(Id.class)) {
				id = field;
				break;
			}
		}
		return id;
	}

	/**
	 * 获取持久化对象的唯一性字段
	 *
	 * @param obj
	 * @return
	 */
	public static Field getUniqueField(Object obj) {
		Field unique = null;
		for (Field field : getAllFields(obj.getClass())) {
			if (field.isAnnotationPresent(Unique.class)) {
				unique = field;
				break;
			}
		}
		return unique;
	}

	/**
	 * 获取指定字段的Field
	 * @param obj
	 * @param fieldName
	 * @return
	 */
	public static Field getIndicateField(Object obj, String fieldName) {
		Field indicateField = null;
		for (Field field : getAllFields(obj.getClass())) {
			if (field.getName().equals(fieldName)) {
				indicateField = field;
				break;
			}
		}
		return indicateField;
	}

    public static Object getIdVaue(Object obj) {
        try {
            Field id = getIdField(obj);
            id.setAccessible(true);
            return id.get(obj);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return null;
    }

    public static Collection getIdVaueList(Collection os) {
        Collection<Object> idList = Lists.newArrayList();
        for(Object obj:os){
            idList.add(getIdVaue(obj));
        }
        return idList;
    }

	public static Collection<Field> getProcessFields(ProcessModel<?> process) {
		Set<Field> fields = Sets.newHashSet();
		for (Field field : getAllFields(process.getClass())) {
			if (field.isAnnotationPresent(ProcessProperty.class)) {
				fields.add(field);
			}
		}
		return fields;
	}

	public static String[] getProcessFieldNames(ProcessModel<?> process) {
		Set<String> fieldNames = Sets.newHashSet();
		for (Field field : getAllFields(process.getClass())) {
			if (field.isAnnotationPresent(ProcessProperty.class)) {
				fieldNames.add(field.getName());
			}
		}
		return fieldNames.toArray(new String[fieldNames.size()]);
	}

	/**
	 * 返回所有字段
	 */
	public static Field[] getAllFields(Class<?> clazz) {
		Collection<Class<?>> classes = getAllSuperClasses(clazz);
		classes.add(clazz);
		return getAllFields(classes);
	}

	/**
	 * 返回所有字段
	 */
	private static Field[] getAllFields(Collection<Class<?>> classes) {
		Set<Field> fields = Sets.newHashSet();
		for (Class<?> clazz : classes) {
			fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
		}
		return fields.toArray(new Field[fields.size()]);
	}

	/**
	 * 返回所有超类
	 */
	public static Collection<Class<?>> getAllSuperClasses(Class<?> clazz) {
		Set<Class<?>> classes = Sets.newHashSet();
		Class<?> superclass = clazz.getSuperclass();
		while (superclass != null) {
			classes.add(superclass);
			superclass = superclass.getSuperclass();
		}

		return classes;
	}

}


text:
package xyz.santeri.wvp;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.Interpolator;
import android.view.animation.Transformation;

/**
 * ViewPager with dynamic height support. For basic usage, replace {@link ViewPager} with {@link WrappingViewPager}
 * in your layout file, and set its height property to {@code wrap_content}.
 * <p>
 * You also have to make your adapter inform the {@link WrappingViewPager} of every page change:
 * the easiest way to achieve this is to override {@link android.support.v4.view.PagerAdapter#setPrimaryItem(ViewGroup, int, Object)}
 * and call {@link WrappingViewPager#onPageChanged(View)}. To avoid unnecessary calls, only do this
 * when the page is changed, instead of the old one being reselected. For a basic example of this,
 * see how it is implemented in the library's own {@link WrappingFragmentStatePagerAdapter}.
 *
 * @author Santeri Elo
 * @author Abhishek V (http://stackoverflow.com/a/32410274)
 * @author Vihaan Verma (http://stackoverflow.com/a/32488566)
 * @since 14-06-2016
 */
public class WrappingViewPager extends ViewPager implements Animation.AnimationListener {
    private View mCurrentView;
    private PagerAnimation mAnimation = new PagerAnimation();
    private boolean mAnimStarted = false;
    private long mAnimDuration = 100;

    public WrappingViewPager(Context context) {
        super(context);
        mAnimation.setAnimationListener(this);
    }

    public WrappingViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
        mAnimation.setAnimationListener(this);
    }

    @Override
    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);

        if (!mAnimStarted && mCurrentView != null) {
            int height;
            mCurrentView.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
            height = mCurrentView.getMeasuredHeight();

            if (height < getMinimumHeight()) {
                height = getMinimumHeight();
            }

            int newHeight = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
            if (getLayoutParams().height != 0 && heightMeasureSpec != newHeight) {
                mAnimation.setDimensions(height, getLayoutParams().height);
                mAnimation.setDuration(mAnimDuration);
                startAnimation(mAnimation);
                mAnimStarted = true;
            } else {
                heightMeasureSpec = newHeight;
            }
        }

        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }

    /**
     * This method should be called when the ViewPager changes to another page. For best results
     * call this method in the adapter's setPrimary
     *
     * @param currentView PagerAdapter item view
     */
    public void onPageChanged(View currentView) {
        mCurrentView = currentView;
        requestLayout();
    }

    /**
     * Custom animation to animate the change of height in the {@link WrappingViewPager}.
     */
    private class PagerAnimation extends Animation {
        private int targetHeight;
        private int currentHeight;
        private int heightChange;

        /**
         * Set the dimensions for the animation.
         *
         * @param targetHeight  View's target height
         * @param currentHeight View's current height
         */
        void setDimensions(int targetHeight, int currentHeight) {
            this.targetHeight = targetHeight;
            this.currentHeight = currentHeight;
            this.heightChange = targetHeight - currentHeight;
        }

        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            if (interpolatedTime >= 1) {
                getLayoutParams().height = targetHeight;
            } else {
                int stepHeight = (int) (heightChange * interpolatedTime);
                getLayoutParams().height = currentHeight + stepHeight;
            }
            requestLayout();
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    }

    /**
     * Sets the duration of the animation.
     *
     * @param duration Duration in ms
     */
    public void setAnimationDuration(long duration) {
        mAnimDuration = duration;
    }

    /**
     * Sets the interpolator used by the animation.
     *
     * @param interpolator {@link Interpolator}
     */
    public void setAnimationInterpolator(Interpolator interpolator) {
        mAnimation.setInterpolator(interpolator);
    }

    @Override
    public void onAnimationStart(Animation animation) {
        mAnimStarted = true;
    }

    @Override
    public void onAnimationEnd(Animation animation) {
        mAnimStarted = false;
    }

    @Override
    public void onAnimationRepeat(Animation animation) {
    }
}