text:
<?php

namespace Flipbox\ImageController;

use URL;
use File;
use Exception;
use Illuminate\Http\UploadedFile;
use Illuminate\Config\Repository;
use Intervention\Image\ImageManager;

class ImageUploader
{
	/**
	 * temporary folder name
	 *
	 * @var string
	 */
	protected $temporaryPath = 'temporary';

	/**
	 * temporary image file
	 *
	 * @var string
	 */
	protected $temporaryImage = null;

	/**
	 * config
	 *
	 * @var array
	 */
	protected $config;

	/**
	 * Create a new ImageController instance.
	 *
	 * @return void
	 */
	public function __construct(Repository $config)
	{
		$this->config = new Repository($config['image-controller']);
	}

	/**
	 * upload image
	 *
	 * @param mixed $file
	 * @return string
	 */
	public function upload($file, $path='')
	{
		$path = ltrim($path, '/');
		$path = rtrim($path, '/');
		$basePath = $this->getImageBasePath();
		$imagePath = $basePath.'/'.$path;

		if (!File::exists($imagePath)) {
			throw new ImageUploaderException("Directory {$path} doesn't exists");
		}

		$uploadedFile = $this->getUploadedFile($file);
		$fileName = $this->generateFileName($uploadedFile->getClientOriginalExtension());
		$uploadedFile->move($imagePath, $fileName);

		if (!is_null($this->temporaryImage)) {
			File::delete($this->temporaryImage);
		}

		return $path.'/'.$fileName;
	}

	/**
	 * get uploaded file
	 *
	 * @param mixed $file
	 * @return UploadedFile
	 */
	protected function getUploadedFile($file)
	{
		if ($file instanceof UploadedFile) {
			return $file;
		}

		return $this->createUploadedFile($file);
	}

	/**
	 * create uploaded file
	 *
	 * @param string $file
	 * @return UploadedFile
	 */
	protected function createUploadedFile($file)
	{
		try {
			$imageManager = new ImageManager;
			$image = $imageManager->make($file);
			$extension = $this->getExtensionFromMime($image->mime());
			$fileName = $this->generateFileName($extension);
			$temporaryPath = $this->getTemporaryImageBasePath();
			$this->temporaryImage = $temporaryPath.'/'.$fileName;
			$image->save($this->temporaryImage);

			return new UploadedFile(
				$this->temporaryImage,
				$fileName,
				$image->mime(),
				$image->filesize(),
				null,
				TRUE
			);
		} catch (Exception $e) {
			throw new ImageUploaderException("Error create uploaded file");
		}
	}

	/**
	 * generate temporary filename
	 *
	 * @param string $extension
	 * @return string
	 */
	protected function generateFileName($extension='jpg')
	{
		return str_random(34).'.'.$extension;
	}

	/**
	 * get extension form mime
	 *
	 * @param string $mime
	 * @return string
	 */
	protected function getExtensionFromMime($mime)
	{
		switch ($mime) {
			case 'image/png':
				return 'png';
				break;

			case 'image/gif':
				return 'png';
				break;

			default:
				return 'jpg';
				break;
		}
	}

	/**
	 * get image base path
	 *
	 * @return string
	 */
	protected function getImageBasePath()
	{
		return rtrim($this->config->get('folder', public_path('images')), '/');
	}

	/**
	 * get temporary image base path
	 *
	 * @return string
	 */
	protected function getTemporaryImageBasePath()
	{
		$basePath = $this->getImageBasePath();

		$temporaryPath = $basePath . '/'. $this->temporaryPath;

		if (!File::exists($temporaryPath)) {
			File::makeDirectory($temporaryPath, 0755, true);
		}

		return $temporaryPath;
	}

	/**
	 * generate image file url
	 *
	 * @param string $file, $size
	 * @return string
	 */
	public function generateImageUrl($file, $size=null)
	{
		$url = $this->config->get('prefix').'/'.$file;

		if (!is_null($size)) {
			$url .= '?size='.$size;
		}

		return URL::to($url);
	}

	/**
	 * delete image
	 *
	 * @param mixed $path
	 * @return string
	 */
	public function delete($path=null)
	{
		if (is_null($path)) return;

		$basePath = $this->getImageBasePath();
		$imagePath = $basePath.'/'.$path;

		if (File::exists($imagePath)) {
			File::delete($imagePath);
		}
	}
}


text:
namespace Knoledge_Monitor
{
    partial class FormNodes
    {
        /// <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()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.textBoxVersion = new System.Windows.Forms.TextBox();
            this.textBoxHeight = new System.Windows.Forms.TextBox();
            this.textBoxPerf = new System.Windows.Forms.TextBox();
            this.textBoxLatency = new System.Windows.Forms.TextBox();
            this.textBoxAt = new System.Windows.Forms.TextBox();
            this.textBoxSeen = new System.Windows.Forms.TextBox();
            this.buttonClose = new System.Windows.Forms.Button();
            this.listView = new System.Windows.Forms.ListView();
            this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.SuspendLayout();
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(403, 15);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(67, 20);
            this.label1.TabIndex = 1;
            this.label1.Text = "Version:";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(403, 49);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(99, 20);
            this.label2.TabIndex = 2;
            this.label2.Text = "Start Height:";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(403, 81);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(104, 20);
            this.label3.TabIndex = 3;
            this.label3.Text = "Performance:";
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(403, 113);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(104, 20);
            this.label4.TabIndex = 4;
            this.label4.Text = "Latency (ms):";
            //
            // label5
            //
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(403, 145);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(109, 20);
            this.label5.TabIndex = 5;
            this.label5.Text = "Connected at:";
            //
            // label6
            //
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(403, 177);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(83, 20);
            this.label6.TabIndex = 6;
            this.label6.Text = "Last seen:";
            //
            // textBoxVersion
            //
            this.textBoxVersion.Location = new System.Drawing.Point(528, 12);
            this.textBoxVersion.Name = "textBoxVersion";
            this.textBoxVersion.ReadOnly = true;
            this.textBoxVersion.Size = new System.Drawing.Size(387, 26);
            this.textBoxVersion.TabIndex = 7;
            //
            // textBoxHeight
            //
            this.textBoxHeight.Location = new System.Drawing.Point(528, 46);
            this.textBoxHeight.Name = "textBoxHeight";
            this.textBoxHeight.ReadOnly = true;
            this.textBoxHeight.Size = new System.Drawing.Size(387, 26);
            this.textBoxHeight.TabIndex = 8;
            //
            // textBoxPerf
            //
            this.textBoxPerf.Location = new System.Drawing.Point(528, 78);
            this.textBoxPerf.Name = "textBoxPerf";
            this.textBoxPerf.ReadOnly = true;
            this.textBoxPerf.Size = new System.Drawing.Size(387, 26);
            this.textBoxPerf.TabIndex = 9;
            //
            // textBoxLatency
            //
            this.textBoxLatency.Location = new System.Drawing.Point(528, 110);
            this.textBoxLatency.Name = "textBoxLatency";
            this.textBoxLatency.ReadOnly = true;
            this.textBoxLatency.Size = new System.Drawing.Size(387, 26);
            this.textBoxLatency.TabIndex = 10;
            //
            // textBoxAt
            //
            this.textBoxAt.Location = new System.Drawing.Point(528, 142);
            this.textBoxAt.Name = "textBoxAt";
            this.textBoxAt.ReadOnly = true;
            this.textBoxAt.Size = new System.Drawing.Size(387, 26);
            this.textBoxAt.TabIndex = 11;
            //
            // textBoxSeen
            //
            this.textBoxSeen.Location = new System.Drawing.Point(528, 174);
            this.textBoxSeen.Name = "textBoxSeen";
            this.textBoxSeen.ReadOnly = true;
            this.textBoxSeen.Size = new System.Drawing.Size(387, 26);
            this.textBoxSeen.TabIndex = 12;
            //
            // buttonClose
            //
            this.buttonClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.buttonClose.Location = new System.Drawing.Point(840, 384);
            this.buttonClose.Name = "buttonClose";
            this.buttonClose.Size = new System.Drawing.Size(75, 34);
            this.buttonClose.TabIndex = 13;
            this.buttonClose.Text = "Close";
            this.buttonClose.UseVisualStyleBackColor = true;
            this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click);
            //
            // listView
            //
            this.listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnHeader1});
            this.listView.FullRowSelect = true;
            this.listView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
            this.listView.HideSelection = false;
            this.listView.Location = new System.Drawing.Point(12, 15);
            this.listView.Name = "listView";
            this.listView.Size = new System.Drawing.Size(365, 403);
            this.listView.TabIndex = 14;
            this.listView.UseCompatibleStateImageBehavior = false;
            this.listView.View = System.Windows.Forms.View.Details;
            this.listView.SelectedIndexChanged += new System.EventHandler(this.listView_SelectedIndexChanged);
            //
            // columnHeader1
            //
            this.columnHeader1.Text = "Address";
            this.columnHeader1.Width = 300;
            //
            // FormNodes
            //
            this.AcceptButton = this.buttonClose;
            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.buttonClose;
            this.ClientSize = new System.Drawing.Size(947, 430);
            this.Controls.Add(this.listView);
            this.Controls.Add(this.buttonClose);
            this.Controls.Add(this.textBoxSeen);
            this.Controls.Add(this.textBoxAt);
            this.Controls.Add(this.textBoxLatency);
            this.Controls.Add(this.textBoxPerf);
            this.Controls.Add(this.textBoxHeight);
            this.Controls.Add(this.textBoxVersion);
            this.Controls.Add(this.label6);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "FormNodes";
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Connected Nodes";
            this.Load += new System.EventHandler(this.FormNodes_Load);
            this.Shown += new System.EventHandler(this.FormNodes_Shown);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.TextBox textBoxVersion;
        private System.Windows.Forms.TextBox textBoxHeight;
        private System.Windows.Forms.TextBox textBoxPerf;
        private System.Windows.Forms.TextBox textBoxLatency;
        private System.Windows.Forms.TextBox textBoxAt;
        private System.Windows.Forms.TextBox textBoxSeen;
        private System.Windows.Forms.Button buttonClose;
        private System.Windows.Forms.ListView listView;
        private System.Windows.Forms.ColumnHeader columnHeader1;
    }
}

redpajama_set_name: RedPajamaGithub


text:
This is an simple provisioner for DigitalOcean [Block Storage](https://www.digitalocean.com/products/storage/).

**Deploy**

1. Get a DigitalOcean access-token [here](https://cloud.digitalocean.com/settings/api/tokens).
   `base64` the token and insert it into [manifests/digitalocean-secret.yaml](manifests/digitalocean-secret.yaml).
   Create the secret: `kubectl create -f manifests/digitalocean-secret.yaml`
2. Deploy the RBAC policies: `kubectl create -f manifests/rbac`
3. Deploy the provisioner: `kubectl create -f manifests/digitalocean-provisioner.yaml`
4. Adjust the `hostPath` in [manifests/digitalocean-flexplugin-deploy.yaml](manifests/digitalocean-flexplugin-deploy.yaml)
   Deploy the flex plugin "installer": `kubectl create -f manifests/digitalocean-flexplugin-deploy.yaml`
5. Modify the zone in [manifests/sc.yaml](manifests/sc.yaml)
   Deploy the default `StorageClass`: `kubectl create -f manifests/sc.yaml`
6. (**optional**) Try it out with the example pod and PVC
   ```
   kubectl create -f examples/pvc.yaml
   kubectl create -f examples/pod-application.yaml
   ```

**TODO**
 - [ ] Support multi zones
 - [x] Rewrite flexvolume plugin in Go
 - [ ] Prevent k8s from scheduling more than 5 disks to a single droplet
 - [ ] Improve documentation


text:
package com.google.cloud.compute.v1;

import com.google.api.core.BetaApi;
import com.google.api.gax.httpjson.ApiMessage;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import javax.annotation.Generated;
import javax.annotation.Nullable;

@Generated("by GAPIC")
@BetaApi
/**
 * A matcher for the path portion of the URL. The BackendService from the longest-matched rule will
 * serve the URL. If no rule was matched, the default service will be used.
 */
public final class PathMatcher implements ApiMessage {
  private final String defaultService;
  private final String description;
  private final String name;
  private final List<PathRule> pathRules;

  private PathMatcher() {
    this.defaultService = null;
    this.description = null;
    this.name = null;
    this.pathRules = null;
  }

  private PathMatcher(
      String defaultService, String description, String name, List<PathRule> pathRules) {
    this.defaultService = defaultService;
    this.description = description;
    this.name = name;
    this.pathRules = pathRules;
  }

  @Override
  public Object getFieldValue(String fieldName) {
    if ("defaultService".equals(fieldName)) {
      return defaultService;
    }
    if ("description".equals(fieldName)) {
      return description;
    }
    if ("name".equals(fieldName)) {
      return name;
    }
    if ("pathRules".equals(fieldName)) {
      return pathRules;
    }
    return null;
  }

  @Nullable
  @Override
  public ApiMessage getApiMessageRequestBody() {
    return null;
  }

  @Nullable
  @Override
  /**
   * The fields that should be serialized (even if they have empty values). If the containing
   * message object has a non-null fieldmask, then all the fields in the field mask (and only those
   * fields in the field mask) will be serialized. If the containing object does not have a
   * fieldmask, then only non-empty fields will be serialized.
   */
  public List<String> getFieldMask() {
    return null;
  }

  /**
   * The full or partial URL to the BackendService resource. This will be used if none of the
   * pathRules or routeRules defined by this PathMatcher are matched. For example, the following are
   * all valid URLs to a BackendService resource: -
   * https://www.googleapis.com/compute/v1/projects/project/global/backendServices/backendService -
   * compute/v1/projects/project/global/backendServices/backendService -
   * global/backendServices/backendService If defaultRouteAction is additionally specified, advanced
   * routing actions like URL Rewrites, etc. take effect prior to sending the request to the
   * backend. However, if defaultService is specified, defaultRouteAction cannot contain any
   * weightedBackendServices. Conversely, if defaultRouteAction specifies any
   * weightedBackendServices, defaultService must not be specified. Only one of defaultService,
   * defaultUrlRedirect or defaultRouteAction.weightedBackendService must be set. Authorization
   * requires one or more of the following Google IAM permissions on the specified resource
   * default_service: - compute.backendBuckets.use - compute.backendServices.use
   */
  public String getDefaultService() {
    return defaultService;
  }

  /**
   * An optional description of this resource. Provide this property when you create the resource.
   */
  public String getDescription() {
    return description;
  }

  /** The name to which this PathMatcher is referred by the HostRule. */
  public String getName() {
    return name;
  }

  /**
   * The list of path rules. Use this list instead of routeRules when routing based on simple path
   * matching is all that's required. The order by which path rules are specified does not matter.
   * Matches are always done on the longest-path-first basis. For example: a pathRule with a path
   * /a/b/c/* will match before /a/b/* irrespective of the order in which those paths appear
   * in this list. Only one of pathRules or routeRules must be set.
   */
  public List<PathRule> getPathRulesList() {
    return pathRules;
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(PathMatcher prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  public static PathMatcher getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final PathMatcher DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new PathMatcher();
  }

  public static class Builder {
    private String defaultService;
    private String description;
    private String name;
    private List<PathRule> pathRules;

    Builder() {}

    public Builder mergeFrom(PathMatcher other) {
      if (other == PathMatcher.getDefaultInstance()) return this;
      if (other.getDefaultService() != null) {
        this.defaultService = other.defaultService;
      }
      if (other.getDescription() != null) {
        this.description = other.description;
      }
      if (other.getName() != null) {
        this.name = other.name;
      }
      if (other.getPathRulesList() != null) {
        this.pathRules = other.pathRules;
      }
      return this;
    }

    Builder(PathMatcher source) {
      this.defaultService = source.defaultService;
      this.description = source.description;
      this.name = source.name;
      this.pathRules = source.pathRules;
    }

    /**
     * The full or partial URL to the BackendService resource. This will be used if none of the
     * pathRules or routeRules defined by this PathMatcher are matched. For example, the following
     * are all valid URLs to a BackendService resource: -
     * https://www.googleapis.com/compute/v1/projects/project/global/backendServices/backendService
     * - compute/v1/projects/project/global/backendServices/backendService -
     * global/backendServices/backendService If defaultRouteAction is additionally specified,
     * advanced routing actions like URL Rewrites, etc. take effect prior to sending the request to
     * the backend. However, if defaultService is specified, defaultRouteAction cannot contain any
     * weightedBackendServices. Conversely, if defaultRouteAction specifies any
     * weightedBackendServices, defaultService must not be specified. Only one of defaultService,
     * defaultUrlRedirect or defaultRouteAction.weightedBackendService must be set. Authorization
     * requires one or more of the following Google IAM permissions on the specified resource
     * default_service: - compute.backendBuckets.use - compute.backendServices.use
     */
    public String getDefaultService() {
      return defaultService;
    }

    /**
     * The full or partial URL to the BackendService resource. This will be used if none of the
     * pathRules or routeRules defined by this PathMatcher are matched. For example, the following
     * are all valid URLs to a BackendService resource: -
     * https://www.googleapis.com/compute/v1/projects/project/global/backendServices/backendService
     * - compute/v1/projects/project/global/backendServices/backendService -
     * global/backendServices/backendService If defaultRouteAction is additionally specified,
     * advanced routing actions like URL Rewrites, etc. take effect prior to sending the request to
     * the backend. However, if defaultService is specified, defaultRouteAction cannot contain any
     * weightedBackendServices. Conversely, if defaultRouteAction specifies any
     * weightedBackendServices, defaultService must not be specified. Only one of defaultService,
     * defaultUrlRedirect or defaultRouteAction.weightedBackendService must be set. Authorization
     * requires one or more of the following Google IAM permissions on the specified resource
     * default_service: - compute.backendBuckets.use - compute.backendServices.use
     */
    public Builder setDefaultService(String defaultService) {
      this.defaultService = defaultService;
      return this;
    }

    /**
     * An optional description of this resource. Provide this property when you create the resource.
     */
    public String getDescription() {
      return description;
    }

    /**
     * An optional description of this resource. Provide this property when you create the resource.
     */
    public Builder setDescription(String description) {
      this.description = description;
      return this;
    }

    /** The name to which this PathMatcher is referred by the HostRule. */
    public String getName() {
      return name;
    }

    /** The name to which this PathMatcher is referred by the HostRule. */
    public Builder setName(String name) {
      this.name = name;
      return this;
    }

    /**
     * The list of path rules. Use this list instead of routeRules when routing based on simple path
     * matching is all that's required. The order by which path rules are specified does not matter.
     * Matches are always done on the longest-path-first basis. For example: a pathRule with a path
     * /a/b/c/* will match before /a/b/* irrespective of the order in which those paths
     * appear in this list. Only one of pathRules or routeRules must be set.
     */
    public List<PathRule> getPathRulesList() {
      return pathRules;
    }

    /**
     * The list of path rules. Use this list instead of routeRules when routing based on simple path
     * matching is all that's required. The order by which path rules are specified does not matter.
     * Matches are always done on the longest-path-first basis. For example: a pathRule with a path
     * /a/b/c/* will match before /a/b/* irrespective of the order in which those paths
     * appear in this list. Only one of pathRules or routeRules must be set.
     */
    public Builder addAllPathRules(List<PathRule> pathRules) {
      if (this.pathRules == null) {
        this.pathRules = new LinkedList<>();
      }
      this.pathRules.addAll(pathRules);
      return this;
    }

    /**
     * The list of path rules. Use this list instead of routeRules when routing based on simple path
     * matching is all that's required. The order by which path rules are specified does not matter.
     * Matches are always done on the longest-path-first basis. For example: a pathRule with a path
     * /a/b/c/* will match before /a/b/* irrespective of the order in which those paths
     * appear in this list. Only one of pathRules or routeRules must be set.
     */
    public Builder addPathRules(PathRule pathRules) {
      if (this.pathRules == null) {
        this.pathRules = new LinkedList<>();
      }
      this.pathRules.add(pathRules);
      return this;
    }

    public PathMatcher build() {

      return new PathMatcher(defaultService, description, name, pathRules);
    }

    public Builder clone() {
      Builder newBuilder = new Builder();
      newBuilder.setDefaultService(this.defaultService);
      newBuilder.setDescription(this.description);
      newBuilder.setName(this.name);
      newBuilder.addAllPathRules(this.pathRules);
      return newBuilder;
    }
  }

  @Override
  public String toString() {
    return "PathMatcher{"
        + "defaultService="
        + defaultService
        + ", "
        + "description="
        + description
        + ", "
        + "name="
        + name
        + ", "
        + "pathRules="
        + pathRules
        + "}";
  }

  @Override
  public boolean equals(Object o) {
    if (o == this) {
      return true;
    }
    if (o instanceof PathMatcher) {
      PathMatcher that = (PathMatcher) o;
      return Objects.equals(this.defaultService, that.getDefaultService())
          && Objects.equals(this.description, that.getDescription())
          && Objects.equals(this.name, that.getName())
          && Objects.equals(this.pathRules, that.getPathRulesList());
    }
    return false;
  }

  @Override
  public int hashCode() {
    return Objects.hash(defaultService, description, name, pathRules);
  }
}


text:
CapiKa
========================

This is a new project to test the full deployment & workflow process in my company.


text:
/**
@module ember
@submodule ember-htmlbars
*/

/**
  @class Helper
  @namespace Ember.HTMLBars
*/
function Helper(helper, preprocessArguments) {
  this.helperFunction = helper;

  if (preprocessArguments) {
    this.preprocessArguments = preprocessArguments;
  }

  this.isHTMLBars = true;
}

Helper.prototype = {
  preprocessArguments: function() { }
};

export default Helper;


text:
/*
 * $Id: mailstorage_tools.c,v 1.24 2010/04/05 13:17:48 hoa Exp $
 */

#ifdef HAVE_CONFIG_H
#	include <config.h>
#endif

#include "mailstorage_tools.h"

#include "libetpan-config.h"

#include <sys/types.h>
#include <stdlib.h>
#ifdef WIN32
#	include "win_etpan.h"
#else
#	include <netdb.h>
#	include <netinet/in.h>
#	include <sys/socket.h>
#	include <unistd.h>
#	include <sys/wait.h>
#	include <sys/ioctl.h>
#endif
#include <fcntl.h>
#include <string.h>
#include <stdio.h>

#include "mail.h"
#include "mailmessage.h"
#include "maildriver.h"
#include "connect.h"

/* tools */

/* connection to TCP/IP server */

/* connection through a shell command */
/* SEB unsupported on Windows */
#ifndef WIN32

#define ENV_BUFFER_SIZE 512

static void do_exec_command(int fd, const char *command,
    char *servername, uint16_t port)
{
  int i, maxopen;
#ifndef HAVE_SETENV
  char env_buffer[ENV_BUFFER_SIZE];
#endif

  if (fork() > 0) {
    /* Fork again to become a child of init rather than
       the etpan client. */
    exit(0);
  }

#ifndef HAVE_SETENV
  if (servername)
    snprintf(env_buffer, ENV_BUFFER_SIZE, "ETPANSERVER=%s", servername);
  else
    snprintf(env_buffer, ENV_BUFFER_SIZE, "ETPANSERVER=");
  putenv(env_buffer);
#else
  if (servername)
    setenv("ETPANSERVER", servername, 1);
  else
    unsetenv("ETPANSERVER");
#endif

#ifndef HAVE_SETENV
  if (port)
    snprintf(env_buffer, ENV_BUFFER_SIZE, "ETPANPORT=%d", port);
  else
    snprintf(env_buffer, ENV_BUFFER_SIZE, "ETPANPORT=");
  putenv(env_buffer);
#else
  if (port) {
    char porttext[20];

    snprintf(porttext, sizeof(porttext), "%d", port);
    setenv("ETPANPORT", porttext, 1);
  }
  else {
    unsetenv("ETPANPORT");
  }
#endif

  /* Not a lot we can do if there's an error other than bail. */
  if (dup2(fd, 0) == -1)
    exit(1);
  if (dup2(fd, 1) == -1)
    exit(1);

  /* Should we close stderr and reopen /dev/null? */

  maxopen = sysconf(_SC_OPEN_MAX);
  for (i=3; i < maxopen; i++)
    close(i);

#ifdef TIOCNOTTY
  /* Detach from the controlling tty if we have one. Otherwise,
     SSH might do something stupid like trying to use it instead
     of running $SSH_ASKPASS. Doh. */
  fd = open("/dev/tty", O_RDONLY);
  if (fd != -1) {
    ioctl(fd, TIOCNOTTY, NULL);
    close(fd);
  }
#endif /* TIOCNOTTY */

  execl("/bin/sh", "/bin/sh", "-c", command, NULL);

  /* Eep. Shouldn't reach this */
  exit(1);
}
#endif /* WIN32 */

static int subcommand_connect(char *command, char *servername, uint16_t port)
{
/* SEB unsupported on Windows */
#ifdef WIN32
	return -1;
#else

  int sockfds[2];
  pid_t childpid;

  if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfds))
    return -1;

  childpid = fork();
  if (!childpid) {
    do_exec_command(sockfds[1], command, servername, port);
  }
  else if (childpid == -1) {
    close(sockfds[0]);
    close(sockfds[1]);
    return -1;
  }

  close(sockfds[1]);

  /* Reap child, leaving grandchild process to run */
  waitpid(childpid, NULL, 0);

  return sockfds[0];
#endif /* WIN32 */
}

int mailstorage_generic_connect(mailsession_driver * driver,
    char * servername,
    uint16_t port,
    char * command,
    int connection_type,
    int cache_function_id,
    char * cache_directory,
    int flags_function_id,
    char * flags_directory,
    mailsession ** result)
{
  return mailstorage_generic_connect_with_local_address(driver,
      servername,
      port,
      NULL,
      0,
      command,
      connection_type,
      cache_function_id,
      cache_directory,
      flags_function_id,
      flags_directory,
      result);
}

int mailstorage_generic_connect_with_local_address(mailsession_driver * driver,
    char * servername,
    uint16_t port,
    char * local_address,
    uint16_t local_port,
    char * command,
    int connection_type,
    int cache_function_id,
    char * cache_directory,
    int flags_function_id,
    char * flags_directory,
    mailsession ** result)
{
  int r;
  int res;
  mailstream * stream = NULL;
  int fd = -1;
  mailsession * session;
  int connect_result;
  switch (connection_type) {
  case CONNECTION_TYPE_PLAIN:
  case CONNECTION_TYPE_TRY_STARTTLS:
  case CONNECTION_TYPE_STARTTLS:
  case CONNECTION_TYPE_TLS:
#if HAVE_CFNETWORK
    if (mailstream_cfstream_enabled) {
      stream = mailstream_cfstream_open_voip(servername, port, mailstream_cfstream_voip_enabled);
      if (stream == NULL) {
        res = MAIL_ERROR_CONNECT;
        goto err;
      }
    }
#endif
    if (stream == NULL) {
      fd = mail_tcp_connect_with_local_address(servername, port,
          local_address, local_port);
      if (fd == -1) {
        res = MAIL_ERROR_CONNECT;
        goto err;
      }
    }
    break;

  case CONNECTION_TYPE_COMMAND:
  case CONNECTION_TYPE_COMMAND_TRY_STARTTLS:
  case CONNECTION_TYPE_COMMAND_STARTTLS:
  case CONNECTION_TYPE_COMMAND_TLS:
    fd = subcommand_connect(command, servername, port);
    break;
  default:
    fd = -1;
    break;
  }

  if (fd == -1 && stream == NULL) {
    res = MAIL_ERROR_INVAL;
    goto err;
  }

  switch (connection_type) {
  case CONNECTION_TYPE_PLAIN:
  case CONNECTION_TYPE_TRY_STARTTLS:
  case CONNECTION_TYPE_STARTTLS:
  case CONNECTION_TYPE_COMMAND:
  case CONNECTION_TYPE_COMMAND_TRY_STARTTLS:
  case CONNECTION_TYPE_COMMAND_STARTTLS:
    if (stream == NULL) {
      stream = mailstream_socket_open(fd);
    }
    break;

  case CONNECTION_TYPE_TLS:
  case CONNECTION_TYPE_COMMAND_TLS:
#if HAVE_CFNETWORK
    if (mailstream_cfstream_enabled) {
      int ssl_level = MAILSTREAM_CFSTREAM_SSL_LEVEL_SSLv3;
      mailstream_cfstream_set_ssl_level(stream, ssl_level);
      mailstream_cfstream_set_ssl_verification_mask(stream, MAILSTREAM_CFSTREAM_SSL_NO_VERIFICATION);
      r = mailstream_cfstream_set_ssl_enabled(stream, 1);
      if (r < 0) {
        mailstream_close(stream);
        return MAIL_ERROR_SSL;
      }
    }
#endif
    if (stream == NULL) {
      stream = mailstream_ssl_open(fd);
    }
    break;

  default:
    stream = NULL;
    break;
  }

  if (stream == NULL) {
    res = MAIL_ERROR_STREAM;
    close(fd);
    goto err;
  }

  session = mailsession_new(driver);
  if (session == NULL) {
    res = MAIL_ERROR_MEMORY;
    goto close_stream;
  }

  if (cache_directory != NULL) {
    char cache_directory_server[PATH_MAX];

    snprintf(cache_directory_server, PATH_MAX, "%s/%s",
        cache_directory, servername);

    r = mailsession_parameters(session,
			       cache_function_id,
			       cache_directory_server);
    if (r != MAIL_NO_ERROR) {
      res = r;
      goto close_stream;
    }
  }

  if (flags_directory != NULL) {
    char flags_directory_server[PATH_MAX];

    snprintf(flags_directory_server, PATH_MAX, "%s/%s",
        flags_directory, servername);

    r = mailsession_parameters(session,
        flags_function_id,
        flags_directory_server);
    if (r != MAIL_NO_ERROR) {
      res = r;
      goto close_stream;
    }
  }

  r = mailsession_connect_stream(session, stream);
  switch (r) {
  case MAIL_NO_ERROR_NON_AUTHENTICATED:
  case MAIL_NO_ERROR_AUTHENTICATED:
  case MAIL_NO_ERROR:
    break;
  default:
    res = r;
    goto free;
  }

  connect_result = r;

  switch (connection_type) {
  case CONNECTION_TYPE_TRY_STARTTLS:
  case CONNECTION_TYPE_COMMAND_TRY_STARTTLS:
    r = mailsession_starttls(session);
    if ((r != MAIL_NO_ERROR) && (r != MAIL_ERROR_NO_TLS)) {
      res = r;
      goto free;
    }
    break;

  case CONNECTION_TYPE_STARTTLS:
  case CONNECTION_TYPE_COMMAND_STARTTLS:
    r = mailsession_starttls(session);
    if (r != MAIL_NO_ERROR) {
      res = r;
      goto free;
    }
  }

  * result = session;

  return connect_result;

 close_stream:
  mailstream_close(stream);
 free:
  mailsession_free(session);
 err:
  return res;
}

int mailstorage_generic_auth(mailsession * session,
    int connect_result,
    int auth_type,
    char * login,
    char * password)
{
  return mailstorage_generic_auth_sasl(session,
      connect_result,
      NULL, NULL, NULL, NULL,
      login, login,
      password, NULL);
}

int mailstorage_generic_auth_sasl(mailsession * session,
    int connect_result,
    const char * auth_type,
    const char * server_fqdn,
    const char * local_ip_port,
    const char * remote_ip_port,
    const char * login, const char * auth_name,
    const char * password, const char * realm)
{
  int must_auth;
  int r;
  int res;

  r = connect_result;

  must_auth = FALSE;
  switch (r) {
  case MAIL_NO_ERROR_NON_AUTHENTICATED:
    must_auth = TRUE;
    break;
  case MAIL_NO_ERROR_AUTHENTICATED:
  case MAIL_NO_ERROR:
    break;
  default:
    res = r;
    goto err;
  }

  if (must_auth) {
    if (auth_type != NULL) {
      r = mailsession_login_sasl(session, auth_type,
          server_fqdn,
          local_ip_port,
          remote_ip_port,
          login, auth_name,
          password, realm);
    }
    else {
      if ((login == NULL) || (password == NULL)) {
        r = MAIL_NO_ERROR;
      }
      else {
        r = mailsession_login(session, login, password);
      }
    }
    if (r != MAIL_NO_ERROR) {
      mailsession_logout(session);
      res = r;
      goto err;
    }
  }

  return MAIL_NO_ERROR;

 err:
  return res;
}


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <title>to_s (Rake::FileList)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />

      # File lib/rake.rb, line 1551
1551:     def to_s
1552:       resolve
1553:       self.join(' ')
1554:     end


text:
Author
======
Student : Alan Niemiec - G00313177

Introduction
============
A numbers game imitating the popular countdown television game show. Using the Racket functional programming language I have created a program that calculates the possible combinations of six numbers that evaluate in a Equation to a single answer number.

ReversePolishNotation.rkt
=========================
The file contains my last minute attempt at ReversePolishNotation solving of the problem. I have not had time to complete this.
I have  utilised some of the code given to us in class and created a method which fires it off for actual calculations of the equations.

ForLoopGame.rkt
===============
This has been my original brute force program that iterates through every possibile equation permutation.
It is not the most efficient way of solving this problem but this was before the Reverse Polish Notation has been explained to us.
On my laptop the program can finish the calculation in 1-2 minutes.

This approach also involves the possibility of lower memory computers crashing from the memory running out. Using certain tweaks in the code I have managed to get the total number of permutations required for this calculation to around 900 thousand.

The program is not efficent as it uses nested for loops for the equation numbers and signs, calling the method again each iteration.
The program follows the idea of Tree data strcutures braching out into different options available for the equations.

 My modification included killing off any branches that equal to zero or less and are not positive, this was easy to achieve with some of rackets built in functions.
 The program at this point returns and starts following other branches in the tree.
 ```
 (if (exact-positive-integer? currentAnswer )
```
If this statement evaluates to true we call the function again with the updated list and send it the list and the current equation that has been evaluated to a positive integer.
```
(findAnswers originalList currentEq))
```
The reason for adding the currentEq is so that we can nest the last equation inside the next one, creating a list of equations that represent actual racket equations.
```
( * ( - 6 3 ) 2 ) = 6
```
In this case the first equation ( - 6 3 ) has been evaluated, then sent to that findAnswers method again, with the originalList without the two numbers used in it. It is then evaluated along with the next number (2) then reaching 6.

When the findAnswers method is called initially in the permutations method, we have to take the initial number in the list and send it as currentEq to the method
```
(for ([set sets])
    (define firstValue (car set))
    (set! set (remove firstValue set))
    (findAnswers set firstValue)
    )
```

We can edit both the amount of numbers in the equation list and the answer number.
* Edit the list by changing the [i 6]  value to as many numbers as you need.
```
;List randomisation
(define (randomiseList numbers)
  (for([i 6])
    (define random-number(list-ref numbers (random (length numbers))))
    (set! numbers(remove random-number numbers))
    (set! numberList(cons random-number numberList)))
  )

```
* The answer number can be changed near the top of the page.
```
(define answerNumber 6)
```

## Sample Output
Sample output for a 6 number random list trying to evaluate to answer number of 6 :

```
Number list : (2 5 3 6 7 75)
Random number: 6
Total Permutations: 866732
Correct Permutations: 4870
Equations list:
( / ( + 7 5 ) 2 ) = 6
( + ( - 7 3 ) 2 ) = 6
( + ( - 7 6 ) 5 ) = 6
( * ( * ( - 7 6 ) 3 ) 2 ) = 6
( - ( + ( * ( - 7 6 ) 3 ) 5 ) 2 ) = 6
( + ( + ( - 7 6 ) 3 ) 2 ) = 6
( - ( - ( + 7 6 ) 5 ) 2 ) = 6
( * ( - 6 3 ) 2 ) = 6

...

```

* UPDATE : I have changed the forloop code and managed to cut the total permutations checked by between 50k - 100k. I have added the remove duplicates line to the permutations creator:

```
  (define sets( remove-duplicates (permutations currentList))
```

This seem to limit the search to 800k-850k in most cases.
### Limitations:
* The program currently prints out duplicate answers to the equations (Solved) - The program now only displays singular type of equations. The Correct permutations counter accounts for all of them still.


text:
package net.bodemann.threegames.fragments;

import android.app.Fragment;
import android.app.FragmentManager;
import android.graphics.Point;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.LinearInterpolator;

import net.bodemann.threegames.R;
import net.bodemann.threegames.util.DrawableUtils;

import static net.bodemann.threegames.util.DrawableUtils.distanceTo;
import static net.bodemann.threegames.util.DrawableUtils.getDisplaySize;

public class SelectionFragment extends Fragment {

    public interface SelectionResultListener {
        void onFlowerGameButtonClicked();

        void onMemoryGameButtonClicked();

        void onBoatGameButtonClicked();

        void onCheatMenuRequested();

        void onInfoClicked();
    }

    private abstract class AnimationRunnable implements Runnable {
        final FragmentManager mFragmentManager;

        public abstract void animate();

        public AnimationRunnable() {
            mFragmentManager = getFragmentManager();
        }

        @Override
        public void run() {
            if (mFragmentManager != null &&
                mFragmentManager.findFragmentById(R.id.main_fragment_container) == SelectionFragment.this) {
                animate();
            }
        }
    }

    private View.OnClickListener mInfoButtonClicked = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mListener != null) {
                mListener.onInfoClicked();
            }
        }
    };

    private View.OnClickListener mMemoryGameButtonListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mListener != null) {
                mListener.onMemoryGameButtonClicked();
            }
            cleanUpAnimations();
        }
    };

    private View.OnLongClickListener mCheatTouchListener = new View.OnLongClickListener() {
        private int longClickCounter = 0;

        @Override
        public boolean onLongClick(View v) {
            longClickCounter++;
            if (mListener != null && longClickCounter >= 3) {
                mListener.onCheatMenuRequested();
                longClickCounter = 0;
            }

            return true;
        }
    };

    private View.OnClickListener mFlowerGameButtonListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mListener != null) {
                mListener.onFlowerGameButtonClicked();
            }
            cleanUpAnimations();
        }
    };

    private View.OnClickListener mShipGameButtonListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mListener != null) {
                mListener.onBoatGameButtonClicked();
            }
            cleanUpAnimations();
        }
    };

    private SelectionResultListener mListener;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);

        getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

        return inflater.inflate(R.layout.fragment_selection, container, false);
    }

    @Override
    public void onResume() {
        super.onResume();

        View view = getView();
        final View infoButton = view.findViewById(R.id.fake_action_bar_info);
        if (infoButton != null) {
            infoButton.setOnClickListener(mInfoButtonClicked);
        }

        setupMemoryGameButton(view);
        setupBoatGameButton(view);
        setupFlowerGameButton(view);
    }

    private void setupFlowerGameButton(View view) {
        view.findViewById(R.id.selector_flower_game_button).setOnClickListener(mFlowerGameButtonListener);

        final Point screenSize = getDisplaySize(getActivity());
        final int imageSize = getResources().getDimensionPixelSize(R.dimen.game_image_size);

        final float stageY = screenSize.y / 3 - imageSize;

        final View guy = view.findViewById(R.id.selector_flower_guy_image);
        guy.setX(3.0f * screenSize.x / 4.0f - imageSize / 2.0f);
        guy.setY(stageY);

        final View girl = view.findViewById(R.id.selector_flower_girl_image);
        girl.setX(screenSize.x / 4.0f - imageSize / 2.0f);
        girl.setY(stageY);

        final View flower = view.findViewById(R.id.selector_flower_flower_image);
        flower.setX(screenSize.x / 2.0f - imageSize / 2.0f);
        flower.setY(stageY);

        animateFlowerGameViews(guy, girl, flower);
    }

    private void animateFlowerGameViews(final View guy, final View girl, final View flower) {
        final float initialGirlX = girl.getX();
        final float initialGuyX = guy.getX();
        final float initialFlowerX = flower.getX();

        final AnimationRunnable reset = new AnimationRunnable() {
            @Override
            public void animate() {
                girl.setX(initialGirlX);
                guy.setX(initialGuyX);
                flower.setX(initialFlowerX);
                flower.setScaleX(1);
                flower.setScaleY(1);

                guy.animate().alpha(1).setDuration(1000L).start();
                flower.animate().alpha(1).setDuration(1000L).start();
                girl.animate().alpha(1).setDuration(1000L).withEndAction(new AnimationRunnable() {
                    @Override
                    public void animate() {
                        animateFlowerGameViews(girl, guy, flower);
                    }
                }).start();
            }
        };

        final AnimationRunnable fadeOut = new AnimationRunnable() {
            @Override
            public void animate() {
                girl.animate().alpha(0).setDuration(1000L).start();
                guy.animate().alpha(0).setDuration(1000L).withEndAction(reset).start();
            }
        };

        final AnimationRunnable girlAndGuyJumpDown = new AnimationRunnable() {
            @Override
            public void animate() {
                girl.animate()
                        .yBy(50)
                        .setDuration(500)
                        .start();
                guy.animate()
                        .yBy(50)
                        .setDuration(500)
                        .withEndAction(fadeOut)
                        .start();

            }
        };

        final AnimationRunnable girlAndGuyJumpUp = new AnimationRunnable() {
            @Override
            public void animate() {
                girl.animate()
                        .yBy(-50)
                        .setDuration(500)
                        .start();
                guy.animate()
                        .yBy(-50)
                        .setDuration(500)
                        .withEndAction(girlAndGuyJumpDown)
                        .start();

            }
        };

        final AnimationRunnable girlMoveToGuy = new AnimationRunnable() {
            @Override
            public void animate() {
                final float finalX = guy.getX() - 0.5f * girl.getWidth() * Math.signum(guy.getX() - girl.getX());

                girl.animate()
                        .x(finalX)
                        .setDuration(1000L)
                        .withEndAction(girlAndGuyJumpUp)
                        .start();
            }
        };

        final AnimationRunnable pickFlower = new AnimationRunnable() {
            @Override
            public void animate() {
                flower.animate()
                        .setDuration(500)
                        .yBy(-50)
                        .withEndAction(new AnimationRunnable() {
                            @Override
                            public void animate() {
                                flower.animate()
                                        .setDuration(500)
                                        .yBy(50)
                                        .scaleX(0.1f)
                                        .scaleY(0.1f)
                                        .alpha(0)
                                        .withEndAction(girlMoveToGuy)
                                        .start();
                            }
                        })
                        .start();
            }
        };

        final float finalX = flower.getX() - 0.5f * girl.getWidth() * Math.signum(flower.getX() - girl.getX());
        girl.animate()
                .x(finalX)
                .setDuration(1000L)
                .withEndAction(pickFlower)
                .start();

    }

    private void setupBoatGameButton(View view) {
        view.findViewById(R.id.selector_boat_game_button).setOnClickListener(mShipGameButtonListener);
        final View boat = view.findViewById(R.id.selector_boat_game_image);

        animateBoat(boat);
    }

    private void animateBoat(final View boat) {
        final Point currentPosition = new Point((int) boat.getX(), (int) boat.getY());
        final Point screenSize = getDisplaySize(getActivity());
        final Point targetPosition = new Point(
                (int) (200 + Math.random() * (screenSize.x - 400)),
                (int) (200 + Math.random() * (screenSize.y / 3.0) - 400));

        final float angle = (float) Math.atan2(targetPosition.y - currentPosition.y, targetPosition.x - currentPosition.x);
        rotateBoatGameImage(boat, angle, new AnimationRunnable() {
            @Override
            public void animate() {
                moveBoatGameImage(boat, targetPosition, new AnimationRunnable() {
                    @Override
                    public void animate() {
                        animateBoat(boat);
                    }
                });
            }
        });
    }

    private void rotateBoatGameImage(final View view, final float angle, final AnimationRunnable afterwards) {
        final long duration = (long) ((Math.abs(Math.toDegrees(angle)) / 90.0) * 1000.0);
        view.animate()
                .rotation((float) (120.0f + Math.toDegrees(angle)))
                .setDuration(duration)
                .withEndAction(afterwards)
                .start();

    }

    private void moveBoatGameImage(final View view, final Point endPosition, final AnimationRunnable afterwards) {
        Point startPosition = new Point((int) view.getX(), (int) view.getY());
        final float distance = (float) distanceTo(startPosition, endPosition);
        final long duration = (long) ((distance / 50.0f) * 1000);

        view.animate()
                .x(endPosition.x)
                .y(endPosition.y)
                .setDuration(duration)
                .setInterpolator(new LinearInterpolator())
                .withEndAction(afterwards)
                .start();

    }

    private void setupMemoryGameButton(View view) {
        final View buttonView = view.findViewById(R.id.selector_memory_game_button);
        buttonView.setOnClickListener(mMemoryGameButtonListener);
        buttonView.setOnLongClickListener(mCheatTouchListener);

        animateMemoryGameImage(buttonView, view.findViewById(R.id.selector_memory_game_image_1));
        animateMemoryGameImage(buttonView, view.findViewById(R.id.selector_memory_game_image_2));
        animateMemoryGameImage(buttonView, view.findViewById(R.id.selector_memory_game_image_3));
        animateMemoryGameImage(buttonView, view.findViewById(R.id.selector_memory_game_image_4));
        animateMemoryGameImage(buttonView, view.findViewById(R.id.selector_memory_game_image_5));
    }

    private void animateMemoryGameImage(final View parentView, final View childView) {
        final Point size = getDisplaySize(getActivity());

        final int parentWidth = size.x;
        final int parentHeight = size.y / 3;

        final int childWidth = 165;

        final int startX = -childWidth;
        final int startY = (int) (parentHeight * Math.random());

        final int endX = parentWidth + childWidth;
        final int endY = startY;

        final float degree = ((endX - startX) / (float) childWidth) * 90;

        childView.setX(startX);
        childView.setY(startY);
        childView.animate()
                .xBy(endX - startX)
                .yBy(endY - startY)
                .setInterpolator(new LinearInterpolator())
                .rotationYBy(degree)
                .setDuration(4000L + (long) (2000L * Math.random()))
                .setStartDelay((int) (Math.random() * 4000.0f))
                .withEndAction(new AnimationRunnable() {
                    @Override
                    public void animate() {
                        animateMemoryGameImage(parentView, childView);
                    }
                })
                .start();
    }

    public void setListener(SelectionResultListener listener) {
        mListener = listener;
    }

    private void cleanUpAnimations() {
        cleanUpAnimations(getView());
    }

    private void cleanUpAnimations(View view) {
        if (view != null) {
            view.clearAnimation();

            if (view instanceof ViewGroup) {
                ViewGroup viewGroup = (ViewGroup) view;
                for (int i = 0; i < viewGroup.getChildCount(); ++i) {
                    View child = viewGroup.getChildAt(i);
                    cleanUpAnimations(child);
                }
            }
        }
    }

    @Override
    public void onDestroy() {
        cleanUpAnimations();
        super.onDestroy();
    }
}


text:
@implementation DTSessionWindow

- (instancetype) init
{
	self = [super init];
	if (self != nil)
	{
	}
	return self;
}

- (CGFloat)toolbarHeight
{
    return NSHeight([self frame]) - NSHeight([[self contentView] frame]);
}

- (BOOL)isFullscreen
{
    return (([self styleMask] & NSFullScreenWindowMask) == NSFullScreenWindowMask);
}

@end


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Dia-Making(its our earth-JIIT)</title>

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="./css_/bootstrap.min.css" rel="stylesheet">
    <link href="./css_/mdb.css" rel="stylesheet">
    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

    <link href="https://unpkg.com/nanogallery2/dist/css/nanogallery2.min.css" rel="stylesheet" type="text/css">

    <link href="./css_/Gallery_Event_Ever.css" rel="stylesheet">
    <link href="./css_/MainPage.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Nunito|Raleway" rel="stylesheet">

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#mynavbar">

        </button>

                        HOME

                        ABOUT US

                        EVENTS

                        TEAM

                        GALLERY

                        CONTACT US

Diya Painting

Made With  by
                    Ashish Kumar Goyal


text:
package sage;

import jtux.*;

/**
 *
 * @author  Jean-Francois based on IVTV by Narflex
 */
public class FirewireCaptureDevice extends CaptureDevice implements Runnable
{
  private int getFirewireInputType(int x, int y)
  {
    return 0;
  }

  /** Creates a new instance of IVTVCaptureDevice */
  public FirewireCaptureDevice()
  {
    super();
    captureFeatureBits = MMC.MPEG_AV_CAPTURE_MASK;
  }

  public FirewireCaptureDevice(int inID)
  {
    super(inID);
    captureFeatureBits = MMC.MPEG_AV_CAPTURE_MASK;
  }

  public boolean isDynamicFormatEncoder()
  {
    return true;
  }

  public void freeDevice()
  {
    if (Sage.DBG) System.out.println("Freeing Firewire capture device");
    try { activateInput(null); } catch (EncodingException e){}
    writePrefs();
    stopEncoding();
    destroyEncoder0(pHandle);
    pHandle = 0;
  }

  public long getRecordedBytes()
  {
    synchronized (caplock)
    {
      return currRecordedBytes;
    }
  }

  public boolean isLoaded()
  {
    return pHandle != 0;
  }

  public void loadDevice() throws EncodingException
  {
    if (Sage.DBG) System.out.println("Loading Firewire capture device "+captureDeviceName);
    pHandle = createEncoder0(captureDeviceName);
    if (Sage.DBG) System.out.println("Loaded Firewire capture device");

    // this is to clear the current crossbar so activate actually sets it
    activateInput(null);
    activateInput(getDefaultInput());

    Sage.put(MMC.MMC_KEY + '/' + MMC.LAST_ENCODER_NAME, getName());
  }

  public void startEncoding(CaptureDeviceInput cdi, String encodeFile, String channel) throws EncodingException
  {
    if (Sage.DBG) System.out.println("startEncoding for Firewire capture device file=" + encodeFile + " chan=" + channel);
    currRecordedBytes = 0;
    if (cdi != null)
      activateInput(cdi);
    if (channel != null)
    {
      // If the channel is nothing, then use the last one. This happens with default live.
      if (channel.length() == 0)
        channel = activeSource.getChannel();
      tuneToChannel(channel);
    }

    if (encodeParams == null)
      setEncodingQuality(currQuality);
    setEncoding0(pHandle, currQuality, (encodeParams == null) ? null : encodeParams.getOptionsMap());
    currentlyRecordingBufferSize = recordBufferSize;
    // new file
    setupEncoding0(pHandle, encodeFile, currentlyRecordingBufferSize);
    recFilename = encodeFile;
    recStart = Sage.time();

    // Start the encoding thread
    stopCapture = false;
    capThread = new Thread(this, "Firewire-Encoder" + captureDeviceNum);
    capThread.setPriority(Thread.MAX_PRIORITY);
    capThread.start();

    // Initially this may not be set so do so now.
    if ((activeSource.getChannel() != null && activeSource.getChannel().length() == 0) ||
        activeSource.getChannel().equals("0"))
    {
      activeSource.setLastChannel(getChannel());
      activeSource.writePrefs();
    }
  }

  public void stopEncoding()
  {
    if (Sage.DBG) System.out.println("stopEncoding for Firewire capture device");
    recFilename = null;
    recStart = 0;
    stopCapture = true;
    if (capThread != null)
    {
      if (Sage.DBG) System.out.println("Waiting for Firewire capture thread to terminate");
      try
      {
        capThread.join(5000);
      }catch (Exception e){}
    }
    capThread = null;
  }

  public void switchEncoding(String switchFile, String channel) throws EncodingException
  {
    if (Sage.DBG) System.out.println("switchEncoding for IVTV capture device file=" + switchFile + " chan=" + channel);
    if (channel != null)
      tuneToChannel(channel);
    synchronized (caplock)
    {
      nextRecFilename = switchFile;
      while (nextRecFilename != null)
      {
        // Wait for the new filename to be switched to and then return after that
        try{caplock.wait(10);}catch (Exception e){}
      }
    }
  }

  public void run()
  {
    boolean logCapture = Sage.getBoolean("debug_capture_progress", false);
    if (Sage.DBG) System.out.println("Starting Firewire capture thread");
    long addtlBytes;
    while (!stopCapture)
    {
      if (nextRecFilename != null)
      {
        try
        {
          switchEncoding0(pHandle, nextRecFilename);
        }
        catch (EncodingException e)
        {
          System.out.println("ERROR Switching encoder file:" + e.getMessage());
        }
        synchronized (caplock)
        {
          recFilename = nextRecFilename;
          nextRecFilename = null;
          recStart = Sage.time();
          currRecordedBytes = 0;
          // There may be a thread waiting on this state change to occur
          caplock.notifyAll();
        }
      }
      try
      {
        addtlBytes = eatEncoderData0(pHandle);
      }
      catch (EncodingException e)
      {
        System.out.println("ERROR Eating encoder data:" + e.getMessage());
        addtlBytes = 0;
      }
      synchronized (caplock)
      {
        currRecordedBytes += addtlBytes;
      }

      if (logCapture)
        System.out.println("FirewireCap " + recFilename + " " + currRecordedBytes);
    }
    closeEncoding0(pHandle);
    if (Sage.DBG) System.out.println("Firewire capture thread terminating");
  }

  public CaptureDeviceInput activateInput(CaptureDeviceInput activateMe) throws EncodingException
  {
    // NOTE: This was removed so we always set the input before we start capture. There was a bug where the audio was
    // getting cut out of some recordings due to the audio standard not being set correctly. This will hopefully
    // resolve that.
    // if (activeSource == activateMe) return activeSource;
    super.activateInput(activateMe);
    if (activeSource != null && isLoaded())
    {
      boolean savePrefsAfter = (activeSource.getBrightness() < 0) || (activeSource.getContrast() < 0) ||
          (activeSource.getHue() < 0) || (activeSource.getSaturation() < 0) || (activeSource.getSharpness() < 0);

      synchronized (devlock)
      {
        setChannel0(pHandle, Integer.toString(activeSource.getIndex()));
      }
      int[] defaultColors = updateColors();
      activeSource.setDefaultColors(defaultColors[0], defaultColors[1], defaultColors[2], defaultColors[3],
          defaultColors[4]);

      if (savePrefsAfter)
        writePrefs();
    }
    return activeSource;
  }

  public int[] updateColors()
  {
    synchronized (devlock)
    {
      return updateColors0(pHandle, activeSource.getBrightness(), activeSource.getContrast(),
          activeSource.getHue(), activeSource.getSaturation(), activeSource.getSharpness());
    }
  }

  protected boolean doTuneChannel(String tuneString, boolean autotune)
  {
    // Clean any bad chars from the tuneString
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < tuneString.length(); i++)
    {
      char c = tuneString.charAt(i);
      if ((c >= '0' && c <= '9') || c == '.' || c == '-')
        sb.append(c);
    }
    tuneString = sb.toString();
    boolean rv = false;
    try
    {
      synchronized (devlock)
      {
        try
        {
          if (autotune)
            rv = setChannel0(pHandle, tuneString);
          else
            setChannel0(pHandle, tuneString);
        }
        catch (EncodingException e)
        {
          System.out.println("ERROR setting channel for Firewire tuner:" + e.getMessage());
        }
      }
    }
    catch (NumberFormatException e){}
    return rv;
  }
  protected boolean doScanChannel(String tuneString)
  {
    return doTuneChannel( tuneString, true);
  }
  protected String doScanChannelInfo(String tuneString)
  {
    return (doTuneChannel( tuneString, true ) ? "1" : "");
  }

  public void setEncodingQuality(String encodingName)
  {
    encodingName = MMC.cleanQualityName(encodingName);
    encodeParams = MPEG2EncodingParams.getQuality(encodingName);
    currQuality = encodingName;
    writePrefs();
  }

  public sage.media.format.ContainerFormat getEncoderMediaFormat()
  {
    sage.media.format.ContainerFormat cf = new sage.media.format.ContainerFormat();
    cf.setFormatName(sage.media.format.MediaFormat.MPEG2_TS);
    return cf;
  }

  protected native long createEncoder0(String deviceName) throws EncodingException;

  protected native boolean setupEncoding0(long encoderPtr, String filename, long bufferSize) throws EncodingException;
  protected native boolean switchEncoding0(long encoderPtr, String filename) throws EncodingException;
  protected native boolean closeEncoding0(long encoderPtr);

  protected native void destroyEncoder0(long encoderPtr);

  // THIS SHOULD BE CONTINUOSLY CALLED FROM ANOTHER THREAD AFTER WE START ENCODING
  // This returns the amount of data just eaten, not the running total
  protected native int eatEncoderData0(long encoderPtr) throws EncodingException;

  protected native boolean setChannel0(long encoderPtr, String chan) throws EncodingException;
  // Add another property to set the index we use in Linux for this
  protected native boolean setInput0(long encoderPtr, int inputType, int inputIndex, String sigFormat, int countryCode,
      int videoFormat) throws EncodingException;
  protected native boolean setEncoding0(long encoderPtr, String encodingName, java.util.Map encodingProps) throws EncodingException;
  protected native int[] updateColors0(long ptr, int brightness, int contrast, int hue, int saturation, int sharpness);

  public String getDeviceClass()
  {
    return "LinuxFirewire";
  }

  protected long pHandle;
  protected MPEG2EncodingParams encodeParams;

  protected String nextRecFilename;

  protected Object caplock = new Object();
  protected Object devlock = new Object();
  protected boolean stopCapture;
  protected Thread capThread;
  protected long currRecordedBytes;
}


text:
<?php

namespace OpenCephalonBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 *  @license 3-clause BSD
 *  @link https://github.com/OpenCephalon/OpenCephalon-Core/blob/master/LICENSE.txt
 * @ORM\Entity()
 * @ORM\Table(name="item_id_rss", uniqueConstraints={@ORM\UniqueConstraint(name="item_id_rss_guid", columns={"source_id", "guid"})})
 * @ORM\HasLifecycleCallbacks
 */
class ItemIdRSS
{

    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="OpenCephalonBundle\Entity\Item")
     * @ORM\JoinColumn(name="item_id", referencedColumnName="id", nullable=false)
     */
    private $item;

    /**
     * @ORM\ManyToOne(targetEntity="OpenCephalonBundle\Entity\Source")
     * @ORM\JoinColumn(name="source_id", referencedColumnName="id", nullable=false)
     */
    private $source;

    /**
     * @var string
     *
     * @ORM\Column(name="guid", type="text", nullable=true)
     */
    private $guid;

    /**
     * @return string
     */
    public function getGuid() {
        return $this->guid;
    }

    /**
     * @param string $guid
     */
    public function setGuid( $guid ) {
        $this->guid = $guid;
    }

    /**
     * @return mixed
     */
    public function getItem() {
        return $this->item;
    }

    /**
     * @param mixed $item
     */
    public function setItem( $item ) {
        $this->item = $item;
    }

    /**
     * @return mixed
     */
    public function getSource() {
        return $this->source;
    }

    /**
     * @param mixed $source
     */
    public function setSource( $source ) {
        $this->source = $source;
    }

}


text:
"""

"""

from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware

from web.apps.website import Website

#import berrynet

website = Website()

application = DispatcherMiddleware(
    website.get_app())

if __name__ == "__main__":
    run_simple(
        '0.0.0.0',
        5000,
        application,
        use_reloader=True,
        use_debugger=True)


text:
.class Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoApi21Impl;
.super Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoKitKatImpl;
.source "AccessibilityNodeInfoCompat.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = "AccessibilityNodeInfoApi21Impl"
.end annotation

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

    .prologue
    .line 1758
    invoke-direct {p0}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat$AccessibilityNodeInfoKitKatImpl;-><init>()V

    return-void
.end method

# virtual methods
.method public addAction(Ljava/lang/Object;Ljava/lang/Object;)V
    .locals 0
    .param p1, "info"    # Ljava/lang/Object;
    .param p2, "action"    # Ljava/lang/Object;

    .prologue
    .line 1778
    invoke-static {p1, p2}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21;->addAction(Ljava/lang/Object;Ljava/lang/Object;)V

    .line 1779
    return-void
.end method

.method public getAccessibilityActionId(Ljava/lang/Object;)I
    .locals 1
    .param p1, "action"    # Ljava/lang/Object;

    .prologue
    .line 1788
    invoke-static {p1}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21;->getAccessibilityActionId(Ljava/lang/Object;)I

    move-result v0

    return v0
.end method

.method public getAccessibilityActionLabel(Ljava/lang/Object;)Ljava/lang/CharSequence;
    .locals 1
    .param p1, "action"    # Ljava/lang/Object;

    .prologue
    .line 1793
    invoke-static {p1}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21;->getAccessibilityActionLabel(Ljava/lang/Object;)Ljava/lang/CharSequence;

    move-result-object v0

    return-object v0
.end method

.method public getActionList(Ljava/lang/Object;)Ljava/util/List;
    .locals 1
    .param p1, "info"    # Ljava/lang/Object;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/Object;",
            ")",
            "Ljava/util/List",
            "<",
            "Ljava/lang/Object;",
            ">;"
        }
    .end annotation

    .prologue
    .line 1766
    invoke-static {p1}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21;->getActionList(Ljava/lang/Object;)Ljava/util/List;

    move-result-object v0

    return-object v0
.end method

.method public getError(Ljava/lang/Object;)Ljava/lang/CharSequence;
    .locals 1
    .param p1, "info"    # Ljava/lang/Object;

    .prologue
    .line 1810
    invoke-static {p1}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21;->getError(Ljava/lang/Object;)Ljava/lang/CharSequence;

    move-result-object v0

    return-object v0
.end method

.method public getMaxTextLength(Ljava/lang/Object;)I
    .locals 1
    .param p1, "info"    # Ljava/lang/Object;

    .prologue
    .line 1825
    invoke-static {p1}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21;->getMaxTextLength(Ljava/lang/Object;)I

    move-result v0

    return v0
.end method

.method public getWindow(Ljava/lang/Object;)Ljava/lang/Object;
    .locals 1
    .param p1, "info"    # Ljava/lang/Object;

    .prologue
    .line 1830
    invoke-static {p1}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21;->getWindow(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    return-object v0
.end method

.method public isCollectionItemSelected(Ljava/lang/Object;)Z
    .locals 1
    .param p1, "info"    # Ljava/lang/Object;

    .prologue
    .line 1805
    invoke-static {p1}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21$CollectionItemInfo;->isSelected(Ljava/lang/Object;)Z

    move-result v0

    return v0
.end method

.method public newAccessibilityAction(ILjava/lang/CharSequence;)Ljava/lang/Object;
    .locals 1
    .param p1, "actionId"    # I
    .param p2, "label"    # Ljava/lang/CharSequence;

    .prologue
    .line 1761
    invoke-static {p1, p2}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21;->newAccessibilityAction(ILjava/lang/CharSequence;)Ljava/lang/Object;

    move-result-object v0

    return-object v0
.end method

.method public obtainCollectionInfo(IIZI)Ljava/lang/Object;
    .locals 1
    .param p1, "rowCount"    # I
    .param p2, "columnCount"    # I
    .param p3, "hierarchical"    # Z
    .param p4, "selectionMode"    # I

    .prologue
    .line 1772
    invoke-static {p1, p2, p3, p4}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21;->obtainCollectionInfo(IIZI)Ljava/lang/Object;

    move-result-object v0

    return-object v0
.end method

.method public obtainCollectionItemInfo(IIIIZZ)Ljava/lang/Object;
    .locals 1
    .param p1, "rowIndex"    # I
    .param p2, "rowSpan"    # I
    .param p3, "columnIndex"    # I
    .param p4, "columnSpan"    # I
    .param p5, "heading"    # Z
    .param p6, "selected"    # Z

    .prologue
    .line 1799
    invoke-static/range {p1 .. p6}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21;->obtainCollectionItemInfo(IIIIZZ)Ljava/lang/Object;

    move-result-object v0

    return-object v0
.end method

.method public removeAction(Ljava/lang/Object;Ljava/lang/Object;)Z
    .locals 1
    .param p1, "info"    # Ljava/lang/Object;
    .param p2, "action"    # Ljava/lang/Object;

    .prologue
    .line 1783
    invoke-static {p1, p2}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21;->removeAction(Ljava/lang/Object;Ljava/lang/Object;)Z

    move-result v0

    return v0
.end method

.method public removeChild(Ljava/lang/Object;Landroid/view/View;)Z
    .locals 1
    .param p1, "info"    # Ljava/lang/Object;
    .param p2, "child"    # Landroid/view/View;

    .prologue
    .line 1835
    invoke-static {p1, p2}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21;->removeChild(Ljava/lang/Object;Landroid/view/View;)Z

    move-result v0

    return v0
.end method

.method public removeChild(Ljava/lang/Object;Landroid/view/View;I)Z
    .locals 1
    .param p1, "info"    # Ljava/lang/Object;
    .param p2, "root"    # Landroid/view/View;
    .param p3, "virtualDescendantId"    # I

    .prologue
    .line 1840
    invoke-static {p1, p2, p3}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21;->removeChild(Ljava/lang/Object;Landroid/view/View;I)Z

    move-result v0

    return v0
.end method

.method public setError(Ljava/lang/Object;Ljava/lang/CharSequence;)V
    .locals 0
    .param p1, "info"    # Ljava/lang/Object;
    .param p2, "error"    # Ljava/lang/CharSequence;

    .prologue
    .line 1815
    invoke-static {p1, p2}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21;->setError(Ljava/lang/Object;Ljava/lang/CharSequence;)V

    .line 1816
    return-void
.end method

.method public setMaxTextLength(Ljava/lang/Object;I)V
    .locals 0
    .param p1, "info"    # Ljava/lang/Object;
    .param p2, "max"    # I

    .prologue
    .line 1820
    invoke-static {p1, p2}, Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompatApi21;->setMaxTextLength(Ljava/lang/Object;I)V

    .line 1821
    return-void
.end method


text:
#ifdef IL_CVMC_CODE

static void CVMCoder_UpConvertArg(ILCoder *coder, ILEngineStackItem *args,
						          ILUInt32 numArgs, ILUInt32 param,
						          ILType *paramType)
{
	/* TODO */
}

static void CVMCoder_DownConvertArg(ILCoder *coder, ILEngineStackItem *args,
						            ILUInt32 numArgs, ILUInt32 param,
						            ILType *paramType)
{
	/* TODO */
}

static void CVMCoder_PackVarArgs(ILCoder *coder, ILType *callSiteSig,
					             ILUInt32 firstParam, ILEngineStackItem *args,
						         ILUInt32 numArgs)
{
#ifdef IL_CONFIG_VARARGS
	CVMP_OUT_WORD2_PTR(COP_PREFIX_PACK_VARARGS,
					   firstParam, numArgs, callSiteSig);
	CVM_ADJUST(-(ILInt32)(ComputeStackSize(coder, args, numArgs)));
	CVM_ADJUST(1);
#endif
}

static void CVMCoder_ValueCtorArgs(ILCoder *coder, ILClass *classInfo,
								   ILEngineStackItem *args, ILUInt32 numArgs)
{
	ILUInt32 posn = ComputeStackSize(coder, args, numArgs);
	ILUInt32 size = GetTypeSize(_ILCoderToILCVMCoder(coder)->process,
								ILType_FromValueType(classInfo));
	CVM_OUT_DWIDE(COP_NEW_VALUE, posn, size);
	CVM_ADJUST(size + 1);
}

/*
 * Adjust the position of the stack for a call.
 */
static void AdjustForCall(ILCoder *coder, ILCoderMethodInfo *info,
						  ILEngineStackItem *returnItem)
{
	CVM_ADJUST(-(ILInt32)ComputeStackSize
					(coder, info->args, info->numBaseArgs));
	if(info->hasParamArray)
	{
		CVM_ADJUST(-1);
	}
	if(returnItem != 0 && returnItem->engineType != ILEngineType_Invalid)
	{
		CVM_ADJUST(ComputeStackSize(coder, returnItem, 1));
	}
}

static void CVMCoder_CheckCallNull(ILCoder *coder, ILCoderMethodInfo *info)
{
	ILUInt32 size = ComputeStackSize(coder, info->args, info->numBaseArgs);
	if(info->hasParamArray)
	{
		/* Account for the vararg parameter array on the stack */
		++size;
	}
	if(size == 1)
	{
		CVM_OUT_NONE(COP_CKNULL);
	}
	else
	{
		--size;
		CVM_OUT_WIDE(COP_CKNULL_N, size);
	}
}

static void CVMCoder_CallMethod(ILCoder *coder, ILCoderMethodInfo *info,
								ILEngineStackItem *returnItem,
								ILMethod *methodInfo)
{
	if(info->tailCall)
	{
		CVMP_OUT_PTR(COP_PREFIX_TAIL_CALL, methodInfo);
	}
	else
	{
		CVM_OUT_PTR(COP_CALL, methodInfo);
	}
	AdjustForCall(coder, info, returnItem);
}

static void CVMCoder_CallIndirect(ILCoder *coder, ILCoderMethodInfo *info,
								  ILEngineStackItem *returnItem)
{
	if(info->tailCall)
	{
		CVMP_OUT_NONE(COP_PREFIX_TAIL_CALLI);
	}
	else
	{
		CVM_OUT_NONE(COP_CALLI);
	}
	CVM_ADJUST(-1);	/* The function pointer was popped */
	AdjustForCall(coder, info, returnItem);
}

static void CVMCoder_CallCtor(ILCoder *coder, ILCoderMethodInfo *info,
					   		  ILMethod *methodInfo)
{
	CVM_OUT_PTR(COP_CALL_CTOR, methodInfo);
	AdjustForCall(coder, info, 0);
	CVM_ADJUST(1);
}

static void CVMCoder_CallVirtual(ILCoder *coder, ILCoderMethodInfo *info,
								 ILEngineStackItem *returnItem,
								 ILMethod *methodInfo)
{
	ILUInt32 argSize = ComputeStackSize(coder, info->args, info->numBaseArgs);
	if(info->hasParamArray)
	{
		++argSize;
	}
	if(info->tailCall)
	{
		CVMP_OUT_WORD2(COP_PREFIX_TAIL_CALLVIRT, argSize, methodInfo->index);
	}
	else
	{
		CVM_OUT_DWIDE(COP_CALL_VIRTUAL, argSize, methodInfo->index);
	}
	AdjustForCall(coder, info, returnItem);
}

static void CVMCoder_CallInterface(ILCoder *coder, ILCoderMethodInfo *info,
								   ILEngineStackItem *returnItem,
								   ILMethod *methodInfo)
{
	ILUInt32 argSize = ComputeStackSize(coder, info->args, info->numBaseArgs);
	if(info->hasParamArray)
	{
		++argSize;
	}
#ifdef IL_USE_IMTS
	{
		ILUInt32 index = methodInfo->index;
		ILClassPrivate *classPrivate;
		classPrivate = (ILClassPrivate *)(methodInfo->member.owner->userData);
		if(classPrivate)
		{
			index += classPrivate->imtBase;
		}
		index %= IL_IMT_SIZE;
		if(info->tailCall)
		{
			CVMP_OUT_WORD2_PTR(COP_PREFIX_TAIL_CALLINTF, argSize,
							   index, methodInfo);
		}
		else
		{
			CVM_OUT_DWIDE_PTR(COP_CALL_INTERFACE, argSize,
							  index, methodInfo);
		}
	}
#else
	{
		void *ptr = ILMethod_Owner(methodInfo);
		if(info->tailCall)
		{
			CVMP_OUT_WORD2_PTR(COP_PREFIX_TAIL_CALLINTF, argSize,
							   methodInfo->index, ptr);
		}
		else
		{
			CVM_OUT_DWIDE_PTR(COP_CALL_INTERFACE, argSize,
							  methodInfo->index, ptr);
		}
	}
#endif
	AdjustForCall(coder, info, returnItem);
}

/*
 * Macros inlining simple methods that don't change the stack height.
 */
#define CASE_INLINEMETHOD(x) \
	case IL_INLINEMETHOD_##x: \
		CVMP_OUT_NONE(COP_PREFIX_##x);\
		return 1;

/*
 * Macros inlining simple methods that change the stack height by 1.
 */
#define CASE_INLINEMETHOD_1(x) \
	case IL_INLINEMETHOD_##x: \
		CVMP_OUT_NONE(COP_PREFIX_##x);\
		CVM_ADJUST(-1); \
		return 1;

static int CVMCoder_CallInlineable(ILCoder *coder, int inlineType,
								   ILMethod *methodInfo)
{
	/* Determine what to do for the inlineable method type */
	switch(inlineType)
	{
		case IL_INLINEMETHOD_MONITOR_ENTER:
		{
			/* Enter the monitor on the top-most object */
			if(ILHasThreads())
			{
				CVMP_OUT_NONE(COP_PREFIX_MONITOR_ENTER);
			}
			else
			{
				CVM_OUT_NONE(COP_POP);
			}
			CVM_ADJUST(-1);
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_MONITOR_EXIT:
		{
			/* Exit the monitor on the top-most object */
			if(ILHasThreads())
			{
				CVMP_OUT_NONE(COP_PREFIX_MONITOR_EXIT);
			}
			else
			{
				CVM_OUT_NONE(COP_POP);
			}
			CVM_ADJUST(-1);
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_STRING_LENGTH:
		{
			/* The string length is at a fixed offset from the pointer */
			CVM_OUT_BYTE(COP_IREAD_FIELD,
						 (unsigned)&(((System_String *)0)->length));
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_STRING_CONCAT_2:
		{
			/* Concatenate two string objects */
			CVMP_OUT_NONE(COP_PREFIX_STRING_CONCAT_2);
			CVM_ADJUST(-1);
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_STRING_CONCAT_3:
		{
			/* Concatenate three string objects */
			CVMP_OUT_NONE(COP_PREFIX_STRING_CONCAT_3);
			CVM_ADJUST(-2);
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_STRING_CONCAT_4:
		{
			/* Concatenate four string objects */
			CVMP_OUT_NONE(COP_PREFIX_STRING_CONCAT_4);
			CVM_ADJUST(-3);
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_STRING_EQUALS:
		{
			/* Compare two string objects for equality */
			CVMP_OUT_NONE(COP_PREFIX_STRING_EQ);
			CVM_ADJUST(-1);
			return 1;
		}

		/* Not reached */

		case IL_INLINEMETHOD_STRING_NOT_EQUALS:
		{
			/* Compare two string objects for inequality */
			CVMP_OUT_NONE(COP_PREFIX_STRING_NE);
			CVM_ADJUST(-1);
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_STRING_GET_CHAR:
		{
			/* Compare two string objects for equality */
			CVMP_OUT_NONE(COP_PREFIX_STRING_GET_CHAR);
			CVM_ADJUST(-1);
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_TYPE_FROM_HANDLE:
		{
			/* Convert a RuntimeTypeHandle into a Type object */
			CVMP_OUT_NONE(COP_PREFIX_TYPE_FROM_HANDLE);
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_GET2D_INT:
		{
			CVMP_OUT_NONE(COP_PREFIX_GET2D);
			CVM_OUT_NONE(COP_IREAD);
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_GET2D_OBJECT:
		{
			CVMP_OUT_NONE(COP_PREFIX_GET2D);
			CVM_OUT_NONE(COP_PREAD);
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_GET2D_DOUBLE:
		{
			CVMP_OUT_NONE(COP_PREFIX_GET2D);
			CVM_OUT_NONE(COP_DREAD);
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_SET2D_INT:
		{
			CVMP_OUT_WORD(COP_PREFIX_SET2D, 1);
			CVM_OUT_NONE(COP_IWRITE);
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_SET2D_OBJECT:
		{
			CVMP_OUT_WORD(COP_PREFIX_SET2D, 1);
			CVM_OUT_NONE(COP_PWRITE);
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_SET2D_DOUBLE:
		{
			CVMP_OUT_WORD(COP_PREFIX_SET2D, CVM_WORDS_PER_NATIVE_FLOAT);
			CVM_OUT_NONE(COP_DWRITE);
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_BUILDER_APPEND_CHAR:
		{
			/* Concatenate a char */
			CVMP_OUT_PTR(COP_PREFIX_APPEND_CHAR, methodInfo);
			CVM_ADJUST(-1);
			return 1;
		}
		/* Not reached */

		case IL_INLINEMETHOD_IS_WHITE_SPACE:
		{
			/* Check a character to see if it is white space */
			CVMP_OUT_NONE(COP_PREFIX_IS_WHITE_SPACE);
			return 1;
		}
		/* Not reached */

		/*
		 * Cases for Math class inlines.
		 */
		CASE_INLINEMETHOD(ABS_I4);
		CASE_INLINEMETHOD(ABS_R4);
		CASE_INLINEMETHOD(ABS_R8);
		CASE_INLINEMETHOD(ASIN);
		CASE_INLINEMETHOD(ATAN);
		CASE_INLINEMETHOD_1(ATAN2);
		CASE_INLINEMETHOD(CEILING);
		CASE_INLINEMETHOD(COS);
		CASE_INLINEMETHOD(COSH);
		CASE_INLINEMETHOD(EXP);
		CASE_INLINEMETHOD(FLOOR);
		CASE_INLINEMETHOD_1(IEEEREMAINDER);
		CASE_INLINEMETHOD(LOG);
		CASE_INLINEMETHOD(LOG10);
		CASE_INLINEMETHOD_1(MAX_I4);
		CASE_INLINEMETHOD_1(MIN_I4);
		CASE_INLINEMETHOD_1(MAX_R4);
		CASE_INLINEMETHOD_1(MIN_R4);
		CASE_INLINEMETHOD_1(MAX_R8);
		CASE_INLINEMETHOD_1(MIN_R8);
		CASE_INLINEMETHOD_1(POW);
		CASE_INLINEMETHOD(ROUND);
		CASE_INLINEMETHOD(SIN);
		CASE_INLINEMETHOD(SIGN_I4);
		CASE_INLINEMETHOD(SIGN_R4);
		CASE_INLINEMETHOD(SIGN_R8);
		CASE_INLINEMETHOD(SINH);
		CASE_INLINEMETHOD(SQRT);
		CASE_INLINEMETHOD(TAN);
		CASE_INLINEMETHOD(TANH);
	}

	/* If we get here, then we don't know how to inline the method */
	return 0;
}

static void CVMCoder_JumpMethod(ILCoder *coder, ILMethod *methodInfo)
{
	/* TODO */
}

static void CVMCoder_ReturnInsn(ILCoder *coder, ILEngineType engineType,
							    ILType *returnType)
{
	switch(engineType)
	{
		case ILEngineType_Invalid:
		{
			CVM_OUT_RETURN(0);
		}
		break;

		case ILEngineType_M:
		case ILEngineType_CM:
		case ILEngineType_O:
		case ILEngineType_T:
		case ILEngineType_I4:
	#ifdef IL_NATIVE_INT32
		case ILEngineType_I:
	#endif
		{
			CVM_OUT_RETURN(1);
			CVM_ADJUST(-1);
		}
		break;

		case ILEngineType_I8:
	#ifdef IL_NATIVE_INT64
		case ILEngineType_I:
	#endif
		{
			CVM_OUT_RETURN(CVM_WORDS_PER_LONG);
			CVM_ADJUST(-CVM_WORDS_PER_LONG);
		}
		break;

		case ILEngineType_F:
		{
			CVM_OUT_RETURN(CVM_WORDS_PER_NATIVE_FLOAT);
			CVM_ADJUST(-CVM_WORDS_PER_NATIVE_FLOAT);
		}
		break;

		case ILEngineType_MV:
		{
			ILUInt32 size = GetTypeSize(_ILCoderToILCVMCoder(coder)->process,
										returnType);
			CVM_OUT_RETURN(size);
			CVM_ADJUST(-(ILInt32)size);
		}
		break;

		case ILEngineType_TypedRef:
		{
			CVM_OUT_RETURN(CVM_WORDS_PER_TYPED_REF);
			CVM_ADJUST(-CVM_WORDS_PER_TYPED_REF);
		}
		break;
	}
}

static void CVMCoder_LoadFuncAddr(ILCoder *coder, ILMethod *methodInfo)
{
	CVMP_OUT_PTR(COP_PREFIX_LDFTN, methodInfo);
	CVM_ADJUST(1);
}

static void CVMCoder_LoadVirtualAddr(ILCoder *coder, ILMethod *methodInfo)
{
	CVMP_OUT_WORD(COP_PREFIX_LDVIRTFTN, methodInfo->index);
}

static void CVMCoder_LoadInterfaceAddr(ILCoder *coder, ILMethod *methodInfo)
{
	CVMP_OUT_WORD_PTR(COP_PREFIX_LDINTERFFTN, methodInfo->index,
					  methodInfo->member.owner);
}

#endif	/* IL_CVMC_CODE */


text:
import tensorflow as tf

class GcnBiasAndFeatureGates:

    def __init__(self, biases, features, transform_1, transform_2, l1_scale=0.0):
        self.features = features
        self.biases = biases
        self.transform_1 = transform_1
        self.transform_2 = transform_2
        self.l1_scale = 0.0

        self.prepare_variables()

    def get_gates(self, mode):
        gate_features = tf.concat([f.get() for f in self.features], -1)
        transformed_gates = self.transform_1.transform(gate_features, mode)

        for b in self.biases:
            transformed_gates += b.get()
        transformed_gates = tf.nn.relu(transformed_gates)

        transformed_gates = self.transform_2.transform(transformed_gates, mode)
        gates = tf.nn.sigmoid(transformed_gates)

        self.gate_sum = tf.reduce_sum(gates)

        return gates

    def prepare_variables(self):
        [f.prepare_variables() for f in self.features]
        [b.prepare_variables() for b in self.biases]

    def get_regularization(self):
        return self.transform_1.get_regularization() + self.l1_scale * self.gate_sum + self.transform_2.get_regularization()