text:
package org.sakaiproject.calendar.cover;

import org.sakaiproject.component.cover.ComponentManager;

/**
*
CalendarService is a static Cover for the {@link org.sakaiproject.calendar.api.CalendarService CalendarService};
* see that interface for usage details.

*/
public class CalendarService
{
   /** session attribute for list of all calendars user can reference */
   public static final String SESSION_CALENDAR_LIST =  org.sakaiproject.calendar.api.CalendarService.SESSION_CALENDAR_LIST;

	/**
	 * Access the component instance: special cover only method.
	 * @return the component instance.
	 */
	public static org.sakaiproject.calendar.api.CalendarService getInstance()
	{
		if (ComponentManager.CACHE_COMPONENTS)
		{
			if (m_instance == null) m_instance = (org.sakaiproject.calendar.api.CalendarService) ComponentManager.get(org.sakaiproject.calendar.api.CalendarService.class);
			return m_instance;
		}
		else
		{
			return (org.sakaiproject.calendar.api.CalendarService) ComponentManager.get(org.sakaiproject.calendar.api.CalendarService.class);
		}
	}
	private static org.sakaiproject.calendar.api.CalendarService m_instance = null;

	public static java.lang.String APPLICATION_ID = org.sakaiproject.calendar.api.CalendarService.APPLICATION_ID;
	public static java.lang.String REFERENCE_ROOT = org.sakaiproject.calendar.api.CalendarService.REFERENCE_ROOT;
	public static java.lang.String REF_TYPE_CALENDAR = org.sakaiproject.calendar.api.CalendarService.REF_TYPE_CALENDAR;
	public static java.lang.String REF_TYPE_CALENDAR_PDF = org.sakaiproject.calendar.api.CalendarService.REF_TYPE_CALENDAR_PDF;
	public static java.lang.String REF_TYPE_CALENDAR_SUBSCRIPTION = org.sakaiproject.calendar.api.CalendarService.REF_TYPE_CALENDAR_SUBSCRIPTION;
	public static java.lang.String REF_TYPE_EVENT = org.sakaiproject.calendar.api.CalendarService.REF_TYPE_EVENT;
	public static java.lang.String REF_TYPE_EVENT_SUBSCRIPTION = org.sakaiproject.calendar.api.CalendarService.REF_TYPE_EVENT_SUBSCRIPTION;
	public static int MOD_NA = org.sakaiproject.calendar.api.CalendarService.MOD_NA;
	public static int MOD_THIS = org.sakaiproject.calendar.api.CalendarService.MOD_THIS;
	public static int MOD_ALL = org.sakaiproject.calendar.api.CalendarService.MOD_ALL;
	public static int MOD_REST = org.sakaiproject.calendar.api.CalendarService.MOD_REST;
	public static int MOD_PRIOR = org.sakaiproject.calendar.api.CalendarService.MOD_PRIOR;
	public static int UNKNOWN_VIEW = org.sakaiproject.calendar.api.CalendarService.UNKNOWN_VIEW;
	public static int DAY_VIEW = org.sakaiproject.calendar.api.CalendarService.DAY_VIEW;
	public static int WEEK_VIEW = org.sakaiproject.calendar.api.CalendarService.WEEK_VIEW;
	public static int MONTH_VIEW = org.sakaiproject.calendar.api.CalendarService.MONTH_VIEW;
	public static int LIST_VIEW = org.sakaiproject.calendar.api.CalendarService.LIST_VIEW;
	/** events */
	public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_TITLE = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_TITLE;
	public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_TIME = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_TIME;
	public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_TYPE = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_TYPE;
	public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_ACCESS = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_ACCESS;
	public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_FREQUENCY = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_FREQUENCY;
	public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_EXCLUSIONS = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_EXCLUSIONS;
	public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_EXCLUDED = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_EXCLUDED;
	public static java.lang.String EVENT_REMOVE_CALENDAR_EVENT = org.sakaiproject.calendar.api.CalendarService.EVENT_REMOVE_CALENDAR_EVENT;

	public static java.lang.String calendarReference(java.lang.String param0, java.lang.String param1)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.calendarReference(param0, param1);
	}

	public static java.lang.String calendarPdfReference(java.lang.String param0, java.lang.String param1,
			int param2, java.lang.String param3, java.lang.String param4, org.sakaiproject.time.api.TimeRange param5)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.calendarPdfReference(param0, param1, param2, param3, param4, param5);
	}

	public static java.lang.String calendarICalReference(org.sakaiproject.entity.api.Reference param0)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.calendarICalReference(param0);
	}

	public static java.lang.String calendarSubscriptionReference(java.lang.String param0, java.lang.String param1)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.calendarSubscriptionReference(param0, param1);
	}

	public static boolean getExportEnabled(String param0)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return false;

		return service.getExportEnabled(param0);
	}

	public static void setExportEnabled(String param0, boolean param1)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return;

		service.setExportEnabled(param0, param1);
	}

	public static org.sakaiproject.calendar.api.CalendarEdit addCalendar(java.lang.String param0) throws org.sakaiproject.exception.IdUsedException, org.sakaiproject.exception.IdInvalidException, org.sakaiproject.exception.PermissionException
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.addCalendar(param0);
	}

	public static boolean allowGetCalendar(java.lang.String param0)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return false;

		return service.allowGetCalendar(param0);
	}

	public static boolean allowImportCalendar(java.lang.String param0)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return false;

		return service.allowImportCalendar(param0);
	}

	public static boolean allowSubscribeCalendar(java.lang.String param0)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return false;

		return service.allowSubscribeCalendar(param0);
	}

	public static boolean allowEditCalendar(java.lang.String param0)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return false;

		return service.allowEditCalendar(param0);
	}

	public static boolean allowMergeCalendar(java.lang.String param0)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return false;

		return service.allowMergeCalendar(param0);
	}

	public static org.sakaiproject.calendar.api.CalendarEdit editCalendar(java.lang.String param0) throws org.sakaiproject.exception.IdUnusedException, org.sakaiproject.exception.PermissionException, org.sakaiproject.exception.InUseException
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.editCalendar(param0);
	}

	public static void commitCalendar(org.sakaiproject.calendar.api.CalendarEdit param0)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return;

		service.commitCalendar(param0);
	}

	public static void cancelCalendar(org.sakaiproject.calendar.api.CalendarEdit param0)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return;

		service.cancelCalendar(param0);
	}

	public static void removeCalendar(org.sakaiproject.calendar.api.CalendarEdit param0) throws org.sakaiproject.exception.PermissionException
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return;

		service.removeCalendar(param0);
	}

	public static java.lang.String eventReference(java.lang.String param0, java.lang.String param1, java.lang.String param2)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.eventReference(param0, param1, param2);
	}

	public static java.lang.String eventSubscriptionReference(java.lang.String param0, java.lang.String param1, java.lang.String param2)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.eventSubscriptionReference(param0, param1, param2);
	}

	public static org.sakaiproject.calendar.api.CalendarEventVector getEvents(java.util.List param0, org.sakaiproject.time.api.TimeRange param1)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.getEvents(param0, param1);
	}

	public static org.sakaiproject.calendar.api.RecurrenceRule newRecurrence(java.lang.String param0, int param1, org.sakaiproject.time.api.Time param2)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.newRecurrence(param0, param1, param2);
	}

	public static org.sakaiproject.calendar.api.RecurrenceRule newRecurrence(java.lang.String param0, int param1)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.newRecurrence(param0, param1);
	}

	public static org.sakaiproject.calendar.api.RecurrenceRule newRecurrence(java.lang.String param0, int param1, int param2)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.newRecurrence(param0, param1, param2);
	}

	public static org.sakaiproject.calendar.api.RecurrenceRule newRecurrence(java.lang.String param0)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.newRecurrence(param0);
	}

	public static org.sakaiproject.calendar.api.Calendar getCalendar(java.lang.String param0) throws org.sakaiproject.exception.IdUnusedException, org.sakaiproject.exception.PermissionException
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.getCalendar(param0);
	}

	public static java.lang.String merge(java.lang.String param0, org.w3c.dom.Element param1, java.lang.String param2, java.lang.String param3, java.util.Map param4, java.util.HashMap param5, java.util.Set param6)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.merge(param0, param1, param2, param3, param4, param5, param6);
	}

	public static java.lang.String getLabel()
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.getLabel();
	}

	public static java.lang.String archive(java.lang.String param0, org.w3c.dom.Document param1, java.util.Stack param2, java.lang.String param3, java.util.List param4)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.archive(param0, param1, param2, param3, param4);
	}

	public static java.lang.String calendarOpaqueUrlReference(org.sakaiproject.entity.api.Reference param0)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return null;

		return service.calendarOpaqueUrlReference(param0);
}

	public static boolean allowSubscribeThisCalendar(java.lang.String param0)
	{
		org.sakaiproject.calendar.api.CalendarService service = getInstance();
		if (service == null)
			return false;

		return service.allowSubscribeThisCalendar(param0);
	}

}


text:
using System;

namespace BitSharper
{
    /// <summary>
    /// Thrown when a problem occurs in communicating with a peer, and we should
    /// retry.
    /// </summary>
    public class PeerException : Exception
    {
        public PeerException()
        {
        }

        public PeerException(string message)
            : base(message)
        {
        }

        public PeerException(Exception innerException)
            : base(innerException.Message, innerException)
        {
        }

        public PeerException(string message, Exception innerException)
            : base(message, innerException)
        {
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
var request = require('request');
var _ = require('underscore');
var parseArgs = require('minimist');

// Collect and parse the CLI arguments
var args = parseArgs(process.argv.slice(2));
var minRent = args.minRent || 0;
var maxRent = args.maxRent || 9999;
var numBedrooms = args.bedrooms || 2;
var numBathrooms = args.bathrooms || 2;

// Make the request to the Avalon API
request('http://api.avalonbay.com/json/reply/ApartmentSearch?communityCode=CA067&min=' + minRent + '&max=' + maxRent + '&_=1443137667833', function (error, response, body) {
  if (!error && response.statusCode == 200) {
    // Parse the JSON output
    var aptData = JSON.parse(body);

    // Filter down based on parameters
    var availableApts = aptData.results.availableFloorPlanTypes;

    if (!_.isUndefined(availableApts)) {
        var bedroomFilter = _.where(availableApts, { floorPlanTypeCode: (numBedrooms + "BD") });

        if (!_.isUndefined(bedroomFilter) && !_.isEmpty(bedroomFilter)) {
            bedroomFilter = bedroomFilter[0].availableFloorPlans;

            if (!_.isUndefined(bedroomFilter)) {
                var bedBathFilter = _.where(bedroomFilter, { floorPlanBathType: (numBathrooms + " baths") });

                if (!_.isEmpty(bedBathFilter)) {
                    console.log(JSON.stringify(bedBathFilter));
                } else {
                    console.log("None available");
                }
            }
        }
    }
  }
});


text:
/* globals window, _, VIZI */

/**
 * Tile grid helper
 * @author Robin Hawkes - vizicities.com
 */

(function() {
  "use strict";

  // TODO: Define a hole so only tiles outside of that area are used / loaded
  VIZI.BlueprintHelperTileGrid = function(world, options) {
    if (VIZI.DEBUG) console.log("Initialising VIZI.BlueprintHelperTileGrid");

    var self = this;

    VIZI.EventEmitter.call(self);

    if (!world || !(world instanceof VIZI.World)) {
      throw new Error("Required world property missing");
    }

    self.world = world;

    self.options = options || {};

    _.defaults(self.options, {});

    if (!self.options.zoom) {
      throw new Error("Required options zoom property missing");
    }

    if (!self.options.cullZoom) {
      throw new Error("Required options cull zoom property missing");
    }

    if (self.options.tilesPerDirection === undefined) {
      throw new Error("Required options tiles per direction property missing");
    }

    self.disable = false;

    // Location of grid center
    self.centerTile = new VIZI.Point();
    self.centerTileLatLon = new VIZI.LatLon();

    // Tile size and zoom level
    self.tileZoom = self.options.zoom;

    // Zoom limit before hiding and disabling grid
    self.cullZoom = self.options.cullZoom;

    // Tiles per direction
    self.tilesPerDirection = self.options.tilesPerDirection;

    // Calculated pixel tile size
    // self.tileSize;

    // Grid bounds (in TMS values)
    self.bounds;

    // Grid bounds (lat, lon)
    self.boundsLatLon;

    self.tileCount;

    // List of tiles, ordered from center outwards
    self.tiles = [];

    // Grid movement difference since last mouse up
    // TODO: Change to something that isn't referencing the mouse as it's no longer used to calculate grid difference.
    self.gridDiffSinceMouseUp = new VIZI.Point();
  };

  VIZI.BlueprintHelperTileGrid.prototype = Object.create( VIZI.EventEmitter.prototype );

  // Set up and start grid
  // TODO: Immediately disable grid if beyond camera cull point
  // What's the best way of getting camera radius to here? Singleton?
  VIZI.BlueprintHelperTileGrid.prototype.init = function() {
    var self = this;

    var coords = self.world.center;

    if (VIZI.DEBUG) console.log("coords", coords);

    self.centerTile = self.world.crs.latLonToTile(coords, self.tileZoom);

    if (VIZI.DEBUG) console.log("centerTile", self.centerTile);

    self.centerTileLatLon = new VIZI.LatLon(self.world.center);

    if (VIZI.DEBUG) console.log("centerTileLatLon", self.centerTileLatLon);

    var centerTileBoundsPoint = self.world.crs.tileBoundsPoint(self.centerTile, self.tileZoom);

    if (VIZI.DEBUG) console.log("centerTileBoundsPoint", centerTileBoundsPoint);

    self.bounds = self.getBounds(self.tilesPerDirection);
    self.boundsLatLon = self.getBoundsLatLon(self.bounds);

    if (VIZI.DEBUG) console.log("bounds", self.bounds);
    if (VIZI.DEBUG) console.log("boundsLatLon", self.boundsLatLon);

    self.tileCount = new VIZI.Point(self.bounds.e - self.bounds.w + 1, self.bounds.s - self.bounds.n + 1);

    if (VIZI.DEBUG) console.log("tileCount", self.tileCount);

    // REMOVED: Shouldn't be needed any longer as updates are now triggered based on world:updateView events
    // TODO: Hook into VIZI.Controls.Mouse or at least use correct DOM element
    // Could do with panControlStart and panControlEnd events
    // document.body.addEventListener("mouseup", function(event) {
    //   self.onMouseUp(event);
    // }, false);

    // TODO: Convert to VIZI.Messenger format
    // TODO: Listen for a zoom event from the camera to handle hiding of objects at distance
    // self.subscribe("zoomChanged", self.onZoomChanged);

    VIZI.Messenger.on("world:updateView", function(center, zoom) {
      self.onWorldUpdate(center, zoom);
    });

    self.collectTiles();

    return self.tiles;
  };

  VIZI.BlueprintHelperTileGrid.prototype.collectTiles = function() {
    var self = this;

    var tiles = [];

    // Rows
    for (var i = 0; i < self.tileCount.x; i++) {
      // Columns
      for (var j = 0; j < self.tileCount.y; j++) {
        var tileData = {
          x: self.bounds.w + j,
          y: self.bounds.n + i,
          z: self.tileZoom,
          distance: 0,
          localCoords: new VIZI.Point()
        };

        tileData.localCoords = self.globalToLocalTiles(tileData.x, tileData.y);

        tileData.distance = Math.abs(self.centerTile.x - tileData.x) + Math.abs(self.centerTile.y - tileData.y);

        tiles.push(tileData);
      }
    }

    // Sort tiles by distance from center
    tiles.sort(function(a, b) {
      if (a.distance < b.distance) {
        return -1;
      }

      if (a.distance > b.distance) {
        return 1;
      }

      return 0;
    });

    self.tiles = tiles;
  };

  // Should be covered in VIZI.CRS, just not with the tileDistance bit
  VIZI.BlueprintHelperTileGrid.prototype.getBounds = function(tileDistance) {
    var self = this;
    var bounds = {
      n: Math.floor(self.centerTile.y) - tileDistance,
      e: Math.ceil(self.centerTile.x) + tileDistance,
      s: Math.ceil(self.centerTile.y) + tileDistance,
      w: Math.floor(self.centerTile.x) - tileDistance
    };

    return bounds;
  };

  // Should be covered in VIZI.CRS, just not with the ability to convert point bounds
  VIZI.BlueprintHelperTileGrid.prototype.getBoundsLatLon = function(bounds) {
    var self = this;
    var max = self.world.crs.tileBoundsLatLon(new VIZI.Point(bounds.e, bounds.n), self.tileZoom);
    var min = self.world.crs.tileBoundsLatLon(new VIZI.Point(bounds.w, bounds.s), self.tileZoom);

    var boundsLatLon = {
      n: max.n,
      e: max.e,
      s: min.s,
      w: min.w
    };

    return boundsLatLon;
  };

  // TODO: Move onZoomChanged logic into here
  VIZI.BlueprintHelperTileGrid.prototype.onWorldUpdate = function(center, zoom) {
    var self = this;

    var centerTile = self.world.crs.latLonToTile(center, self.tileZoom);

    var gridDiff = new VIZI.Point(
      Math.floor(centerTile.x) - Math.floor(self.centerTile.x),
      Math.floor(centerTile.y) - Math.floor(self.centerTile.y)
    );

    if (Math.abs(gridDiff.x) > 0 || Math.abs(gridDiff.y) > 0) {
      self.centerTile = centerTile;

      self.centerTileLatLon = new VIZI.LatLon(self.world.center);

      self.bounds = self.getBounds(self.tilesPerDirection);
      self.boundsLatLon = self.getBoundsLatLon(self.bounds);

      self.gridDiffSinceMouseUp.x += gridDiff.x;
      self.gridDiffSinceMouseUp.y += gridDiff.y;

      self.collectTiles();
    }

    if (zoom < self.cullZoom) {
      if (!self.disable) {
        // Disable grid
        self.disable = true;
        self.emit("disabled");
      }
    } else {
      if (self.disable) {
        // Enable grid
        self.disable = false;
        self.emit("enabled");
      }
    }

    // Force an update, even if nothing has changed
    self.updateGrid();
  };

  // REMOVED: Due to move toward using world:updateView instead
  // VIZI.BlueprintHelperTileGrid.prototype.onMouseUp = function(event) {
  //   var self = this;
  //   self.updateGrid();
  // };

  VIZI.BlueprintHelperTileGrid.prototype.updateGrid = function() {
    var self = this;
    // If grid has moved (there's an offset) then move grid mesh and update tiles
    // TODO: Change gridDiffSinceMouseUp to something unrelated to mouse
    if (Math.abs(self.gridDiffSinceMouseUp.x) > 0 || Math.abs(self.gridDiffSinceMouseUp.y) > 0) {
      // self.onGridMove(self.gridDiffSinceMouseUp);
      self.emit("moved", self.tiles, self.gridDiffSinceMouseUp);

      self.gridDiffSinceMouseUp = new VIZI.Point();
    }
  };

  VIZI.BlueprintHelperTileGrid.prototype.globalToLocalTiles = function(x, y) {
    var self = this;
    return new VIZI.Point(x - self.bounds.w, y - self.bounds.n);
  };
}());


text:
package com.citelic.game.entity.npc.combat.impl;

import com.citelic.game.engine.Engine;
import com.citelic.game.engine.task.EngineTask;
import com.citelic.game.engine.task.EngineTaskManager;
import com.citelic.game.entity.Animation;
import com.citelic.game.entity.Entity;
import com.citelic.game.entity.npc.NPC;
import com.citelic.game.entity.npc.combat.CombatScript;
import com.citelic.game.entity.npc.combat.NPCCombatDefinitions;
import com.citelic.utility.Utilities;

public class TheInadequacyCombat extends CombatScript {

	@Override
	public int attack(final NPC npc, final Entity target) {
		final NPCCombatDefinitions defs = npc.getCombatDefinitions();
		npc.setNextAnimation(new Animation(6325));
		EngineTaskManager.schedule(new EngineTask() {
			@Override
			public void run() {
				// World.sendProjectile(npc, target, 1067, 18, 18, 50, 30, 0,
				// 0);
				Engine.sendProjectile(target, npc, 1067, 34, 16, 30, 35, 16, 0);
				EngineTaskManager.schedule(new EngineTask() {
					@Override
					public void run() {
						// target.setNextGraphics(new Graphics(1068, 0, 100));
						delayHit(npc, 0, target,
								getMagicHit(npc, Utilities.random(350)));
					}
				}, 1);
			}
		}, 1);

		return defs.getAttackDelay();
	}

	@Override
	public Object[] getKeys() {

		return new Object[] { 5902 };
	}

}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:id="@+id/nd_bind_phone_number_layout"
	android:layout_width="fill_parent"
	android:layout_height="fill_parent"
	android:orientation ="vertical"
	android:fillViewport="true"
	android:gravity="center"
	>
	<RelativeLayout
        android:id="@+id/nd3_title_bar_layout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/nd3_title_bar_bg"
        android:orientation="vertical" >

        <!-- 左按钮 -->

        <Button
            android:id="@+id/nd3_title_bar_button_left"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dip"
            android:background="@drawable/nd3_title_bar_return_btn_xml"
            android:gravity="center"
            android:text="@string/nd3_topbar_ret"
            android:textColor="#FFFFFFFF"
            android:textSize="16sp" >
        </Button>

        <!-- 标题 -->

        <TextView
            android:id="@+id/nd3_title_bar_title"
            style="@style/nd3_textview_0"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:drawablePadding="@dimen/nd3_option_item_marginLeft"
            android:text="@string/nd_bind_phone_title" >
        </TextView>

        <!-- 右按钮 -->

        <Button
            android:id="@+id/nd3_title_bar_button_right"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="10dip"
            android:background="@drawable/nd3_title_bar_action_btn_xml"
            android:gravity="center"
            android:text="@string/nd3_account_login_button_right"
            android:textColor="#FFFFFFFF"
            android:textSize="16sp"
            android:visibility="invisible" >
        </Button>
    </RelativeLayout>

    <ScrollView
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:fillViewport="true"
	 android:fadingEdge="none" >
    <LinearLayout
	    android:layout_width="fill_parent"
		android:layout_height="fill_parent"
		android:orientation="vertical">
        <!-- 提示 -->
        <TextView android:id="@+id/nd_account"
			android:layout_width="fill_parent"
			android:layout_height="wrap_content"
			android:textSize="@dimen/nd3_pay_password_tip_text_size"
			android:textColor="@color/nd3_white"
			android:textStyle="bold"
			android:padding="@dimen/nd3_margin_size"
			android:gravity="center"
			>
		</TextView>
		<TextView
			android:layout_width="fill_parent"
			android:layout_height="wrap_content"
			android:text="@string/nd_account_bind_tips"
			android:textColor="@color/nd3_white"
			android:textStyle="bold"
			android:padding="@dimen/nd3_margin_size"
			android:gravity="center"

			>
		</TextView>

	<!-- 输入绑定的手机号 -->
	<LinearLayout
	    android:layout_width="fill_parent"
		android:layout_height="fill_parent"
		android:orientation="vertical"
		android:paddingLeft="@dimen/nd_20"
		android:paddingRight="@dimen/nd_20"
		>

		<LinearLayout
		    android:id="@+id/nd_bind_group_code"
		    android:layout_width="fill_parent"
		    android:layout_height="wrap_content"
		    >
			<LinearLayout
			    android:layout_width="fill_parent"
			    android:layout_height="wrap_content"
			    android:layout_weight="0.8"
			    android:orientation="vertical">
			    	<!-- 提示 -->
					<TextView
						android:layout_width="fill_parent"
						android:layout_height="wrap_content"
						android:gravity="left"
						android:text="@string/nd_bind_phone_number_enter_number_tip"
						android:textSize="@dimen/nd3_register_agreement_text_size"
						android:textColor="@color/nd3_white"
						>
					</TextView>

					<!-- 编辑框 -->
					<EditText
			            android:id="@+id/nd_bind_edit_phone_number"
			            android:textSize="16.0sp"
			            android:layout_width="fill_parent"
			            android:layout_height="wrap_content"
			            android:layout_marginTop="@dimen/nd3_margin_size"
			            android:inputType="phone"
			            android:textColor="@color/nd3_white"
			            android:background="@drawable/nd3_input_gray"
			            android:singleLine="true" >
			        </EditText>

			</LinearLayout>

			<!-- 和 -->
			<LinearLayout
				    android:layout_width="wrap_content"
			    	android:layout_height="wrap_content"
			    	android:orientation="vertical">
					<TextView
					    android:id="@+id/nd_number_gain_text"
						android:layout_width="wrap_content"
						android:layout_height="wrap_content"
						android:textSize="@dimen/nd3_register_agreement_text_size"
						android:textColor="@color/nd3_balance_color"
						android:visibility="invisible"
						android:layout_gravity="right"/>

					<Button
					    android:id="@+id/nd_bind_phone_number_gain"
				    	android:layout_width="wrap_content"
						android:layout_height="wrap_content"
						android:text="@string/nd_bind_phone_number_gain_code"
						android:background="@drawable/nd_white_btn"
						android:textColor="@color/nd3_font_color"
						android:layout_gravity="right"
						android:layout_marginTop="@dimen/nd3_margin_size"
						/>
			</LinearLayout>
		</LinearLayout>
		<!-- 请输入收到的短信验证码 -->
		<LinearLayout
		    android:id="@+id/nd_bind_phone_number_bind_group_phone_number"
		    android:layout_width="fill_parent"
		    android:layout_height="wrap_content"
		    android:orientation="vertical"
		    android:layout_marginTop="@dimen/nd_10"
		    >
			<!-- 提示 -->
			<TextView
				android:layout_width="fill_parent"
				android:layout_height="wrap_content"
				android:gravity="left"
				android:text="@string/nd_bind_phone_number_enter_code_tip"
				android:textSize="@dimen/nd3_register_agreement_text_size"
				android:textColor="@color/nd3_white"
				>
			</TextView>
			<!-- 编辑框 -->
			<EditText
	            android:id="@+id/nd_bind_edit_code"
	            android:textSize="16.0sp"
	            android:layout_width="fill_parent"
	            android:layout_height="wrap_content"
	            android:layout_weight="1.0"
	            android:textColor="@color/nd3_white"
	            android:background="@drawable/nd3_input_gray"
	            android:layout_marginTop="@dimen/nd3_margin_size"
	            android:singleLine="true" />

		</LinearLayout>
		 <!-- 绑定手机 -->
		<Button
		    android:id="@+id/nd_bind_phone_number_bind"
	    	android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:text="@string/nd_bind_phone_number_bind"
			android:textSize="@dimen/nd3_pay_tip_text_size"
			android:textColor="@color/nd3_white"
			android:background="@drawable/nd_blue"
			android:layout_gravity="center"
			android:layout_marginTop="@dimen/nd_20"
			/>

		<TextView
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:text="@string/nd_bind_phone_reason"
			android:textSize="@dimen/nd_20"
			android:textColor="@color/nd3_white"
			android:layout_marginTop="@dimen/nd_20"
			/>
		<TextView
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:text="@string/nd_bind_phone_reason1"
			android:textSize="@dimen/nd3_register_agreement_text_size"
			android:textColor="@color/nd3_white"
			/>
		<TextView
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:text="@string/nd_bind_phone_reason2"
			android:textSize="@dimen/nd3_register_agreement_text_size"
			android:textColor="@color/nd3_white"
			/>
		<!-- <TextView
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:text="@string/nd_bind_phone_reason3"
			android:textSize="@dimen/nd3_register_agreement_text_size"
			android:textColor="@color/nd3_white"
			/> -->

	</LinearLayout>
	</LinearLayout>
	</ScrollView>
</LinearLayout>


text:
typedef NS_ENUM(NSInteger, HJResourceManagerRequestStatus)
{
    HJResourceManagerRequestStatusIdle,
    HJResourceManagerRequestStatusLoaded,
    HJResourceManagerRequestStatusLoadFailed,
    HJResourceManagerRequestStatusDownloadStarted,
    HJResourceManagerRequestStatusDownloaded,
    HJResourceManagerRequestStatusDownloadFailed,
    HJResourceManagerRequestStatusUpdated,
    HJResourceManagerRequestStatusUpdateFailed,
    HJResourceManagerRequestStatusRemoved,
    HJResourceManagerRequestStatusRemoveFailed,
    HJResourceManagerRequestStatusCalculated,
    HJResourceManagerRequestStatusCalculateFailed,
    HJResourceManagerRequestStatusUnknownError
};

typedef NS_ENUM(NSInteger, HJResourceFetchFromType)
{
    HJResourceFetchFromTypeMemory,
    HJResourceFetchFromTypeRepository
};

typedef void(^HJResourceManagerCompleteBlock)(NSDictionary * _Nullable);

@interface HJResourceManager : HYManager

+ (HJResourceManager * _Nonnull)defaultHJResourceManager;

- (BOOL)standbyWithRepositoryPath:(NSString * _Nullable)path localJobWorkerName:(NSString * _Nullable)localJobWorkerName remoteJobWorkerName:(NSString * _Nullable)remoteJobWorkerName;
- (void)pauseTransfering;
- (void)resumeTransfering;
- (void)cancelTransfering;

- (id _Nullable)cipherForName:(NSString * _Nullable)name;
- (BOOL)setCipher:(id _Nullable)cipher forName:(NSString * _Nullable)name;
- (void)removeCipherForName:(NSString * _Nullable)name;
- (void)removeAllCiphers;
- (NSData * _Nullable)encryptData:(NSData * _Nullable)anData forName:(NSString * _Nullable)name;
- (NSData * _Nullable)decryptData:(NSData * _Nullable)anData forName:(NSString * _Nullable)name;
- (BOOL)encryptData:(NSData * _Nullable)anData toFilePath:(NSString * _Nullable)filePath forName:(NSString * _Nullable)name;
- (NSData * _Nullable)decryptDataFromFilePath:(NSString * _Nullable)filePath forName:(NSString * _Nullable)name;

- (id _Nullable)remakerForName:(NSString * _Nullable)name;
- (BOOL)setRemaker:(id _Nullable)remaker forName:(NSString * _Nullable)name;
- (void)removeRemakerForName:(NSString * _Nullable)name;
- (void)removeAllRemakers;
- (NSData * _Nullable)remakeData:(NSData * _Nullable)anData withParameter:(id _Nullable)anParameter forName:(NSString * _Nullable)name;

- (void)resourceForQuery:(NSDictionary * _Nullable)resourceQuery completion:(HJResourceManagerCompleteBlock _Nullable)completion;
- (void)resourceForQuery:(NSDictionary * _Nullable)resourceQuery cutInLine:(BOOL)cutInLine completion:(HJResourceManagerCompleteBlock _Nullable)completion;
- (NSDate * _Nullable)cachedDateOfResourceForQuery:(NSDictionary * _Nullable)resourceQuery;
- (BOOL)checkValidationOfResourceWithExpireTimeInterval:(NSTimeInterval)expireTimeInterval forQuery:(NSDictionary * _Nullable)resourceQuery;
- (id _Nullable)cachedResourceForQuery:(NSDictionary * _Nullable)resourceQuery;
- (id _Nullable)pickResourceFromMemoryCacheForQuery:(NSDictionary * _Nullable)resourceQuery;
- (void)updateCachedResourceForQuery:(NSDictionary * _Nullable)resourceQuery completion:(HJResourceManagerCompleteBlock _Nullable)completion;
- (BOOL)unloadResourceForQuery:(NSDictionary * _Nullable)resourceQuery;
- (BOOL)unloadAllResources;
- (void)removeResourceForQuery:(NSDictionary * _Nullable)resourceQuery completion:(HJResourceManagerCompleteBlock _Nullable)completion;
- (void)removeResourcesForElapsedTimeFromNow:(NSTimeInterval)elpasedTime completion:(HJResourceManagerCompleteBlock _Nullable)completion;
- (void)removeResourcesUnderMaximumBoundarySize:(NSUInteger)maximumBoundarySize completion:(HJResourceManagerCompleteBlock _Nullable)completion;
- (void)removeAllResourcesWithCompletion:(HJResourceManagerCompleteBlock _Nullable)completion;
- (void)amountSizeOfAllResoursesWithCompletion:(HJResourceManagerCompleteBlock _Nullable)completion;

- (NSString * _Nullable)resourcePathFromResourceQuery:(NSDictionary * _Nullable)resourceQuery;
- (NSString * _Nullable)resourceKeyStringFromResourceQuery:(NSDictionary * _Nullable)resourceQuery;
- (NSString * _Nullable)filePathFromReosurceQuery:(NSDictionary * _Nullable)resourceQuery;
- (NSNumber * _Nullable)fileSizeFromReosurceQuery:(NSDictionary * _Nullable)resourceQuery;

@property (nonatomic, readonly) NSString * _Nullable repositoryPath;
@property (nonatomic, readonly) BOOL standby;
@property (nonatomic, readonly) NSUInteger usedMemorySize;
@property (nonatomic, assign) NSUInteger limitSizeOfMemory;
@property (nonatomic, assign) NSTimeInterval timeoutInterval;
@property (nonatomic, assign) NSInteger maximumConnection;

@end


text:
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace StackExchange.Opserver.Data.Dashboard
{
    public partial class Volume
    {
        public class VolumeUtilization : GraphPoint
        {
            public override long DateEpoch { get; set; }
            public double AvgDiskUsed { get; internal set; }

            public override double? Value => AvgDiskUsed;
        }

        /// <summary>
        /// Gets usage for this volume (optionally) for the given time period, optionally sampled if pointCount is specified
        /// </summary>
        /// <param name="start">Start date, unbounded if null</param>
        /// <param name="end">End date, unbounded if null</param>
        /// <param name="pointCount">Points to return, if specified results will be sampled rather than including every point</param>
        /// <returns>Volume usage data points</returns>
        public Task<List<GraphPoint>> GetVolumeUtilization(DateTime? start, DateTime? end, int? pointCount = null)
        {
            return Node.DataProvider.GetUtilization(this, start, end, pointCount);
        }
    }
}


text:
/* */
(function(process) {
  'use strict';
  var CSSProperty = require('./CSSProperty');
  var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
  var ReactInstrumentation = require('./ReactInstrumentation');
  var camelizeStyleName = require('fbjs/lib/camelizeStyleName');
  var dangerousStyleValue = require('./dangerousStyleValue');
  var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
  var memoizeStringOnly = require('fbjs/lib/memoizeStringOnly');
  var warning = require('fbjs/lib/warning');
  var processStyleName = memoizeStringOnly(function(styleName) {
    return hyphenateStyleName(styleName);
  });
  var hasShorthandPropertyBug = false;
  var styleFloatAccessor = 'cssFloat';
  if (ExecutionEnvironment.canUseDOM) {
    var tempStyle = document.createElement('div').style;
    try {
      tempStyle.font = '';
    } catch (e) {
      hasShorthandPropertyBug = true;
    }
    if (document.documentElement.style.cssFloat === undefined) {
      styleFloatAccessor = 'styleFloat';
    }
  }
  if (process.env.NODE_ENV !== 'production') {
    var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
    var badStyleValueWithSemicolonPattern = /;\s*$/;
    var warnedStyleNames = {};
    var warnedStyleValues = {};
    var warnedForNaNValue = false;
    var warnHyphenatedStyleName = function(name, owner) {
      if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
        return;
      }
      warnedStyleNames[name] = true;
      process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0;
    };
    var warnBadVendoredStyleName = function(name, owner) {
      if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
        return;
      }
      warnedStyleNames[name] = true;
      process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), checkRenderMessage(owner)) : void 0;
    };
    var warnStyleValueWithSemicolon = function(name, value, owner) {
      if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
        return;
      }
      warnedStyleValues[value] = true;
      process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon.%s ' + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0;
    };
    var warnStyleValueIsNaN = function(name, value, owner) {
      if (warnedForNaNValue) {
        return;
      }
      warnedForNaNValue = true;
      process.env.NODE_ENV !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0;
    };
    var checkRenderMessage = function(owner) {
      if (owner) {
        var name = owner.getName();
        if (name) {
          return ' Check the render method of `' + name + '`.';
        }
      }
      return '';
    };
    var warnValidStyle = function(name, value, component) {
      var owner;
      if (component) {
        owner = component._currentElement._owner;
      }
      if (name.indexOf('-') > -1) {
        warnHyphenatedStyleName(name, owner);
      } else if (badVendoredStyleNamePattern.test(name)) {
        warnBadVendoredStyleName(name, owner);
      } else if (badStyleValueWithSemicolonPattern.test(value)) {
        warnStyleValueWithSemicolon(name, value, owner);
      }
      if (typeof value === 'number' && isNaN(value)) {
        warnStyleValueIsNaN(name, value, owner);
      }
    };
  }
  var CSSPropertyOperations = {
    createMarkupForStyles: function(styles, component) {
      var serialized = '';
      for (var styleName in styles) {
        if (!styles.hasOwnProperty(styleName)) {
          continue;
        }
        var styleValue = styles[styleName];
        if (process.env.NODE_ENV !== 'production') {
          warnValidStyle(styleName, styleValue, component);
        }
        if (styleValue != null) {
          serialized += processStyleName(styleName) + ':';
          serialized += dangerousStyleValue(styleName, styleValue, component) + ';';
        }
      }
      return serialized || null;
    },
    setValueForStyles: function(node, styles, component) {
      if (process.env.NODE_ENV !== 'production') {
        ReactInstrumentation.debugTool.onHostOperation(component._debugID, 'update styles', styles);
      }
      var style = node.style;
      for (var styleName in styles) {
        if (!styles.hasOwnProperty(styleName)) {
          continue;
        }
        if (process.env.NODE_ENV !== 'production') {
          warnValidStyle(styleName, styles[styleName], component);
        }
        var styleValue = dangerousStyleValue(styleName, styles[styleName], component);
        if (styleName === 'float' || styleName === 'cssFloat') {
          styleName = styleFloatAccessor;
        }
        if (styleValue) {
          style[styleName] = styleValue;
        } else {
          var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
          if (expansion) {
            for (var individualStyleName in expansion) {
              style[individualStyleName] = '';
            }
          } else {
            style[styleName] = '';
          }
        }
      }
    }
  };
  module.exports = CSSPropertyOperations;
})(require('process'));


text:
possible_ivy_dir=[os.path.join(os.environ["HOME"],".m2/repository"),os.path.join(os.environ["HOME"],".gradle/cache"),os.path.join(os.environ["HOME"],".ivy2/lin-cache/ivy-cache"),os.path.join(os.environ["HOME"],".ivy2/lin-cache"),"/ivy/.ivy2/ivy-cache","/ivy/.ivy2", os.path.join(os.environ["VIEW_ROOT"],"build/ivy2/cache")]
zookeeper_classpath="IVY_DIR/org/apache/zookeeper/zookeeper/3.3.3/zookeeper-3.3.3.jar:IVY_DIR/log4j/log4j/1.2.15/log4j-1.2.15.jar"

# espresso use -2
kill_cmd_template="jps | grep %s | cut -f1 -d\\  | xargs kill -2"
kill_container_template="ps -ef | grep tail | grep %s | awk '{print $2}' | xargs kill -9"

# This is not used in helix
afterParsingHook=None

# some global variables
router_http_port=12917
router_mgmt_port=12920
storage_node_http_port=12918
storage_node_mgmt_port=12919
curl_kill_cmd_template="curl -s http://localhost:%d/pid | xargs kill -2"

# used to run cmd, can combine multiple command
cmd_dict={
     "storage-node":{"start":"%s; %s" % (curl_kill_cmd_template % storage_node_mgmt_port,"ant -f espresso-storage-node/run/build.xml run-storage-node"),"stop":curl_kill_cmd_template % storage_node_mgmt_port,"stats":[get_stats,"EspressoSingleNode"]}
    ,"router":{"start":"ant -f espresso-router/run/build.xml run-router","stop":curl_kill_cmd_template % router_mgmt_port,"stats":[get_stats,"EspressoRouter"]}
    ,"zookeeper":{"start":[zookeeper_opers,"start"],"stop":[zookeeper_opers,"stop"],"wait_for_exist":[zookeeper_opers,"wait_for_exist"],"wait_for_nonexist":[zookeeper_opers,"wait_for_nonexist"],"wait_for_value":[zookeeper_opers,"wait_for_value"],"cmd":[zookeeper_opers,"cmd"]}
    ,"cluster-manager":{"start":"ant -f cluster-manager/run/build.xml run-cluster-manager", "stop":kill_cmd_template % "HelixControllerMain"}
    ,"mock-storage":{"start":"ant -f cluster-manager/run/build.xml run-mock-storage", "stop":kill_cmd_template % "MockStorageProcess"}
    ,"cluster-state-verifier":{"start":"ant -d -f cluster-manager/run/build.xml run-cluster-state-verifier", "stop":kill_cmd_template % "ClusterStateVerifier"}
    ,"dummy-process":{"start":"ant -f cluster-manager/run/build.xml run-dummy-process", "stop":kill_cmd_template % "DummyProcess"}
    ,"mock-health-report-process":{"start":"ant -f cluster-manager/run/build.xml run-mock-health-report-process", "stop":kill_cmd_template % "MockHealthReportParticipant"}
    ,"clm_console":{"default":"ant -f cluster-manager/run/build.xml run-cm-console","stop":kill_cmd_template % "ClusterSetup"}
}

cmd_ret_pattern={    # the pattern when the call is considered return successfully
    "storage-node_start":re.compile("Espresso service started")
   ,"router_start":re.compile("Espresso service started")
   ,"cluster-manager_start":re.compile("No Messages to process")
   ,"mock-storage_start":re.compile("Mock storage started")
   ,"dummy-process_start":re.compile("Dummy process started")
   ,"mock-health-report-process_start":re.compile("MockHealthReportParticipant process started")
}

# the mapping of option to the java options, if not give, then use directly
direct_java_call_option_mapping={
   "dump_file":"-f "
   ,"value_file":"--value.dump.file="
   #,"log4j_file":"-Dlog4j.configuration=file://"   # this is only for cluster manager
   #,"log4j_file":"--log_props="
   ,"config":"--container_props="
   ,"consumer_event_pattern":"event_pattern"
   ,"cmdline_props":"--cmdline_props="
   ,"cmdline_args":" "   # just put the cmdline_args directly
   ,"relay_host":"--relay_host="
   ,"relay_port":"--relay_port="
   #,"jmx_service_port":"--jmx_service_port="
   ,"bootstrap_host":"--bootstrap_host="
   ,"bootstrap_port":"--bootstrap_port="
   ,"http_port":"--http_port="
   ,"checkpoint_dir":"--checkpoint_dir="
   ,"dbname":"--dbname="
   ,"tablename":"--tablename="
   ,"dburi":"--dburi="
   ,"dbuser":"--dbuser="
   ,"dbpasswd":"--dbpassword="
   ,"schemareg":"--schemareg="
   ,"schemareg":"--schemareg="
   ,"db_relay_config":"--db_relay_config="
}

# has default value, append to the beginning
direct_java_call_jvm_args={
   "jvm_direct_memory_size":["-XX:MaxDirectMemorySize=","100m"]
   ,"jvm_max_heap_size":["-Xmx","512m"]
   ,"jvm_min_heap_size":["-Xms","100m"]
   ,"jvm_gc_log":["-Xloggc:",""]
   ,"jvm_args":["",""]
   ,"log4j_file":["-Dlog4j.configuration=file://",""]   # this is only for cluster manager
}
direct_java_call_jvm_args_ordered=[
   "jvm_direct_memory_size"
   ,"jvm_max_heap_size"
   ,"jvm_min_heap_size"
   ,"jvm_gc_log"
   ,"jvm_args"
   ,"log4j_file"
]
# mapping from option to ant
ant_call_option_mapping={
   "dump_file":"dump.file"
   ,"value_file":"value.dump.file"
   ,"log4j_file":"log4j.file"
   ,"config":"config.file"
   ,"jvm_direct_memory_size":"jvm.direct.memory.size"
   ,"jvm_max_heap_size":"jvm.max.heap.size"
   ,"jvm_gc_log":"jvm.gc.log"
   ,"jvm_args":"jvm.args"
   ,"cmdline_props":"cmdline.props"
   ,"cmdline_args":"config.cmdline"
   ,"relay_host":"relay.host"
   ,"relay_port":"relay.port"
   #,"jmx_service_port":"jmx.service.port"
   ,"bootstrap_host":"bootstrap.host"
   ,"bootstrap_port":"bootstrap.port"
   ,"consumer_event_pattern":"consumer.event.pattern"
   ,"http_port":"http.port"
   ,"checkpoint_dir":"checkpoint.dir"
#   ,"db_relay_config":"db.relay.config"
}

# class path
import glob
#print "view_root=" + get_view_root()
cm_jar_files=glob.glob(os.path.join(get_view_root(),"../../../target/helix-core-*.jar"))
#cm_jar_file=os.path.basename(cm_jar_file)
#print cm_jar_file
cmd_direct_call={
   "clm_console":
   {
    "class_path":[
      "IVY_DIR/com/github/sgroschupf/zkclient/0.1/zkclient-0.1.jar"
      ,"IVY_DIR/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar"
      ,"IVY_DIR/commons-cli/commons-cli/1.2/commons-cli-1.2.jar"
      ,"IVY_DIR/commons-io/commons-io/1.4/commons-io-1.4.jar"
      ,"IVY_DIR/commons-lang/commons-lang/2.4/commons-lang-2.4.jar"
      ,"IVY_DIR/jdom/jdom/1.0/jdom-1.0.jar"
      ,"IVY_DIR/log4j/log4j/1.2.15/log4j-1.2.15.jar"
      ,"IVY_DIR/org/apache/zookeeper/zookeeper/3.3.3/zookeeper-3.3.3.jar"
      ,"IVY_DIR/org/codehaus/jackson/jackson-core-asl/1.8.5/jackson-core-asl-1.8.5.jar"
      ,"IVY_DIR/org/codehaus/jackson/jackson-mapper-asl/1.8.5/jackson-mapper-asl-1.8.5.jar"
      ,"IVY_DIR/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar"
      ,"IVY_DIR/org/restlet/org.restlet/1.1.10/org.restlet-1.1.10.jar"
      ,"IVY_DIR/com/noelios/restlet/com.noelios.restlet/1.1.10/com.noelios.restlet-1.1.10.jar"
]+cm_jar_files
  ,"class_name":"org.apache.helix.tools.ClusterSetup"
  ,"before_cmd":"../../../mvn package -Dmaven.test.skip.exec=true"  # build jar first
   }

  ,"dummy-process":
   {
    "class_path":[
      "IVY_DIR/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar"
      ,"IVY_DIR/commons-cli/commons-cli/1.2/commons-cli-1.2.jar"
      ,"IVY_DIR/commons-io/commons-io/1.4/commons-io-1.4.jar"
      ,"IVY_DIR/commons-lang/commons-lang/2.4/commons-lang-2.4.jar"
      ,"IVY_DIR/jdom/jdom/1.0/jdom-1.0.jar"
      ,"IVY_DIR/log4j/log4j/1.2.15/log4j-1.2.15.jar"
      ,"IVY_DIR/org/apache/zookeeper/zookeeper/3.3.3/zookeeper-3.3.3.jar"
      ,"IVY_DIR/org/codehaus/jackson/jackson-core-asl/1.8.5/jackson-core-asl-1.8.5.jar"
      ,"IVY_DIR/org/codehaus/jackson/jackson-mapper-asl/1.8.5/jackson-mapper-asl-1.8.5.jar"
      ,"IVY_DIR/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar"
      ,"IVY_DIR/com/github/sgroschupf/zkclient/0.1/zkclient-0.1.jar"
      ,"IVY_DIR/org/apache/commons/commons-math/2.1/commons-math-2.1.jar"
]+cm_jar_files

  ,"class_name":"org.apache.helix.mock.participant.DummyProcess"
  ,"before_cmd":"../../../mvn package -Dmaven.test.skip.exec=true"  # build jar first
   }

  ,"mock-health-report-process":
   {
    "class_path":[
      "IVY_DIR/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar"
      ,"IVY_DIR/commons-cli/commons-cli/1.2/commons-cli-1.2.jar"
      ,"IVY_DIR/commons-io/commons-io/1.4/commons-io-1.4.jar"
      ,"IVY_DIR/commons-lang/commons-lang/2.4/commons-lang-2.4.jar"
      ,"IVY_DIR/jdom/jdom/1.0/jdom-1.0.jar"
      ,"IVY_DIR/log4j/log4j/1.2.15/log4j-1.2.15.jar"
      ,"IVY_DIR/org/apache/zookeeper/zookeeper/3.3.3/zookeeper-3.3.3.jar"
      ,"IVY_DIR/org/codehaus/jackson/jackson-core-asl/1.8.5/jackson-core-asl-1.8.5.jar"
      ,"IVY_DIR/org/codehaus/jackson/jackson-mapper-asl/1.8.5/jackson-mapper-asl-1.8.5.jar"
      ,"IVY_DIR/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar"
      ,"IVY_DIR/com/github/sgroschupf/zkclient/0.1/zkclient-0.1.jar"
      ,"IVY_DIR/org/apache/commons/commons-math/2.1/commons-math-2.1.jar"
      ,"IVY_DIR/org/restlet/org.restlet/1.1.10/org.restlet-1.1.10.jar"
      ,"IVY_DIR/com/noelios/restlet/com.noelios.restlet/1.1.10/com.noelios.restlet-1.1.10.jar"
]+cm_jar_files

  ,"class_name":"org.apache.helix.mock.participant.MockHealthReportParticipant"
  ,"before_cmd":"../../../mvn package -Dmaven.test.skip.exec=true"  # build jar first
   }

  ,"cluster-manager":
   {
    "class_path":[
      "IVY_DIR/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar"
      ,"IVY_DIR/commons-cli/commons-cli/1.2/commons-cli-1.2.jar"
      ,"IVY_DIR/commons-io/commons-io/1.4/commons-io-1.4.jar"
      ,"IVY_DIR/commons-lang/commons-lang/2.4/commons-lang-2.4.jar"
      ,"IVY_DIR/jdom/jdom/1.0/jdom-1.0.jar"
      ,"IVY_DIR/log4j/log4j/1.2.15/log4j-1.2.15.jar"
      ,"IVY_DIR/org/apache/zookeeper/zookeeper/3.3.3/zookeeper-3.3.3.jar"
      ,"IVY_DIR/org/codehaus/jackson/jackson-core-asl/1.8.5/jackson-core-asl-1.8.5.jar"
      ,"IVY_DIR/org/codehaus/jackson/jackson-mapper-asl/1.8.5/jackson-mapper-asl-1.8.5.jar"
      ,"IVY_DIR/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar"
      ,"IVY_DIR/com/github/sgroschupf/zkclient/0.1/zkclient-0.1.jar"
      ,"IVY_DIR/org/apache/commons/commons-math/2.1/commons-math-2.1.jar"
      ,"IVY_DIR/org/restlet/org.restlet/1.1.10/org.restlet-1.1.10.jar"
      ,"IVY_DIR/com/noelios/restlet/com.noelios.restlet/1.1.10/com.noelios.restlet-1.1.10.jar"
]+cm_jar_files
  ,"class_name":"org.apache.helix.controller.HelixControllerMain"
  ,"before_cmd":"../../../mvn package -Dmaven.test.skip.exec=true"  # build jar first
   }

  ,"cluster-state-verifier":
   {
    "class_path":[
      "IVY_DIR/com/github/sgroschupf/zkclient/0.1/zkclient-0.1.jar"
      ,"IVY_DIR/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar"
      ,"IVY_DIR/commons-cli/commons-cli/1.2/commons-cli-1.2.jar"
      ,"IVY_DIR/commons-io/commons-io/1.4/commons-io-1.4.jar"
      ,"IVY_DIR/commons-lang/commons-lang/2.4/commons-lang-2.4.jar"
      ,"IVY_DIR/jdom/jdom/1.0/jdom-1.0.jar"
      ,"IVY_DIR/log4j/log4j/1.2.15/log4j-1.2.15.jar"
      ,"IVY_DIR/org/apache/zookeeper/zookeeper/3.3.3/zookeeper-3.3.3.jar"
      ,"IVY_DIR/org/codehaus/jackson/jackson-core-asl/1.8.5/jackson-core-asl-1.8.5.jar"
      ,"IVY_DIR/org/codehaus/jackson/jackson-mapper-asl/1.8.5/jackson-mapper-asl-1.8.5.jar"
      ,"IVY_DIR/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar"
      ,"IVY_DIR/org/restlet/org.restlet/1.1.10/org.restlet-1.1.10.jar"
      ,"IVY_DIR/com/noelios/restlet/com.noelios.restlet/1.1.10/com.noelios.restlet-1.1.10.jar"
]+cm_jar_files
  ,"class_name":"org.apache.helix.tools.ClusterStateVerifier"
  ,"before_cmd":"../../../mvn package -Dmaven.test.skip.exec=true"  # build jar first
   }

  ,"mock-storage":
   {
    "class_path":[
      "IVY_DIR/com/github/sgroschupf/zkclient/0.1/zkclient-0.1.jar"
     ,"IVY_DIR/log4j/log4j/1.2.15/log4j-1.2.15.jar"
     ,"IVY_DIR/commons-cli/commons-cli/1.2/commons-cli-1.2.jar"
     ,"IVY_DIR/commons-math/commons-math/2.1/commons-math-2.1.jar"
]+cm_jar_files
  ,"class_name":"org.apache.helix.mock.participant.MockStorageProcess"
   }
}

# file the log4j file
def log4j_file_store_value(option, opt_str, value, parser):
  setattr(parser.values, option.dest, file_exists(value))
# configure
config_group = OptionGroup(parser, "Config options", "")
config_group.add_option("-p", "--config", action="store", dest="config", default=None,
                   help="config file path")
config_group.add_option("--dump_file", action="store", dest="dump_file", default=None,
                   help="Event dump file")
config_group.add_option("--value_file", action="store", dest="value_file", default=None,
                   help="Event value dump file")
config_group.add_option("-l", "--log4j_file", action="callback", callback=log4j_file_store_value, type="str", dest="log4j_file", default=None,
                   help="Log4j config file")
#config_group.add_option("-l", "--log4j_file", action="store", dest="log4j_file", default=None,
#                   help="Log4j config file")
config_group.add_option("--relay_host", action="store", dest="relay_host", default=None,
                   help="Host of relay for a consumer")
config_group.add_option("--relay_port", action="store", dest="relay_port", default=None,
                   help="Port of relay for a consumer")
config_group.add_option("--http_port", action="store", dest="http_port", default=None,
                   help="Http Port of the current started component")
config_group.add_option("--db_relay_config", action="store", dest="db_relay_config", default=None,
                   help="DB relay config file")
config_group.add_option("--cmdline_props", action="store", dest="cmdline_props", default=None,
                   help="Command line config props. Comma separate config parameter, e.g., --cmdline_props=databus.relay.eventBuffer.maxSize=1024000;...")
config_group.add_option("--bootstrap_host", action="store", dest="bootstrap_host", default=None,
                   help="Host of bootstrap server")
config_group.add_option("--bootstrap_port", action="store", dest="bootstrap_port", default=None,
                   help="Port of bootstrap server")
config_group.add_option("--checkpoint_dir", action="store", dest="checkpoint_dir", default=None,
                   help="Client checkpoint dir")
config_group.add_option("--checkpoint_keep", action="store_true", dest="checkpoint_keep", default=False,
                   help="Do NOT clean client checkpoint dir")
config_group.add_option("--consumer_event_pattern", action="store", dest="consumer_event_pattern", default=None,
                   help="Check consumer event pattern if set")
config_group.add_option("--dbname", action="store", dest="dbname", default=None, help="Espresso db name")
config_group.add_option("--tablename", action="store", dest="tablename", default=None, help="Espresso table name")
config_group.add_option("--dburi", action="store", dest="dburi", default=None, help="Espresso db uri")
config_group.add_option("--dbuser", action="store", dest="dbuser", default=None, help="Espresso db user")
config_group.add_option("--dbpasswd", action="store", dest="dbpasswd", default=None, help="Espresso db password")
config_group.add_option("--schemareg", action="store", dest="schemareg", default=None, help="Espresso schemareg ")
config_group.add_option("-x","--extservice_props", action="append", dest="extservice_props", default=None,
                       help="Config props to override the extservices. Can give multiple times. One for each property. <entry name>;<prop name>;value. e.g., databus2.relay.local.bizfollow;db.bizfollow.db_url;jdbc.. ")
config_group.add_option("--cmdline_args", action="store", dest="cmdline_args", default=None, help="Command line arguments")

other_option_group = OptionGroup(parser, "Other options", "")
other_option_group.add_option("", "--component_id", action="store", dest="component_id", default = None,
                   help="The compnent id (1,2..) if there are mutliple instance of a component")
parser.add_option("","--sleep_before_wait", action="store", type="long", dest="sleep_before_wait", default=0,
                   help="Sleep secs before waiting consumer reaching maxEventWindowScn. [default: %default]")
parser.add_option("","--sleep_after_wait", action="store", type="long", dest="sleep_after_wait", default=1,
                   help="Sleep secs after consumer reaching maxEventWindowScn. [default: %default]")
parser.add_option("","--producer_log_purge_limit", action="store", type="int", dest="producer_log_purge_limit", default=1000,
                   help="The limit on number of logs to purge for producer [default: %default]")


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

using GoogleCloudExtension.StackdriverErrorReporting;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using EventTimeRangePeriodEnum =
    Google.Apis.Clouderrorreporting.v1beta1.ProjectsResource.EventsResource.ListRequest.TimeRangePeriodEnum;
using GroupTimeRangePeriodEnum =
    Google.Apis.Clouderrorreporting.v1beta1.ProjectsResource.GroupStatsResource.ListRequest.TimeRangePeriodEnum;

namespace GoogleCloudExtensionUnitTests.StackdriverErrorReporting.TimeRangeButtons
{
    [TestClass]
    public class TimeRangeItemTests
    {
        [TestMethod]
        public void TestInitalConditions()
        {
            const string durationString = "duration";
            const string captionString = "caption";

            var objectUnderTest = new TimeRangeItem(
                captionString, durationString, GroupTimeRangePeriodEnum.PERIOD30DAYS, EventTimeRangePeriodEnum.PERIOD1WEEK);

            Assert.AreEqual(captionString, objectUnderTest.Caption);
            Assert.AreEqual(GroupTimeRangePeriodEnum.PERIOD30DAYS, objectUnderTest.GroupTimeRange);
            Assert.AreEqual(EventTimeRangePeriodEnum.PERIOD1WEEK, objectUnderTest.EventTimeRange);
            Assert.AreEqual(durationString, objectUnderTest.TimedCountDuration);
            Assert.IsFalse(objectUnderTest.IsCurrentSelection);
        }

        [TestMethod]
        public void TestIsCurrentSelectionProperty()
        {
            var propertiesChanged = new List<string>();
            var objectUnderTest = new TimeRangeItem("", "", 0, 0);
            objectUnderTest.PropertyChanged += (sender, args) => propertiesChanged.Add(args.PropertyName);

            objectUnderTest.IsCurrentSelection = true;

            Assert.IsTrue(objectUnderTest.IsCurrentSelection);
            CollectionAssert.AreEqual(new[] { nameof(objectUnderTest.IsCurrentSelection) }, propertiesChanged);
        }

        [TestMethod]
        public void TestEquals()
        {
            var objectUnderTest = new TimeRangeItem("", "", 0, 0);
            var equalObject = new TimeRangeItem("", "", 0, 0);
            var selectedEqualObject = new TimeRangeItem("", "", 0, 0) { IsCurrentSelection = true };
            var unequalCaption = new TimeRangeItem("unequal", "", 0, 0);
            var unequalDuration = new TimeRangeItem("", "unequal", 0, 0);
            var unequalGroupTimePeriod = new TimeRangeItem("", "", GroupTimeRangePeriodEnum.PERIOD1HOUR, 0);
            var unequalEventTimePeriod = new TimeRangeItem("", "", 0, EventTimeRangePeriodEnum.PERIOD1HOUR);

            // ReSharper disable once EqualExpressionComparison
            Assert.IsTrue(objectUnderTest.Equals(objectUnderTest));
            Assert.IsTrue(objectUnderTest.Equals(equalObject));
            Assert.IsTrue(selectedEqualObject.Equals(equalObject));

            Assert.IsFalse(objectUnderTest.Equals(null));
            Assert.IsFalse(objectUnderTest.Equals(new object()));
            Assert.IsFalse(objectUnderTest.Equals(unequalCaption));
            Assert.IsFalse(objectUnderTest.Equals(unequalDuration));
            Assert.IsFalse(objectUnderTest.Equals(unequalGroupTimePeriod));
            Assert.IsFalse(objectUnderTest.Equals(unequalEventTimePeriod));
        }

        [TestMethod]
        public void TestGetHashCode()
        {
            var objectUnderTest = new TimeRangeItem("", "", 0, 0);
            var equalObject = new TimeRangeItem("", "", 0, 0);
            var selectedEqualObject = new TimeRangeItem("", "", 0, 0) { IsCurrentSelection = true };
            var unequalCaption = new TimeRangeItem("unequal", "", 0, 0);
            var unequalDuration = new TimeRangeItem("", "unequal", 0, 0);
            var unequalGroupTimePeriod = new TimeRangeItem("", "", GroupTimeRangePeriodEnum.PERIOD1HOUR, 0);
            var unequalEventTimePeriod = new TimeRangeItem("", "", 0, EventTimeRangePeriodEnum.PERIOD1HOUR);

            Assert.AreEqual(objectUnderTest.GetHashCode(), objectUnderTest.GetHashCode());
            Assert.AreEqual(equalObject.GetHashCode(), objectUnderTest.GetHashCode());
            Assert.AreEqual(selectedEqualObject.GetHashCode(), objectUnderTest.GetHashCode());
            Assert.AreNotEqual(objectUnderTest.GetHashCode(), unequalCaption.GetHashCode());
            Assert.AreNotEqual(objectUnderTest.GetHashCode(), unequalDuration.GetHashCode());
            Assert.AreNotEqual(objectUnderTest.GetHashCode(), unequalGroupTimePeriod.GetHashCode());
            Assert.AreNotEqual(objectUnderTest.GetHashCode(), unequalEventTimePeriod.GetHashCode());
            Assert.AreNotEqual(0, objectUnderTest.GetHashCode());
        }
    }
}


text:
<?php

namespace Imagine\Exception;

/**
 * Imagine-specific exception.
 */
interface Exception
{
}


text:
package com.privatecloud.manager;

import com.privatecloud.users.dao.ElasticSearchDao;

public class ThresholdAlarmManager extends Thread{

	public void run() {
		try {
			System.out.println("Checking and Updating system usage");
			ElasticSearchDao.checkAndUpdateSystemUsage();
			Thread.sleep(2000);
		} catch (InterruptedException e) {
			System.out.println("Exception while thread sleep");
			//e.printStackTrace();
		}
	}
}