text:
try:
	from Tkinter import *
	import tkMessageBox
	import Pmw
	from random import randint
	from wireless.menu_functions import *
	from wireless.iface_list import ListInterfaces, GetInterfaceList

except ImportError, e:
	pass

class DisplayBox:
	def __init__(self, parent):
		self.myParent = parent
		Pmw.initialise()
		self.balloon = Pmw.Balloon(parent)

		# Color declaration
		self.bg = "#009900"
		self.fg = "#ffffff"
		# Creating panel containing main actions' icons
		panel = Frame(parent, background="white")
		# Adding Start Scan button to panel
		self.start_img = PhotoImage(file='gui/images/scan.gif')
		self.start_btn = Button(panel, state='disabled', image=self.start_img, width=25, height=25)
		self.start_btn.pack(side=LEFT, padx=2)
		self.balloon.bind(self.start_btn, 'Start Scanning')

		# Adding Stop Scan button to panel
		self.stop_img = PhotoImage(file='gui/images/stop.gif')
		self.stop_btn = Button(panel, image=self.stop_img, state='disabled')
		self.stop_btn.pack(side=LEFT, padx=2)
		self.balloon.bind(self.stop_btn, 'Stop Scanning')

		# Adding Dump scan results button to panel
		self.dump_img = PhotoImage(file='gui/images/dump.gif')
		dump_btn = Button(panel, image=self.dump_img, state='disabled', width=25, height=25)
		dump_btn.pack(side=LEFT, padx=2)
		self.balloon.bind(dump_btn, 'Dump Scan Results')

		# Adding in-depth scanning of selected device/network button to panel
		self.sniff_img = PhotoImage(file='gui/images/duck.gif')
		self.sniff_btn = Button(panel, state='disabled', image=self.sniff_img, width=25, height=25)
		self.sniff_btn.pack(side=LEFT, padx=2)
		self.balloon.bind(self.sniff_btn, 'Sniff or Capture packets on selected interface')

		# Adding button to choose wireless interface
		self.choose_iface = Button(panel, text="Interface: None", fg="red", activeforeground="blue")
		self.choose_iface.pack(side=LEFT, padx=20, pady=2)
		self.balloon.bind(self.choose_iface, 'The %s has been selected for packet capture.'%self.choose_iface['text'])

		# Adding scan filter area
		filter_area = Frame(panel, highlightbackground="gray", highlightthickness=1)
		filter_lbl = Label(filter_area, text="Filter:").pack(side=LEFT)
		filter_entry = Entry(filter_area, width=30, borderwidth=0).pack(side=LEFT,expand=YES, fill=X)
		filter_area.pack(side=LEFT, expand=YES, fill=X, padx=30)
		self.balloon.bind(filter_area, 'Enter the scan filter value here')

		# Adding labels for graph and table views
		self.graph_btn = Button(panel, text="Graph", activeforeground="blue", command=lambda x="graph": self.create_items(x))
		self.graph_btn.pack(side=RIGHT)
		self.balloon.bind(self.graph_btn, 'Click to view Graphical plot of wireless scan results')
		self.table_btn = Button(panel, text="Table", activeforeground="blue", command=lambda y="table": self.create_items(y))
		self.table_btn.pack(side=RIGHT)
		self.balloon.bind(self.table_btn, 'Click to view Tabular view of wireless scan results')

		panel.pack(anchor=N, side=TOP, fill=X, expand=YES)

		# Container contains the canvas
		self.container = Frame(parent, bg="white")
		self.container.configure(highlightbackground="black", highlightthickness=5)

		# Creating a scrollbar for the canvas
		self.scrollY1 = Scrollbar(self.container, orient=VERTICAL)

		self.CANVAS_SIZE = 900
		self.canvas1 = Canvas(self.container, width=self.CANVAS_SIZE, height=670, background='white')
		self.canvas1["scrollregion"] = (0,0,self.CANVAS_SIZE,self.CANVAS_SIZE)
		global canvas
		canvas = self.canvas1

		self.scrollY1.configure(command=self.canvas1.yview)
		# Binding Mousewheel event to canvas for vertical scrolling
		self.canvas1.bind("<MouseWheel>", lambda event: self.canvas1.yview('scroll', 1, 'units'))
		self.canvas1.bind('<4>', lambda event : self.canvas1.yview('scroll', -1, 'units'))
		self.canvas1.bind('<5>', lambda event : self.canvas1.yview('scroll', 1, 'units'))

		self.canvas1["yscrollcommand"] = self.scrollY1.set

		self.listresult = Frame(self.container, bg="gray", width=1200, height=700)
		self.create_welcome()

		self.container.pack(fill=BOTH, expand=YES, anchor='center')
		self.count = 0

	# Creating the Home display or Welcome window of the Program
	# It lists the available interfaces in the computer on Left side and the Image slider on the right side.
	def create_welcome(self):
		# Main container in welcome window
		self.win = Frame(self.container, bg="gray")
		# Creates Title or introduction of the Program.
		win_title = Label(self.win, text="Wireless Scanner and Analyzer", font="Verdana 18 bold", bg = self.bg, fg=self.fg).pack(ipadx=10, ipady=10, fill=BOTH, padx=5, pady=5)
		win_body = Frame(self.win, background="gray")

		# Container containing list of available interfaces in the Computer.
		iface_box = Frame(win_body,  height=450, bg="gray", highlightbackground="gray", highlightthickness=1)

		# Defining images representing interfaces
		self.img_eth = PhotoImage(file="gui/images/eth.gif")
		self.img_wlan = PhotoImage(file="gui/images/wlan.gif")
		self.img_help = PhotoImage(file="gui/images/help.gif")

		# Getting list of Interfaces available in the computer
		self.interfaces = ListInterfaces().getAllInterfaces()
		iface_box_top = Frame(iface_box, highlightbackground=self.bg, highlightthickness=2)
		iface_title = Label(iface_box_top, text="Interfaces", width=20, bg=self.bg, fg=self.fg, font="Verdana 16 bold").pack(fill=X)
		for i in self.interfaces:
			# Displays Interfaces as a Label
			iface_lbl1 = Label(iface_box_top, text=i.title(), width=20, font="Verdana 12 bold", cursor="hand2", bg="gray")
			img1_lbl = Label(iface_lbl1, image=self.img_eth, bg="gray").pack(side=LEFT, padx=5)
			iface_lbl1.pack(anchor=W, ipady=5, pady=5, padx=2, fill=X)
			iface_lbl1.bind("<Enter>", lambda e: e.widget.config(background="tan"))
			iface_lbl1.bind("<Leave>", lambda e: e.widget.config(background="gray"))
			iface_lbl1.bind("<Button-1>", lambda event, iface=i: self.select_interface(event, iface))
		iface_box_top.pack(fill=X)

		# Container for list of Wireless Interfaces.
		iface_box_bottom = Frame(iface_box, highlightbackground=self.bg, highlightthickness=2)
		iface_title2 = Label(iface_box_bottom, text="Wireless Interfaces", bg=self.bg, fg=self.fg, width=20, font="Verdana 16 bold").pack(fill=X)

		# Getting list of wireless interfaces in the system
		self.w_interfaces = GetInterfaceList().getIface()
		for iface, mode in self.w_interfaces:
			text = "%s (Mode: %s)" % (iface.title(), mode.title())
			iface_lbl2 = Label(iface_box_bottom, text=text, width=20, font="Verdana 12 bold", cursor="hand2", bg="gray")
			img2_lbl = Label(iface_lbl2, image=self.img_wlan, bg="gray").pack(side=LEFT, padx=5)
			iface_lbl2.pack(anchor=W, ipady=5, pady=5, padx=2, fill=X)
			iface_lbl2.bind("<Enter>", lambda e: e.widget.config(background="tan"))
			iface_lbl2.bind("<Leave>", lambda e: e.widget.config(background="gray"))
			iface_lbl2.bind("<Button-1>", lambda event, iface=iface, mode=mode: self.select_interface(event, iface, mode))
		iface_box_bottom.pack(pady=10, fill=X)

		# Container for putting Help information
		help_box = Frame(iface_box, highlightbackground=self.bg, highlightthickness=2)
		help_title = Label(help_box, text="Help", width=20, bg=self.bg, fg=self.fg, font="Verdana 16 bold").pack(fill=X)
		# Link to Documentation of the program.
		help_lbl = Label(help_box, text="Read Documentation", width=20, font="Verdana 12 bold", cursor="hand2", bg="gray")
		help_img = Label(help_lbl, image=self.img_help, bg="gray").pack(side=LEFT, padx=5)
		help_lbl.pack(anchor=W, ipady=5, pady=5, padx=2, fill=X)
		help_lbl.bind("<Enter>", lambda e: e.widget.config(background="tan"))
		help_lbl.bind("<Leave>", lambda e: e.widget.config(background="gray"))
		help_lbl.bind("<Button-1>", read_documentation)
		help_box.pack(fill=X)

		iface_box.pack(side=LEFT, anchor=NW, ipadx=5, ipady=5, padx=5, pady=5, expand=YES, fill=X)

		right_box = Frame(win_body, width=500, height=500, highlightbackground="green", bg="green", highlightthickness=1)
		self.slide1_image = PhotoImage(file="gui/images/slide1.gif")
		slide1 = Label(right_box, image=self.slide1_image, width=500, height=500).pack(expand=YES, fill=BOTH)
		right_box.pack(side=LEFT, anchor=NE, ipadx=5, ipady=5, padx=5, pady=5, expand=YES, fill=BOTH)
		win_body.pack(ipadx=5, ipady=5, fill=BOTH, expand=YES)
		bottom_lbl = Label(self.win, text="Copyright: Sajjan Bhattarai\n2014", font="Verdana 8 underline").pack(fill=X, padx=5, pady=5)
		self.win.pack(expand=YES, fill=BOTH)

	# Displays or creates items in the main window according to user's view preference.
	# This function is aimed to be run after the capture interface is selected and the Sniffer or Scanner is initiated.
	def create_items(self, view):
		if view == "graph":
			self.graph_btn.configure(background=self.bg, foreground=self.fg)
			self.table_btn.configure(background=self.fg, foreground="black")
			self.scrollY1.pack(fill=Y, side=RIGHT, expand=FALSE)
			self.canvas1.pack()
			self.win.pack_forget()
			self.listresult.pack_forget()
		elif view == "table":
			self.table_btn.configure(background=self.bg, foreground=self.fg)
			self.graph_btn.configure(background=self.fg, foreground="black")
			self.listresult.pack(expand=YES, fill=BOTH)
			self.scrollY1.pack_forget()
			self.canvas1.pack_forget()

	def scan_ap(self, iface, canvas):
		self.create_items("graph")
		table = Toplevel()
	    	table.title("Wireless Scanning: Access Points")
	    	scan = ThreadedClient()
	    	scan.main(table, iface, canvas, "position")
	    	self.stop_btn.configure(state='normal', command=scan.endApplication)
	    	table.mainloop()

	# Creating function to handle events occured on interfaces' list
	def select_interface(self, event, iface, mode=""):
		if mode != "":
			if mode != "monitor":
				ask_user = tkMessageBox.askokcancel(title="Turn on Monitor mode", message="Monitor Mode isn't yet enabled on this interface. Turn Monitor mode on %s interface?"%iface)
				if ask_user > 0 :
					os.system("sudo -A ifconfig %s down" % iface)
					os.system("sudo iwconfig %s mode monitor" % iface)
					os.system("sudo ifconfig %s up" % iface)
					event.widget.configure(text="%s (Mode: Monitor)" %iface.title())
				else:
					return
			self.start_btn.configure(state='normal', command=lambda i=iface, canvas=self.canvas1: self.scan_ap(i, canvas))
		else:
			self.start_btn.configure(state='disabled')
		self.interface = iface
		global interface
		interface = self.interface
		self.sniff_btn.configure(state='normal', command=lambda i=iface: self.sniffall(i))
		self.choose_iface.configure(fg=self.bg, text="Interface: %s"%self.interface)
		self.balloon.bind(self.choose_iface, 'The %s has been selected for packet capture.'%self.choose_iface['text'])

	def sniffall(self, iface):
		self.listresult.pack(expand=YES, fill=BOTH)
		if self.count == 0:
			st = self.SniffTable(self.listresult)
		sniff = ThreadSniffer()
		sniff.main(self.table, self.canvas, iface)
		self.stop_btn.configure(state='normal', command=sniff.endApplication)
		self.win.pack_forget()
		self.count += 1

	def SniffTable(self, parent):
		# Creating vertical scrollbar on the right side
		vscrollbar = Scrollbar(parent, orient=VERTICAL)

		# Creating canvas in order to make the widgets be scrollable.
		self.canvas = Canvas(parent, yscrollcommand=vscrollbar.set, height=700)
		vscrollbar.pack(fill=Y, side=RIGHT, expand=FALSE)

		# Creating table using Frame
		self.table = Frame(self.canvas, height=700)

		# Creating color definitions
		self.bg = "#009900"
		self.fg = "#ffffff"

		# Creating Table header
		table_head = Frame(parent)
		col0 = Label(table_head, width=3, text="SN", background=self.bg, foreground=self.fg, highlightbackground=self.fg, highlightthickness=1).pack(side=LEFT,fill=X)
		col1 = Label(table_head, width=7, text="Protocol", background=self.bg, foreground=self.fg, highlightbackground=self.fg, highlightthicknes=1).pack(side=LEFT,fill=X)
		col2 = Label(table_head, width=20, text="Source", background=self.bg, foreground=self.fg, highlightbackground=self.fg, highlightthickness=1).pack(side=LEFT,fill=X)
		col3 = Label(table_head, width=20, text="Destination", background=self.bg, foreground=self.fg, highlightbackground=self.fg, highlightthicknes=1).pack(side=LEFT,fill=X)
		col4 = Label(table_head, width=12, text="Type", background=self.bg, foreground=self.fg, highlightbackground=self.fg, highlightthicknes=1).pack(side=LEFT,fill=X)
		col5 = Label(table_head, width=8, text="Subtype", background=self.bg, foreground=self.fg, highlightbackground=self.fg, highlightthicknes=1).pack(side=LEFT,fill=X)
		col6= Label(table_head, width=16, text="SSID", background=self.bg, foreground=self.fg, highlightbackground=self.fg, highlightthicknes=1).pack(side=LEFT,fill=X)
		col8 = Label(table_head, width=100, text="Info", background=self.bg, foreground=self.fg, highlightbackground=self.fg, highlightthicknes=1).pack(side=LEFT,fill=X)

		# Packing table header and table into the GUI layout
		table_head.pack(side=TOP, fill=X, expand=YES, padx=2)
		#self.table.pack(expand=YES,fill=BOTH)
		# Packing canvas widget into the window
		self.canvas.pack(expand=YES, padx=2, anchor=NW)
		#self.canvas['scrollregion'] = '0 0 800 9999999999'
		vscrollbar.configure(command=self.canvas.yview)
		self.cw = self.canvas.create_window(0,0, window=self.table, anchor=NW, tags="table")

		# track changes to the canvas and frame width and sync them also updating the scrollbar
		self.table.bind('<Configure>', self._configure_table)
		self.canvas.bind('<Configure>', self._configure_canvas)

	# Functions to track and update canvas's size and table's sizes accordingly.
	def _configure_table(self, event):
		# update the scrollbars to match the size of the table
		size = (self.table.winfo_reqwidth(), self.table.winfo_reqheight())
		self.canvas.configure(scrollregion="0 0 %s %s" % size)
		if self.table.winfo_reqwidth() != self.canvas.winfo_width():
			# update the canvas's width to fit the inner table
			self.canvas.configure(width=self.table.winfo_reqwidth())

	def _configure_canvas(self, event):
		if self.table.winfo_reqwidth() != self.canvas.winfo_width():
			# update the inner table's width to fill the canvas
			self.canvas.itemconfigure(self.cw, width=self.canvas.winfo_width())


text:
title: Life in the balance
layout: page
author: dnavon
permalink: /2016-05-12-life-in-balance/
tags:
- genetics
- research
- day-in-the-life
- work/life-balance
categories:
 - Grad School Diaries
header:
 image_fullwidth: gradschooldiaries-header.jpg
image:
 thumb: dnavon-fig3.jpg
teaser: I'm a up-and-coming molecular biologist, and I study genetics, evolution, and development.  But what do I actually do all day?
subheadline: Juggling teaching, research, and outreach
source-id: 1WwrKVFq8yJYhAb_4kjdOEir2vtuENs_e8q1mEvCgKOA
published: true
---
If I ask to you imagine a scientist, you'll probably summon up images of white lab coats and coke-bottle-thick glasses, middle-aged white men working at sterile lab benches with various instruments and chemicals.  But if I asked you to imagine what a scientist does all day…you may have more trouble with that.

I'm a biologist.  More specifically, I'm a third year PhD candidate in the Organismic and Evolutionary Biology (OEB) program at the University of Massachusetts Amherst.  What does all that mean?  It means I study organisms that evolve (more on that later, I'm sure), and I'm coming to the end of the middle of my graduate career.  I've passed my qualification exams, which in my program means that I took a 3-hour-long oral test on various subjects related to my field.  Now I need to develop, present, and defend an extensive body of research in order to achieve my doctoral degree. But what exactly do I do all day?  The answer to that question really depends on the day – so here's a snapshot of one of mine, to give you a better idea of what it means to be a grad student.

**Monday, 2/8/2016**

8:15am

I've overslept!  That's what I get for staying out to make sure that the Broncos were going to make up for their crushing defeat two years ago.  I really could care less about football and was proudly sporting my personalized Bruins jersey the whole game.  But it was a nice excuse to get together with some of my friends from OEB as well as their significant others for a potluck style shindig.

9:30 am

I walk in, late, to our first lab meeting of the semester.  My advisor jokes about how he was late as well, and we talk briefly about "lab business", which involves answering questions like who is going to come in over the next few weekends to feed and check on our fish, when are we expecting to see some new fish arriving from Africa, and who will be presenting what at the next few lab meetings.  Next, we launch into a discussion of a recent paper from our field.

11:00 am

I have to run upstairs to a colleague's lab to start a piece of equipment – a centrifuge – that will help me to complete my lab work for the morning.  I need it to be cold before I spin down the results of a reaction I ran the day before.  The tubes have to spin for about 30 minutes to separate the RNA probe I synthesized yesterday from the solution it's currently suspended in.  I'll be using that probe to try and figure out where the gene I'm interested in is expressed in developing fish embryos.

11:45 am

My probes have spun down, and I run back upstairs to collect my precious tubes.  I have to take out all of the liquid and hope that the invisible RNA probe is clinging to the side of the tubes, so I can start the five day protocol I need to run tomorrow.  I have to check whether there's any probe using a technique called gel electrophoresis.  Basically, this is a way of separating DNA and RNA fragments based on their size.   I already have a gel ready to go, so I can check whether or not there's actually anything in my tubes after I take off the excess liquid.

![image alt text]({{ site.url }}/public/XI4GU4RNU0mikAYXAnYiw_img_0.jpg)

**Fig. 1** The results of a gel electrophoresis – bands of white indicate presence of RNA or DNA

12:15 pm

My gel is running, and I nervously await the results while eating my lunch and answering a few emails.  I also take some of the data I collected late last week from a different (though related) experiment and type it into the Excel spreadsheet I've created for that experiment.

12:45 pm

Success!  I have probe, which means that tomorrow I can finally begin the week-long process of figuring out where the gene I'm interested in is expressed during development. You only find out if the experiment worked on the last day, which makes it exciting and nerve-wracking.  But it's a really useful technique to have in my arsenal, since I can potentially tailor it to work with any gene and any organism.

1:00 pm

An undergraduate student I work with comes in to use the computer.  He's doing some data collection for me right now, but he's eager to dip his toes into the world of molecular biology.  Today, he asks me some questions about a few papers I've sent him that use the very same technique I'll be using tomorrow.  It's a good chance for me to explain the procedure to him, testing my own understanding of it.

![image alt text]({{ site.url }}/public/XI4GU4RNU0mikAYXAnYiw_img_1.jpg)

**Fig. 2** The results from a gene expression study in developing fly embryos.  Deep purple indicates gene expression.

1:15 pm

I'm running across a very snowy campus to get to my Public Engagement & Communication class on time. Today we're supposed to talk about some readings and also present a two minute "story" about our science based on a guest lecture given last week.

3:30 pm

Due to the worsening snow, our professor decided to let us go early.  When I get back to lab, I email back and forth with my teaching assistantship supervisor to talk about our goals for the week.  I also write up two advertisements for events run by the Graduate Women in STEM group – as the chair of the communications committee, this is one of my weekly responsibilities.

4:30 pm

I have to edit a post for another blog, which focuses on marine science.  Even though the fish I study live in fresh water, it's still a cool opportunity for me to practice outreach writing. Today's post examines the strange reproductive behavior of anglerfishes, in honor of Valentine's Day.

5:30 pm

I have a little brainpower left, so I go ahead and start on this post.  When I finish, I'll head home for the day.  I have a pretty calico cat waiting anxiously for me to feed her.  Once I start a load of laundry and cook dinner for myself, we'll probably cuddle up on the couch so I can work a little on my manuscript and then catch up on Downton Abbey.

![image alt text]({{ site.url }}/public/XI4GU4RNU0mikAYXAnYiw_img_2.jpg)

**Fig. 3** My cat, Nika, "helping" me grade papers last year

## More From Thats Life [Science]
{: .t60 }
{% include list-posts offset="1" category="Grad School Diaries" %}

redpajama_set_name: RedPajamaGithub


text:
import Ember from "ember-metal/core"; // Handlebars, uuid, FEATURES, assert, deprecate
import { get } from "ember-metal/property_get";
import { forEach } from "ember-metal/array";
import run from "ember-metal/run_loop";

import { isSimpleClick } from "ember-views/system/utils";
import EmberRouter from "ember-routing/system/router";

import EmberHandlebars from "ember-handlebars";
import { handlebarsGet } from "ember-handlebars/ext";
import { viewHelper } from "ember-handlebars/helpers/view";
import {
  resolveParams,
  resolvePath
} from "ember-routing/helpers/shared";

// requireModule('ember-handlebars');

/**
@module ember
@submodule ember-routing
*/

var SafeString = EmberHandlebars.SafeString;
var a_slice = Array.prototype.slice;

function args(options, actionName) {
  var ret = [];
  if (actionName) { ret.push(actionName); }

  var types = options.options.types.slice(1),
      data = options.options.data;

  return ret.concat(resolveParams(options.context, options.params, { types: types, data: data }));
}

var ActionHelper = {
  registeredActions: {}
};

export { ActionHelper };

var keys = ["alt", "shift", "meta", "ctrl"];

var POINTER_EVENT_TYPE_REGEX = /^click|mouse|touch/;

var isAllowedEvent = function(event, allowedKeys) {
  if (typeof allowedKeys === "undefined") {
    if (POINTER_EVENT_TYPE_REGEX.test(event.type)) {
      return isSimpleClick(event);
    } else {
      allowedKeys = '';
    }
  }

  if (allowedKeys.indexOf("any") >= 0) {
    return true;
  }

  var allowed = true;

  forEach.call(keys, function(key) {
    if (event[key + "Key"] && allowedKeys.indexOf(key) === -1) {
      allowed = false;
    }
  });

  return allowed;
};

ActionHelper.registerAction = function(actionNameOrPath, options, allowedKeys) {
  var actionId = ++Ember.uuid;

  ActionHelper.registeredActions[actionId] = {
    eventName: options.eventName,
    handler: function handleRegisteredAction(event) {
      if (!isAllowedEvent(event, allowedKeys)) { return true; }

      if (options.preventDefault !== false) {
        event.preventDefault();
      }

      if (options.bubbles === false) {
        event.stopPropagation();
      }

      var target = options.target,
          parameters = options.parameters,
          actionName;

      if (target.target) {
        target = handlebarsGet(target.root, target.target, target.options);
      } else {
        target = target.root;
      }

      if (options.boundProperty) {
        actionName = resolveParams(parameters.context, [actionNameOrPath], { types: ['ID'], data: parameters.options.data })[0];

        if(typeof actionName === 'undefined' || typeof actionName === 'function') {
          Ember.assert("You specified a quoteless path to the {{action}} helper '" + actionNameOrPath + "' which did not resolve to an actionName. Perhaps you meant to use a quoted actionName? (e.g. {{action '" + actionNameOrPath + "'}}).", true);
          actionName = actionNameOrPath;
        }
      }

      if (!actionName) {
        actionName = actionNameOrPath;
      }

      run(function runRegisteredAction() {
        if (target.send) {
          target.send.apply(target, args(parameters, actionName));
        } else {
          Ember.assert("The action '" + actionName + "' did not exist on " + target, typeof target[actionName] === 'function');
          target[actionName].apply(target, args(parameters));
        }
      });
    }
  };

  options.view.on('willClearRender', function() {
    delete ActionHelper.registeredActions[actionId];
  });

  return actionId;
};

/**
  The `{{action}}` helper registers an HTML element within a template for DOM
  event handling and forwards that interaction to the templates's controller
  or supplied `target` option (see 'Specifying a Target').

  If the controller does not implement the event, the event is sent
  to the current route, and it bubbles up the route hierarchy from there.

  User interaction with that element will invoke the supplied action name on
  the appropriate target. Specifying a non-quoted action name will result in
  a bound property lookup at the time the event will be triggered.

  Given the following application Handlebars template on the page

  ```handlebars
  <div {{action 'anActionName'}}>
    click me
  </div>
  ```

  And application code

  ```javascript
  App.ApplicationController = Ember.Controller.extend({
    actions: {
      anActionName: function() {
      }
    }
  });
  ```

  Will result in the following rendered HTML

  ```html
  <div class="ember-view">
    <div data-ember-action="1">
      click me
    </div>
  </div>
  ```

  Clicking "click me" will trigger the `anActionName` action of the
  `App.ApplicationController`. In this case, no additional parameters will be passed.

  If you provide additional parameters to the helper:

  ```handlebars
  <button {{action 'edit' post}}>Edit</button>
  ```

  Those parameters will be passed along as arguments to the JavaScript
  function implementing the action.

  ### Event Propagation

  Events triggered through the action helper will automatically have
  `.preventDefault()` called on them. You do not need to do so in your event
  handlers. If you need to allow event propagation (to handle file inputs for
  example) you can supply the `preventDefault=false` option to the `{{action}}` helper:

  ```handlebars
  <div {{action "sayHello" preventDefault=false}}>
    <input type="file" />
    <input type="checkbox" />
  </div>
  ```

  To disable bubbling, pass `bubbles=false` to the helper:

  ```handlebars
  <button {{action 'edit' post bubbles=false}}>Edit</button>
  ```

  If you need the default handler to trigger you should either register your
  own event handler, or use event methods on your view class. See [Ember.View](/api/classes/Ember.View.html)
  'Responding to Browser Events' for more information.

  ### Specifying DOM event type

  By default the `{{action}}` helper registers for DOM `click` events. You can
  supply an `on` option to the helper to specify a different DOM event name:

  ```handlebars
  <div {{action "anActionName" on="doubleClick"}}>
    click me
  </div>
  ```

  See `Ember.View` 'Responding to Browser Events' for a list of
  acceptable DOM event names.

  NOTE: Because `{{action}}` depends on Ember's event dispatch system it will
  only function if an `Ember.EventDispatcher` instance is available. An
  `Ember.EventDispatcher` instance will be created when a new `Ember.Application`
  is created. Having an instance of `Ember.Application` will satisfy this
  requirement.

  ### Specifying whitelisted modifier keys

  By default the `{{action}}` helper will ignore click event with pressed modifier
  keys. You can supply an `allowedKeys` option to specify which keys should not be ignored.

  ```handlebars
  <div {{action "anActionName" allowedKeys="alt"}}>
    click me
  </div>
  ```

  This way the `{{action}}` will fire when clicking with the alt key pressed down.

  Alternatively, supply "any" to the `allowedKeys` option to accept any combination of modifier keys.

  ```handlebars
  <div {{action "anActionName" allowedKeys="any"}}>
    click me with any key pressed
  </div>
  ```

  ### Specifying a Target

  There are several possible target objects for `{{action}}` helpers:

  In a typical Ember application, where views are managed through use of the
  `{{outlet}}` helper, actions will bubble to the current controller, then
  to the current route, and then up the route hierarchy.

  Alternatively, a `target` option can be provided to the helper to change
  which object will receive the method call. This option must be a path
  to an object, accessible in the current context:

  ```handlebars
  {{! the application template }}
  <div {{action "anActionName" target=view}}>
    click me
  </div>
  ```

  ```javascript
  App.ApplicationView = Ember.View.extend({
    actions: {
      anActionName: function(){}
    }
  });

  ```

  ### Additional Parameters

  You may specify additional parameters to the `{{action}}` helper. These
  parameters are passed along as the arguments to the JavaScript function
  implementing the action.

  ```handlebars
  {{#each person in people}}
    <div {{action "edit" person}}>
      click me
    </div>
  {{/each}}
  ```

  Clicking "click me" will trigger the `edit` method on the current controller
  with the value of `person` as a parameter.

  @method action
  @for Ember.Handlebars.helpers
  @param {String} actionName
  @param {Object} [context]*
  @param {Hash} options
*/
export function actionHelper(actionName) {
  var options = arguments[arguments.length - 1],
      contexts = a_slice.call(arguments, 1, -1);

  var hash = options.hash,
      controller = options.data.keywords.controller;

  // create a hash to pass along to registerAction
  var action = {
    eventName: hash.on || "click",
    parameters: {
      context: this,
      options: options,
      params: contexts
    },
    view: options.data.view,
    bubbles: hash.bubbles,
    preventDefault: hash.preventDefault,
    target: { options: options },
    boundProperty: options.types[0] === "ID"
  };

  if (hash.target) {
    action.target.root = this;
    action.target.target = hash.target;
  } else if (controller) {
    action.target.root = controller;
  }

  var actionId = ActionHelper.registerAction(actionName, action, hash.allowedKeys);
  return new SafeString('data-ember-action="' + actionId + '"');
}


text:
<?php
/*
Language: Danish
File: lang/da.php
Made by: Mattias Fjellvang aka. Canfiax
*/

$lang = array(
	"decimal seperator"             => ".",
	"thousands separator"           => ",",
	"datetime format"               => "m/d/Y H:i", // www.php.net/manual/en/function.date.php
	"Insert"                        => "Indsæt",
	"File"                          => "Fil",
	"Root"                          => "Root",
	"Close"                         => "Luk",
	"New folder"                    => "Ny mappe",
	"Upload"                        => "Upload",
	"Clipboard"                     => "Udklipsholder",
	"Items"                         => "filer",
	"Change view"                   => "Skift visning",
	"View"                          => "Visning",
	"Large images"                  => "Store ikoner",
	"Small images"                  => "Små ikoner",
	"List"                          => "Liste",
	"Details"                       => "Detaljer",
	"Tiles"                         => "Titler",
	"Content"                       => "Indhold",
	"Show the preview pane"         => "Vis visningsruden",
	"Help"                          => "Hjælp",
	"Search"                        => "Søg",
	"All files"                     => "Alle filer",
	"Dimensions"                    => "Dimensioner",
	"Filename"                      => "Navn",
	"Filetype"                      => "Type",
	"Size"                          => "Størrelse",
	"Modified on"                   => "Sidst ændret",
	"Directory"                     => "Mappe",
	"Add a new folder"              => "Opret ny mappe",
	"New folder is created in"      => "Oprettes i (sti)",
	"Name of the new folder"        => "Navnet på den nye mappe",
	"Create folder"                 => "Opret mappe",
	"Upload a new file"             => "Upload filer",
	"Image editor"                  => "Billede redigering",
	"Browse..."                     => "Browse...",
	"Upload queue"                  => "Uploads kø:",
	"Currently uploading in folder" => "Uploades til",
	"Select your file"              => "Vælg fil(er)",

	//Context menu
	"Edit"                          => "Ret billede",
	"Copy"                          => "Kopier",
	"Cut"                           => "Klip",
	"Paste"                         => "Sæt ind",
	"Delete"                        => "Slet",
	"Do you really want to delete this folder and its contents?" => "Er du sikker på at du vil slette denne mappe og alle filer i den?",
	"Do you really want to delete this file?"                    => "Er du sikker på at du vil slette denne fil?",
	"Do you really want to delete this image?"                   => "Er du sikker på at du vil slette dette billede?",
	"Open"                          => "åbn",
	"Refresh"                       => "Opdater",
	"Rename"                        => "Omdøb",

	//Error, success and general messages
    "The folder path was tampered with!"                         => "Fejl i mappestien!",
    "Creating new folder failed!"                                => "Oprettelse af en ny mappe fejlede!<br />De følgende ikoner er ikke tilladt: ^ \\ / ? * \" ' < > : |",
    "A new folder was created!"                                  => "Mappen blev oprettet!",
    "Creating the new folder failed!"                            => "Mappen kunne ikke oprettes!",
    "The files where successfully copied!"                       => "Filerne blev kopieret!",
    "The file or folder path was tampered with!"                 => "Fejl i filens/mappens sti!",
    "Deleting file failed!"                                      => "Kunne ikke slette filen!",
    "Deleting folder failed!"                                    => "Kunne ikke slette mappen!",
    "%d file(s) successfully removed!"                           => "%d filer slettet!",
    "Select only one file to insert!"                            => "Vælg kun en fil at indsætte!",
    "Insert cancelled because there is no target to insert to!"  => "Indsættelse annulleret, fordi der ikke er noget mål at indsætte til!",
    "Directory already exists!"                                  => "Der findes allerede en mappe med samme navn på denne placering!",
    "File already exists!"                                       => "Der findes allerede en fil med samme navn på denne placering!",
    "Name successfully changed!"                                 => "Navnet blev ændret!",
    "Rename failed!"                                             => "Omdøbningen mislykkedes!",
    "Please give a new name for file"                            => "Indtast venligst en nyt navn til {0}{1}Fil endelsen er tilføjet automatisk!{1}(Disse tegn er ikke tilladt {2})",
    "Please give a new name for folder"                          => "Indtast venligst en nyt navn til {0}{1}(Disse tegn er ikke tilladt {2})",
    "Action not allowed!"                                        => "Handling ikke tilladt!",
	"Invalid characters used!"                                   => "Disse tegn er ikke tilladt ^ \\\ / ? * \\\" ' < > : | .",

    //Upload
    #"Upload limited to %d MB!"      => "Upload limited to %d MB!",
    #"bytes"                         => "bytes",
    #"kB"                            => "kB",
    #"MB"                            => "MB",
    #"Cancel all uploads"            => "Cancel all uploads",

    //Settings
    #"Settings"                      => "Settings",
    #"Language"                      => "Language",
    #"Theme"                         => "Theme",
    #"Cookies need to be enabled to save your settings!"          => "Cookies need to be enabled to save your settings!",
    #"Save settings"                 => "Save settings",
    #"Settings saved!"               => "Settings saved!",

    "EOF" => TRUE
);

?>


text:
using System;
using System.Diagnostics;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Renci.SshNet.Common;
using Renci.SshNet.Tests.Properties;

namespace Renci.SshNet.Tests.Classes
{
    public partial class ForwardedPortRemoteTest
    {
        [TestMethod]
        [TestCategory("integration")]
        public void Test_PortForwarding_Remote()
        {
            //  ******************************************************************
            //  ************* Tests are still in not finished ********************
            //  ******************************************************************

            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
            {
                client.Connect();
                var port1 = new ForwardedPortRemote(8082, "www.renci.org", 80);
                client.AddForwardedPort(port1);
                port1.Exception += delegate(object sender, ExceptionEventArgs e)
                {
                    Assert.Fail(e.Exception.ToString());
                };
                port1.Start();
                var boundport = port1.BoundPort;

                System.Threading.Tasks.Parallel.For(0, 5,

                    //new ParallelOptions
                    //{
                    //    MaxDegreeOfParallelism = 1,
                    //},
                    (counter) =>
                    {
                        var cmd = client.CreateCommand(string.Format("wget -O- http://localhost:{0}", boundport));
                        var result = cmd.Execute();
                        var end = DateTime.Now;
                        Debug.WriteLine(string.Format("Length: {0}", result.Length));
                    }
                );
                Thread.Sleep(1000 * 100);
                port1.Stop();
            }
        }
    }
}


text:
import { TestBed, waitForAsync } from '@angular/core/testing';

import { AppMocksCoreModule } from './mocks-core.module';

describe('AppMocksCoreModule', () => {
  beforeEach(
    waitForAsync(() => {
      void TestBed.configureTestingModule({
        imports: [AppMocksCoreModule],
      }).compileComponents();
    }),
  );

  it('should be defined', () => {
    expect(AppMocksCoreModule).toBeDefined();
  });
});


text:
LearnRead
=========

LearRead is a tools that will help You to learn english. A nice way to learn it is by reading,
unfortunatelly You have to know a lot of words to fully understand a book. LearRead helps You to learn
words used in a book before reading it so that You can enjoy it more.

Currently it can only save a list of words that You think You know, and analyze a book or any other document(currently only txt format) and list words that you probably do not know. You can then analyze the list, add any words You know to the your list of words, and the ones You don't to Anki (see https://github.com/maciejklimek/AnkiCreator for a convenient way to add words to Anki).


text:
#region License Header

#endregion License Header

using System;

namespace Quantler.Utilities.DataConverter
{
    internal class InputLine
    {
        #region Public Properties

        /// <summary>
        /// Hashed line item
        /// </summary>
        public UInt64 Hash { get; set; }

        /// <summary>
        /// Line text
        /// </summary>
        public string Line { get; set; }

        /// <summary>
        /// Line number in file
        /// </summary>
        public long LineNumber { get; set; }

        /// <summary>
        /// The original filename
        /// </summary>
        public string Filename { get; set; }

        #endregion Public Properties
    }
}


text:
using System.IO;
using Mustache.Reports.Data.ReportRendering;
using System;
using Microsoft.Extensions.Options;
using Mustache.Reports.Domain;
using Mustache.Reports.Domain.Options;
using Mustache.Reports.Domain.Report;
using Mustache.Reports.Domain.Report.Excel;
using Mustache.Reports.Domain.Report.Word;
using StoneAge.CleanArchitecture.Domain.Messages;
using StoneAge.CleanArchitecture.Domain.Output;
using StoneAge.CleanArchitecture.Domain.Presenters;
using StoneAge.Synchronous.Process.Runner;
using StoneAge.Synchronous.Process.Runner.PipeLineTask;

namespace Mustache.Reports.Data
{
    public class ReportGateway : IReportGateway
    {
        private readonly MustacheReportOptions _options;

        public ReportGateway(IOptions<MustacheReportOptions> options)
        {
            _options = options.Value;
        }

        public RenderedDocumentOutput CreateWordReport(RenderWordInput input)
        {
            Func<string, ReportGenerationArguments, NodePipeLineTask> renderFactory = (nodeAppPath, arguements) =>
            {
                return new WordRender(nodeAppPath, arguements.TemplatePath, arguements.JsonPath);
            };

            var factoryArguments = new ReportFactoryArguments
            {
                ReportJson = input.JsonModel.ToString(),
                TemplateName = input.TemplateName,
                Extension = "docx"
            };

            var result = CreateReport(factoryArguments, renderFactory);
            result.ContentType = ContentTypes.Word;
            return result;
        }

        public RenderedDocumentOutput CreateExcelReport(RenderExcelInput input)
        {
            Func<string, ReportGenerationArguments, NodePipeLineTask> renderFactory = (nodeAppPath, arguments) =>
            {
                return new ExcelRender(nodeAppPath, arguments.TemplatePath, arguments.JsonPath, arguments.SheetNumber);
            };

            var factoryArguments = new ReportFactoryArguments
            {
                ReportJson = input.JsonModel.ToString(),
                TemplateName = input.TemplateName,
                Extension = "xlsx",
                SheetNumber = input.SheetNumber
            };

            var result =  CreateReport(factoryArguments, renderFactory);
            result.ContentType = ContentTypes.Excel;
            return result;
        }

        private RenderedDocumentOutput CreateReport(ReportFactoryArguments arguements,
                                                    Func<string, ReportGenerationArguments, NodePipeLineTask> taskFactory)
        {
            using (var renderDirectory = GetWorkspace())
            {
                var reportJsonPath = PersistReportData(arguements.ReportJson, renderDirectory.TmpPath);
                var reportTemplatePath = FetchReportTemplatePath(arguements.TemplateName, arguements.Extension);

                if (InvalidReportTemplatePath(reportTemplatePath))
                {
                    return ReturnInvalidReportTemplatePathError(reportTemplatePath);
                }

                var presenter = new PropertyPresenter<string, ErrorOutput>();
                var reportArguments = new ReportGenerationArguments
                {
                    TemplatePath = reportTemplatePath,
                    JsonPath = reportJsonPath,
                    SheetNumber = arguements.SheetNumber
                };
                RenderReport(reportArguments, taskFactory, presenter);

                return RenderingErrors(presenter) ? ReturnErrors(presenter) : ReturnRenderedReport(presenter);
            }
        }

        private string PersistReportData(string reportData, string renderDirectory)
        {
            var reportJsonPath = Path.Combine(renderDirectory, "reportData.json");
            WriteTo(reportJsonPath, reportData);
            return reportJsonPath;
        }

        private bool RenderingErrors(PropertyPresenter<string, ErrorOutput> presenter)
        {
            return presenter.IsErrorResponse();
        }

        private RenderedDocumentOutput ReturnInvalidReportTemplatePathError(string templatePath)
        {
            var result = new RenderedDocumentOutput();
            result.ErrorMessages.Add($"Invalid Report Template [{templatePath}]");
            return result;
        }

        private bool InvalidReportTemplatePath(string reportTemplatePath)
        {
            return !File.Exists(reportTemplatePath);
        }

        private RenderedDocumentOutput ReturnRenderedReport(PropertyPresenter<string, ErrorOutput> presenter)
        {
            var base64Report = presenter.SuccessContent.TrimEnd('\r', '\n');
            return new RenderedDocumentOutput {Base64String = base64Report};
        }

        private RenderedDocumentOutput ReturnErrors(PropertyPresenter<string, ErrorOutput> presenter)
        {
            var result = new RenderedDocumentOutput();
            result.ErrorMessages.AddRange(presenter.ErrorContent.Errors);
            return result;
        }

        private void RenderReport(ReportGenerationArguments arguments,
                                  Func<string, ReportGenerationArguments, NodePipeLineTask> taskFactory,
                                  IRespondWithSuccessOrError<string, ErrorOutput> presenter)
        {
            var nodeAppPath = Fetch_NodeApp_Path(_options.NodeApp);

            var task = taskFactory.Invoke(nodeAppPath, arguments);

            var executor = new SynchronousAction(task, new ProcessFactory());
            executor.Execute(presenter);
        }

        private string Fetch_NodeApp_Path(NodeAppOptions optionsNodeApp)
        {
            var prefix = string.Empty;
            if (_options.Template.IsRelative)
            {
                prefix = Directory.GetCurrentDirectory();
            }

            return Path.Combine(prefix, _options.NodeApp.RootDirectory, "cmdLineRender.js");
        }

        private void WriteTo(string filePath, string data)
        {
            File.WriteAllText(filePath, data);
        }

        private DisposableWorkSpace GetWorkspace()
        {
            return new DisposableWorkSpace();
        }

        private string FetchReportTemplatePath(string reportName, string extension)
        {
            var prefix = string.Empty;
            if (_options.Template.IsRelative)
            {
                prefix = Directory.GetCurrentDirectory();
            }
            return Path.Combine(prefix, _options.Template.RootDirectory, $"{reportName}.{extension}");
        }
    }
}


text:
Tkn2 is a presentation tool for the terminal. It's heavily inspired in [Xavier Noria](http://www.hashref.com/)'s
[tkn](https://github.com/fxn/tkn) (Terminal Keynote).

See [usage](#usage).

Tkn2 is work in progress. First goal is compatibility with tkn (it's almost there) and, from there, keep building
interesting features. Although the initial idea is to clone it, it might drop complete compatibility in some future
point.

Main differences with tkn:

* The commands are not available in the general namespace; you need to wrap the slides in a `Tkn2.deck` block
* It's packed as a gem, and intended to use with bundler via a `Gemfile`. That may sound like overkill but, with tkn2
  evolving, it's nice to have each deck stored with a explicit reference to the verion of tkn2 it was written
  for (tkn solves this having the script vendored)
* It uses [ncurses](http://www.gnu.org/software/ncurses/) instead of direct printing. This gets it some nice behaviour
  like autoredrawing when resizing windows or changing font size
* It aims to have the code better split and organized, in order to allow better extensibility and an easier time when
  adding features in the future. This is, however, a claim to be proofed.

## Usage

Install tkn2 if you haven't, and run the generator to create a new deck:

```
$ gem install tkn2
$ tkn2 new 'My slides'
```

This will create a directory called `my_slides/` which will contain your deck in the file `my_slides.rb`:

```ruby
require 'tkn2'

Tkn2.deck do
  # here go your slides
end
```

To run the deck:

```
$ tkn2 show ruby my_slides.rb
```

### Available commands

Each command generates a slide. These are the commands available:

#### `center`

Generates a slide with the given text, centered line by line.

```ruby
center <<-EOS
  Tkn2
  Less is more
EOS
```

#### `block`

Generates a slide with the given text, centered as a whole (useful for bulleted lists).

```ruby
block <<-EOS
  This is why Tkn2 is cool:
    * Reason number 1
    * Reason number 2
EOS
```

#### `code`

Highlights the code given (using [pygments.rb](https://github.com/tmm1/pygments.rb) and
[pygments](http://pygments.org/)) and displays it centered.

```ruby
code <<-RUBY
  puts 'hello'
RUBY
```

#### `section`

Generates a slide with the section title centered and proceeds with the contained slides.

```ruby
section 'This is a section' do
  center 'Slide n. 1'
  center 'Slide n. 2'
end
```

See the [`examples/`](examples/) directory.

Apart from that, it's Ruby! So you're not limited to use string literals to generate the content and you can do whatever
you want (read from the network, make calculations, etc.).

### Keys

These are the keys you can use to navigate the deck:

* Down, Right, Enter, Space, Page Down, N: next slide
* Up, Left, Backspace, Page Up, P: previous slide
* Home: first slide
* Q: quit

## TODO / Roadmap

I'm writing Tkn2 as a way to experiment. This may make the roadmap a bit strange, as I'll be trying to bring to the
terminal the most features common in graphical presentation software, even when it will be difficult and not very practical in many cases.

That said:

* (Auto)reload [1]
* Images [1]
* Better control of *overflow* (currently the deck crashes if the content doesn't fit in the screen). I'm
  playing with the idea of having *scroll*, something usually not present in graphical presentation software and that
  can be useful to present code without using a tiny font size
* Colors and themes
* Plugin system. More as an exercise, I want to try to keep the core small and simple and implement features as plugins
* A way to compose slides with more than one element. Tools to generate content (ASCII art diagrams, etc.)
* Speaker's notes (with next slide, etc.). The only practical way of doing this I see is implementing a *server* and
  having two different *clients*. This *client-server* mode is an interesting feature in itself, for remote
  presentations through the network

[1] Already present in tkn.

## Thanks

* [Xavi](http://www.hashref.com/), for the great inspiration and brilliant hack

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## License

Released under the MIT License, Copyright (c) 2013 Sergio Gil.


text:
function inventoryWidget() {

    return {
        restrict: 'E',
        controller: 'InventoryController',
        controllerAs: 'inventoryCtrl',
        bindToController: true,
        scope: {
            inventoryItems: '='
        },
        templateUrl: 'src/components/dashboard/inventory-widget/inventory.html'
    };

}

module.exports = inventoryWidget;


text:
<?php

namespace Luminary\Services\ApiLoader\Console\Commands;

use Illuminate\Console\Command;
use Luminary\Services\ApiLoader\Helpers\Cache;

class LuminaryCache extends Command
{
    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'luminary:cache';

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'luminary:cache
        {--clear : Whether the job should be queued}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Cache the luminary API Loader';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->option('clear') ? $this->clearCache() : $this->createCache();
    }

    protected function clearCache()
    {
        Cache::clear();

        $this->info('Api Loader Cache Cleared');
    }

    protected function createCache()
    {
        Cache::create();

        $this->info('Api Loader Cached successfully');
    }
}


text:
<?php

namespace Dwo\Aggregator\Model;

/**
 * Class PreAggregateGroup
 *
 * @author Dave Www <davewwwo@gmail.com>
 */
class PreAggregateGroup implements \Iterator
{
    use EntriesTrait;

    /**
     * @var int
     */
    private $count;

    /**
     * @var GroupKey
     */
    private $group;

    /**
     * @param GroupKey $group
     */
    public function __construct(GroupKey $group)
    {
        $this->group = $group;
    }

    /**
     * @return GroupKey
     */
    public function getGroup()
    {
        return $this->group;
    }

    /**
     * @param PreAggregate $aggregate
     */
    public function addEntry(PreAggregate $aggregate)
    {
        $this->entries[] = $aggregate;

        $this->count += $aggregate->getCount();
    }

    /**
     * @return int
     */
    public function getCount()
    {
        return $this->count;
    }

    /**
     * @param int $count
     */
    public function setCount($count)
    {
        $this->count = $count;
    }
}


text:
package org.basex.query.util.pkg;

import static org.basex.util.Token.*;

import org.basex.io.*;
import org.basex.util.*;

/**
 * This class assembles textual information for package handling.
 *
 * @author BaseX Team 2005-16, BSD License
 * @author Christian Gruen
 */
public interface PkgText {
  /** JAR manifest file. */
  String MANIFEST_MF = "META-INF/MANIFEST.MF";

  /** Package descriptor. */
  String DESCRIPTOR = "expath-pkg" + IO.XMLSUFFIX;
  /** Jar descriptor. */
  String JARDESC = Prop.PROJECT_NAME + IO.XMLSUFFIX;

  /** EXPath type. */
  String EXPATH = "EXPath";
  /** Internal type. */
  String INTERNAL = "Internal";
  /** Content directory. */
  String CONTENT = "content";

  /** <package/> root element. */
  /** Element package. */
  byte[] PACKAGE = token("package");

  /** <package/> children. */
  /** Element dependency. */
  byte[] DEPEND = token("dependency");
  /** Element xquery. */
  byte[] XQUERY = token("xquery");

  /** <xquery/> children. */
  /** Attribute namespace. */
  byte[] A_NAMESPACE = token("namespace");
  /** Attribute file. */
  byte[] A_FILE = token("file");

  /** Jar descriptor children. */
  /** <jar/> element. */
  byte[] JAR = token("jar");
  /** <class/> element. */
  byte[] CLASS = token("class");

  /** <package/> attributes. */
  /** Attribute name. */
  byte[] A_NAME = token("name");
  /** Attribute abbrev. */
  byte[] A_ABBREV = token("abbrev");
  /** Attribute version. */
  byte[] A_VERSION = token("version");
  /** Attribute spec. */
  byte[] A_SPEC = token("spec");

  /** <dependency/> attributes. */
  /** Attribute package. */
  byte[] A_PACKAGE = token("package");
  /** Attribute processor. */
  byte[] A_PROCESSOR = token("processor");
  /** Attribute versions. */
  byte[] A_VERSIONS = token("versions");
  /** Attribute semver. */
  byte[] A_SEMVER = token("semver");
  /** Attribute semver-min. */
  byte[] A_SEMVER_MIN = token("semver-min");
  /** Attribute semver-max. */
  byte[] A_SEMVER_MAX = token("semver-max");

  /** Not expected initialization error. */
  String MISSDESC = "Missing package descriptor for package '%'";
  /** Attribute missing. */
  String MISSATTR = "'%' attribute missing in '%' element";
  /** Invalid attribute. */
  String WHICHATTR = "Invalid attribute '%'";
  /** Invalid element. */
  String WHICHELEM = "Invalid element %";
  /** Secondary package missing. */
  String MISSSECOND = "Dependency not completely specified.";
  /** Component missing. */
  String MISSCOMP = "Component '%' not specified";
  /** No jars registered. */
  String NOJARS = "No jars specified";
  /** No public classes registered. */
  String NOCLASSES = "No public classes specified";
}


text:
<?xml version="1.0" encoding="UTF-8"?>
    <project name="build-xmlstruct" default="build-xmlstruct">
        <description>
            Builds the XML structure application $Rev: 561 $
        </description>

            <!-- Preamble definitions -->
        <dirname property="module.root.folder" file="${ant.file}"/>
        <dirname property="parent.root.dir" file="${module.root.folder}"/>
        <property name="tools.apps.root.dir" value="${parent.root.dir}"/>
        <property name="module.base.target.name" value="xmlstruct"/>

        <import file="${parent.root.dir}${file.separator}build-base.xml"/>
        <property name="module.application.base.pkg.name" value="${tools.apps.base.pkg.name}.${module.application.sub.pkg.name}"/>

        <property name="module.app.chest.libs" value="${community.base.pkg.name}-jdk.${jar.file.suffix},
                                                        ${community.base.pkg.name}-mail.${jar.file.suffix},
                                                        ${community.base.pkg.name}-io.${jar.file.suffix},
                                                      ${community.base.pkg.name}-apps-common.${jar.file.suffix},
                                                        ${community.base.pkg.name}-logging.${jar.file.suffix},
                                                      ${community.base.pkg.name}-gui-awt.${jar.file.suffix},
                                                        ${community.base.pkg.name}-gui-swing.${jar.file.suffix},
                                                      ${community.base.pkg.name}-gui-helpers.${jar.file.suffix},
                                                        ${community.base.pkg.name}-gui-components.${jar.file.suffix}"
            />

        <target name="copy-extra-xmlstruct-files" depends="tools-apps-base">
                <!-- copy some extra files -->
            <mkdir dir="${module.application.folder}"/>
            <copy preservelastmodified="true" verbose="true" todir="${module.application.folder}">
                <fileset dir="${module.root.folder}" includes="${module.base.target.name}.*"/>
            </copy>
        </target>

        <target name="build-xmlstruct"
                depends="jar-tools-app-module-files,
                         copy-extra-xmlstruct-files,
                         jar-application-files"
                description="Builds xmlstruct application"/>

        <target name="clean-xmlstruct"
                depends="clean-tools-app-module-build"
                description="Removes the xmlstruct object files and JAR"/>
    </project>


text:
package org.apache.any23.configuration;

/**
 * Modifiable implementation of {@link Configuration}.
 *
 * @author Michele Mostarda (mostarda@fbk.eu)
 */
public interface ModifiableConfiguration extends Configuration {

    /**
     * Sets a new value propertyValue for property which name propertyName.
     *
     * @param propertyName
     *            name of property.
     * @param propertyValue
     *            value of property.
     *
     * @return the old property value.
     */
    String setProperty(String propertyName, String propertyValue);

}


text:
import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';

moduleFor('route:dag/index/index', 'Unit | Route | dag/index/index', {
  // Specify the other units that are required for this test.
  // needs: ['controller:foo']
});

test('Basic creation test', function(assert) {
  let route = this.subject();

  assert.ok(route);
  assert.ok(route.title);
  assert.ok(route.loaderNamespace);
  assert.ok(route.setupController);
  assert.ok(route.load);

  assert.ok(route._canPollObserver);
  assert.ok(route.actions.reload);
  assert.ok(route.actions.willTransition);
});

test('setupController test', function(assert) {
  assert.expect(2);

  let route = this.subject({
    modelFor: function (type) {
      assert.equal(type, 'dag');
      return Ember.Object.create({
        entityID: 'dag_123'
      });
    },
    startCrumbBubble: function () {
      assert.ok(true);
    }
  });

  route.setupController({}, {});
});


text:
//
//  IRoutingOptionsFactory.h
//  Pods
//
//  Created by Bartel on 21.08.15.
//
//

#import <Foundation/Foundation.h>
#import "IVISPERRoutingOption.h"
@protocol IVISPERWireframe;

@protocol IVISPERRoutingOptionsFactory <NSObject>

/**
 * GENERATING CONVINIENCE ROUTING OPTIONS
 **/
-(NSObject<IVISPERRoutingOption> *)routingOptionPush;
-(NSObject<IVISPERRoutingOption> *)routingOptionPush:(BOOL)animated;

-(NSObject<IVISPERRoutingOption> *)routingOptionModal;
-(NSObject<IVISPERRoutingOption> *)routingOptionModal:(BOOL)animated;

-(NSObject<IVISPERRoutingOption> *)backToRoute;
-(NSObject<IVISPERRoutingOption> *)backToRoute:(BOOL)animated;

-(NSObject<IVISPERRoutingOption> *)routingOptionPresentRootVC;
-(NSObject<IVISPERRoutingOption> *)routingOptionPresentRootVC:(BOOL)animated;

-(NSObject<IVISPERRoutingOption> *)routingOptionReplaceTopVC;
-(NSObject<IVISPERRoutingOption> *)routingOptionReplaceTopVC:(BOOL)animated;

-(NSObject<IVISPERRoutingOption> *)routingOptionShow;
-(NSObject<IVISPERRoutingOption> *)routingOptionShow:(BOOL)animated;

@end


text:
'use strict'

const disque = require('.')
const cli = disque.createClient(7711)

cli.info()(function * (err, info) {
  if (err) throw err
  console.log('Version:', info.disque_version)

  var add = []
  var discard = []
  var commandsInfo = {}
  var commands = yield cli.command()

  commands = commands.map(function (command) {
    commandsInfo[command[0]] = command.slice(1)
    return command[0]
  })

  commands.reduce(function (add, command) {
    if (cli.clientCommands.indexOf(command) === -1) add.push(command)
    return add
  }, add)
  console.log('Add:', add)

  cli.clientCommands.reduce(function (discard, command) {
    if (commands.indexOf(command) === -1) discard.push(command)
    return discard
  }, discard)
  console.log('Discard:', discard)

  info = {}
  Object.keys(commandsInfo).sort().forEach(function (command) {
    info[command] = commandsInfo[command]
  })
  console.log(info)

  process.exit()
})()


text:
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using Aspose.Cells.Translation.Internal;
using Aspose.Cells.Translation.Internal.RequestHandlers;
using Aspose.Cells.Translation.Models;
using Aspose.Cells.Translation.Models.Requests;

namespace Aspose.Cells.Translation.Api
{
    public class FileApi
    {
        private readonly ApiInvoker _apiInvoker;
        private readonly TranslationConfiguration _configuration;

        public FileApi(TranslationConfiguration configuration)
        {
            _configuration = configuration;

            var requestHandlers = new List<IRequestHandler>();
            switch (_configuration.AuthType)
            {
                case AuthType.RequestSignature:
                    requestHandlers.Add(new AuthWithSignatureRequestHandler(_configuration));
                    break;
                case AuthType.OAuth2:
                    requestHandlers.Add(new OAuthRequestHandler(_configuration));
                    break;
                case AuthType.ExternalAuth:
                    requestHandlers.Add(new ExternalAuthorizationRequestHandler(_configuration));
                    break;
                case AuthType.JWT:
                    requestHandlers.Add(new JwtRequestHandler(_configuration));
                    break;
            }

            requestHandlers.Add(new DebugLogRequestHandler(_configuration));
            requestHandlers.Add(new ApiExceptionRequestHandler());
            _apiInvoker = new ApiInvoker(requestHandlers);
        }

        public Stream DownloadFile(DownloadFileRequest request)
        {
            // verify the required parameter 'path' is set
            if (request.Path == null)
            {
                throw new ApiException(400, "Missing required parameter 'path' when calling DownloadFile");
            }

            // create path and map variables
            var resourcePath = _configuration.GetApiRootUrl() + "/storage/file/{path}";
            resourcePath = Regex
                .Replace(resourcePath, "\\*", string.Empty)
                .Replace("&", "&")
                .Replace("/?", "?");
            resourcePath = UrlHelper.AddPathParameter(resourcePath, "path", request.Path);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "storageName", request.StorageName);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "versionId", request.VersionId);

            try
            {
                return _apiInvoker.InvokeBinaryApi(
                    resourcePath,
                    "GET",
                    null,
                    null,
                    null);
            }
            catch (ApiException ex)
            {
                if (ex.ErrorCode == 404)
                {
                    return null;
                }

                throw;
            }
        }

        public FilesUploadResult UploadFile(UploadFileRequest request)
        {
            // verify the required parameter 'path' is set
            if (request.Path == null)
            {
                throw new ApiException(400, "Missing required parameter 'path' when calling UploadFile");
            }

            // verify the required parameter 'file' is set
            if (request.File == null)
            {
                throw new ApiException(400, "Missing required parameter 'file' when calling UploadFile");
            }

            // create path and map variables
            var resourcePath = _configuration.GetApiRootUrl() + "/storage/file/{path}";
            resourcePath = Regex
                .Replace(resourcePath, "\\*", string.Empty)
                .Replace("&", "&")
                .Replace("/?", "?");
            var formParams = new Dictionary<string, object>();
            resourcePath = UrlHelper.AddPathParameter(resourcePath, "path", request.Path);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "storageName", request.StorageName);

            if (request.File != null)
            {
                formParams.Add("file", _apiInvoker.ToFileInfo(request.File, "File"));
            }

            try
            {
                var response = _apiInvoker.InvokeApi(
                    resourcePath,
                    "PUT",
                    null,
                    null,
                    formParams);
                if (response != null)
                {
                    return (FilesUploadResult) SerializationHelper.Deserialize(response, typeof(FilesUploadResult));
                }

                var errors = new List<Error> {new Error {Code = "500", Message = "response null"}};
                return new FilesUploadResult {Errors = errors};
            }
            catch (ApiException ex)
            {
                var errors = new List<Error> {new Error {Code = ex.ErrorCode.ToString(), Message = ex.Message, Description = ex.StackTrace}};
                return new FilesUploadResult {Errors = errors};
            }
        }
    }
}


text:
<?php
ini_set('display_errors', 0);
error_reporting(-1);

require_once("vendor/autoload.php");

$timezone = CoreApp\AppConfig::getTimeZone();
date_default_timezone_set($timezone);

//$analytics = new CoreApp\Controller\Analytics();

//FRONTCONTROLLER

$url = isset($_GET["url"]) ? $_GET["url"] : "Index";

$app = new CoreApp\App($url);
$app->build();


text:
/*global GamepadManager*/
/*eslint no-unused-vars: ["error", { "vars": "local" }]*/

class Input {
    /**
     * Input handling for WebRTC web app
     *
     * @constructor
     * @param {Element} [element]
     *    Video element to attach events to
     * @param {function} [send]
     *    Function used to send input events to server.
     */
    constructor(element, send) {
        /**
         * @type {Element}
         */
        this.element = element;

        /**
         * @type {function}
         */
        this.send = send;

        /**
         * @type {boolean}
         */
        this.mouseRelative = false;

        /**
         * @type {Object}
         */
        this.m = null;

        /**
         * @type {Integer}
         */
        this.buttonMask = 0;

        /**
         * @type {Guacamole.Keyboard}
         */
        this.keyboard = null;

        /**
         * @type {GamepadManager}
         */
        this.gamepadManager = null;

        /**
         * @type {Integer}
         */
        this.x = 0;

        /**
         * @type {Integer}
         */
        this.y = 0;

        /**
         * @type {function}
         */
        this.onmenuhotkey = null;

        /**
         * @type {function}
         */
        this.onfullscreenhotkey = null;

        /**
         * @type {function}
         */
        this.ongamepadconnected = null;

        /**
         * @type {function}
         */
        this.ongamepaddisconneceted = null;

        /**
         * List of attached listeners, record keeping used to detach all.
         * @type {Array}
         */
        this.listeners = [];

        /**
         * @type {function}
         */
        this.onresizeend = null;

        // internal variables used by resize start/end functions.
        this._rtime = null;
        this._rtimeout = false;
        this._rdelta = 200;
    }

    /**
     * Handles mouse button and motion events and sends them to WebRTC app.
     * @param {MouseEvent} event
     */
    _mouseButtonMovement(event) {
        const down = (event.type === 'mousedown' ? 1 : 0);
        var mtype = "m";

        if (event.type === 'mousemove' && !this.m) return;

        if (!document.pointerLockElement) {
            if (this.mouseRelative)
                event.target.requestPointerLock();
        }

        // Hotkey to enable pointer lock, CTRL-SHIFT-LeftButton
        if (down && event.button === 0 && event.ctrlKey && event.shiftKey) {
            event.target.requestPointerLock();
            return;
        }

        if (document.pointerLockElement) {
            mtype = "m2";
            this.x = event.movementX;
            this.y = event.movementY;
        } else if (event.type === 'mousemove') {
            this.x = this._clientToServerX(event.clientX);
            this.y = this._clientToServerY(event.clientY);
        }

        if (event.type === 'mousedown' || event.type === 'mouseup') {
            var mask = 1 << event.button;
            if (down) {
                this.buttonMask |= mask;
            } else {
                this.buttonMask &= ~mask;
            }
        }

        var toks = [
            mtype,
            this.x,
            this.y,
            this.buttonMask
        ];

        this.send(toks.join(","));
    }

    /**
     * Handles touch events and sends them to WebRTC app.
     * @param {TouchEvent} event
     */
    _touch(event) {
        var mtype = "m";
        var mask = 1;

        if (event.type === 'touchstart') {
            this.buttonMask |= mask;
        } else if (event.type === 'touchend') {
            this.buttonMask &= ~mask;
        } else if (event.type === 'touchmove') {
            event.preventDefault();
        }

        this.x = this._clientToServerX(event.changedTouches[0].clientX);
        this.y = this._clientToServerY(event.changedTouches[0].clientY);

        var toks = [
            mtype,
            this.x,
            this.y,
            this.buttonMask
        ];

        this.send(toks.join(","));
    }

    /**
     * Handles mouse wheel events and sends them to WebRTC app.
     * @param {MouseWheelEvent} event
     */
    _mouseWheel(event) {
        var mtype = (document.pointerLockElement ? "m2" : "m");
        var button = 3;
        if (event.deltaY < 0) {
            button = 4;
        }
        var mask = 1 << button;
        var toks;
        // Simulate button press and release.
        for (var i = 0; i < 2; i++) {
            if (i === 0)
                this.buttonMask |= mask;
            else
                this.buttonMask &= ~mask;
            toks = [
                mtype,
                this.x,
                this.y,
                this.buttonMask
            ];
            this.send(toks.join(","));
        }

        event.preventDefault();
    }

    /**
     * Captures mouse context menu (right-click) event and prevents event propagation.
     * @param {MouseEvent} event
     */
    _contextMenu(event) {
        event.preventDefault();
    }

    /**
     * Captures keyboard events to detect pressing of CTRL-SHIFT hotkey.
     * @param {KeyboardEvent} event
     */
    _key(event) {

        // disable problematic browser shortcuts
        if (event.code === 'F5' && event.ctrlKey ||
            event.code === 'KeyI' && event.ctrlKey && event.shiftKey ||
            event.code === 'F11') {
            event.preventDefault();
            return;
        }

        // capture menu hotkey
        if (event.type === 'keydown' && event.code === 'KeyM' && event.ctrlKey && event.shiftKey) {
            if (document.fullscreenElement === null && this.onmenuhotkey !== null) {
                this.onmenuhotkey();
                event.preventDefault();
            }

            return;
        }

        // capture fullscreen hotkey
        if (event.type === 'keydown' && event.code === 'KeyF' && event.ctrlKey && event.shiftKey) {
            if (document.fullscreenElement === null && this.onfullscreenhotkey !== null) {
                this.onfullscreenhotkey();
                event.preventDefault();
            }
            return;
        }
    }

    /**
     * Sends WebRTC app command to toggle display of the remote mouse pointer.
     */
    _pointerLock() {
        if (document.pointerLockElement) {
            this.send("p,1");
        } else {
            this.send("p,0");
        }
    }

    /**
     * Sends WebRTC app command to hide the remote pointer when exiting pointer lock.
     */
    _exitPointerLock() {
        document.exitPointerLock();
        // hide the pointer.
        this.send("p,0");
    }

    /**
     * Captures display and video dimensions required for computing mouse pointer position.
     * This should be fired whenever the window size changes.
     */
    _windowMath() {
        const windowW = this.element.offsetWidth;
        const windowH = this.element.offsetHeight;
        const frameW = this.element.videoWidth;
        const frameH = this.element.videoHeight;

        const multi = Math.min(windowW / frameW, windowH / frameH);
        const vpWidth = frameW * multi;
        const vpHeight = (frameH * multi);

        this.m = {
            mouseMultiX: frameW / vpWidth,
            mouseMultiY: frameH / vpHeight,
            mouseOffsetX: Math.max((windowW - vpWidth) / 2.0, 0),
            mouseOffsetY: Math.max((windowH - vpHeight) / 2.0, 0),
            centerOffsetX: (document.documentElement.clientWidth - this.element.offsetWidth) / 2.0,
            centerOffsetY: (document.documentElement.clientHeight - this.element.offsetHeight) / 2.0,
            scrollX: window.scrollX,
            scrollY: window.scrollY,
            frameW,
            frameH,
        };
    }

    /**
     * Translates pointer position X based on current window math.
     * @param {Integer} clientX
     */
    _clientToServerX(clientX) {
        let serverX = Math.round((clientX - this.m.mouseOffsetX - this.m.centerOffsetX + this.m.scrollX) * this.m.mouseMultiX);

        if (serverX === this.m.frameW - 1) serverX = this.m.frameW;
        if (serverX > this.m.frameW) serverX = this.m.frameW;
        if (serverX < 0) serverX = 0;

        return serverX;
    }

    /**
     * Translates pointer position Y based on current window math.
     * @param {Integer} clientY
     */
    _clientToServerY(clientY) {
        let serverY = Math.round((clientY - this.m.mouseOffsetY - this.m.centerOffsetY + this.m.scrollY) * this.m.mouseMultiY);

        if (serverY === this.m.frameH - 1) serverY = this.m.frameH;
        if (serverY > this.m.frameH) serverY = this.m.frameH;
        if (serverY < 0) serverY = 0;

        return serverY;
    }

    /**
     * Sends command to WebRTC app to connect virtual joystick and initializes the local GamepadManger.
     * @param {GamepadEvent} event
     */
    _gamepadConnected(event) {
        console.log("Gamepad connected at index %d: %s. %d buttons, %d axes.",
            event.gamepad.index, event.gamepad.id,
            event.gamepad.buttons.length, event.gamepad.axes.length);

        if (this.ongamepadconnected !== null) {
            this.ongamepadconnected(event.gamepad.id);
        }

        // Initialize the gamepad manager.
        this.gamepadManager = new GamepadManager(event.gamepad, this._gamepadButton.bind(this), this._gamepadAxis.bind(this), this._gamepadDisconnect.bind(this));

        // Send joystick connect message over data channel.
        this.send("js,c," + this.gamepadManager.numAxes + "," + this.gamepadManager.numButtons);
    }

    /**
     * Sends joystick disconnect command to WebRTC app.
     */
    _gamepadDisconnect() {
        console.log("Gamepad disconnected");

        if (this.ongamepaddisconneceted !== null) {
            this.ongamepaddisconneceted();
        }

        this.send("js,d")
    }

    /**
     * Send gamepad button to WebRTC app.
     *
     * @param {number} gp_num  - the gamepad number
     * @param {number} btn_num - the uinput converted button number
     * @param {number} val - the button value, 1 or 0 for pressed or not-pressed.
     */
    _gamepadButton(gp_num, btn_num, val) {
        this.send("js,b," + btn_num + "," + val);
    }

    /**
     * Send the gamepad axis to the WebRTC app.
     *
     * @param {number} gp_num - the gamepad number
     * @param {number} axis_num - the uinput converted axis number
     * @param {number} val - the normalize value between [0, 255]
     */
    _gamepadAxis(gp_num, axis_num, val) {
        this.send("js,a," + axis_num + "," + val)
    }

    /**
     * When fullscreen is entered, request keyboard and pointer lock.
     */
    _onFullscreenChange() {
        if (document.fullscreenElement !== null) {
            // Enter fullscreen
            this.requestKeyboardLock();
            this.element.requestPointerLock();
        }
        // Reset local keyboard. When holding to exit full-screen the escape key can get stuck.
        this.keyboard.reset();

        // Reset stuck keys on server side.
        this.send("kr");
    }

    /**
     * Called when window is being resized, used to detect when resize ends so new resolution can be sent.
     */
    _resizeStart() {
        this._rtime = new Date();
        if (this._rtimeout === false) {
            this._rtimeout = true;
            setTimeout(() => { this._resizeEnd() }, this._rdelta);
        }
    }

    /**
     * Called in setTimeout loop to detect if window is done being resized.
     */
    _resizeEnd() {
        if (new Date() - this._rtime < this._rdelta) {
            setTimeout(() => { this._resizeEnd() }, this._rdelta);
        } else {
            this._rtimeout = false;
            if (this.onresizeend !== null) {
                this.onresizeend();
            }
        }
    }

    /**
     * Attaches input event handles to docuemnt, window and element.
     */
    attach() {
        this.listeners.push(addListener(this.element, 'resize', this._windowMath, this));
        this.listeners.push(addListener(this.element, 'mousewheel', this._mouseWheel, this));
        this.listeners.push(addListener(this.element, 'contextmenu', this._contextMenu, this));
        this.listeners.push(addListener(this.element.parentElement, 'fullscreenchange', this._onFullscreenChange, this));
        this.listeners.push(addListener(document, 'pointerlockchange', this._pointerLock, this));
        this.listeners.push(addListener(window, 'keydown', this._key, this));
        this.listeners.push(addListener(window, 'keyup', this._key, this));
        this.listeners.push(addListener(window, 'resize', this._windowMath, this));
        this.listeners.push(addListener(window, 'resize', this._resizeStart, this));

        // Gamepad support
        this.listeners.push(addListener(window, 'gamepadconnected', this._gamepadConnected, this));
        this.listeners.push(addListener(window, 'gamepaddisconnected', this._gamepadDisconnect, this));

        if ('ontouchstart' in window) {
            this.listeners.push(addListener(window, 'touchstart', this._touch, this));
            this.listeners.push(addListener(this.element, 'touchend', this._touch, this));
            this.listeners.push(addListener(this.element, 'touchmove', this._touch, this));

            console.log("Enabling mouse pointer display for touch devices.");
            this.send("p,1");
        } else {
            this.listeners.push(addListener(this.element, 'mousemove', this._mouseButtonMovement, this));
            this.listeners.push(addListener(this.element, 'mousedown', this._mouseButtonMovement, this));
            this.listeners.push(addListener(this.element, 'mouseup', this._mouseButtonMovement, this));
        }

        // Adjust for scroll offset
        this.listeners.push(addListener(window, 'scroll', () => {
            this.m.scrollX = window.scrollX;
            this.m.scrollY = window.scrollY;
        }, this));

        // Using guacamole keyboard because it has the keysym translations.
        this.keyboard = new Guacamole.Keyboard(window);
        this.keyboard.onkeydown = (keysym) => {
            this.send("kd," + keysym);
        };
        this.keyboard.onkeyup = (keysym) => {
            this.send("ku," + keysym);
        };

        this._windowMath();
    }

    detach() {
        removeListeners(this.listeners);
        this._exitPointerLock();
        if (this.keyboard) {
            this.keyboard.onkeydown = null;
            this.keyboard.onkeyup = null;
            this.keyboard.reset();
            delete this.keyboard;
            this.send("kr");
        }
    }

    /**
     * Request keyboard lock, must be in fullscreen mode to work.
     */
    requestKeyboardLock() {
        // event codes: https://www.w3.org/TR/uievents-code/#key-alphanumeric-writing-system
        const keys = [
            "AltLeft",
            "AltRight",
            "Tab",
            "Escape",
            "ContextMenu",
            "MetaLeft",
            "MetaRight"
        ];
        console.log("requesting keyboard lock");
        navigator.keyboard.lock(keys).then(
            () => {
                console.log("keyboard lock success");
            }
        ).catch(
            (e) => {
                console.log("keyboard lock failed: ", e);
            }
        )
    }

    getWindowResolution() {
        return [
            parseInt(this.element.offsetWidth * window.devicePixelRatio),
            parseInt(this.element.offsetHeight * window.devicePixelRatio)
        ];
    }
}

/**
 * Helper function to keep track of attached event listeners.
 * @param {Object} obj
 * @param {string} name
 * @param {function} func
 * @param {Object} ctx
 */
function addListener(obj, name, func, ctx) {
    const newFunc = ctx ? func.bind(ctx) : func;
    obj.addEventListener(name, newFunc);

    return [obj, name, newFunc];
}

/**
 * Helper function to remove all attached event listeners.
 * @param {Array} listeners
 */
function removeListeners(listeners) {
    for (const listener of listeners)
        listener[0].removeEventListener(listener[1], listener[2]);
}


text:
describe CloudNetworkHelper::TextualSummary do
  include_examples "textual_group", "Relationships", %i[
    parent_ems_cloud
    ems_network
    cloud_tenant
    instances
    cloud_subnets
    network_routers
    floating_ips
    custom_button_events
  ]
  include_examples "textual_group", "Properties", %i[name description type status ems_ref]
end


text:
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {

OsdDrawContext::~OsdDrawContext() {}

void
OsdDrawContext::ConvertPatchArrays(FarPatchTables::PatchArrayVector const &farPatchArrays,
                                   OsdDrawContext::PatchArrayVector &osdPatchArrays,
                                   int maxValence, int numElements)
{
    // create patch arrays for drawing (while duplicating subpatches for transition patch arrays)
    static int subPatchCounts[] = { 1, 3, 4, 4, 4, 2 }; // number of subpatches for patterns

    int numTotalPatchArrays = 0;
    for (int i = 0; i < (int)farPatchArrays.size(); ++i) {
        FarPatchTables::TransitionPattern pattern = farPatchArrays[i].GetDescriptor().GetPattern();
        numTotalPatchArrays += subPatchCounts[(int)pattern];
    }

    // allocate drawing patch arrays
    osdPatchArrays.clear();
    osdPatchArrays.reserve(numTotalPatchArrays);

    for (int i = 0; i < (int)farPatchArrays.size(); ++i) {
        FarPatchTables::TransitionPattern pattern = farPatchArrays[i].GetDescriptor().GetPattern();
        int numSubPatches = subPatchCounts[(int)pattern];

        FarPatchTables::PatchArray const &parray = farPatchArrays[i];
        FarPatchTables::Descriptor srcDesc = parray.GetDescriptor();

        for (int j = 0; j < numSubPatches; ++j) {
            PatchDescriptor desc(srcDesc, maxValence, j, numElements);

            osdPatchArrays.push_back(PatchArray(desc, parray.GetArrayRange()));
        }
    }
}

} // end namespace OPENSUBDIV_VERSION
} // end namespace OpenSubdiv


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bull. N. Y. St. Mus. 157: 45 & 107 (1912)

#### Original name
Cercosporella mirabilis Peck

### Remarks
null


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You 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.
  -->

<sql-cases>
    <sql-case id="update_without_alias" value="UPDATE t_order SET status = ? WHERE order_id = ? AND user_id = ?" />
    <sql-case id="update_with_alias" value="UPDATE t_order AS o SET o.status = ? WHERE o.order_id = ? AND o.user_id = ?" db-types="MySQL,H2" />
    <sql-case id="update_equal_with_geography" value="UPDATE t_order SET start_time = ?, status = 0, start_point = ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')'), rule = ?::jsonb, discount_type = ?, order_type = ? WHERE user_id = ? AND order_id = ?" db-types="PostgreSQL" />
    <sql-case id="update_without_condition" value="UPDATE t_order o SET o.status = 'finished'" db-types="MySQL,H2" />
    <sql-case id="update_with_extra_keywords" value="UPDATE LOW_PRIORITY IGNORE t_order SET status = ? WHERE order_id = ? AND user_id = ?" db-types="MySQL" />
    <sql-case id="update_with_special_character" value="UPDATE `t_order` SET `status` = ? WHERE `order_id` = ? AND user_id = ?" db-types="MySQL" />
    <sql-case id="update_with_special_comments" value="UPDATE /*+ index(field1) */ ONLY t_order SET status=? WHERE order_id = ? AND user_id = ? RETURN * LOG ERRORS INTO TABLE_LOG" db-types="Oracle" />
    <sql-case id="update_without_parameters" value="UPDATE t_order SET status = 'update' WHERE order_id = 1000 AND user_id = 10" />
    <sql-case id="update_with_or" value="UPDATE t_order SET status = 'update' WHERE (order_id = ? OR order_id = ?) AND user_id = ?" />
    <sql-case id="update_with_set_calculation" value="UPDATE t_order SET status = status - ? WHERE order_id = ? AND user_id = ?" />
    <sql-case id="update_with_where_calculation" value="UPDATE t_order SET status = ? WHERE order_id = order_id - ? AND user_id = ?" />
</sql-cases>


text:
package com.planet_ink.coffee_mud.Races;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

public class WereAnimal extends StdRace
{
	@Override
	public String ID()
	{
		return "WereAnimal";
	}

	private final static String localizedStaticName = CMLib.lang().L("WereAnimal");

	@Override
	public String name()
	{
		return localizedStaticName;
	}

	@Override
	public int shortestMale()
	{
		return 59;
	}

	@Override
	public int shortestFemale()
	{
		return 59;
	}

	@Override
	public int heightVariance()
	{
		return 12;
	}

	@Override
	public int lightestWeight()
	{
		return 80;
	}

	@Override
	public int weightVariance()
	{
		return 80;
	}

	@Override
	public long forbiddenWornBits()
	{
		return 0;
	}

	private final static String localizedStaticRacialCat = CMLib.lang().L("Animal");

	@Override
	public String racialCategory()
	{
		return localizedStaticRacialCat;
	}

	private final String[]	racialAbilityNames			= { "AnimalSpeak" };
	private final int[]		racialAbilityLevels			= { 1 };
	private final int[]		racialAbilityProficiencies	= { 100 };
	private final boolean[]	racialAbilityQuals			= { false };

	@Override
	protected String[] racialAbilityNames()
	{
		return racialAbilityNames;
	}

	@Override
	protected int[] racialAbilityLevels()
	{
		return racialAbilityLevels;
	}

	@Override
	protected int[] racialAbilityProficiencies()
	{
		return racialAbilityProficiencies;
	}

	@Override
	protected boolean[] racialAbilityQuals()
	{
		return racialAbilityQuals;
	}

	//  							  an ey ea he ne ar ha to le fo no gi mo wa ta wi
	private static final int[] parts={0 ,2 ,2 ,1 ,1 ,2 ,2 ,1 ,2 ,2 ,1 ,0 ,1 ,1 ,1 ,0 };

	@Override
	public int[] bodyMask()
	{
		return parts;
	}

	private final int[]	agingChart	= { 0, 4, 8, 12, 16, 20, 24, 28, 32 };

	@Override
	public int[] getAgingChart()
	{
		return agingChart;
	}

	protected static Vector<RawMaterial>	resources	= new Vector<RawMaterial>();

	@Override
	public List<RawMaterial> myResources()
	{
		synchronized(resources)
		{
			if(resources.size()==0)
			{
				resources.addElement(makeResource
				(L("some @x1 claws",name().toLowerCase()),RawMaterial.RESOURCE_BONE));
				for(int i=0;i<4;i++)
				{
					resources.addElement(makeResource
					(L("a strip of @x1 hide",name().toLowerCase()),RawMaterial.RESOURCE_FUR));
				}
				for(int i=0;i<2;i++)
				{
					resources.addElement(makeResource
					(L("a pound of @x1 meat",name().toLowerCase()),RawMaterial.RESOURCE_MEAT));
				}
				resources.addElement(makeResource
				(L("some @x1 blood",name().toLowerCase()),RawMaterial.RESOURCE_BLOOD));
				resources.addElement(makeResource
				(L("a pile of @x1 bones",name().toLowerCase()),RawMaterial.RESOURCE_BONE));
			}
		}
		return resources;
	}

	@Override
	public Weapon myNaturalWeapon()
	{
		if(naturalWeapon==null)
		{
			naturalWeapon=CMClass.getWeapon("StdWeapon");
			naturalWeapon.setName(L("sharp claws"));
			naturalWeapon.setMaterial(RawMaterial.RESOURCE_BONE);
			naturalWeapon.setUsesRemaining(1000);
			naturalWeapon.setWeaponDamageType(Weapon.TYPE_PIERCING);
		}
		return naturalWeapon;
	}

	@Override
	public String healthText(MOB viewer, MOB mob)
	{
		final double pct=(CMath.div(mob.curState().getHitPoints(),mob.maxState().getHitPoints()));

		if(pct<.10)
			return L("^r@x1^r is hovering on deaths door!^N",mob.name(viewer));
		else
		if(pct<.20)
			return L("^r@x1^r is covered in blood and matted hair.^N",mob.name(viewer));
		else
		if(pct<.30)
			return L("^r@x1^r is bleeding badly from lots of wounds.^N",mob.name(viewer));
		else
		if(pct<.40)
			return L("^y@x1^y has large patches of bloody matted fur.^N",mob.name(viewer));
		else
		if(pct<.50)
			return L("^y@x1^y has some bloody matted fur.^N",mob.name(viewer));
		else
		if(pct<.60)
			return L("^p@x1^p has a lot of cuts and gashes.^N",mob.name(viewer));
		else
		if(pct<.70)
			return L("^p@x1^p has a few cut patches.^N",mob.name(viewer));
		else
		if(pct<.80)
			return L("^g@x1^g has a cut patch of fur.^N",mob.name(viewer));
		else
		if(pct<.90)
			return L("^g@x1^g has some disheveled fur.^N",mob.name(viewer));
		else
		if(pct<.99)
			return L("^g@x1^g has some misplaced hairs.^N",mob.name(viewer));
		else
			return L("^c@x1^c is in perfect health.^N",mob.name(viewer));
	}
}


text:
<?php

namespace Sf\LoanBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Loan
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Sf\LoanBundle\Entity\LoanRepository")
 */
class Loan
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @var string
     *
     * @ORM\Column(name="item", type="string", length=255)
     */
    private $item;

    /**
     * @ORM\ManyToOne(targetEntity="Sf\UserBundle\Entity\User", inversedBy="borrowedThings")
     * @ORM\JoinColumn(nullable=false)
     */
    private $borrower;

    /**
     * @ORM\ManyToOne(targetEntity="Sf\UserBundle\Entity\User", inversedBy="lentThings")
     * @ORM\JoinColumn(nullable=false)
     */
    private $lender;

    /**
     * @var integer
     *
     * @ORM\Column(name="createdBy", type="integer")
     */
    private $createdBy;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="creationDate", type="datetime")
     */
    private $creationDate;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="modificationDate", type="datetime")
     */
    private $modificationDate;

    /**
     * @ORM\ManyToOne(targetEntity="Sf\UserBundle\Entity\Foyer", inversedBy="tasks")
     * @ORM\JoinColumn(nullable=false)
     */
    private $foyer;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set item
     *
     * @param string $item
     * @return Loan
     */
    public function setItem($item)
    {
        $this->item = $item;

        return $this;
    }

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

    /**
     * Set borrower
     *
     * @param Sf\UserBundle\Entity\User $borrower
     */
    public function setBorrower(\Sf\UserBundle\Entity\User $borrower)
    {
        $this->borrower = $borrower;
    }

    /**
     * Get borrower
     *
     * @return Sf\UserBundle\Entity\User
     */
    public function getBorrower()
    {
        return $this->borrower;
    }

    /**
     * Set lender
     *
     * @param Sf\UserBundle\Entity\User $lender
     */
    public function setLender(\Sf\UserBundle\Entity\User $lender)
    {
        $this->lender = $lender;
    }

    /**
     * Get lender
     *
     * @return Sf\UserBundle\Entity\User
     */
    public function getLender()
    {
        return $this->lender;
    }

    /**
     * Set createdBy
     *
     * @param integer $createdBy
     * @return Loan
     */
    public function setCreatedBy($createdBy)
    {
        $this->createdBy = $createdBy;

        return $this;
    }

    /**
     * Get createdBy
     *
     * @return integer
     */
    public function getCreatedBy()
    {
        return $this->createdBy;
    }

    /**
     * Set creationDate
     *
     * @param \DateTime $creationDate
     * @return Loan
     */
    public function setCreationDate($creationDate)
    {
        $this->creationDate = $creationDate;

        return $this;
    }

    /**
     * Get creationDate
     *
     * @return \DateTime
     */
    public function getCreationDate()
    {
        return $this->creationDate;
    }

    /**
     * Set modificationDate
     *
     * @param \DateTime $modificationDate
     * @return Loan
     */
    public function setModificationDate($modificationDate)
    {
        $this->modificationDate = $modificationDate;

        return $this;
    }

    /**
     * Get modificationDate
     *
     * @return \DateTime
     */
    public function getModificationDate()
    {
        return $this->modificationDate;
    }

    /**
     * Set foyer
     *
     * @param Sf\UserBundle\Entity\Foyer $foyer
     */
    public function setFoyer(\Sf\UserBundle\Entity\Foyer $foyer)
    {
        $this->foyer = $foyer;
    }

    /**
     * Get foyer
     *
     * @return Sf\UserBundle\Entity\Foyer
     */
    public function getFoyer()
    {
        return $this->foyer;
    }
}