text:
<!-- This file was autogenerated via cilium cmdref, do not edit manually-->

## cilium completion

Output shell completion code

```
cilium completion [shell] [flags]
```

### Examples

```

# Installing bash completion on macOS using homebrew
## If running Bash 3.2 included with macOS
	brew install bash-completion
## or, if running Bash 4.1+
	brew install bash-completion@2
## afterwards you only need to run
	cilium completion bash > $(brew --prefix)/etc/bash_completion.d/cilium

# Installing bash completion on Linux
## Load the cilium completion code for bash into the current shell
	source <(cilium completion bash)
## Write bash completion code to a file and source if from .bash_profile
	cilium completion bash > ~/.cilium/completion.bash.inc
	printf "
	  # Cilium shell completion
	  source '$HOME/.cilium/completion.bash.inc'
	  " >> $HOME/.bash_profile
	source $HOME/.bash_profile

# Installing zsh completion on Linux/macOS
## Load the cilium completion code for zsh into the current shell
	source <(cilium completion zsh)
## Write zsh completion code to a file and source if from .zshrc
	cilium completion zsh > ~/.cilium/completion.zsh.inc
	printf "
	  # Cilium shell completion
	  source '$HOME/.cilium/completion.zsh.inc'
	  " >> $HOME/.zshrc
	source $HOME/.zshrc

# Installing fish completion on Linux/macOS
## Write fish completion code to fish specific location
	cilium completion fish > ~/.config/fish/completions/cilium.fish

```

### Options

```
  -h, --help   help for completion
```

### Options inherited from parent commands

```
      --config string   config file (default is $HOME/.cilium.yaml)
  -D, --debug           Enable debug messages
  -H, --host string     URI to server-side API
```

### SEE ALSO

* [cilium](cilium.md)	 - CLI


text:
* Added before_create, after_build, after_create callbacks (@beorc)

## 1.0.0

* Initial baseline for future change tracking

redpajama_set_name: RedPajamaGithub


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE253_Incorrect_Check_of_Function_Return_Value__char_putchar_07.c
Label Definition File: CWE253_Incorrect_Check_of_Function_Return_Value.label.xml
Template File: point-flaw-07.tmpl.c
*/
/*
 * @description
 * CWE: 253 Incorrect Check of Return Value
 * Sinks: putchar
 *    GoodSink: Correctly check if putchar() failed
 *    BadSink : Incorrectly check if putchar() failed
 * Flow Variant: 07 Control flow: if(staticFive==5) and if(staticFive!=5)
 *
 * */

#include "std_testcase.h"

#ifndef _WIN32
#include <wchar.h>
#endif

/* The variable below is not declared "const", but is never assigned
   any other value so a tool should be able to identify that reads of
   this will always give its initialized value. */
static int staticFive = 5;

#ifndef OMITBAD

void CWE253_Incorrect_Check_of_Function_Return_Value__char_putchar_07_bad()
{
    if(staticFive==5)
    {
        /* FLAW: putchar() might fail, in which case the return value will be EOF (-1), but
         * we are checking to see if the return value is 0 */
        if (putchar((int)'A') == 0)
        {
            printLine("putchar failed!");
        }
    }
}

#endif /* OMITBAD */

#ifndef OMITGOOD

/* good1() uses if(staticFive!=5) instead of if(staticFive==5) */
static void good1()
{
    if(staticFive!=5)
    {
        /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
        printLine("Benign, fixed string");
    }
    else
    {
        /* FIX: check for the correct return value */
        if (putchar((int)'A') == EOF)
        {
            printLine("putchar failed!");
        }
    }
}

/* good2() reverses the bodies in the if statement */
static void good2()
{
    if(staticFive==5)
    {
        /* FIX: check for the correct return value */
        if (putchar((int)'A') == EOF)
        {
            printLine("putchar failed!");
        }
    }
}

void CWE253_Incorrect_Check_of_Function_Return_Value__char_putchar_07_good()
{
    good1();
    good2();
}

#endif /* OMITGOOD */

/* Below is the main(). It is only used when building this testcase on
   its own for testing or for building a binary to use in testing binary
   analysis tools. It is not used when compiling all the testcases as one
   application, which is how source code analysis tools are tested. */

#ifdef INCLUDEMAIN

int main(int argc, char * argv[])
{
    /* seed randomness */
    srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
    printLine("Calling good()...");
    CWE253_Incorrect_Check_of_Function_Return_Value__char_putchar_07_good();
    printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
    printLine("Calling bad()...");
    CWE253_Incorrect_Check_of_Function_Return_Value__char_putchar_07_bad();
    printLine("Finished bad()");
#endif /* OMITBAD */
    return 0;
}

#endif


text:
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <sched.h>
#include <sys/mman.h>
#include <string.h>

#define MY_PRIORITY (99) /* we use 49 as the PRREMPT_RT use 50
                            as the priority of kernel tasklets
                            and interrupt handler by default */

#define MAX_SAFE_STACK (8*1024) /* The maximum stack size which is
                                   guaranteed safe to access without
                                   faulting */

void stack_prefault(void) {

        unsigned char dummy[MAX_SAFE_STACK];

        memset(dummy, 0, MAX_SAFE_STACK);
        return;
}

int main(int argc, char* argv[])
{

        struct sched_param param;

        /* Declare ourself as a real time task */

        param.sched_priority = MY_PRIORITY;
        if(sched_setscheduler(0, SCHED_FIFO, &param) == -1) {
                perror("sched_setscheduler failed");
                exit(-1);
        }

        /* Lock memory */

        if(mlockall(MCL_CURRENT|MCL_FUTURE) == -1) {
                perror("mlockall failed");
                exit(-2);
        }

        /* Pre-fault our stack */

        stack_prefault();

        while(1) {

                /* do the stuff */
		fork();

   		}
}


text:
import { MemberEntity } from '../../model';
import { members } from './mockData';

const baseURL = 'https://api.github.com/orgs/lemoncode';
const userURL = 'https://api.github.com/user';
let mockMembers = members;

const fetchMembers = (): Promise<MemberEntity[]> => {
  return Promise.resolve(mockMembers);
};

const fetchMembersAsync = (): Promise<MemberEntity[]> => {
  const membersURL = `${baseURL}/members`;

  return fetch(membersURL)
    .then((response) => (response.json()))
    .then(mapToMembers);
};

const mapToMembers = (githubMembers: any[]): MemberEntity[] => {
  return githubMembers.map(mapToMember);
};

const mapToMember = (githubMember): MemberEntity => {
  return {
    id: githubMember.id,
    login: githubMember.login,
    avatar_url: githubMember.avatar_url,
  };
};

const saveMember = (member: MemberEntity): Promise<boolean> => {
  const index = mockMembers.findIndex(m => m.id === member.id);

  index >= 0 ?
    updateMember(member, index) :
    insertMember(member);

  return Promise.resolve(true);
};

const updateMember = (member: MemberEntity, index: number) => {
  mockMembers = [
    ...mockMembers.slice(0, index),
    member,
    ...mockMembers.slice(index + 1),
  ];
};

const insertMember = (member: MemberEntity) => {
  member.id = mockMembers.length;

  mockMembers = [
    ...mockMembers,
    member,
  ];
};

const fetchMemberById = (id: number): Promise<MemberEntity> => {
  const member = mockMembers.find(m => m.id === id);

  return Promise.resolve(member);
}

const fetchMemberByIdAsync = (id: number): Promise<MemberEntity> => {
  const membersURL = `${userURL}/${id}`;
  return fetch(membersURL)
    .then((response) => (response.json()))
    .then(mapToMember);
}

export const memberAPI = {
  fetchMembers,
  fetchMembersAsync,
  saveMember,
  fetchMemberById,
  fetchMemberByIdAsync,

};


text:
        <link rel="stylesheet" type="text/css" href="../../../funcunit/qunit/qunit.css" />
        <title>Slides.Presentation.List Test</title>

Slides.Presentation.List Test


text:
package instance

import (
	"fmt"

	"github.com/golang/glog"
	"github.com/kubernetes-incubator/service-catalog/cmd/svcat/output"
	"github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1"

	"github.com/kubernetes-incubator/service-catalog/cmd/svcat/command"
	"github.com/spf13/cobra"
)

type deprovisonCmd struct {
	*command.Namespaced
	*command.WaitableCommand

	instanceName string
}

// NewDeprovisionCmd builds a "svcat deprovision" command
func NewDeprovisionCmd(cxt *command.Context) *cobra.Command {
	deprovisonCmd := &deprovisonCmd{
		Namespaced:      command.NewNamespacedCommand(cxt),
		WaitableCommand: command.NewWaitableCommand(),
	}
	cmd := &cobra.Command{
		Use:   "deprovision NAME",
		Short: "Deletes an instance of a service",
		Example: command.NormalizeExamples(`
  svcat deprovision wordpress-mysql-instance
`),
		PreRunE: command.PreRunE(deprovisonCmd),
		RunE:    command.RunE(deprovisonCmd),
	}
	command.AddNamespaceFlags(cmd.Flags(), false)
	deprovisonCmd.AddWaitFlags(cmd)

	return cmd
}

func (c *deprovisonCmd) Validate(args []string) error {
	if len(args) == 0 {
		return fmt.Errorf("an instance name is required")
	}
	c.instanceName = args[0]

	return nil
}

func (c *deprovisonCmd) Run() error {
	return c.deprovision()
}

func (c *deprovisonCmd) deprovision() error {
	err := c.App.Deprovision(c.Namespace, c.instanceName)
	if err != nil {
		return err
	}

	if c.Wait {
		glog.V(2).Infof("Waiting for the instance to be deleted...")

		var instance *v1beta1.ServiceInstance
		instance, err = c.App.WaitForInstance(c.Namespace, c.instanceName, c.Interval, c.Timeout)

		// The instance failed to deprovision cleanly, dump out more information on why
		if c.App.IsInstanceFailed(instance) {
			output.WriteInstanceDetails(c.Output, instance)
		}
	}

	if err == nil {
		output.WriteDeletedResourceName(c.Output, c.instanceName)
	}
	return err
}


text:
(function (enyo, scope) {
	/**
	* Fires after the [popup]{@link enyo.Popup} is shown.
	*
	* @event enyo.Popup#onShow
	* @type {Object}
	* @property {Object} sender - The [component]{@link enyo.Component} that most recently
	*	propagated the {@glossary event}.
	* @property {Object} event - An [object]{@glossary Object} containing event information.
	* @public
	*/

	/**
	* Fires after the [popup]{@link enyo.Popup} is hidden.
	*
	* @event enyo.Popup#onHide
	* @type {Object}
	* @property {Object} sender - The [component]{@link enyo.Component} that most recently
	*	propagated the {@glossary event}.
	* @property {Object} event - An [object]{@glossary Object} containing event information.
	* @public
	*/

	/**
	* {@link enyo.Popup} is a [control]{@link enyo.Control} used to display certain content
	* on top of other content.
	*
	* Popups are initially hidden on creation; they may be shown by calling the
	* [show()]{@link enyo.Control#show} method and re-hidden by calling
	* [hide()]{@link enyo.Control#hide}. Popups may be centered using the
	* [centered]{@link enyo.Popup#centered} property; if not centered, they should
	* be given a specific position.
	*
	* A popup may be optionally floated above all
	* [application]{@link enyo.Application} content by setting its
	* [floating]{@link enyo.Popup#floating} property to `true`. This has the
	* advantage of guaranteeing that the popup will be displayed on top of other
	* content. This usage is appropriate when the popup does not need to scroll
	* along with other content.
	*
	* To avoid obscuring popup contents, scrims require the dialog to be floating;
	* otherwise, they won't render. A modal popup will get a transparent scrim
	* unless the popup isn't floating. To get a translucent scrim when modal,
	* specify `[scrim]{@link enyo.Popup#scrim}: true` and
	* `[scrimWhenModal]{@link enyo.Popup#scrimWhenModal}: false`.
	*
	* Finally, there is a WebKit bug affecting the behavior of popups that are
	* displayed on top of text input controls.  For more information, including a
	* workaround, see the documentation on
	* [Popups]{@linkplain $dev-guide/building-apps/controls/popups.html}
	* in the Enyo Developer Guide.
	*
	* @class enyo.Popup
	* @extends enyo.Control
	* @ui
	* @public
	*/
	enyo.kind(
		/** @lends enyo.Popup.prototype */ {

		/**
		* @private
		*/
		name: 'enyo.Popup',

		/**
		* @private
		*/
		kind: 'enyo.Control',

		/**
		* @private
		*/
		noDefer: true,

		/**
		* @private
		*/
		classes: 'enyo-popup enyo-no-touch-action',

		/**
		* @private
		*/
		published:
			/** @lends enyo.Popup.prototype */ {

			/**
			* Set to `true` to prevent [controls]{@link enyo.Control} outside the
			* [popup]{@link enyo.Popup} from receiving [events]{@glossary event} while the
			* popup is showing.
			*
			* @type {Boolean}
			* @default false
			* @public
			*/
			modal: false,

			/**
			* By default, the [popup]{@link enyo.Popup} will hide when the user taps outside it or
			* presses `ESC`.  Set to `false` to prevent this behavior.
			*
			* @type {Boolean}
			* @default true
			* @public
			*/
			autoDismiss: true,

			/**
			* Set to `true` to render the [popup]{@link enyo.Popup} in a
			* [floating layer]{@link enyo.FloatingLayer} outside of other
			* [controls]{@link enyo.Control}.  This may be used to guarantee that the
			* popup will be shown on top of other controls.
			*
			* @type {Boolean}
			* @default false
			* @public
			*/
			floating: false,

			/**
			* Set to `true` to automatically center the [popup]{@link enyo.Popup} in
			* the middle of the viewport.
			*
			* @type {Boolean}
			* @default false
			* @public
			*/
			centered: false,

			/**
			* Set to `true` to be able to show transition on the style modifications;
			* otherwise the transition is invisible `(visibility: hidden)`.
			*
			* @type {Boolean}
			* @default false
			* @public
			*/
			showTransitions: false,

			/**
			* Set to `true` to stop `preventDefault()` from being called on captured
			* [events]{@glossary event}.
			*
			* @type {Boolean}
			* @default false
			* @public
			*/
			allowDefault: false,

			/**
			* Boolean that controls whether a scrim will appear when the dialog is
			* modal. Note that modal scrims are transparent, so you won't see them.
			*
			* @type {Boolean}
			* @default true
			* @public
			*/
			scrimWhenModal: true,

			/**
			* Boolean that controls whether or not a scrim will be displayed. Scrims are
			* only displayed when the dialog is floating.
			*
			* @type {Boolean}
			* @default  false
			* @public
			*/
			scrim: false,

			/**
			* Optional class name to apply to the scrim. Be aware that the scrim
			* is a singleton and you will be modifying the scrim instance used for
			* other popups.
			*
			* @type {String}
			* @default  ''
			* @public
			*/
			scrimClassName: '',

			/**
			* Lowest z-index that may be applied to a popup
			*
			* @type {Number}
			* @default  120
			* @public
			*/
			defaultZ: 120
		},

		/**
		* @lends  enyo.Popup
		* @private
		*/
		protectedStatics: {
			/**
			* Count of currently showing popups
			* @type {Number}
			* @static
			* @private
			*/
			count: 0,

			/**
			* Highest possible z-index for a popup
			* @type {Number}
			* @static
			* @private
			*/
			highestZ: 120
		},

		/**
		* @private
		*/
		showing: false,

		/**
		* @private
		*/
		handlers: {
			onkeydown: 'keydown',
			ondragstart: 'dragstart',
			onfocus: 'focus',
			onblur: 'blur',
			onRequestShow: 'requestShow',
			onRequestHide: 'requestHide'
		},

		/**
		* @private
		*/
		captureEvents: true,

		/**
		* @private
		*/
		eventsToCapture: {
			ondown: 'capturedDown',
			ontap: 'capturedTap'
		},

		/**
		* @private
		*/
		events: {
			onShow: '',
			onHide: ''
		},

		/**
		* @private
		*/
		tools: [
			{kind: 'Signals', onKeydown: 'keydown'}
		],

		/**
		* @method
		* @private
		*/
		create: enyo.inherit(function (sup) {
			return function() {
				var showing = this.showing;
				this.showing = false;

				sup.apply(this, arguments);
				this.canGenerate = !this.floating;

				// if the showing flag was true we know the intent was to automatically show the
				// popup on render...but it can't be rendered in the normal flow...but the rendered
				// method won't be called because it wasn't generated...SO...we arbitrarily flag
				// it as generated even though it wasn't to ensure that its rendered method will
				// be called and we then check for this scenario in rendered
				this.generated = showing;
			};
		}),

		/**
		* @method
		* @private
		*/
		render: enyo.inherit(function (sup) {
			return function() {
				if (this.floating) {
					if (!enyo.floatingLayer.hasNode()) {
						enyo.floatingLayer.render();
					}
					this.parentNode = enyo.floatingLayer.hasNode();
				}
				sup.apply(this, arguments);
			};
		}),

		/**
		* @method
		* @private
		*/
		teardownRender: enyo.inherit(function (sup) {
			return function () {
				// if this is a rendered floating popup, remove the node from the
				// floating layer because it won't be removed otherwise
				var node = this.hasNode();
				if(this.floating && node) {
					this.node.remove();
				}

				sup.apply(this, arguments);
			};
		}),

		/**
		* @method
		* @private
		*/
		destroy: enyo.inherit(function (sup) {
			return function() {
				this.release();
				sup.apply(this, arguments);
			};
		}),

		/**
		* @method
		* @private
		*/
		reflow: enyo.inherit(function (sup) {
			return function() {
				this.updatePosition();
				sup.apply(this, arguments);
			};
		}),

		/**
		* @private
		*/
		calcViewportSize: function () {
			if (window.innerWidth) {
				return {
					width: window.innerWidth,
					height: window.innerHeight
				};
			} else {
				var e = document.documentElement;
				return {
					width: e.offsetWidth,
					height: e.offsetHeight
				};
			}
		},

		/**
		* @private
		*/
		updatePosition: function () {
			var d = this.calcViewportSize(),
				b = this.getBounds();

			if (this.targetPosition) {
				// For brevity's sake...
				var p = this.targetPosition;

				// Test and optionally adjust our target bounds (only first is commented, because logic is effectively identical for all scenarios)
				if (typeof p.left == 'number') {
					// If popup will be outside window bounds, switch anchor
					if (p.left + b.width > d.width) {
						if (p.left - b.width >= 0) {
							// Switching to right corner will fit in window
							p.right = d.width - p.left;
						} else {
							// Neither corner will work; stick at side of window
							p.right = 0;
						}
						p.left = null;
					} else {
						p.right = null;
					}
				} else if (typeof p.right == 'number') {
					if (p.right + b.width > d.width) {
						if (p.right - b.width >= 0) {
							p.left = d.width - p.right;
						} else {
							p.left = 0;
						}
						p.right = null;
					} else {
						p.left = null;
					}
				}

				if (typeof p.top == 'number') {
					if (p.top + b.height > d.height) {
						if (p.top - b.height >= 0) {
							p.bottom = d.height - p.top;
						} else {
							p.bottom = 0;
						}
						p.top = null;
					} else {
						p.bottom = null;
					}
				} else if (typeof p.bottom == 'number') {
					if (p.bottom + b.height > d.height) {
						if (p.bottom - b.height >= 0) {
							p.top = d.height - p.bottom;
						} else {
							p.top = 0;
						}
						p.bottom = null;
					} else {
						p.top = null;
					}
				}

				// 'initial' values are necessary to override positioning rules in the CSS
				this.addStyles('left: ' + (p.left !== null ? p.left + 'px' : 'initial') + '; right: ' + (p.right !== null ? p.right + 'px' : 'initial') + '; top: ' + (p.top !== null ? p.top + 'px' : 'initial') + '; bottom: ' + (p.bottom !== null ? p.bottom + 'px' : 'initial') + ';');
			} else if (this.centered) {
				var o = this.floating ? d : this.getInstanceOwner().getBounds();
				this.addStyles( 'top: ' + Math.max( ( ( o.height - b.height ) / 2 ), 0 ) + 'px; left: ' + Math.max( ( ( o.width - b.width ) / 2 ), 0 ) + 'px;' );
			}
		},

		/**
		* @method
		* @private
		*/
		rendered: enyo.inherit(function (sup) {
			return function () {
				// generated won't be true when this method is called with showing false unless
				// we set it that way so we need to go ahead and do our actual render now that the container (parent)
				// has been rendered and the floating layer can be rendered and we should be able to carry on normally
				if (this.generated && !this.showing && !this.hasNode()) {
					this.generated = false;
					this.showing = true;
					this.showingChanged();
				} else sup.apply(this, arguments);
			};
		}),

		/**
		* @method
		* @fires enyo.Popup#onShow
		* @fires enyo.Popup#onHide
		* @private
		*/
		showingChanged: enyo.inherit(function (sup) {
			return function() {
				// auto render when shown.
				if (this.floating && this.showing && !this.hasNode()) {
					this.render();
				}
				// hide while sizing, and move to top corner for accurate sizing
				if (this.centered || this.targetPosition) {
					if (!this.showTransitions) {
						this.applyStyle('visibility', 'hidden');
					}
					this.addStyles('top: 0px; left: 0px; right: initial; bottom: initial;');
				}
				sup.apply(this, arguments);
				if (this.showing) {
					this.resize();
					enyo.Popup.count++;
					this.applyZIndex();
					if (this.captureEvents) {
						this.capture();
					}
				} else {
					if(enyo.Popup.count > 0) {
						enyo.Popup.count--;
					}
					if (this.captureEvents) {
						this.release();
					}
				}
				this.showHideScrim(this.showing);
				// show after sizing
				if (this.centered || this.targetPosition && !this.showTransitions) {
					this.applyStyle('visibility', null);
				}
				// events desired due to programmatic show/hide
				if (this.hasNode()) {
					this[this.showing ? 'doShow' : 'doHide']();
				}
			};
		}),

		/**
		* @private
		*/
		capture: function () {
			enyo.dispatcher.capture(this, this.eventsToCapture);
		},

		/**
		* @private
		*/
		release: function () {
			enyo.dispatcher.release(this);
		},

		/**
		* @private
		*/
		capturedDown: function (sender, e) {
			//record the down event to verify in tap
			this.downEvent = e;

			// prevent focus from shifting outside the popup when modal.
			if (this.modal && !this.allowDefault) {
				e.preventDefault();
			}
			return this.modal;
		},

		/**
		* @private
		*/
		capturedTap: function (sender, e) {
			// dismiss on tap if property is set and click started & ended outside the popup
			if (this.autoDismiss && (!e.dispatchTarget.isDescendantOf(this)) && this.downEvent &&
				(!this.downEvent.dispatchTarget.isDescendantOf(this))) {
				this.downEvent = null;
				this.hide();
			}
			return this.modal;
		},

		/**
		* If a drag event occurs outside a [popup]{@link enyo.Popup}, hide.
		*
		* @private
		*/
		dragstart: function (sender, e) {
			var inScope = (e.dispatchTarget === this || e.dispatchTarget.isDescendantOf(this));
			if (sender.autoDismiss && !inScope) {
				sender.setShowing(false);
			}
			return true;
		},

		/**
		* @private
		*/
		keydown: function (sender, e) {
			if (this.showing && this.autoDismiss && e.keyCode == 27 /* escape */) {
				this.hide();
			}
		},

		/**
		* If something inside the [popup]{@link enyo.Popup} blurred, keep track of it.
		*
		* @private
		*/
		blur: function (sender, e) {
			if (e.dispatchTarget.isDescendantOf(this)) {
				this.lastFocus = e.originator;
			}
		},

		/**
		* When something outside the [popup]{@link enyo.Popup} focuses (e.g., due to tab key), focus
		* our last focused [control]{@link enyo.Control}.
		*
		* @private
		*/
		focus: function (sender, e) {
			var dt = e.dispatchTarget;
			if (this.modal && !dt.isDescendantOf(this)) {
				if (dt.hasNode()) {
					dt.node.blur();
				}
				var n = (this.lastFocus && this.lastFocus.hasNode()) || this.hasNode();
				if (n) {
					n.focus();
				}
			}
		},

		/**
		* @private
		*/
		requestShow: function () {
			this.show();
			return true;
		},

		/**
		* @private
		*/
		requestHide: function () {
			this.hide();
			return true;
		},

		/**
		* Opens the [popup]{@link enyo.Popup} at the location of a mouse
		* {@glossary event}. The popup's position is automatically constrained so
		* that it does not display outside the viewport, and defaults to anchoring
		* the top left corner of the popup to the position of the mouse event.
		*
		* @param {Object} e - The mouse {@glossary event} that initiated this call.
		* @param {Object} [offset] - An optional [object]{@glossary Object} that may
		* contain `left` and `top` properties to specify an offset relative to the
		* location where the [popup]{@link enyo.Popup} would otherwise be positioned.
		* @public
		*/
		showAtEvent: function (e, offset) {
			// Calculate our ideal target based on the event position and offset
			var p = {
				left: e.centerX || e.clientX || e.pageX,
				top: e.centerY || e.clientY || e.pageY
			};
			if (offset) {
				p.left += offset.left || 0;
				p.top += offset.top || 0;
			}

			this.showAtPosition(p);
		},

		/**
		* Opens the [popup]{@link enyo.Popup} at a specific position. The final
		* location of the popup will be automatically constrained so that it does
		* not display outside the viewport.
		*
		* @param {Object} pos An [object]{@glossary Object} that may contain `left`,
		* `top`, `bottom`, and `right` properties to specify where the
		* [popup]{@link enyo.Popup} will be anchored. If both `left` and `right` are
		* included, the preference will be to anchor on the left; similarly, if both
		* `top` and `bottom` are specified, the preference will be to anchor at the
		* top.
		* @public
		*/
		showAtPosition: function (pos) {
			// Save our target position for later processing
			this.targetPosition = pos;

			// Show the dialog
			this.show();
		},

		/**
		* Toggles the display of the scrim
		*
		* @param  {Boolean} show - Show the scrim
		* @private
		*/
		showHideScrim: function (show) {
			if (this.floating && (this.scrim || (this.modal && this.scrimWhenModal))) {
				var scrim = this.getScrim();
				if (show) {
					// move scrim to just under the popup to obscure rest of screen
					var i = this.getScrimZIndex();
					this._scrimZ = i;
					scrim.showAtZIndex(i);
				} else {
					scrim.hideAtZIndex(this._scrimZ);
				}
				enyo.call(scrim, 'addRemoveClass', [this.scrimClassName, scrim.showing]);
			}
		},

		/**
		* Calculates the z-index for the scrim so it's directly below the popup
		*
		* @private
		*/
		getScrimZIndex: function () {
			return enyo.Popup.highestZ >= this._zIndex ? this._zIndex - 1 : enyo.Popup.highestZ;
		},

		/**
		* Show a transparent scrim for modal popups if {@link enyo.Popup#scrimWhenModal} is `true`
		* if {@link enyo.Popup#scrim} is `true`, then show a regular scrim.
		*
		* @return {enyo.Scrim}
		* @private
		*/
		getScrim: function () {
			//
			if (this.modal && this.scrimWhenModal && !this.scrim) {
				return enyo.scrimTransparent.make();
			}
			return enyo.scrim.make();
		},

		/**
		* Adjust the zIndex so that popups will properly stack on each other.
		*
		* @private
		*/
		applyZIndex: function () {
			this._zIndex = (enyo.Popup.count * 2) + this.findZIndex() + 1;
			if (this._zIndex <= enyo.Popup.highestZ) {
				this._zIndex = enyo.Popup.highestZ + 1;
			}
			if (this._zIndex > enyo.Popup.highestZ) {
				enyo.Popup.highestZ = this._zIndex;
			}
			// leave room for scrim
			this.applyStyle('z-index', this._zIndex);
		},

		/**
		* Find the z-index for this popup, clamped by {@link enyo.Popup#defaultZ}
		*
		* @return {Number} z-index value
		* @private
		*/
		findZIndex: function () {
			// a default z value
			var z = this.defaultZ;
			if (this._zIndex) {
				z = this._zIndex;
			} else if (this.hasNode()) {
				// Re-use existing zIndex if it has one
				z = Number(enyo.dom.getComputedStyleValue(this.node, 'z-index')) || z;
			}
			if (z < this.defaultZ) {
				z = this.defaultZ;
			}
			this._zIndex = z;
			return this._zIndex;
		}
	});

	/**
	* By default, we capture `ondown` and `ontap` to implement the [popup's]{@link enyo.Popup}
	* modal behavior, but in certain circumstances it may be necessary to capture other
	* [events]{@glossary event} as well, so we provide this hook to extend. (We are currently
	* using this in Moonstone to capture `onSpotlightFocus` [events]{@glossary event}).
	*
	* @private
	*/
	enyo.Popup.concat = function (ctor, props, instance) {
		var proto = ctor.prototype || ctor,
			evts = proto.eventsToCapture;
		proto.eventsToCapture = evts ? enyo.mixin({}, [evts, props.eventsToCapture]) : props.eventsToCapture;
		delete props.eventsToCapture;
	};

})(enyo, this);


text:
package org.preprid.model.information;

import lombok.*;
import lombok.experimental.Accessors;
import org.preprid.model.identification.Identifiable;

import java.time.Instant;

/**
 * Base class for all modifiable information, which is basically everything
 * except the lastname and firstname at the time of registeration.
 */
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
@Accessors(chain = true, fluent = true)
@NoArgsConstructor
public abstract class VersionedInformation extends Identifiable {
    @NonNull protected Instant utcTimeOfLastUpdate;
}


text:
"""
A Speaker handles audio output from iPeppaCar to the user
codes from Dingdang.
Speaker methods:
    say - output 'phrase' as speech
    play - play the audio in 'filename'
    is_available - returns True if the platform supports this implementation
"""
import os
import platform
import re
import tempfile
import subprocess
import pipes
import logging
import urllib
import requests
from abc import ABCMeta, abstractmethod
from uuid import getnode as get_mac

import argparse

import sys
reload(sys)
sys.setdefaultencoding('utf8')

class AbstractTTSEngine(object):
    """
    Generic parent class for all speakers
    """
    __metaclass__ = ABCMeta

    @classmethod
    def get_config(cls):
        return {}

    @classmethod
    def get_instance(cls):
        config = cls.get_config()
        instance = cls(**config)
        return instance

    @classmethod

    def __init__(self, **kwargs):
        self._logger = logging.getLogger(__name__)

    @abstractmethod
    def say(self, phrase, *args):
        pass

    def play(self, filename):
        cmd = ['aplay', str(filename)]
        self._logger.debug('Executing %s', ' '.join([pipes.quote(arg)
                                                     for arg in cmd]))
        with tempfile.TemporaryFile() as f:
            subprocess.call(cmd, stdout=f, stderr=f)
            f.seek(0)
            output = f.read()
            if output:
                self._logger.debug("Output was: '%s'", output)

class AbstractMp3TTSEngine(AbstractTTSEngine):
    """
    Generic class that implements the 'play' method for mp3 files
    """
    @classmethod
    def is_available(cls):
        return (super(AbstractMp3TTSEngine, cls).is_available() and
                diagnose.check_python_import('mad'))

    def play_mp3(self, filename, remove=False):
        cmd = ['play', str(filename)]
        self._logger.debug('Executing %s', ' '.join([pipes.quote(arg)
                                                     for arg in cmd]))
        with tempfile.TemporaryFile() as f:
            subprocess.call(cmd, stdout=f, stderr=f)
            f.seek(0)
            output = f.read()
            if output:
                self._logger.debug("Output was: '%s'", output)

class BaiduTTS(AbstractMp3TTSEngine):

    SLUG = "baidu-tts"

    def __init__(self, api_key, secret_key, per=0):
        self._logger = logging.getLogger(__name__)
        self.api_key = api_key
        self.secret_key = secret_key
        self.per = per
        self.token = ''

    def get_token(self):
        URL = 'http://openapi.baidu.com/oauth/2.0/token'
        params = urllib.urlencode({'grant_type': 'client_credentials',
                                   'client_id': self.api_key,
                                   'client_secret': self.secret_key})
        r = requests.get(URL, params=params)
        try:
            r.raise_for_status()
            token = r.json()['access_token']
            return token
        except requests.exceptions.HTTPError:
            self._logger.critical('Token request failed with response: %r',
                                  r.text,
                                  exc_info=True)
            return ''

    def split_sentences(self, text):
        punctuations = ['.', '。', ';', ';', '\n']
        for i in punctuations:
            text = text.replace(i, '@@@')
        return text.split('@@@')

    def get_speech(self, phrase):
        if self.token == '':
            self.token = self.get_token()
        query = {'tex': phrase,
                 'lan': 'zh',
                 'tok': self.token,
                 'ctp': 1,
                 'cuid': str(get_mac())[:32],
                 'per': self.per
                 }
        r = requests.post('http://tsn.baidu.com/text2audio',
                          data=query,
                          headers={'content-type': 'application/json'})
        try:
            r.raise_for_status()
            if r.json()['err_msg'] is not None:
                self._logger.critical('Baidu TTS failed with response: %r',
                                      r.json()['err_msg'],
                                      exc_info=True)
                return None
        except Exception:
            pass
        with tempfile.NamedTemporaryFile(suffix='.mp3', delete=False) as f:
            f.write(r.content)
            tmpfile = f.name
            return tmpfile

    def say(self, phrase):
        self._logger.debug(u"Saying '%s' with '%s'", phrase, self.SLUG)
        tmpfile = self.get_speech(phrase)
        if tmpfile is not None:
            self.play_mp3(tmpfile)
            os.remove(tmpfile)

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='baidu TTS module')
    parser.add_argument('--debug', action='store_true',
                        help='Show debug messages')
    args = parser.parse_args()

    logging.basicConfig()
    if args.debug:
        logger = logging.getLogger(__name__)
        logger.setLevel(logging.DEBUG)
    #this is only for test, plz apply your app_id
    textt = u'Baidu,welcome to you!'
    #appid = '9931643'
    api_key = 'gp3Hcx6nK0ycnDN8aNob3jAF'
    secret_key = 'GVB5Xbg0TOpe9LfRpmkZKp0txZOTysF2'

    tts = BaiduTTS(api_key,secret_key)

    tts.say(textt)


text:
package org.multibit.hd.hardware.core.wallets;

import com.google.common.base.Optional;
import com.google.protobuf.Message;
import org.multibit.hd.hardware.core.HardwareWalletSpecification;
import org.multibit.hd.hardware.core.events.MessageEvent;

import java.util.concurrent.TimeUnit;

/**
 *
Interface to provide the following to applications:

 *

 *
Low level communication methods to hardware wallet devices

 *

 *
 *
Typically a hardware wallet device is wrapped by a client that provides the higher protocol messages such as
 * Initialise or Ping.

 *
 * @since 0.0.1
 *
 */
public interface HardwareWallet extends Connectable {

  /**
   * @return The hardware wallet specification in use
   */
  HardwareWalletSpecification getSpecification();

  /**
   * @return A default hardware wallet specification to use during the creation process if one is not supplied
   */
  HardwareWalletSpecification getDefaultSpecification();

  /**
   *
Apply any hardware wallet specific parameters

   *
Implementers should override this, but call super.applySpecification(specification) as part of the application process

   *
   * @param specification The {@link HardwareWalletSpecification}
   */
  void applySpecification(HardwareWalletSpecification specification);

  /**
   *
Read a protobuf message from the hardware wallet and adapt it to a Core message event.

   *
Consumers of this interface should check the returned message event wrapper for failure modes
   * as appropriate.

   *
   *
Forcing early adaption to a message event eases the implementation in many ways.

   *
   * @return The low level message event wrapping the adapted protobuf message read from the hardware wallet if present
   * @param duration The duration
   * @param timeUnit The time unit
   */
  Optional<MessageEvent> readMessage(int duration, TimeUnit timeUnit);

  /**
   *
Send a message to the hardware wallet using the generated protocol buffer classes

   *
Any response will be provided through the event bus subscribers

   *
If this call fails the hardware wallet will be closed and a DISCONNECT message will be emitted

   *
   * @param message A generated protocol buffer message (e.g. Message.Initialize)
   */
  void writeMessage(Message message);

  /**
   *
Assist downstream API consumers with identifying the source of events

   *
   * @return The client name in an enum format (e.g. "TREZOR", "KEEP_KEY" etc)
   */
  String name();

}


text:
<?php

namespace Bootcamp\JobeetBundle\Controller\Category;

use Admingenerated\BootcampJobeetBundle\BaseCategoryController\NewController as BaseNewController;

/**
 * NewController
 */
class NewController extends BaseNewController
{
}


text:
layout: project
modal-id: analog
date: 2014-07-18
img: analog.png
alt: image-alt
title: Analog VLSI
link :
category: project
description: This is the collection of Analog VLSI Designs created in EC580

---
# Analog VLSI

## OpAmp

TBA

## RF Energy Harvester Paper Summary

### Original Paper

"A 90-nm CMOS Threshold-Compensated RF Energy Harvester", Papotto, Carrara, and Palmisano, IEEE
Journal of Solid-State Circuits, Vol. 46, No. 9, Sept. 2011, pp. 1985-1997.

### Summary

This article summarizes the design and the philosophy of building a Threshold-Compensated RF Energy Harvester which are used for powering wireless sensor and other communication devices which do not have a power supply or a battery source. First the concept of a rectifier being used as an energy harvester is introduced continued by a short description of these designs are realized for our specific problem. The latter part of the article describes the energy harvester as a system and provides a walkthrough of the design process of the system.

[PDF](/resources/EC580_Paper_Summary.pdf)

## Resources


text:
package com.example.mobilesafe.activity;

import java.util.ArrayList;

import java.util.HashMap;

import com.example.mobilesafe.R;
import com.example.mobilesafe.R.id;
import com.example.mobilesafe.R.layout;
import com.example.mobilesafe.R.menu;

import android.support.v7.app.ActionBarActivity;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.SimpleAdapter;

public class ContactActivity extends ActionBarActivity {

	private ArrayList<HashMap<String, String>> arrayList;

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

		arrayList = returnContact();
		System.out.println("arrayList=" + arrayList.toString());
		ListView view = (ListView) findViewById(R.id.lv_list);
		//view.setAdapter(new SimpleAdapter(this, arrayList, R.layout.list_view_item, new String{"name","phone"},new int{R.id.tv_name,R.id.tv_number}));
//		view.setAdapter(new SimpleAdapter(this, arrayList,
//				R.layout.list_view_item, new String[] { "name", "phone" },
//				new int[] { R.id.tv_name, R.id.tv_number }));
		view.setAdapter(new SimpleAdapter(this, arrayList,
				R.layout.list_view_item, new String[] { "name", "phone" },
				new int[] { R.id.tv_name, R.id.tv_number }));
		//监听listview 子条目的点击事件, 并且用setreuslt返回相应额事件
		view.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				// TODO Auto-generated method stub

		        String phone = arrayList.get(position).get("phone");
		        Intent intent = new Intent();
		        intent.putExtra("phone", phone);
		        setResult(Activity.RESULT_OK, intent);
		        finish();

			}
		});
	}

	private ArrayList<HashMap<String, String>> returnContact() {
		ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
		Uri raw_uri = Uri.parse("content://com.android.contacts/raw_contacts");
		Uri data_uri = Uri.parse("content://com.android.contacts/data");
		// Cursor cursor = getContentResolver().query(uri, ", null,null,null);
		Cursor cursor = getContentResolver().query(raw_uri,
				new String[] { "_id" }, null, null, null);
		if (cursor != null && cursor.getCount() > 0) {

			while (cursor.moveToNext()) {
				int id = cursor.getInt(0);
				Cursor c = getContentResolver().query(data_uri,
						new String[] { "mimetype", "data1" },
						"raw_contact_id = ?",
						new String[] { String.valueOf(id) }, null);

				HashMap<String, String> per = new HashMap<String, String>();

				if (c != null && c.getCount() > 0) {
					while (c.moveToNext()) {

						String mtype = c.getString(0);
						String data = c.getString(1);
						if ("vnd.android.cursor.item/email_v2".equals(mtype)) {
							Log.i("==", "email" + data);
						}
						if ("vnd.android.cursor.item/name".equals(mtype)) {
							Log.i("==", "名字" + data);
							per.put("name", data);
						}
						if ("vnd.android.cursor.item/postal-address_v2"
								.equals(mtype)) {
							Log.i("==", "手机号码1" + data);

						}
						if ("vnd.android.cursor.item/phone_v2".equals(mtype)) {
							Log.i("==", "手机号码" + data);
							per.put("phone", data);
						}
						Log.i("==", "////////");

					}
				}

				list.add(per);
				c.close();
			}

		}
		cursor.close();

		return list;
	}

}


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

	<Button
	    android:id="@+id/Bold"
	    android:layout_width="fill_parent"
	    android:layout_height="wrap_content"
	    android:layout_alignLeft="@+id/Bnew"
	    android:layout_centerVertical="true"
	    android:text="View previous counters"
	    android:textSize="15sp" />

	<Button
	    android:id="@+id/Bnew"
	    android:layout_width="fill_parent"
	    android:layout_height="wrap_content"
	    android:layout_above="@+id/Bold"
	    android:layout_alignParentLeft="true"
	    android:layout_marginBottom="48dp"
	    android:text="Create a new counter"
	    android:textSize="15sp" />

</RelativeLayout>


text:
function StopAnimation(Animation) {
  window.clearInterval(Animation);
};

function DotAnimation(Element, AnimatedText) {
  AnimatedText = typeof AnimatedText !== 'undefined' ? AnimatedText : '.';

  Element.html(AnimatedText + '.');

  return window.setInterval(function() {
    if (Element.html().length > 5 + AnimatedText.length) Element.html(AnimatedText + '.');
    else Element.append('.');
  }, 500);
};

function TimerAnimation(Element, RemainingTime) {
  milliseconds = 1000;
  interval = 500;
  starttime = moment();
  shortdisplay = true;
  autochange = true;

  Element.click(function() {
    autochange = false;
    shortdisplay = !shortdisplay;
    UpdateDisplay();
  });

  function UpdateDisplay() {
    duration = moment.duration(Math.max(0, RemainingTime - (moment().unix() - starttime.unix())), 'seconds');
    days = Math.floor(duration.asDays());

    if (autochange) shortdisplay = days > 0;

    if (!shortdisplay) {
      hours = duration.hours();
      minutes = duration.minutes();
      seconds = duration.seconds();

      Element.html((days > 0 ? (days + ' day' + (days > 1 ? 's, ' : ', ')) : '') + hours + ':' + ('00' + minutes).slice(-2) + ':' + ('00' + seconds).slice(-2));
    }
    else Element.html(duration.humanize());
  };

  UpdateDisplay();

  return window.setInterval(function() {
    UpdateDisplay();
  }, interval);
};


text:
tinyMCE.addToLang('table',{
general_tab : 'Algemeen',
advanced_tab : 'Geavanceerd',
general_props : 'Algemene eigenschappen',
advanced_props : 'Geavanceerde eigenschappen',
desc : 'Nieuwe tabel invoegen',
row_before_desc : 'Rij boven invoegen',
row_after_desc : 'Rij onder invoegen',
delete_row_desc : 'Rij verwijderen',
col_before_desc : 'Kolom links invoegen',
col_after_desc : 'Kolom rechts invoegen',
delete_col_desc : 'Kolom verwijderen',
rowtype : 'Row in table part',
title : 'Tabel invoegen/bewerken',
width : 'Breedte',
height : 'Hoogte',
cols : 'Kolommen',
rows : 'Rijen',
cellspacing : 'Ruimte om cel',
cellpadding : 'Ruimte in cel',
border : 'Rand',
align : 'Uitlijning',
align_default : 'Standaard',
align_left : 'Links',
align_right : 'Rechts',
align_middle : 'Centreren',
row_title : 'Tabelrij-eigenschappen',
cell_title : 'Tabelcel-eigenschappen',
cell_type : 'Celtype',
row_desc : 'Tabelrij-eigenschappen',
cell_desc : 'Tabelcel-eigenschappen',
valign : 'Verticale uitlijning',
align_top : 'Boven',
align_bottom : 'Onder',
props_desc : 'Tabeleigenschappen',
bordercolor : 'Randkleur',
bgcolor : 'Achtergrondkleur',
merge_cells_title : 'Tabelcellen samenvoegen',
split_cells_desc : 'Tabelcellen splitsen',
merge_cells_desc : 'Tabelcellen samenvoegen',
cut_row_desc : 'Tabelrij knippen',
copy_row_desc : 'Tebelrij kopiëren',
paste_row_before_desc : 'Tabelrij boven plakken',
paste_row_after_desc : 'tabelrij onder plakken',
id : 'Id',
style: 'Stijl',
langdir : 'Taalrichting',
langcode : 'Taalcode',
mime : 'MIME type',
ltr : 'Links naar rechts',
rtl : 'Rechts naar links',
bgimage : 'Achtergrondafbeelding',
summary : 'Samenvatting',
td : "Data",
th : "Kop",
cell_cell : 'Huidige cel bijwerken',
cell_row : 'Alle cellen in rij bijwerken',
cell_all : 'Alle cellen in tabel bijwerken',
row_row : 'Huidige rij bijwerken',
row_odd : 'Oneven rijen in tabel bijwerken',
row_even : 'Even rijen in tabel bijwerken',
row_all : 'Alle rijen in tabel bijwerken',
thead : 'Tabel-kop',
tbody : 'Tabel-body',
tfoot : 'Tabel-voet',
del : 'Tabel verwijderen',
scope : 'Bereik',
row : 'Rij',
col : 'Kolom',
rowgroup : 'Rijgroep',
colgroup : 'Kolomgroep',
missing_scope: 'Zonder een bereik van een tabelkop, is het moeilijk voor mensen met een visuele handicap deze pagina te begrijpen. Weet u zeker dat u zonder bereik verder wilt gaan?'
});


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

<title>Overview List (Trellis Linked Data Server Documentation)</title>
<meta name="date" content="2017-12-16">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">

All Classes

Packages

org.trellisldp.rosid.app

org.trellisldp.rosid.app.auth

org.trellisldp.rosid.app.config

org.trellisldp.rosid.app.health

org.trellisldp.rosid.common

org.trellisldp.rosid.file


text:
/**
 */
package ConceptualScenarioMetaModel;

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;

/**
 *
 * A representation of the model object 'Event'.
 *
 *
 *

 * The following features are supported:
 *

 *
{@link ConceptualScenarioMetaModel.Event#getName Name}

 *
{@link ConceptualScenarioMetaModel.Event#getSouceCharacteristic Souce Characteristic}

 *
{@link ConceptualScenarioMetaModel.Event#getTargetCharacteristic Target Characteristic}

 *
{@link ConceptualScenarioMetaModel.Event#getContentCharacteristic Content Characteristic}

 *
{@link ConceptualScenarioMetaModel.Event#getTrigger Trigger}

 *

 *

 *
 * @see ConceptualScenarioMetaModel.ConceptualScenarioMetaModelPackage#getEvent()
 * @model
 * @generated
 */
public interface Event extends EObject {

	/**
	 * Returns the value of the 'Name' attribute.
	 *
	 *

	 * If the meaning of the 'Name' attribute isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Name' attribute.
	 * @see #setName(String)
	 * @see ConceptualScenarioMetaModel.ConceptualScenarioMetaModelPackage#getEvent_Name()
	 * @model
	 * @generated
	 */
	String getName();

	/**
	 * Sets the value of the '{@link ConceptualScenarioMetaModel.Event#getName Name}' attribute.
	 *
	 *
	 * @param value the new value of the 'Name' attribute.
	 * @see #getName()
	 * @generated
	 */
	void setName(String value);

	/**
	 * Returns the value of the 'Souce Characteristic' containment reference.
	 *
	 *

	 * If the meaning of the 'Souce Characteristic' containment reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Souce Characteristic' containment reference.
	 * @see #setSouceCharacteristic(EntityCharacteristic)
	 * @see ConceptualScenarioMetaModel.ConceptualScenarioMetaModelPackage#getEvent_SouceCharacteristic()
	 * @model containment="true" required="true"
	 * @generated
	 */
	EntityCharacteristic getSouceCharacteristic();

	/**
	 * Sets the value of the '{@link ConceptualScenarioMetaModel.Event#getSouceCharacteristic Souce Characteristic}' containment reference.
	 *
	 *
	 * @param value the new value of the 'Souce Characteristic' containment reference.
	 * @see #getSouceCharacteristic()
	 * @generated
	 */
	void setSouceCharacteristic(EntityCharacteristic value);

	/**
	 * Returns the value of the 'Target Characteristic' containment reference list.
	 * The list contents are of type {@link ConceptualScenarioMetaModel.EntityCharacteristic}.
	 *
	 *

	 * If the meaning of the 'Target Characteristic' containment reference list isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Target Characteristic' containment reference list.
	 * @see ConceptualScenarioMetaModel.ConceptualScenarioMetaModelPackage#getEvent_TargetCharacteristic()
	 * @model containment="true"
	 * @generated
	 */
	EList<EntityCharacteristic> getTargetCharacteristic();

	/**
	 * Returns the value of the 'Content Characteristic' containment reference list.
	 * The list contents are of type {@link ConceptualScenarioMetaModel.EntityCharacteristic}.
	 *
	 *

	 * If the meaning of the 'Content Characteristic' containment reference list isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Content Characteristic' containment reference list.
	 * @see ConceptualScenarioMetaModel.ConceptualScenarioMetaModelPackage#getEvent_ContentCharacteristic()
	 * @model containment="true"
	 * @generated
	 */
	EList<EntityCharacteristic> getContentCharacteristic();

	/**
	 * Returns the value of the 'Trigger' containment reference.
	 *
	 *

	 * If the meaning of the 'Trigger' containment reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Trigger' containment reference.
	 * @see #setTrigger(TriggerCondition)
	 * @see ConceptualScenarioMetaModel.ConceptualScenarioMetaModelPackage#getEvent_Trigger()
	 * @model containment="true"
	 * @generated
	 */
	TriggerCondition getTrigger();

	/**
	 * Sets the value of the '{@link ConceptualScenarioMetaModel.Event#getTrigger Trigger}' containment reference.
	 *
	 *
	 * @param value the new value of the 'Trigger' containment reference.
	 * @see #getTrigger()
	 * @generated
	 */
	void setTrigger(TriggerCondition value);
} // Event


text:
namespace base {
class DictionaryValue;
class ListValue;
}

namespace cryptauth {
class ToggleEasyUnlockResponse;
}

namespace proximity_auth {
class CryptAuthClient;
}

class EasyUnlockToggleFlow;
class Profile;

// EasyUnlockService instance that should be used for regular, non-signin
// profiles.
class EasyUnlockServiceRegular : public EasyUnlockService {
 public:
  explicit EasyUnlockServiceRegular(Profile* profile);
  ~EasyUnlockServiceRegular() override;

 private:
  // EasyUnlockService implementation.
  EasyUnlockService::Type GetType() const override;
  std::string GetUserEmail() const override;
  void LaunchSetup() override;
  const base::DictionaryValue* GetPermitAccess() const override;
  void SetPermitAccess(const base::DictionaryValue& permit) override;
  void ClearPermitAccess() override;
  const base::ListValue* GetRemoteDevices() const override;
  void SetRemoteDevices(const base::ListValue& devices) override;
  void RunTurnOffFlow() override;
  void ResetTurnOffFlow() override;
  TurnOffFlowStatus GetTurnOffFlowStatus() const override;
  std::string GetChallenge() const override;
  std::string GetWrappedSecret() const override;
  void RecordEasySignInOutcome(const std::string& user_id,
                               bool success) const override;
  void RecordPasswordLoginEvent(const std::string& user_id) const override;
  void InitializeInternal() override;
  void ShutdownInternal() override;
  bool IsAllowedInternal() override;

  // Opens the component packaged app responsible for setting up Smart Lock.
  void OpenSetupApp();

  // Callback when the controlling pref changes.
  void OnPrefsChanged();

  // Sets the new turn-off flow status.
  void SetTurnOffFlowStatus(TurnOffFlowStatus status);

  // Callback for ToggleEasyUnlock CryptAuth API.
  void OnToggleEasyUnlockApiComplete(
      const cryptauth::ToggleEasyUnlockResponse& response);
  void OnToggleEasyUnlockApiFailed(const std::string& error_message);

#if defined(OS_CHROMEOS)
  // Called with the user's credentials (e.g. username and password) after the
  // user reauthenticates to begin setup.
  void OnUserContextFromReauth(const chromeos::UserContext& user_context);

  // Called after a cryptohome RemoveKey or RefreshKey operation to set the
  // proper hardlock state if the operation is successful.
  void SetHardlockAfterKeyOperation(
      EasyUnlockScreenlockStateHandler::HardlockState state_on_success,
      bool success);

  scoped_ptr<chromeos::ShortLivedUserContext> short_lived_user_context_;
#endif

  PrefChangeRegistrar registrar_;

  TurnOffFlowStatus turn_off_flow_status_;
  scoped_ptr<proximity_auth::CryptAuthClient> cryptauth_client_;

  base::WeakPtrFactory<EasyUnlockServiceRegular> weak_ptr_factory_;

  DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceRegular);
};

#endif  // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_


text:
from __future__ import absolute_import

import os
import re
import traceback

from maya import cmds, mel

from mayatools.playblast import screenshot
from sgfs import SGFS
from sgfs.commands.utils import parse_spec
import metatools.deprecate
import qbfutures.maya
import sgpublish.commands.utils as publish_cli_utils
import sgpublish.exporter.maya

from .utils import export_cache

def run():
    import warnings
    warnings.warn('exporter.run moved to exporterui')
    from .exporterui import run
    run()

def cache_name_from_cache_set(path):
    name_parts = path.split(':')
    name_parts[-1] = name_parts[-1].replace('cache', '_')
    name_parts = [re.sub(r'[\W_]+', '_', x).strip('_') for x in name_parts]
    name_parts[-1] = '_' + name_parts[-1]
    return '_'.join(name_parts).strip('_')

class Exporter(sgpublish.exporter.maya.Exporter):

    def __init__(self):
        super(Exporter, self).__init__(
            workspace=cmds.workspace(q=True, fullName=True) or None,
            filename_hint=cmds.file(q=True, sceneName=True) or 'geocache.mb',
            publish_type='maya_geocache',
        )

    def add_path_to_work(self, directory, to_cache):
        for members, name, frame_from, frame_to, world in to_cache:
            yield members, os.path.join(directory, name), name, frame_from, frame_to, world

    def export_publish(self, publish, **kwargs):
        # Set the path to the directory.
        publish.path = publish.directory
        kwargs['name'] = '%s - v%04d' % (publish.name, publish.version)
        kwargs['alembic_metadata'] = metadata = (kwargs.get('alembic_metadata') or {}).copy()
        metadata['sgpublish'] = {
            'entity': publish.entity.minimal,
            'name': publish.name,
            'path': publish.path,
            'type': publish.type,
            'version': publish.version,
        }
        self.export(publish.directory, publish.path, **kwargs)

    def export(self, directory, path, to_cache, on_farm=False, as_abc=True, alembic_metadata=None, name=None):

        if not os.path.exists(directory):
            os.makedirs(directory)

        # Save the scene itself into the directory.
        src_path = cmds.file(q=True, sceneName=True)
        src_ext = os.path.splitext(src_path)[1]
        dst_path = os.path.join(directory, os.path.basename(src_path))
        maya_type = 'mayaBinary' if src_ext == '.mb' else 'mayaAscii'
        try:
            cmds.file(rename=dst_path)
            cmds.file(save=True, type=maya_type)
        finally:
            cmds.file(rename=src_path)

        # Add the path.
        to_cache = self.add_path_to_work(path, to_cache)

        if on_farm:

            executor = qbfutures.maya.Executor(
                cpus=4,
                clone_environ=True,
                create_tempfile=True,
            )

            with executor.batch('Geocache Export - %s' % (name or os.path.basename(path))) as batch:
                for args in to_cache:
                    members, path, name, frame_from, frame_to, world = args
                    batch.submit_ext(export_cache, args=args, kwargs={'as_abc': as_abc, 'alembic_metadata': alembic_metadata}, name=str(name))

            try:
                from PyQt4 import QtGui
            except ImportError:
                print 'job', batch.futures[0].job_id
            else:
                QtGui.QMessageBox.information(None, "Submitted to Qube", "The geocache export was submitted as job %d" % batch.futures[0].job_id)

        if not on_farm:
            for args in to_cache:
                export_cache(*args, as_abc=as_abc, alembic_metadata=alembic_metadata)

def main(argv=None):

    import argparse
    import logging
    log = logging.getLogger(__name__)

    parser = argparse.ArgumentParser()
    parser.add_argument('--no-world', action='store_true')
    parser.add_argument('--no-abc', action='store_true')
    parser.add_argument('-s', '--start', type=int)
    parser.add_argument('-e', '--end', type=int)
    parser.add_argument('-d', '--out-dir')

    publish_cli_utils.add_publisher_arguments(parser, short_flags=False, prefix=True)

    parser.add_argument('-l', '--list-sets', action='store_true')
    parser.add_argument('scene')
    parser.add_argument('cache_sets', nargs='*')
    args = parser.parse_args(argv)

    publisher_kwargs = publish_cli_utils.extract_publisher_kwargs(args)

    log.info('initializing Maya')
    import maya.standalone
    maya.standalone.initialize()

    log.info('loading file')
    cmds.file(args.scene, open=True)
    log.info('done loading file')

    cache_sets = set(cmds.ls(*(args.cache_sets or ['__cache__*']), sets=True, recursive=True, long=True) or ())
    if args.list_sets:
        print '\n'.join(sorted(cache_sets))
        return

    frame_from = args.start or cmds.playbackOptions(q=True, animationStartTime=True)
    frame_to   = args.end   or cmds.playbackOptions(q=True, animationEndTime=True)

    world = not args.no_world
    as_abc = not args.no_abc

    to_cache = []
    for cache_set in cache_sets:
        members = cmds.sets(cache_set, q=True)
        name = cache_name_from_cache_set(cache_set) or 'cache'
        to_cache.append((members, name, frame_from, frame_to, world))

    exporter = Exporter()
    name = os.path.splitext(os.path.basename(args.scene))[0]

    if 'link' in publisher_kwargs or 'template' in publisher_kwargs:
        if 'template' not in publisher_kwargs:
            publisher_kwargs['name'] = name
        exporter.publish(export_kwargs=dict(to_cache=to_cache, as_abc=as_abc), **publisher_kwargs)

    else:
        directory = args.out_dir or os.path.join(args.scene, '..', 'data', 'geo_cache', name)
        exporter.export(directory=directory, path=directory, to_cache=to_cache, as_abc=as_abc)

    log.info('DONE')

if __name__ == '__main__':
    try:
        main()
    except Exception as e:
        traceback.print_exc()
        os._exit(1)
    else:
        os._exit(0)


text:
// This file is automatically generated.

package adila.db;

/*
 * Fujitsu ARROWS X F-02E
 *
 * DEVICE: F02E
 * MODEL: F-02E
 */
final class f02e_f2d02e {
    public static final String DATA = "Fujitsu|ARROWS X F-02E|";
}


text:
本项目使用了axios提供http请求服务,文件在src/utils/request.js

## 自定义Header

为了提供鉴权、修改cookie等服务,可以手动修改Header

```
axios.defaults.headers.common['Authorization'] = 'token'
```

或者

```
// 添加请求拦截器
axios.interceptors.request.use(function (config) {
  // 在发送请求之前做些什么
  config.headers.token = window.localStorage.getItem('token');
  return config;
}, function (error) {
  return Promise.reject(error);
});
```


text:
package org.gradle.api.tasks.testing.testng;

import groovy.lang.MissingMethodException;
import groovy.lang.MissingPropertyException;
import groovy.xml.MarkupBuilder;
import org.gradle.api.file.ProjectLayout;
import org.gradle.api.internal.tasks.testing.testng.TestNGTestClassProcessor;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.PathSensitive;
import org.gradle.api.tasks.PathSensitivity;
import org.gradle.api.tasks.testing.TestFrameworkOptions;
import org.gradle.internal.ErroringAction;
import org.gradle.internal.IoActions;

import javax.annotation.Nullable;
import javax.inject.Inject;
import java.io.BufferedWriter;
import java.io.File;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

/**
 * The TestNG specific test options.
 */
public abstract class TestNGOptions extends TestFrameworkOptions {
    public static final String DEFAULT_CONFIG_FAILURE_POLICY = TestNGTestClassProcessor.DEFAULT_CONFIG_FAILURE_POLICY;
    private static final String DEFAULT_PARALLEL_MODE = null;
    private static final int DEFAULT_THREAD_COUNT = -1;

    private File outputDirectory;

    private Set<String> includeGroups = new LinkedHashSet<String>();

    private Set<String> excludeGroups = new LinkedHashSet<String>();

    private String configFailurePolicy = DEFAULT_CONFIG_FAILURE_POLICY;

    private Set<String> listeners = new LinkedHashSet<String>();

    private String parallel = DEFAULT_PARALLEL_MODE;

    private int threadCount = DEFAULT_THREAD_COUNT;

    private boolean useDefaultListeners;

    private String suiteName = "Gradle suite";

    private String testName = "Gradle test";

    private List<File> suiteXmlFiles = new ArrayList<File>();

    private boolean preserveOrder;

    private boolean groupByInstances;

    private transient StringWriter suiteXmlWriter;

    private transient MarkupBuilder suiteXmlBuilder;

    private final File projectDir;

    @Inject
    public TestNGOptions(ProjectLayout projectLayout) {
        this.projectDir = projectLayout.getProjectDirectory().getAsFile();
    }

    /**
     * Copies the options from the source options into the current one.
     * @since 8.0
     */
    public void copyFrom(TestNGOptions other) {
        this.outputDirectory = other.outputDirectory;
        replace(this.includeGroups, other.includeGroups);
        replace(this.excludeGroups, other.excludeGroups);
        this.configFailurePolicy = other.configFailurePolicy;
        replace(this.listeners, other.listeners);
        this.parallel = other.parallel;
        this.threadCount = other.threadCount;
        this.useDefaultListeners = other.useDefaultListeners;
        this.suiteName = other.suiteName;
        this.testName = other.testName;
        replace(this.suiteXmlFiles, other.suiteXmlFiles);
        this.preserveOrder = other.preserveOrder;
        this.groupByInstances = other.groupByInstances;
        // not copying suiteXmlWriter as it is transient
        // not copying suiteXmlBuilder as it is transient
    }

    private static <T> void replace(Collection<T> target, Collection<T> source) {
        target.clear();
        target.addAll(source);
    }

    public MarkupBuilder suiteXmlBuilder() {
        suiteXmlWriter = new StringWriter();
        suiteXmlBuilder = new MarkupBuilder(suiteXmlWriter);
        return suiteXmlBuilder;
    }

    /**
     * Add suite files by Strings. Each suiteFile String should be a path relative to the project root.
     */
    public void suites(String... suiteFiles) {
        for (String suiteFile : suiteFiles) {
            suiteXmlFiles.add(new File(TestNGOptions.this.getProjectDir(), suiteFile));
        }
    }

    @Internal
    protected File getProjectDir() {
        return projectDir;
    }

    /**
     * Add suite files by File objects.
     */
    public void suites(File... suiteFiles) {
        suiteXmlFiles.addAll(Arrays.asList(suiteFiles));
    }

    public List<File> getSuites(File testSuitesDir) {
        List<File> suites = new ArrayList<File>();

        suites.addAll(suiteXmlFiles);

        if (suiteXmlBuilder != null) {
            File buildSuiteXml = new File(testSuitesDir.getAbsolutePath(), "build-suite.xml");

            if (buildSuiteXml.exists()) {
                if (!buildSuiteXml.delete()) {
                    throw new RuntimeException("failed to remove already existing build-suite.xml file");
                }
            }

            IoActions.writeTextFile(buildSuiteXml, new ErroringAction<BufferedWriter>() {
                @Override
                protected void doExecute(BufferedWriter writer) throws Exception {
                    writer.write("<!DOCTYPE suite SYSTEM \"http://testng.org/testng-1.0.dtd\">");
                    writer.newLine();
                    writer.write(getSuiteXml());
                }
            });

            suites.add(buildSuiteXml);
        }

        return suites;
    }

    public TestNGOptions includeGroups(String... includeGroups) {
        this.includeGroups.addAll(Arrays.asList(includeGroups));
        return this;
    }

    public TestNGOptions excludeGroups(String... excludeGroups) {
        this.excludeGroups.addAll(Arrays.asList(excludeGroups));
        return this;
    }

    public TestNGOptions useDefaultListeners() {
        useDefaultListeners = true;
        return this;
    }

    public TestNGOptions useDefaultListeners(boolean useDefaultListeners) {
        this.useDefaultListeners = useDefaultListeners;
        return this;
    }

    public Object propertyMissing(final String name) {
        if (suiteXmlBuilder != null) {
            return suiteXmlBuilder.getMetaClass().getProperty(suiteXmlBuilder, name);
        }

        throw new MissingPropertyException(name, getClass());
    }

    public Object methodMissing(String name, Object args) {
        if (suiteXmlBuilder != null) {
            return suiteXmlBuilder.getMetaClass().invokeMethod(suiteXmlBuilder, name, args);
        }

        throw new MissingMethodException(name, getClass(), (Object[]) args);
    }

    /**
     * The location to write TestNG's output.
 Defaults to the owning test task's location for writing the HTML report.
     *
     * @since 1.11
     */
    @OutputDirectory
    public File getOutputDirectory() {
        return outputDirectory;
    }

    public void setOutputDirectory(File outputDirectory) {
        this.outputDirectory = outputDirectory;
    }

    /**
     * The set of groups to run.
     */
    @Input
    public Set<String> getIncludeGroups() {
        return includeGroups;
    }

    public void setIncludeGroups(Set<String> includeGroups) {
        this.includeGroups = includeGroups;
    }

    /**
     * The set of groups to exclude.
     */
    @Input
    public Set<String> getExcludeGroups() {
        return excludeGroups;
    }

    public void setExcludeGroups(Set<String> excludeGroups) {
        this.excludeGroups = excludeGroups;
    }

    /**
     * Option for what to do for other tests that use a configuration step when that step fails. Can be "skip" or "continue", defaults to "skip".
     */
    @Internal
    public String getConfigFailurePolicy() {
        return configFailurePolicy;
    }

    public void setConfigFailurePolicy(String configFailurePolicy) {
        this.configFailurePolicy = configFailurePolicy;
    }

    /**
     * Fully qualified classes that are TestNG listeners (instances of org.testng.ITestListener or org.testng.IReporter). By default, the listeners set is empty.
     *
     * Configuring extra listener:
     *

     * plugins {
     *     id 'java'
     * }
     *
     * test {
     *     useTestNG() {
     *         // creates emailable HTML file
     *         // this reporter typically ships with TestNG library
     *         listeners << 'org.testng.reporters.EmailableReporter'
     *     }
     * }
     *

     */
    @Internal
    public Set<String> getListeners() {
        return listeners;
    }

    public void setListeners(Set<String> listeners) {
        this.listeners = listeners;
    }

    /**
     * The parallel mode to use for running the tests - one of the following modes: methods, tests, classes or instances.
     *
     * Not required.
     *
     * If not present, parallel mode will not be selected
     */
    @Nullable
    @Internal
    public String getParallel() {
        return parallel;
    }

    public void setParallel(String parallel) {
        this.parallel = parallel;
    }

    /**
     * The number of threads to use for this run. Ignored unless the parallel mode is also specified
     */
    @Internal
    public int getThreadCount() {
        return threadCount;
    }

    public void setThreadCount(int threadCount) {
        this.threadCount = threadCount;
    }

    @Internal
    public boolean getUseDefaultListeners() {
        return useDefaultListeners;
    }

    /**
     * Whether the default listeners and reporters should be used. Since Gradle 1.4 it defaults to 'false' so that Gradle can own the reports generation and provide various improvements. This option
     * might be useful for advanced TestNG users who prefer the reports generated by the TestNG library. If you cannot live without some specific TestNG reporter please use {@link #listeners}
     * property. If you really want to use all default TestNG reporters (e.g. generate the old reports):
     *
     *

     * plugins {
     *     id 'java'
     * }
     *
     * test {
     *     useTestNG() {
     *         // report generation delegated to TestNG library:
     *         useDefaultListeners = true
     *     }
     *
     *     // turn off Gradle's HTML report to avoid replacing the
     *     // reports generated by TestNG library:
     *     reports.html.required = false
     * }
     *

     *
     * Please refer to the documentation of your version of TestNG what are the default listeners. At the moment of writing this documentation, the default listeners are a set of reporters that
     * generate: TestNG variant of HTML results, TestNG variant of XML results in JUnit format, emailable HTML test report, XML results in TestNG format.
     */
    @Internal
    public boolean isUseDefaultListeners() {
        return useDefaultListeners;
    }

    public void setUseDefaultListeners(boolean useDefaultListeners) {
        this.useDefaultListeners = useDefaultListeners;
    }

    /**
     * Sets the default name of the test suite, if one is not specified in a suite XML file or in the source code.
     */
    @Internal
    public String getSuiteName() {
        return suiteName;
    }

    public void setSuiteName(String suiteName) {
        this.suiteName = suiteName;
    }

    /**
     * Sets the default name of the test, if one is not specified in a suite XML file or in the source code.
     */
    @Internal
    public String getTestName() {
        return testName;
    }

    public void setTestName(String testName) {
        this.testName = testName;
    }

    /**
     * The suiteXmlFiles to use for running TestNG.
     *
     * Note: The suiteXmlFiles can be used in conjunction with the suiteXmlBuilder.
     */
    @InputFiles
    @PathSensitive(PathSensitivity.NONE)
    public List<File> getSuiteXmlFiles() {
        return suiteXmlFiles;
    }

    public void setSuiteXmlFiles(List<File> suiteXmlFiles) {
        this.suiteXmlFiles = suiteXmlFiles;
    }

    @Internal
    public boolean getPreserveOrder() {
        return preserveOrder;
    }

    /**
     * Indicates whether the tests should be run in deterministic order. Preserving the order guarantees that the complete test
     * (including @BeforeXXX and @AfterXXX) is run in a test thread before the next test is run.
     *
     * Not required.
     *
     * If not present, the order will not be preserved.
     */
    @Internal
    public boolean isPreserveOrder() {
        return preserveOrder;
    }

    public void setPreserveOrder(boolean preserveOrder) {
        this.preserveOrder = preserveOrder;
    }

    @Internal
    public boolean getGroupByInstances() {
        return groupByInstances;
    }

    /**
     * Indicates whether the tests should be grouped by instances. Grouping by instances will result in resolving test method dependencies for each instance instead of running the dependees of all
     * instances before running the dependants.
     *
     * Not required.
     *
     * If not present, the tests will not be grouped by instances.
     */
    @Internal
    public boolean isGroupByInstances() {
        return groupByInstances;
    }

    public void setGroupByInstances(boolean groupByInstances) {
        this.groupByInstances = groupByInstances;
    }

    /**
     * Returns the XML generated using {@link #suiteXmlBuilder()}, if any.
     *
     *
This property is read-only and exists merely for up-to-date checking.
     */
    @Input
    @Optional
    protected String getSuiteXml() {
        return suiteXmlWriter == null ? null : suiteXmlWriter.toString();
    }

    @Internal
    public StringWriter getSuiteXmlWriter() {
        return suiteXmlWriter;
    }

    public void setSuiteXmlWriter(StringWriter suiteXmlWriter) {
        this.suiteXmlWriter = suiteXmlWriter;
    }

    @Internal
    public MarkupBuilder getSuiteXmlBuilder() {
        return suiteXmlBuilder;
    }

    public void setSuiteXmlBuilder(MarkupBuilder suiteXmlBuilder) {
        this.suiteXmlBuilder = suiteXmlBuilder;
    }

}


text:
<?php

namespace FastPay\Tests\Api;

use FastPay\Error\InvalidRequestError;
use FastPay\Error\CardError;

class ChargeTest extends \FastPay\Tests\FastPayTestCase
{
    public function testChargeCreate()
    {
        $this->setMock("charges/create");
        $params = array(
            "amount" => 7777,
            "card" => "tok_xxxxxxxxxxxxxxxxxxxxx",
            "description" => "fastpay@example.com",
        );

        $actual = $this->fastpay->charge->create($params);
        $this->assertInstanceOf("FastPay\Api\Charge", $actual);
        $this->assertRegExp('/^ch_[A-Za-z0-9]+$/', $actual->id);

        $this->assertInstanceOf("FastPay\Api\Card", $actual->card);
        $this->assertRegExp('/^card_[A-Za-z0-9]+$/', $actual->card->id);

        $this->assertPost("/charges", $params);
    }

    public function testChargeRetrieve()
    {
        $this->setMock("charges/retrieve");
        $id = "ch_xxxxxxxxxx";
        $actual = $this->fastpay->charge->retrieve($id);

        $this->assertInstanceOf("FastPay\Api\Charge", $actual);
        $this->assertRegExp('/^ch_[A-Za-z0-9]+$/', $actual->id);

        $this->assertInstanceOf("FastPay\Api\Card", $actual->card);
        $this->assertRegExp('/^card_[A-Za-z0-9]+$/', $actual->card->id);

        $this->assertGet("/charges/{$id}");
    }

    public function testChargeAll()
    {
        $this->setMock("charges/all");
        $params = array(
            "count" => 3,
        );

        $charges = $this->fastpay->charge->all($params);

        $actual = $charges[0];
        $this->assertInstanceOf("FastPay\Api\Charge", $actual);
        $this->assertRegExp('/^ch_[A-Za-z0-9]+$/', $actual->id);

        $actual = $charges[1];
        $this->assertInstanceOf("FastPay\Api\Card", $actual->card);
        $this->assertRegExp('/^card_[A-Za-z0-9]+$/', $actual->card->id);

        $this->assertGet("/charges", $params);
    }

    public function testChargeRefund()
    {
        $this->setMock("charges/create");
        $charge = $this->fastpay->charge->create(array(
            "amount" => 7777,
            "card" => "tok_xxxxxxxxxxxxxxxxxxxxx",
            "description" => "fastpay@example.com",
        ));

        $this->setMock("charges/refund");
        $actual = $charge->refund();

        $this->assertRegExp('/^card_[A-Za-z0-9]+$/', $actual->card->id);

        $this->assertPost("/charges/ch_4Iv1CIKeIJQiF1Yg1tjWZejT/refund");
    }

    public function testChargePartialRefund()
    {
        $this->setMock("charges/create");
        $charge = $this->fastpay->charge->create(array(
            "amount" => 7777,
            "card" => "tok_xxxxxxxxxxxxxxxxxxxxx",
            "description" => "fastpay@example.com",
        ));

        $this->setMock("charges/refund");
        $actual = $charge->refund(777);

        $this->assertRegExp('/^card_[A-Za-z0-9]+$/', $actual->card->id);

        $this->assertPost("/charges/ch_4Iv1CIKeIJQiF1Yg1tjWZejT/refund");
    }

    public function testChargeCapture()
    {
        $this->setMock("charges/create");
        $charge = $this->fastpay->charge->create(array(
            "amount" => 7777,
            "card" => "tok_xxxxxxxxxxxxxxxxxxxxx",
            "description" => "fastpay@example.com",
        ));

        $this->setMock("charges/capture");
        $actual = $charge->capture();

        $this->assertRegExp('/^card_[A-Za-z0-9]+$/', $actual->card->id);

        $this->assertPost("/charges/ch_4Iv1CIKeIJQiF1Yg1tjWZejT/capture");
    }

    public function testChargeCreateInvalidToken()
    {
        $this->setMock("errors/invalid_token");
        $body = '{"error":{"type":"card_error","message":"Invalid token id: tok_xxxxxxxxxxxxx","code":"","param":""}}';
        try {
            $this->fastpay->charge->create(array(
                "amount" => 7777,
                "card" => "tok_invalid",
                "description" => "fastpay@example.com",
            ));
            $this->fail("invalid card id");
        } catch (CardError $e) {
            $this->assertSame(402, $e->getHttpStatus());
            $this->assertSame("Status:402, Body:$body", $e->getMessage());
            $this->assertEquals(json_decode($body), $e->getHttpBody());
        }
    }

    public function testChargeRetrieveInvalidChargeId()
    {
        $this->setMock("errors/token_not_found");
        $body = '{"error":{"type":"invalid_request_error","message":"No such charge: tok_xxxxxxxxxxxxxx","code":null,"param":"id"}}';
        try {
            $this->fastpay->charge->retrieve("tok_xxxxxxxxxxxxxx");
            $this->fail("invalid charge id");
        } catch (InvalidRequestError $e) {
            $this->assertSame(404, $e->getHttpStatus());
            $this->assertSame("Status:404, Body:$body", $e->getMessage());
            $this->assertEquals(json_decode($body), $e->getHttpBody());
        }
    }

    public function testChargeCreateValidationError()
    {
        $this->setMock("errors/invalid_capture");
        $body = '{"error":{"type":"invalid_request_error","message":"Invalid boolean: 0","code":"","param":"capture"}}';
        try {
            $this->fastpay->charge->create(array(
                "amount" => 7777,
                "card" => "tok_xxxxxxxxxxxxxxxxxxxxx",
                "description" => "fastpay@example.com",
                "capture" => 0,
            ));
            $this->fail("invalid capture");
        } catch (InvalidRequestError $e) {
            $this->assertSame(402, $e->getHttpStatus());
            $this->assertSame("Status:402, Body:$body", $e->getMessage());
            $this->assertEquals(json_decode($body), $e->getHttpBody());
        }
    }
}


text:
<!doctype html>

    <title>Talk - Python Performance Profiling: The Guts And The Glory - PyGotham 2016</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../../../static/css/app.css">

    <meta name="msapplication-TileColor" content="#182833">
    <meta name="msapplication-TileImage" content="/static/img/metro-icon.png">
    <link rel="apple-touch-icon-precomposed" href="../../../static/img/apple-touch-icon.png">
    <link rel="icon" href="../../../static/img/favicon.png">

          Menu

              About

Code of Conduct

FAQ

Privacy Policy

What is PyGotham?

              Events

Social

Talk List

Talk Schedule

              Registration

Information

              Speaking

Call for Proposals

              Sponsors

Sponsors

Sponsorship Prospectus

              Venue

Hotels

Information

Python Performance Profiling: The Guts And The Glory

      01:45 PM - 02:10 PM on July 16, 2016, Room CR4

        A. Jesse Jiryu Davis

Audience level:

intermediate

Watch:

https://www.youtube.com/watch?v=EJ87Kfzvnbs

Description

Your Python program is too slow, and you need to optimize it. Where do you start? Optimization is a scientific investigation, just like debugging is: you generate hypotheses about how to make your program faster, then use benchmarks as the experiments that test your hypotheses. With the right tools, you can optimize your code where it counts. With the Python profiler "Yappi" to understand its features and limitations we'll learn how to find the maximum performance wins with minimum effort.

Abstract

My boss alerted me to an article on a popular site, which claimed to show that my open-source Python client for MongoDB is three times slower than the Javascript client. Anxiety immediately set in: Was this true? Could I improve it? What should I tell my boss?

I'll describe three open-source profilers for Python, and explain why Yappi is the right profiler for this job.

Optimization is like debugging: we use the scientific method. We form a hypothesis about what changes we can make to our code to make it faster, and we estimate how much improvement an optimization can yield. Then comes the second part of the scientific method: we test the hypothesis with an experiment.

And now, let's return to the problem at hand: Is my code slow? We'll use Yappi to form some hypotheses, then validate them with tests. Finally, I have an answer to my boss's question, and better yet, I can back up my answer with hard evidence.

        PyGotham 2016 is a production of Big Apple Py.

        Artwork by Jessie Sima. UX by Allison Cameron. Hosting provided by Rackspace.

        Questions? Comments? Please contact organizers@pygotham.org.


text:
@protocol NSObject
@end

@protocol NSCopying
@end

__attribute__((objc_root_class))
@interface NSObject <NSObject>
@end

@interface NSString : NSObject <NSCopying>
@end

@interface NSMutableString : NSString
@end

@interface NSNumber : NSObject <NSCopying>
@end

extern __kindof NSObject <NSCopying> *kindof_NSObject_NSCopying;

#else
void testPrettyPrint(int *ip) {
  ip = kindof_NSObject_NSCopying; // expected-warning{{from '__kindof NSObject<NSCopying> *'}}
}

#endif


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ParserCore;

namespace ParserCore.Expr.Simple
{
    public class Abs: FuncExpr_OneOperand
    {
        public override void Prepare()
        {
            base.Prepare();
            if (!(Operand.GetResultType() == SimpleTypes.Integer || Operand.GetResultType() == SimpleTypes.Float)) TypesException();
            SetResultType(SimpleTypes.Integer);
            GetIntResultOut = CalcRes;
        }
        private Int64 CalcRes(object data) { return (Int64)Math.Abs(Operand.GetFloatResultOut(data)); }

        public override string ToStr() { return "abs(" + Operand.ToStr() + ")"; }
        public override string ToSql(ExpressionSqlBuilder builder)
        {
            return "abs(" + Operand.ToSql(builder) + ")";
        }
    }
}


text:
from .widget.oembed.models import OembedWidget
from .widget.feed.models import FeedWidget