text:
<?php

class Application_Form_FrmMessage extends Zend_Form
{

    public function init()
    {
        /* Form Elements & Other Definitions Here ... */

    }

    public static function MessageBacktoOldHistory($msg)
    {
    	$tr= Application_Form_FrmLanguages::getCurrentlanguage();
    	$msg = $tr->translate($msg);
    	echo '<script language="javascript">
    	alert("'.$msg.'");
    	window.history.back();
    	</script>';
    }

	public static function Sucessfull($msg,$url)
	{
		$tr= Application_Form_FrmLanguages::getCurrentlanguage();
		$msg = $tr->translate($msg);
		echo '<script language="javascript">
					alert("'.$msg.'");
					window.location = "'.Zend_Controller_Front::getInstance()->getBaseUrl().$url.'";
			 </script>';
		//alert("'.$msg.'");
	}

	public static function message($msg)
	{
		$tr= Application_Form_FrmLanguages::getCurrentlanguage();
		$msg = $tr->translate($msg);
		echo '<script language="javascript">
		        	alert("'.$msg.'")
		      </script>';
		//alert("'.$msg.'");
	}

	public static function redirectUrl($url)
	{
		echo '<script language="javascript">
					window.location = "'.Zend_Controller_Front::getInstance()->getBaseUrl().$url.'";
			 </script>';
	}

	public static function getUrl($url){
		return Zend_Controller_Front::getInstance()->getBaseUrl().$url;
	}

	public static function redirectorview($url)
	{
		$baseUrl=Zend_Controller_Front::getInstance()->getBaseUrl();
    	$uri='';
    	foreach($url as $key=>$value)
    		$uri.='/'.$value;
    	return $baseUrl.$uri;
	}

	public static function redirector($url){
		$base_url=Zend_Controller_Front::getInstance()->getBaseUrl();
		$siteurl=$base_url.$url;
		echo '<script language="javascript">
		         window.location.href="'.$siteurl.'";
		      </script>';
	}

	public static function messageAlert($msg,$url)
	{
		$tr= Application_Form_FrmLanguages::getCurrentlanguage();
		$msg = $tr->translate($msg);
		echo '<script language="javascript">
		alert("'.$msg.'");
		window.location = "'.Zend_Controller_Front::getInstance()->getBaseUrl().$url.'";
		</script>';
	}

	public static function  getBrowser(){
	    $u_agent = $_SERVER['HTTP_USER_AGENT'];
	    $bname = 'Unknown';
	    $platform = 'Unknown';
	    $version= "";

	    //First get the platform?
	    if (preg_match('/linux/i', $u_agent)) {
	        $platform = 'linux';
	    }
	    elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {
	        $platform = 'mac';
	    }
	    elseif (preg_match('/windows|win32/i', $u_agent)) {
	        $platform = 'windows';
	    }

	    // Next get the name of the useragent yes seperately and for good reason
	    if(preg_match('/MSIE/i',$u_agent) && !preg_match('/Opera/i',$u_agent))
	    {
	        $bname = 'Internet Explorer';
	        $ub = "MSIE";
	    }
	    elseif(preg_match('/Firefox/i',$u_agent))
	    {
	        $bname = 'Mozilla Firefox';
	        $ub = "Firefox";
	    }
	    elseif(preg_match('/Chrome/i',$u_agent))
	    {
	        $bname = 'Google Chrome';
	        $ub = "Chrome";
	    }
	    elseif(preg_match('/Safari/i',$u_agent))
	    {
	        $bname = 'Apple Safari';
	        $ub = "Safari";
	    }
	    elseif(preg_match('/Opera/i',$u_agent))
	    {
	        $bname = 'Opera';
	        $ub = "Opera";
	    }
	    elseif(preg_match('/Netscape/i',$u_agent))
	    {
	        $bname = 'Netscape';
	        $ub = "Netscape";
	    }

	    // finally get the correct version number
	    $known = array('Version', $ub, 'other');
	    $pattern = '#(?<browser>' . join('|', $known) .
	    ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
	    if (!preg_match_all($pattern, $u_agent, $matches)) {
	        // we have no matching number just continue
	    }

	    // see how many we have
	    $i = count($matches['browser']);
	    if ($i != 1) {
	        //we will have two since we are not using 'other' argument yet
	        //see if version is before or after the name
	        if (strripos($u_agent,"Version") < strripos($u_agent,$ub)){
	            $version= $matches['version'][0];
	        }
	        else {
	            $version= $matches['version'][1];
	        }
	    }
	    else {
	        $version= $matches['version'][0];
	    }

	    // check if we have a number
	    if ($version==null || $version=="") {$version="?";}

	    return array(
	        'userAgent' => $u_agent,
	        'name'      => $bname,
	        'version'   => $version,
	        'platform'  => $platform,
	        'pattern'    => $pattern
	    );
	}
}


text:
package org.codehaus.enunciate.modules.objc.config;

import org.apache.commons.digester.Digester;
import org.apache.commons.digester.RuleSetBase;

/**
 * Rules for the configuration of the Objective-C client module.
 *
 * @author Ryan Heaton
 */
public class ObjCRuleSet extends RuleSetBase {

  public void addRuleInstances(Digester digester) {
    digester.addObjectCreate("enunciate/modules/obj-c/package", PackageIdentifier.class);
    digester.addSetProperties("enunciate/modules/obj-c/package");
    digester.addSetNext("enunciate/modules/obj-c/package", "addPackageIdentifier");

    digester.addCallMethod("enunciate/modules/obj-c/facets/include", "addFacetInclude", 1);
    digester.addCallParam("enunciate/modules/obj-c/facets/include", 0, "name");
    digester.addCallMethod("enunciate/modules/obj-c/facets/exclude", "addFacetExclude", 1);
    digester.addCallParam("enunciate/modules/obj-c/facets/exclude", 0, "name");
  }
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

var Base = require('./../base');

module.exports = Base.extend({
  url: '/camunda/app/admin/default/#/groups',

  newGroupButton: function() {
    return element(by.css('[ng-show="availableOperations.create"] a'));
  },

  groupList: function() {
    return element.all(by.repeater('group in groupList'));
  },

  groupId: function(idx) {
    return this.groupList()
      .get(idx)
      .element(by.css('.group-id > a'));
  },

  groupName: function(idx) {
    return this.groupList()
      .get(idx)
      .element(by.binding('{{group.name}}'));
  },

  groupType: function(idx) {
    return this.groupList()
      .get(idx)
      .element(by.binding('{{group.type}}'));
  },

  selectGroupByEditLink: function(idx) {
    return this.groupList()
      .get(idx)
      .element(by.linkText('Edit'))
      .click();
  },

  selectGroupByNameLink: function(idx) {
    return this.groupId(idx).click();
  }
});


text:
package com.amazonaws.services.support.model;

import java.io.Serializable;
import javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;

/**
 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AddCommunicationToCaseRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     *

     * The support case ID requested or returned in the call. The case ID is an alphanumeric string formatted as shown
     * in this example: case-12345678910-2013-c4c1d2bf33c5cf47
     *

     */
    private String caseId;
    /**
     *

     * The body of an email communication to add to the support case.
     *

     */
    private String communicationBody;
    /**
     *

     * The email addresses in the CC line of an email to be added to the support case.
     *

     */
    private com.amazonaws.internal.SdkInternalList<String> ccEmailAddresses;
    /**
     *

     * The ID of a set of one or more attachments for the communication to add to the case. Create the set by calling
     * AddAttachmentsToSet
     *

     */
    private String attachmentSetId;

    /**
     *

     * The support case ID requested or returned in the call. The case ID is an alphanumeric string formatted as shown
     * in this example: case-12345678910-2013-c4c1d2bf33c5cf47
     *

     *
     * @param caseId
     *        The support case ID requested or returned in the call. The case ID is an alphanumeric string formatted as
     *        shown in this example: case-12345678910-2013-c4c1d2bf33c5cf47
     */

    public void setCaseId(String caseId) {
        this.caseId = caseId;
    }

    /**
     *

     * The support case ID requested or returned in the call. The case ID is an alphanumeric string formatted as shown
     * in this example: case-12345678910-2013-c4c1d2bf33c5cf47
     *

     *
     * @return The support case ID requested or returned in the call. The case ID is an alphanumeric string formatted as
     *         shown in this example: case-12345678910-2013-c4c1d2bf33c5cf47
     */

    public String getCaseId() {
        return this.caseId;
    }

    /**
     *

     * The support case ID requested or returned in the call. The case ID is an alphanumeric string formatted as shown
     * in this example: case-12345678910-2013-c4c1d2bf33c5cf47
     *

     *
     * @param caseId
     *        The support case ID requested or returned in the call. The case ID is an alphanumeric string formatted as
     *        shown in this example: case-12345678910-2013-c4c1d2bf33c5cf47
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AddCommunicationToCaseRequest withCaseId(String caseId) {
        setCaseId(caseId);
        return this;
    }

    /**
     *

     * The body of an email communication to add to the support case.
     *

     *
     * @param communicationBody
     *        The body of an email communication to add to the support case.
     */

    public void setCommunicationBody(String communicationBody) {
        this.communicationBody = communicationBody;
    }

    /**
     *

     * The body of an email communication to add to the support case.
     *

     *
     * @return The body of an email communication to add to the support case.
     */

    public String getCommunicationBody() {
        return this.communicationBody;
    }

    /**
     *

     * The body of an email communication to add to the support case.
     *

     *
     * @param communicationBody
     *        The body of an email communication to add to the support case.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AddCommunicationToCaseRequest withCommunicationBody(String communicationBody) {
        setCommunicationBody(communicationBody);
        return this;
    }

    /**
     *

     * The email addresses in the CC line of an email to be added to the support case.
     *

     *
     * @return The email addresses in the CC line of an email to be added to the support case.
     */

    public java.util.List<String> getCcEmailAddresses() {
        if (ccEmailAddresses == null) {
            ccEmailAddresses = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return ccEmailAddresses;
    }

    /**
     *

     * The email addresses in the CC line of an email to be added to the support case.
     *

     *
     * @param ccEmailAddresses
     *        The email addresses in the CC line of an email to be added to the support case.
     */

    public void setCcEmailAddresses(java.util.Collection<String> ccEmailAddresses) {
        if (ccEmailAddresses == null) {
            this.ccEmailAddresses = null;
            return;
        }

        this.ccEmailAddresses = new com.amazonaws.internal.SdkInternalList<String>(ccEmailAddresses);
    }

    /**
     *

     * The email addresses in the CC line of an email to be added to the support case.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setCcEmailAddresses(java.util.Collection)} or {@link #withCcEmailAddresses(java.util.Collection)} if you
     * want to override the existing values.
     *

     *
     * @param ccEmailAddresses
     *        The email addresses in the CC line of an email to be added to the support case.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AddCommunicationToCaseRequest withCcEmailAddresses(String... ccEmailAddresses) {
        if (this.ccEmailAddresses == null) {
            setCcEmailAddresses(new com.amazonaws.internal.SdkInternalList<String>(ccEmailAddresses.length));
        }
        for (String ele : ccEmailAddresses) {
            this.ccEmailAddresses.add(ele);
        }
        return this;
    }

    /**
     *

     * The email addresses in the CC line of an email to be added to the support case.
     *

     *
     * @param ccEmailAddresses
     *        The email addresses in the CC line of an email to be added to the support case.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AddCommunicationToCaseRequest withCcEmailAddresses(java.util.Collection<String> ccEmailAddresses) {
        setCcEmailAddresses(ccEmailAddresses);
        return this;
    }

    /**
     *

     * The ID of a set of one or more attachments for the communication to add to the case. Create the set by calling
     * AddAttachmentsToSet
     *

     *
     * @param attachmentSetId
     *        The ID of a set of one or more attachments for the communication to add to the case. Create the set by
     *        calling AddAttachmentsToSet
     */

    public void setAttachmentSetId(String attachmentSetId) {
        this.attachmentSetId = attachmentSetId;
    }

    /**
     *

     * The ID of a set of one or more attachments for the communication to add to the case. Create the set by calling
     * AddAttachmentsToSet
     *

     *
     * @return The ID of a set of one or more attachments for the communication to add to the case. Create the set by
     *         calling AddAttachmentsToSet
     */

    public String getAttachmentSetId() {
        return this.attachmentSetId;
    }

    /**
     *

     * The ID of a set of one or more attachments for the communication to add to the case. Create the set by calling
     * AddAttachmentsToSet
     *

     *
     * @param attachmentSetId
     *        The ID of a set of one or more attachments for the communication to add to the case. Create the set by
     *        calling AddAttachmentsToSet
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AddCommunicationToCaseRequest withAttachmentSetId(String attachmentSetId) {
        setAttachmentSetId(attachmentSetId);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getCaseId() != null)
            sb.append("CaseId: ").append(getCaseId()).append(",");
        if (getCommunicationBody() != null)
            sb.append("CommunicationBody: ").append(getCommunicationBody()).append(",");
        if (getCcEmailAddresses() != null)
            sb.append("CcEmailAddresses: ").append(getCcEmailAddresses()).append(",");
        if (getAttachmentSetId() != null)
            sb.append("AttachmentSetId: ").append(getAttachmentSetId());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof AddCommunicationToCaseRequest == false)
            return false;
        AddCommunicationToCaseRequest other = (AddCommunicationToCaseRequest) obj;
        if (other.getCaseId() == null ^ this.getCaseId() == null)
            return false;
        if (other.getCaseId() != null && other.getCaseId().equals(this.getCaseId()) == false)
            return false;
        if (other.getCommunicationBody() == null ^ this.getCommunicationBody() == null)
            return false;
        if (other.getCommunicationBody() != null && other.getCommunicationBody().equals(this.getCommunicationBody()) == false)
            return false;
        if (other.getCcEmailAddresses() == null ^ this.getCcEmailAddresses() == null)
            return false;
        if (other.getCcEmailAddresses() != null && other.getCcEmailAddresses().equals(this.getCcEmailAddresses()) == false)
            return false;
        if (other.getAttachmentSetId() == null ^ this.getAttachmentSetId() == null)
            return false;
        if (other.getAttachmentSetId() != null && other.getAttachmentSetId().equals(this.getAttachmentSetId()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getCaseId() == null) ? 0 : getCaseId().hashCode());
        hashCode = prime * hashCode + ((getCommunicationBody() == null) ? 0 : getCommunicationBody().hashCode());
        hashCode = prime * hashCode + ((getCcEmailAddresses() == null) ? 0 : getCcEmailAddresses().hashCode());
        hashCode = prime * hashCode + ((getAttachmentSetId() == null) ? 0 : getAttachmentSetId().hashCode());
        return hashCode;
    }

    @Override
    public AddCommunicationToCaseRequest clone() {
        return (AddCommunicationToCaseRequest) super.clone();
    }

}


text:
<?php

declare(strict_types=1);

namespace AdminPanel\Component\PropertyObserver;

class MultiplePropertyObserver extends PropertyObserver implements MultiplePropertyObserverInterface
{
    /**
     * {@inheritdoc}
     */
    public function saveValues($object, array $propertyPaths)
    {
        foreach ($propertyPaths as $propertyPath) {
            $this->saveValue($object, $propertyPath);
        }
    }

    /**
     * {@inheritdoc}
     */
    public function hasChangedValues($object, array $propertyPaths, $notSavedAsNull = false)
    {
        $valueChanged = false;
        foreach ($propertyPaths as $propertyPath) {
            $valueChanged = $valueChanged || $this->hasChangedValue($object, $propertyPath, $notSavedAsNull);
        }
        return $valueChanged;
    }
}


text:
<?php

/*
*  Copyright 2011, Monits, S.A.
*  Released under the Apache 2 and New BSD Licenses.
*  More information: https://github.com/Monits/ZendExt/
*/
/**
 * A generic builder.
 *
 * Can only build instances of classes that receive an
 * associative array of values in their constructor as their
 * first and only argument.
 *
 * @category  ZendExt
 * @package   ZendExt_Builder
 * @author    jsotuyod <juansotuyo@gmail.com>
 * @copyright 2010 Juan Sotuyo
 * @license   Copyright 2011. All rights reserved.
 * @version   Release: 1.0.0
 * @link      http://www.monits.com/
 * @since     1.0.0
 */
class ZendExt_Builder_Generic
{
    protected $_data = array();

    protected $_fields = array();

    protected $_class;

    /**
     * Default handler for method calls.
     *
     * @param string $methodName The name of the method called.
     * @param array  $args       The arguments passed to the method.
     *
     * @return ZendExt_Builder_Generic
     *
     * @throws ZendExt_Builder_Exception
     */
    public function __call($methodName, $args)
    {
        if (isset($methodName[4]) && 'with' === substr($methodName, 0, 4)) {
            $var = strtolower($methodName[4]) . substr($methodName, 5);
            $val = $args[0];

            if (!isset($this->_fields[$var])) {
                throw new ZendExt_Builder_Exception('Unknown field: ' . $var);
            }

            if (isset($this->_fields[$var]['validators'])) {
                $this->_validateField(
                    $this->_fields[$var]['validators'], $var, $val
                );
            }

            $this->_data[$var] = $val;
        } else {
            throw new ZendExt_Builder_Exception(
                'Unknown method: ' . $methodName
            );
        }

        return $this;
    }

    /**
     * Validates the given field with the requested validators.
     *
     * @param array|Zend_Validate_Interface $validators The validators
     *                                                  to be applied.
     * @param string                        $var        The name of the var
     *                                                  being validated.
     * @param any                           $val        The value to be
     *                                                  validated.
     *
     * @return void
     *
     * @throws ZendExt_Builder_Exception
     * @throws ZendExt_Builder_ValidationException
     */
    private function _validateField($validators, $var, $val)
    {
        if (!is_array($validators)) {
            $validators = array($this->_fields[$var]['validators']);
        }

        if (null === $val && $this->hasDefault($var)
                && $this->getDefault($var) === null) {
            return;
        }

        foreach ($validators as $validator) {
            if (!$validator instanceof Zend_Validate_Interface) {
                throw new ZendExt_Builder_Exception(
                    'Validators must be instances of Zend_Validate_Interface'
                );
            }

            if (!$validator->isValid($val)) {
                throw new ZendExt_Builder_ValidationException(
                    $var, $validator->getMessages()
                );
            }
        }
    }

    /**
     * Creates a builder given it's configuration.
     *
     * @param array|Zend_Config $config The configuration with which
     *                                     to create a builder.
     *
     * @return ZendExt_Builder_Generic
     *
     * @throws ZendExt_Builder_Exception
     */
    public static function factory($config)
    {
        $builder = new ZendExt_Builder_Generic();
        if ($config instanceof Zend_Config) {
            $config = $config->toArray();
        }

        if (!isset($config['class']) || !class_exists($config['class'])) {
            throw new ZendExt_Builder_Exception(
                'Invalid config, no class to be builded specified.'
            );
        }

        if (!isset($config['fields']) || !is_array($config['fields'])) {
            throw new ZendExt_Builder_Exception(
                'Invalid config, no fields specified.'
            );
        }

        $builder->_class = $config['class'];
        $builder->_fields = $config['fields'];

        return $builder;
    }

    /**
     * Actually builds am instance of the requested class.
     *
     * @return Instance of $_class
     *
     * @throws ZendExt_Builder_Exception
     */
    public function build()
    {
        foreach ($this->_fields as $field => $config) {

            if (array_key_exists('default', $config)
                    && !isset($this->_data[$field])) {
                $this->_data[$field] = $config['default'];
            }

            if (isset($config['required']) && true === $config['required']
                    && !array_key_exists($field, $this->_data)) {
                throw new ZendExt_Builder_Exception(
                    "The field '$field' is required but missing."
                );
            }
        }

        return new $this->_class($this->_data);
    }

    /**
     * Get the names of the fields.
     *
     * @return array
     */
    public function getFieldsNames()
    {
        return array_keys($this->_fields);
    }

    /**
     * Get the default value of the field.
     *
     * @param string $field The field.
     *
     * @return mixed
     */
    public function getDefault($field)
    {
        return $this->_fields[$field]['default'];
    }

    /**
     * Checks if the given field has default value.
     *
     * @param string $field The field.
     *
     * @return boolean
     */
    public function hasDefault($field)
    {
        return array_key_exists('default', $this->_fields[$field]);
    }
}


text:
var Mongoose = require('mongoose');

var UserSchema = new Mongoose.Schema({
  "fb_id": Number,
  "email": String,
  "password": String,
  "first_name": String,
  "last_name": String,
  "school": String,
  "year": String,
  "major": String,
  "dorm": String,
  "gender": String,
  "courses": [String],
  "photo": String
});

var CourseSchema = new Mongoose.Schema({
  "dept_num": String,
  "department": String,
  "number": String,
  "title": String,
  "description": String,
  "students": [String]
});

exports.User = Mongoose.model('User', UserSchema, 'Users');
exports.Course = Mongoose.model('Course', CourseSchema, 'Courses');


text:
> An ember-cli-deploy-plugin for setting the status deploy on a commit in a PR on [GitHub](https://github.com/).

[![](https://ember-cli-deploy.github.io/ember-cli-deploy-version-badges/plugins/ember-cli-deploy-s3.svg)](http://ember-cli-deploy.github.io/ember-cli-deploy-version-badges/)
[![npm version](https://badge.fury.io/js/ember-cli-deploy-github-deployments.svg)](https://badge.fury.io/js/ember-cli-deploy-github-deployments)

## What is an ember-cli-deploy plugin?

A plugin is an addon that can be executed as a part of the ember-cli-deploy pipeline. A plugin will implement one or more of the ember-cli-deploy's pipeline hooks.

For more information on what plugins are and how they work, please refer to the [Plugin Documentation][2].

## Quick Start

To get up and running quickly, do the following:

- Install this plugin

```bash
$ ember install ember-cli-deploy-github-deployments
```

- Get a github api [token](https://github.com/settings/tokens) make sure the `repo:status` scope is selected

- Place the following configuration into `config/deploy.js`

```javascript
ENV['github-deployments'] = {
  token: '<your-github-token>',
  username: '<user-name>'
  reporname: '<my-ember-app-repo>',
  publicURL: '<url-where-assets-will-be-viewed-from>',
  commit: '<sha-for-specific-commit>'
}
```

## ember-cli-deploy Hooks Implemented

For detailed information on what plugin hooks are and how they work, please refer to the [Plugin Documentation][2].

- `configure`
- `willDeploy`
- `didDeploy`
- `didFail`

## Required Configuration Options

For detailed information on how configuration of plugins works, please refer to the [Plugin Documentation][2].

### commit

The github commit sha that the status will be applied to. e.x https://github.com/my-user/:repo/commit/:sha

### token

The [token](https://github.com/settings/tokens) that will be used to set the status on the github commit.

### username

The user or organization that owns the repo. e.x https://github.com/:username/my-repo

### reporname

The user or organization that owns the reporname. e.x https://github.com/my-user/:reporname

### publicURL

The url which your assets are going to be viewed from. e.x. https://my-app-domain.com/{{commit}}

## Screenshot (Pipeline)

### Pending deploy
`ember-cli-deploy-github-deployments` will set the status `pending` of the github commit on the willDeploy.

![screenshot from 2017-08-20 14-08-42](https://user-images.githubusercontent.com/118861/29496839-452f279e-85b1-11e7-9ea0-0c9d608f3043.png)

### Success Deploy
`ember-cli-deploy-github-deployments` will set the status `success` of the github commit on the didDeploy.

![screenshot from 2017-08-20 14-07-10](https://user-images.githubusercontent.com/118861/29496840-452fb4e8-85b1-11e7-9706-4e2f0f8d2863.png)

### Error Deploy
`ember-cli-deploy-github-deployments` will set the status `error` of the github commit on the didFail.

![screenshot from 2017-08-20 14-09-04](https://user-images.githubusercontent.com/118861/29496838-452ec646-85b1-11e7-9319-3769c06155a9.png)

## Roadmap
- [ ] [Save log of deploy in Gist, when failure deploy][4]
- [ ] [Add Github status deployments in timeline][3]

[2]: http://ember-cli.github.io/ember-cli-deploy/plugins "Plugin Documentation"
[3]: https://developer.github.com/v3/repos/deployments/
[4]: https://developer.github.com/v3/gists/


text:
Disclaimer: This is not an official Google product.

This is an example application demonstrating how the deployed model
 can be used to make online predictions from web applications.

## Products
- [Cloud Machine Learning Engine][1]
- [App Engine][2]

## Language
- [Python][3]

[1]: https://cloud.google.com/ml-engine/
[2]: https://cloud.google.com/appengine/docs
[3]: https://python.org

## Prerequisites
You are supposed to have deployed the trained model for online predictions
 by following the instruction in the Cloud Datalab [notebook][4]. You need to
 use the same project to run this application.

[4]: https://github.com/GoogleCloudPlatform/training-data-analyst/blob/master/blogs/babyweight/babyweight.ipynb

## Do this first
In this section you will start your [Google Cloud Shell][6] and clone the
 application code repository to it.

1. [Open the Cloud Console][7]

2. Click the Google Cloud Shell icon in the top-right and wait for your shell
 to open:

 ![](docs/img/cloud-shell.png)

3. Clone the lab repository in your cloud shell, then `cd` into that dir:

  ```shell
  $ git clone https://github.com/GoogleCloudPlatform/training-data-analyst
  Cloning into 'training-data-analyst'...
  ...

  $ cd training-data-analyst/blogs/babyweight/application
  ```

[6]: https://cloud.google.com/cloud-shell/docs/
[7]: https://console.cloud.google.com/

## Customize the model name

If you have deployed the model with the name different from 'babyweight',
 open `app.yaml` with a text editor and replace the model name accordingly.

```yaml
env_variables:
  MODEL_NAME: 'babyweight'
```

## Deploy the application

```shell
$ pip install -r requirements.txt -t lib
$ gcloud app create
$ gcloud app deploy
```

By executing these commands on the Cloud Shell, the project id is automatically
 applied to the application and the application URL will be
 `https://[project id].appspot.com`.

Now you can access the URL from your browser to use the web application
 to predict a baby's weight.

 ![](docs/img/screenshot.png)


text:
//Copyright (c) 2011 Kenneth Evans
//
//Permission is hereby granted, free of charge, to any person obtaining
//a copy of this software and associated documentation files (the
//"Software"), to deal in the Software without restriction, including
//without limitation the rights to use, copy, modify, merge, publish,
//distribute, sublicense, and/or sell copies of the Software, and to
//permit persons to whom the Software is furnished to do so, subject to
//the following conditions:
//
//The above copyright notice and this permission notice shall be included
//in all copies or substantial portions of the Software.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
//EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
//MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
//IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
//CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
//TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
//SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

package net.kenevans.android.misc;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.Locale;

import androidx.appcompat.app.AppCompatActivity;

import static net.kenevans.android.misc.MessageUtils.formatDate;

/**
 * Manages a ListView of all the messages in the database specified by the
 * URI field.
 */
public class MMSActivity extends AppCompatActivity implements IConstants {
    /**
     * The current position when ACTIVITY_DISPLAY_MESSAGE is requested. Used
     * with the resultCodes RESULT_PREV and RESULT_NEXT when they are returned.
     */
    private int mCurrentPosition;

    /**
     * The current id when ACTIVITY_DISPLAY_MESSAGE is requested. Used with the
     * resultCodes RESULT_PREV and RESULT_NEXT when they are returned.
     */
    private long mCurrentId;

    /**
     * The mIncrement for displaying the next message.
     */
    private long mIncrement = 0;

    /**
     * The Uri to use.
     */
    private static final Uri URI = MMS_URI;

    /**
     * The date multiplier to use to get ms. MMS message timestamps are in sec
     * not ms.
     */
    private static final Long DATE_MULTIPLIER = 1000L;

    /**
     * Enum to specify the sort order.
     */
    private enum Order {
        TIME(COL_DATE + " DESC"), ID(COL_ID + " DESC");
        public final String sqlCommand;

        Order(String sqlCommand) {
            this.sqlCommand = sqlCommand;
        }
    }

    /**
     * The sort order to use.
     */
    private Order mSortOrder = Order.TIME;

    private CustomListAdapter mListAdapter;
    private ListView mListView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.list_view);
        mListView = findViewById(R.id.mainListView);
        mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                                    int position, long id) {
                onListItemClick(mListView, view, position, id);
            }
        });

        // Set fast scroll
        mListView.setFastScrollEnabled(true);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.smsmenu, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        switch (id) {
            case R.id.refresh:
                refresh();
                return true;
            case R.id.order:
                setOrder();
                return true;
        }
        return false;
    }

    protected void onListItemClick(ListView lv, View view, int position, long
            id) {
        Log.d(TAG, this.getClass().getSimpleName() + ": onListItemClick: " +
                "position=" + position + " id=" + id);
        Data data = mListAdapter.getData(position);
        if (data == null) return;
        Log.d(TAG, "data: id=" + data.getId() + " " + data.getAddress());
        // Save the position when starting the activity
        mCurrentPosition = position;
        mCurrentId = data.getId();
        mIncrement = 0;
        displayMessage();
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode,
                                    Intent intent) {
        super.onActivityResult(requestCode, resultCode, intent);
        // DEBUG
        Log.d(TAG, this.getClass().getSimpleName()
                + ".onActivityResult: requestCode=" + requestCode
                + " resultCode=" + resultCode + " mCurrentPosition="
                + mCurrentPosition);
        if (requestCode == DISPLAY_MESSAGE) {
            mIncrement = 0;
            // Note that earlier items are at higher positions in the list
            if (resultCode == RESULT_PREV) {
                mIncrement = -1;
            } else if (resultCode == RESULT_NEXT) {
                mIncrement = +1;
            }
        }
    }

    @Override
    protected void onResume() {
        Log.d(TAG, this.getClass().getSimpleName()
                + ".onResume: mCurrentPosition=" + mCurrentPosition
                + " mCurrentId=" + mCurrentId + " mIncrement=" + mIncrement);
        super.onResume();
        refresh();
        // If mIncrement is set display a new message
        if (mIncrement != 0) {
            displayMessage();
        }
    }

    @Override
    protected void onPause() {
        Log.d(TAG, this.getClass().getSimpleName()
                + ".onPause: mCurrentPosition=" + mCurrentPosition);
        Log.d(TAG, this.getClass().getSimpleName() + ".onPause: mCurrentId="
                + mCurrentId);
        super.onPause();
    }

    /**
     * Bring up a dialog to change the sort order.
     */
    private void setOrder() {
        final CharSequence[] items = {getText(R.string.sort_time),
                getText(R.string.sort_id)};
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(getText(R.string.sort_title));
        builder.setSingleChoiceItems(items, mSortOrder == Order.TIME ? 0 : 1,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int item) {
                        dialog.dismiss();
                        mSortOrder = item == 0 ? Order.TIME : Order.ID;
                        refresh();
                    }
                });
        AlertDialog alert = builder.create();
        alert.show();
    }

    /**
     * Displays the message at the current position plus the current mIncrement,
     * adjusting for being within range. Resets the mIncrement to 0 after.
     */
    private void displayMessage() {
        if (mListAdapter == null) {
            return;
        }
        try {
            int count = mListAdapter.getCount();
            Log.d(TAG, this.getClass().getSimpleName()
                    + ".displayMessage: count=" + count + " mCurrentId=" +
                    mCurrentId + " mCurrentPosition=" + mCurrentPosition);
            if (count == 0) {
                Utils.infoMsg(this, "There are no items in the list");
                return;
            }
            // Check if the item is still at the same position in the list
            boolean changed = false;
            long id = -1;
            if (mCurrentPosition > count - 1 || mCurrentPosition < 0) {
                changed = true;
            } else {
                Data data = mListAdapter.getData(mCurrentPosition);
                if (data == null) {
                    Utils.errMsg(this, "Error displaying message: Missing " +
                            "data for position " + mCurrentPosition);
                    return;
                }
                id = data.getId();
                if (id != mCurrentId) {
                    changed = true;
                }
            }
            // Determine the new mCurrentPosition
            Log.d(TAG, this.getClass().getSimpleName()
                    + ".displayMessage: position=" + mCurrentPosition + " id="
                    + id + " changed=" + changed);
            if (changed) {
                for (int i = 0; i < count; i++) {
                    Data data = mListAdapter.getData(mCurrentPosition);
                    if (data == null) {
                        Utils.errMsg(this, "Error displaying message: Missing" +
                                " " + "data for position " + mCurrentPosition);
                        return;
                    }
                    id = data.getId();
                    if (id == mCurrentId) {
                        mCurrentPosition = i;
                        break;
                    }
                }
            }
            // mCurrentPosition may still be invalid, check it is in range
            if (mCurrentPosition < 0) {
                mCurrentPosition = 0;
            } else if (mCurrentPosition > count - 1) {
                mCurrentPosition = count - 1;
            }

            // Display messages if a requested mIncrement is not possible
            if (mIncrement > 0) {
                mCurrentPosition += mIncrement;
                if (mCurrentPosition > count - 1) {
                    Toast.makeText(getApplicationContext(),
                            "At the last item in the list", Toast.LENGTH_LONG)
                            .show();
                    mCurrentPosition = count - 1;
                }
            } else if (mIncrement < 0) {
                mCurrentPosition += mIncrement;
                if (mCurrentPosition < 0) {
                    Toast.makeText(getApplicationContext(),
                            "At the first item in the list", Toast.LENGTH_LONG)
                            .show();
                    mCurrentPosition = 0;
                }
            }

            // Request the new message
            Data data = mListAdapter.getData(mCurrentPosition);
            if (data == null) {
                Utils.errMsg(this, "Error displaying message: Missing " +
                        "data for position " + mCurrentPosition);
                return;
            }
            mCurrentId = data.getId();
            Intent i = new Intent(this, DisplayMMSActivity.class);
            i.putExtra(COL_ID, mCurrentId);
            i.putExtra(URI_KEY, URI.toString());
            Log.d(TAG, this.getClass().getSimpleName()
                    + ".displayMessage: position=" + mCurrentPosition
                    + " mCurrentId=" + mCurrentId);
            startActivityForResult(i, DISPLAY_MESSAGE);
        } catch (Exception ex) {
            Utils.excMsg(this, "Error displaying message", ex);
        } finally {
            // Reset mIncrement
            mIncrement = 0;
        }
    }

    /**
     * Gets a new cursor and starts managing it.
     */
    private void refresh() {
        // Initialize the list view mListAdapter
        mListAdapter = new CustomListAdapter();
        mListView.setAdapter(mListAdapter);
    }

    /**
     * Class to manage the data needed for an item in the ListView.
     */
    private static class Data {
        private final long id;
        private String address;
        private long dateNum = -1;
        private boolean invalid = true;

        private Data(long id) {
            this.id = id;
        }

        private void setValues(String address, long dateNum) {
            this.address = address;
            this.dateNum = dateNum;
            invalid = false;
        }

        private long getId() {
            return id;
        }

        private String getAddress() {
            return address;
        }

        private long getDateNum() {
            return dateNum;
        }

        private boolean isInvalid() {
            return invalid;
        }
    }

    /**
     * ListView adapter class for this activity.
     */
    private class CustomListAdapter extends BaseAdapter {
        private String[] mDesiredColumns;
        private Data[] mDataArray;
        private final LayoutInflater mInflator;
        private int mIndexId;
        private int mIndexDate;

        private CustomListAdapter() {
            super();
            // DEBUG
//            Log.d(TAG, this.getClass().getSimpleName() + " Start");
//            Date start = new Date();
            mInflator = getLayoutInflater();
            Cursor cursor = null;
            int nItems = 0;
            try {
                // First get the names of all the columns in the database
                String[] availableColumns;
                cursor = getContentResolver().query(URI, null, null,
                        null, null);
                if (cursor == null) {
                    availableColumns = new String[0];
                } else {
                    availableColumns = cursor.getColumnNames();
                    cursor.close();
                }

                // Make an array of the desired ones that are available
                String[] desiredColumns = {COL_ID, COL_DATE};
                ArrayList<String> list = new ArrayList<>();
                for (String col : desiredColumns) {
                    for (String col1 : availableColumns) {
                        if (col.equals(col1)) {
                            list.add(col);
                            break;
                        }
                    }
                }
                mDesiredColumns = new String[list.size()];
                list.toArray(mDesiredColumns);

                // Get the available columns from all rows
                cursor = getContentResolver().query(URI, mDesiredColumns,
                        null, null, mSortOrder.sqlCommand);
                if (cursor == null) {
                    Utils.errMsg(MMSActivity.this,
                            "ListAdapter: Error getting data: No items in " +
                                    "database");
                    return;
                }

                mIndexId = cursor.getColumnIndex(COL_ID);
                mIndexDate = cursor.getColumnIndex(COL_DATE);

                int count = cursor.getCount();
                mDataArray = new Data[count];

                if (count <= 0) {
                    Utils.infoMsg(MMSActivity.this, "No items in database");
                } else {
                    // Loop over items
                    if (cursor.moveToFirst()) {
                        while (!cursor.isAfterLast()) {
                            long id = cursor.getLong(mIndexId);
                            mDataArray[nItems] = new Data(id);
                            nItems++;
                            cursor.moveToNext();
                        }
                    }
                }
            } catch (Exception ex) {
                Utils.excMsg(MMSActivity.this,
                        "ListAdapter: Error getting data", ex);
            } finally {
                try {
                    if (cursor != null) cursor.close();
                } catch (Exception ex) {
                    // Do nothing
                }
            }
            // DEBUG
//            Date end = new Date();
//            double elapsed = (end.getTime() - start.getTime()) / 1000.;
//            Log.d(TAG, "Elapsed time=" + elapsed);
            Log.d(TAG, "Data list created with " + nItems + " items");
        }

        private Data getData(int i) {
            if (mDataArray == null || i < 0 || i >= mDataArray.length) {
                return null;
            }
            return mDataArray[i];
        }

        @Override
        public int getCount() {
            return mDataArray == null ? 0 : mDataArray.length;
        }

        @Override
        public Object getItem(int i) {
            if (mDataArray == null || i < 0 || i >= mDataArray.length) {
                return null;
            }
            return mDataArray[i];
        }

        @Override
        public long getItemId(int i) {
            return i;
        }

        @Override
        public View getView(int i, View view, ViewGroup viewGroup) {
//            Log.d(TAG, this.getClass().getSimpleName() + ": i=" + i);
            ViewHolder viewHolder;
            // General ListView optimization code.
            if (view == null) {
                view = mInflator.inflate(R.layout.list_row, viewGroup,
                        false);
                viewHolder = new ViewHolder();
                viewHolder.title = view.findViewById(R.id.title);
                viewHolder.subTitle = view.findViewById(R.id
                        .subtitle);
                view.setTag(viewHolder);
            } else {
                viewHolder = (ViewHolder) view.getTag();
            }
            String titleText;
            String subTitleText;

            // Check if index is OK.
            if (i < 0 || i >= mDataArray.length) {
                titleText = "Error";
                subTitleText = "Bad view index" + i + " (Should be 0 to "
                        + mDataArray.length + ")";
                viewHolder.title.setText(titleText);
                viewHolder.subTitle.setText(subTitleText);
                return view;
            }
            Data data = mDataArray[i];
            if (data == null) {
                titleText = "Error";
                subTitleText = "Cannot find data for i=" + i;
                viewHolder.title.setText(titleText);
                viewHolder.subTitle.setText(subTitleText);
                return view;
            }

            // Only calculate what is needed (i.e visible)
            // Speeds up tremendously over calculating everything before
            if (data.isInvalid()) {
                // Get the values for this item
                Cursor cursor = getContentResolver().query(URI,
                        mDesiredColumns,
                        COL_ID + "=" + mDataArray[i].getId(), null, mSortOrder
                                .sqlCommand);
                if (cursor != null && cursor.moveToFirst()) {
                    String id = cursor.getString(mIndexId);
                    // We need to get the address from another provider
                    String address = "<Address NA>";
                    // Determine if From or To
                    String fromAddr =
                            MessageUtils.getMmsAddress(MMSActivity.this, 137,
                                    id);
                    String toAddr =
                            MessageUtils.getMmsAddress(MMSActivity.this, 151,
                                    id);
                    if (fromAddr != null) {
                        if (!fromAddr.equals("insert-address-token")) {
                            address = "From: " + fromAddr;
                        } else {
                            // Is outgoing
                            if (toAddr != null) {
                                address = "To: " + toAddr;
                            }
                        }
                    }
                    long dateNum = -1L;
                    if (mIndexDate > -1) {
                        dateNum = cursor.getLong(mIndexDate) *
                                DATE_MULTIPLIER;
                    }
                    data.setValues(address, dateNum);
                }
                if (cursor != null) cursor.close();
            }

            titleText = String.format(Locale.US, "%d", data.getId()) +
                    ": " + MessageUtils.formatAddress(data.getAddress());
            subTitleText = formatDate(data.getDateNum());
            String contactName = MessageUtils.getContactNameFromNumber(
                    MMSActivity.this, data.getAddress());
            if (contactName != null && !contactName.equals("Unknown")) {
                titleText += " " + contactName;
            }
            viewHolder.title.setText(titleText);
            viewHolder.subTitle.setText(subTitleText);
            return view;
        }
    }

    /**
     * Convenience class for managing views for a ListView row.
     */
    private static class ViewHolder {
        TextView title;
        TextView subTitle;
    }

}


text:
"""AnnouncementExternalFeeds API Tests for Version 1.0.

This is a testing template for the generated AnnouncementExternalFeedsAPI Class.
"""
import unittest
import requests
import secrets
from py3canvas.apis.announcement_external_feeds import AnnouncementExternalFeedsAPI
from py3canvas.apis.announcement_external_feeds import Externalfeed

class TestAnnouncementExternalFeedsAPI(unittest.TestCase):
    """Tests for the AnnouncementExternalFeedsAPI."""

    def setUp(self):
        self.client = AnnouncementExternalFeedsAPI(
            secrets.instance_address, secrets.access_token
        )

    def test_list_external_feeds_courses(self):
        """Integration test for the AnnouncementExternalFeedsAPI.list_external_feeds_courses method."""
        course_id = None  # Change me!!

        r = self.client.list_external_feeds_courses(course_id)

    def test_list_external_feeds_groups(self):
        """Integration test for the AnnouncementExternalFeedsAPI.list_external_feeds_groups method."""
        group_id = None  # Change me!!

        r = self.client.list_external_feeds_groups(group_id)

    def test_create_external_feed_courses(self):
        """Integration test for the AnnouncementExternalFeedsAPI.create_external_feed_courses method."""
        # This method utilises the POST request method and will make changes to the Canvas instance. This needs consideration.
        pass

    def test_create_external_feed_groups(self):
        """Integration test for the AnnouncementExternalFeedsAPI.create_external_feed_groups method."""
        # This method utilises the POST request method and will make changes to the Canvas instance. This needs consideration.
        pass

    def test_delete_external_feed_courses(self):
        """Integration test for the AnnouncementExternalFeedsAPI.delete_external_feed_courses method."""
        course_id = None  # Change me!!
        external_feed_id = None  # Change me!!

        r = self.client.delete_external_feed_courses(course_id, external_feed_id)

    def test_delete_external_feed_groups(self):
        """Integration test for the AnnouncementExternalFeedsAPI.delete_external_feed_groups method."""
        group_id = None  # Change me!!
        external_feed_id = None  # Change me!!

        r = self.client.delete_external_feed_groups(external_feed_id, group_id)


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using Azure.Storage.Queues.Models;

namespace Microsoft.Azure.WebJobs.Host.Queues.Triggers
{
    internal class StorageQueueMessageToStringConverter : IConverter<QueueMessage, string>
    {
        public string Convert(QueueMessage input)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            return input.MessageText;
        }
    }
}


text:
post '/search' do
  @category = Category.find_by(name: params[:search].downcase)
  if @category
    @category.timeCheck
    @category.searchCount += 1
    @category.save
  else
    @category = Category.create(name: params[:search].downcase, searchCount: 1)
    @category.updateThumbnail
    @category.createContent(@category.search)
  end
  @category.createUriArray.to_json
end

get '/search/:id' do |id|
  @category = Category.find(id)
  @category.timeCheck
  @category.searchCount += 1
  @category.save
  @category.createUriArray.to_json
end


text:
package bigip

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/http/httptest"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
	"github.com/stretchr/testify/suite"
)

type SysTestSuite struct {
	suite.Suite
	Client          *BigIP
	Server          *httptest.Server
	LastRequest     *http.Request
	LastRequestBody string
	ResponseFunc    func(http.ResponseWriter, *http.Request)
}

func (s *SysTestSuite) SetupSuite() {
	s.Server = httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		body, _ := ioutil.ReadAll(r.Body)
		s.LastRequestBody = string(body)
		s.LastRequest = r
		if s.ResponseFunc != nil {
			s.ResponseFunc(w, r)
		}
	}))

	s.Client = NewSession(s.Server.URL, "", "", nil)
}

func (s *SysTestSuite) TearDownSuite() {
	s.Server.Close()
}

func (s *SysTestSuite) SetupTest() {
	s.ResponseFunc = nil
	s.LastRequest = nil
}

func (s *SysTestSuite) requireReserializesTo(expected string, actual interface{}, message string) {
	b, err := json.Marshal(actual)
	s.Require().Nil(err, message)

	s.Require().JSONEq(expected, string(b), message)
}

func TestSysSuite(t *testing.T) {
	suite.Run(t, new(SysTestSuite))
}

func (s *SysTestSuite) TestFolders() {
	resp := `{
  "items": [
    {
      "name": "/",
      "fullPath": "/",
      "deviceGroup": "none",
      "hidden": "false",
      "inheritedDevicegroup": "false",
      "inheritedTrafficGroup": "false",
      "noRefCheck": "false",
      "trafficGroup": "/Common/traffic-group-1"
    },
    {
      "name": "Common",
      "subPath": "/",
      "fullPath": "/Common",
      "deviceGroup": "none",
      "hidden": "false",
      "inheritedDevicegroup": "true",
      "inheritedTrafficGroup": "true",
      "noRefCheck": "false",
      "trafficGroup": "/Common/traffic-group-1"
    },
    {
      "name": "Drafts",
      "partition": "Common",
      "fullPath": "/Common/Drafts",
      "deviceGroup": "none",
      "hidden": "false",
      "inheritedDevicegroup": "true",
      "inheritedTrafficGroup": "true",
      "noRefCheck": "false",
      "trafficGroup": "/Common/traffic-group-1"
    },
    {
      "name": "test",
      "partition": "Common",
      "fullPath": "/Common/test",
      "deviceGroup": "none",
      "hidden": "false",
      "inheritedDevicegroup": "true",
      "inheritedTrafficGroup": "true",
      "noRefCheck": "false",
      "trafficGroup": "/Common/traffic-group-1"
    }
  ]
}`

	s.ResponseFunc = func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte(resp))
	}

	folders, err := s.Client.Folders()

	require.Nil(s.T(), err, "Error loading folders")
	assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s", uriSys, uriFolder), s.LastRequest.URL.Path, "Wrong uri to fetch folders")
	assert.Equal(s.T(), 4, len(folders.Folders), "Wrong number of folders")
	assert.Equal(s.T(), "/", folders.Folders[0].Name)
	assert.Equal(s.T(), "Common", folders.Folders[1].Name)
	assert.Equal(s.T(), "Drafts", folders.Folders[2].Name)
	assert.Equal(s.T(), "test", folders.Folders[3].Name)

	s.requireReserializesTo(resp, folders, "Folders should reserialize to itself")
}

func (s *SysTestSuite) TestCreateFolder() {
	err := s.Client.CreateFolder("/Common/test")

	require.Nil(s.T(), err, "Error creating folder")
	assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s", uriSys, uriFolder), s.LastRequest.URL.Path, "Wrong uri to create folders")
	assert.Equal(s.T(), "POST", s.LastRequest.Method)
	assert.JSONEq(s.T(), `{"name":"/Common/test"}`, s.LastRequestBody)
}

func (s *SysTestSuite) TestAddFolder() {
	folder := Folder{
		Name:         "/Common/test",
		TrafficGroup: "default",
		NoRefCheck:   Bool(true),
	}
	err := s.Client.AddFolder(&folder)

	require.Nil(s.T(), err, "Error adding folder")
	assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s", uriSys, uriFolder), s.LastRequest.URL.Path, "Wrong uri to create folders")
	assert.Equal(s.T(), "POST", s.LastRequest.Method)
	assert.JSONEq(s.T(), `{"name":"/Common/test", "trafficGroup": "default", "noRefCheck": "true"}`, s.LastRequestBody)
}

func (s *SysTestSuite) TestGetFolder() {
	resp := `{
  "name": "test",
  "partition": "Common",
  "fullPath": "/Common/test",
  "deviceGroup": "none",
  "hidden": "false",
  "inheritedDevicegroup": "true",
  "inheritedTrafficGroup": "true",
  "noRefCheck": "false",
  "trafficGroup": "/Common/traffic-group-1"
  }`

	s.ResponseFunc = func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte(resp))
	}

	folder, err := s.Client.GetFolder("/Common/test")

	require.Nil(s.T(), err, "Error getting folder")
	assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s/%s", uriSys, uriFolder, "~Common~test"), s.LastRequest.URL.Path, "Wrong uri to fetch folders")
	s.requireReserializesTo(resp, folder, "Folder should reserialize to itself")
}

func (s *SysTestSuite) TestDeleteFolder() {
	err := s.Client.DeleteFolder("/Common/test")

	require.Nil(s.T(), err, "Error deleting folder")
	assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s/%s", uriSys, uriFolder, "~Common~test"), s.LastRequest.URL.Path, "Wrong uri to create folders")
	assert.Equal(s.T(), "DELETE", s.LastRequest.Method)
}

func (s *SysTestSuite) TestModifyFolder() {
	folder := Folder{
		TrafficGroup: "default",
		NoRefCheck:   Bool(true),
	}
	err := s.Client.ModifyFolder("/Common/test", &folder)

	require.Nil(s.T(), err, "Error modifying folder")
	assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s/%s", uriSys, uriFolder, "~Common~test"), s.LastRequest.URL.Path, "Wrong uri to fetch folders")
	assert.Equal(s.T(), "PUT", s.LastRequest.Method)
}

func (s *SysTestSuite) TestPatchFolder() {
	folder := Folder{
		TrafficGroup: "default",
		NoRefCheck:   Bool(true),
	}
	err := s.Client.PatchFolder("/Common/test", &folder)

	require.Nil(s.T(), err, "Error patching folder")
	assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s/%s", uriSys, uriFolder, "~Common~test"), s.LastRequest.URL.Path, "Wrong uri to fetch folders")
	assert.Equal(s.T(), "PATCH", s.LastRequest.Method)
}

func (s *SysTestSuite) TestCertificates() {
	resp := `{
  "items": [
    {
      "name": "foo.crt",
      "partition": "Common",
      "fullPath": "/Common/foo.crt",
      "generation": 1,
      "certificateKeyCurveName": "none",
      "certificateKeySize": 2048,
      "checksum": "SHA1:1184:d8af9b644095d0c0626ad38f1cec5b9e4188e794",
      "createTime": "2019-03-15T15:10:11Z",
      "createdBy": "admin",
      "expirationDate": 1584198611,
      "expirationString": "Mar 14 15:10:11 2020 GMT",
      "isBundle": "false",
      "issuer": "CN=foo.example.com,O=Foo Inc.,L=New York,ST=New York,C=US",
      "keyType": "rsa-public",
      "lastUpdateTime": "2019-03-15T15:10:11Z",
      "mode": 33188,
      "revision": 1,
      "serialNumber": "291519056",
      "size": 1184,
      "sourcePath": "/config/ssl/ssl.crt/foo.crt",
      "subject": "CN=foo.example.com,O=Foo Inc.,L=New York,ST=New York,C=US",
      "updatedBy": "admin",
      "version": 1
    },
    {
      "name": "bar.crt",
      "partition": "Common",
      "fullPath": "/Common/bar.crt",
      "generation": 1,
      "certificateKeyCurveName": "none",
      "certificateKeySize": 2048,
      "checksum": "SHA1:1196:7b55ca0b4dc10bdb29a4bca5d0d70627e3fc63f3",
      "createTime": "2019-03-15T15:10:31Z",
      "createdBy": "admin",
      "expirationDate": 1584198631,
      "expirationString": "Mar 14 15:10:31 2020 GMT",
      "isBundle": "false",
      "issuer": "CN=bar.example.com,O=Bar Inc.,L=Los Angeles,ST=California,C=US",
      "keyType": "rsa-public",
      "lastUpdateTime": "2019-03-15T15:10:31Z",
      "mode": 33188,
      "revision": 1,
      "serialNumber": "203165026",
      "size": 1196,
      "sourcePath": "/config/ssl/ssl.crt/bar.crt",
      "subject": "CN=bar.example.com,O=Bar Inc.,L=Los Angeles,ST=California,C=US",
      "updatedBy": "admin",
      "version": 1
    }
  ]
}`

	s.ResponseFunc = func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte(resp))
	}

	certs, err := s.Client.Certificates()

	require.Nil(s.T(), err, "Error loading certificates")
	assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s/%s", uriSys, uriFile, uriSslCert), s.LastRequest.URL.Path, "Wrong uri to fetch certificates")
	assert.Equal(s.T(), 2, len(certs.Certificates), "Wrong number of certificates")
	assert.Equal(s.T(), "foo.crt", certs.Certificates[0].Name)
	assert.Equal(s.T(), "bar.crt", certs.Certificates[1].Name)
	s.requireReserializesTo(resp, certs, "Certificates should reserialize to itself")
}

func (s *SysTestSuite) TestAddCertificate() {
	cert := Certificate{
		Name:       "test",
		SourcePath: "file:///var/config/rest/downloads/test.crt",
	}
	err := s.Client.AddCertificate(&cert)

	require.Nil(s.T(), err, "Error adding certificate")
	assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s/%s", uriSys, uriFile, uriSslCert), s.LastRequest.URL.Path, "Wrong uri to create certificate")
	assert.Equal(s.T(), "POST", s.LastRequest.Method)
	assert.JSONEq(s.T(), `{"name":"test", "sourcePath":"file:///var/config/rest/downloads/test.crt"}`, s.LastRequestBody)
}

func (s *SysTestSuite) TestGetCertificate() {
	resp := `{
  "name": "test.crt",
  "partition": "Common",
  "fullPath": "/Common/test.crt",
  "generation": 1,
  "certificateKeyCurveName": "none",
  "certificateKeySize": 2048,
  "checksum": "SHA1:1188:ef0223d316fb0f16e07fc25e4c3f396ff4f43e8e",
  "createTime": "2019-03-15T15:09:46Z",
  "createdBy": "admin",
  "expirationDate": 1584198586,
  "expirationString": "Mar 14 15:09:46 2020 GMT",
  "isBundle": "false",
  "issuer": "CN=test.example.com,O=Test Inc.,L=New York,ST=New York,C=US",
  "keyType": "rsa-public",
  "lastUpdateTime": "2019-03-15T15:09:46Z",
  "mode": 33188,
  "revision": 1,
  "serialNumber": "219156055",
  "size": 1188,
  "sourcePath": "/config/ssl/ssl.crt/test.crt",
  "subject": "CN=test.example.com,O=Test Inc.,L=New York,ST=New York,C=US",
  "updatedBy": "admin",
  "version": 1
}`

	s.ResponseFunc = func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte(resp))
	}

	cert, err := s.Client.GetCertificate("/Common/test.crt")

	require.Nil(s.T(), err, "Error getting certificate")
	assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s/%s/%s", uriSys, uriFile, uriSslCert, "~Common~test.crt"), s.LastRequest.URL.Path, "Wrong uri to fetch certificate")
	s.requireReserializesTo(resp, cert, "Certificate should reserialize to itself")
}

func (s *SysTestSuite) TestDeleteCertificate() {
	err := s.Client.DeleteCertificate("/Common/test.crt")

	require.Nil(s.T(), err, "Error deleting certificate")
	assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s/%s/%s", uriSys, uriFile, uriSslCert, "~Common~test.crt"), s.LastRequest.URL.Path, "Wrong uri to delete certificate")
	assert.Equal(s.T(), "DELETE", s.LastRequest.Method)
}

func (s *SysTestSuite) TestKeys() {
	resp := `{
  "items": [
    {
      "name": "foo.key",
      "partition": "Common",
      "fullPath": "/Common/foo.key",
      "generation": 1,
      "checksum": "SHA1:1704:bbfccd4b6d1215b2f7feb92ba8ff336bdb22885f",
      "createTime": "2019-03-15T15:10:11Z",
      "createdBy": "admin",
      "curveName": "none",
      "keySize": 2048,
      "keyType": "rsa-private",
      "lastUpdateTime": "2019-03-15T15:10:11Z",
      "mode": 33184,
      "revision": 1,
      "securityType": "normal",
      "size": 1704,
      "sourcePath": "/config/ssl/ssl.key/foo.key",
      "updatedBy": "admin"
    },
    {
      "name": "bar.key",
      "partition": "Common",
      "fullPath": "/Common/bar.key",
      "generation": 1,
      "checksum": "SHA1:1704:b41c6b484421ad6229bc7e8ea623f0eacf5bc78b",
      "createTime": "2019-03-15T15:10:31Z",
      "createdBy": "admin",
      "curveName": "none",
      "keySize": 2048,
      "keyType": "rsa-private",
      "lastUpdateTime": "2019-03-15T15:10:31Z",
      "mode": 33184,
      "revision": 1,
      "securityType": "normal",
      "size": 1704,
      "sourcePath": "/config/ssl/ssl.key/bar.key",
      "updatedBy": "admin"
    }
  ]
}`

	s.ResponseFunc = func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte(resp))
	}

	keys, err := s.Client.Keys()

	require.Nil(s.T(), err, "Error loading keys")
	assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s/%s", uriSys, uriFile, uriSslKey), s.LastRequest.URL.Path, "Wrong uri to fetch keys")
	assert.Equal(s.T(), 2, len(keys.Keys), "Wrong number of keys")
	assert.Equal(s.T(), "foo.key", keys.Keys[0].Name)
	assert.Equal(s.T(), "bar.key", keys.Keys[1].Name)
	s.requireReserializesTo(resp, keys, "Keys should reserialize to itself")
}

func (s *SysTestSuite) TestAddKey() {
	key := Key{
		Name:       "test",
		SourcePath: "file:///var/config/rest/downloads/test.key",
	}
	err := s.Client.AddKey(&key)

	require.Nil(s.T(), err, "Error adding key")
	assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s/%s", uriSys, uriFile, uriSslKey), s.LastRequest.URL.Path, "Wrong uri to create key")
	assert.Equal(s.T(), "POST", s.LastRequest.Method)
	assert.JSONEq(s.T(), `{"name":"test", "sourcePath":"file:///var/config/rest/downloads/test.key"}`, s.LastRequestBody)
}

func (s *SysTestSuite) TestGetKey() {
	resp := `{
  "name": "test.key",
  "partition": "Common",
  "fullPath": "/Common/test.key",
  "generation": 1,
  "checksum": "SHA1:1704:73c6766b89be06a464d2269a0b96b2cc0e6cc2f2",
  "createTime": "2019-03-15T15:09:46Z",
  "createdBy": "admin",
  "curveName": "none",
  "keySize": 2048,
  "keyType": "rsa-private",
  "lastUpdateTime": "2019-03-15T15:09:46Z",
  "mode": 33184,
  "revision": 1,
  "securityType": "normal",
  "size": 1704,
  "sourcePath": "/config/ssl/ssl.key/test.key",
  "updatedBy": "admin"
}`

	s.ResponseFunc = func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte(resp))
	}

	key, err := s.Client.GetKey("/Common/test.key")

	require.Nil(s.T(), err, "Error getting key")
	assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s/%s/%s", uriSys, uriFile, uriSslKey, "~Common~test.key"), s.LastRequest.URL.Path, "Wrong uri to fetch key")
	s.requireReserializesTo(resp, key, "Key should reserialize to itself")
}

func (s *SysTestSuite) TestDeleteKey() {
	err := s.Client.DeleteKey("/Common/test.key")

	require.Nil(s.T(), err, "Error deleting key")
	assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s/%s/%s", uriSys, uriFile, uriSslKey, "~Common~test.key"), s.LastRequest.URL.Path, "Wrong uri to delete key")
	assert.Equal(s.T(), "DELETE", s.LastRequest.Method)
}

func (s *SysTestSuite) TestSaveSysConfig() {
	s.ResponseFunc = func(w http.ResponseWriter, r *http.Request) {
		w.WriteHeader(200)
	}
	err := s.Client.SaveSysConfig("", "")
	assert.Nil(s.T(), err)

	err = s.Client.SaveSysConfig("backup.scf", "")
	assert.Nil(s.T(), err)

	err = s.Client.SaveSysConfig("backup.scf", "secret-key")
	assert.Nil(s.T(), err)

	err = s.Client.SaveSysConfig("backup.tar", "")
	assert.Nil(s.T(), err)

	err = s.Client.SaveSysConfig("backup.tar", "secret-key")
	assert.Nil(s.T(), err)
}

func (s *SysTestSuite) TestLodSysConfig() {
	s.ResponseFunc = func(w http.ResponseWriter, r *http.Request) {
		w.WriteHeader(200)
	}
	err := s.Client.LoadSysConfig("", "")
	assert.Nil(s.T(), err)

	err = s.Client.LoadSysConfig("backup.scf", "")
	assert.Nil(s.T(), err)

	err = s.Client.LoadSysConfig("backup.scf", "secret-key")
	assert.Nil(s.T(), err)

	err = s.Client.LoadSysConfig("backup.tar", "")
	assert.Nil(s.T(), err)

	err = s.Client.LoadSysConfig("backup.tar", "secret-key")
	assert.Nil(s.T(), err)
}


text:
SYNONYM

#### According to
GRIN Taxonomy for Plants

#### Published in
Trans. Roy. Soc. South Africa 3:315. 1913

#### Original name
null

### Remarks
null


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Shorcut_Virus_Remover
{
    public partial class StartupPage : Form
    {
        public StartupPage()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Signup is not available right now. Please connect to the internet","Error Signup",System.Windows.Forms.MessageBoxButtons.OK,MessageBoxIcon.Error);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Login loginform = new Login();

            this.Hide();
            loginform.Show();
        }
    }
}


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GraphUtilities;

import BasicDataStructures.*;
/**
 *
 * @author tsourolampis
 */
public class PathFinder {
     // prev[v] = previous vertex on shortest path from s to v
    // dist[v] = length of shortest path from s to v

    private ST<Integer, Integer>  prev = new ST<Integer, Integer>();
    private ST<Integer, Integer> dist = new ST<Integer, Integer>();

    // run BFS in graph G from given source vertex s
    public PathFinder(Graph G, int s) {

        // put source on the queue
        Queue q = new Queue();
        q.enqueue(s);
        dist.put(s, 0);

        // repeated remove next vertex v from queue and insert
        // all its neighbors, provided they haven't yet been visited
        while (!q.isEmpty()) {
            int v = q.dequeue();
            for (Integer w : G.adjacentTo(v)) {
                if (!dist.contains(w)) {
                    q.enqueue(w);
                    dist.put(w, 1 + dist.get(v));
                    prev.put(w, v);
                }
            }
        }
    }

    // is v reachable from the source s?
    public boolean isReachable(int v) {
        return dist.contains(v);
    }

    // return the length of the shortest path from v to s
    public int distanceTo(int v) {
        if (!dist.contains(v)) return Integer.MAX_VALUE;
        return dist.get(v);
    }

    public Iterable<Integer> getAllReachable()
    {
        return dist.keys();
    }

}


text:
<?php

namespace Academic\Bundle\ProjectBundle\Model;

class ExtendProject
{
    /**
     * Constructor
     *
     * The real implementation of this method is auto generated.
     *
     * IMPORTANT: If the derived class has own constructor it must call parent constructor.
     */
    public function __construct()
    {
    }
}


text:
@interface CLTableAPIViewController : CLAPIViewController

@end


text:
package grumpy

import (
	"fmt"
	"math"
	"math/big"
	"reflect"
	"strconv"
)

const (
	internedIntMin = -2
	internedIntMax = 300
)

var (
	internedInts = makeInternedInts()
)

// Int represents Python 'int' objects.
type Int struct {
	Object
	value int
}

// NewInt returns a new Int holding the given integer value.
func NewInt(value int) *Int {
	if value >= internedIntMin && value <= internedIntMax {
		return &internedInts[value-internedIntMin]
	}
	return &Int{Object{typ: IntType}, value}
}

func toIntUnsafe(o *Object) *Int {
	return (*Int)(o.toPointer())
}

// ToObject upcasts i to an Object.
func (i *Int) ToObject() *Object {
	return &i.Object
}

// Value returns the underlying integer value held by i.
func (i *Int) Value() int {
	return i.value
}

// IsTrue returns false if i is zero, true otherwise.
func (i *Int) IsTrue() bool {
	return i.Value() != 0
}

// IntType is the object representing the Python 'int' type.
var IntType = newBasisType("int", reflect.TypeOf(Int{}), toIntUnsafe, ObjectType)

func intAbs(f *Frame, o *Object) (*Object, *BaseException) {
	z := toIntUnsafe(o)
	if z.Value() > 0 {
		return z.ToObject(), nil
	}
	return intNeg(f, o)
}

func intAdd(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intAddMulOp(f, "__add__", v, w, intCheckedAdd, longAdd)
}

func intAnd(f *Frame, v, w *Object) (*Object, *BaseException) {
	if !w.isInstance(IntType) {
		return NotImplemented, nil
	}
	return NewInt(toIntUnsafe(v).Value() & toIntUnsafe(w).Value()).ToObject(), nil
}

func intDiv(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intDivModOp(f, "__div__", v, w, intCheckedDiv, longDiv)
}

func intEq(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intCompare(compareOpEq, toIntUnsafe(v), w), nil
}

func intGE(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intCompare(compareOpGE, toIntUnsafe(v), w), nil
}

func intGetNewArgs(f *Frame, args Args, _ KWArgs) (*Object, *BaseException) {
	if raised := checkMethodArgs(f, "__getnewargs__", args, IntType); raised != nil {
		return nil, raised
	}
	return NewTuple1(args[0]).ToObject(), nil
}

func intGT(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intCompare(compareOpGT, toIntUnsafe(v), w), nil
}

func intFloat(f *Frame, o *Object) (*Object, *BaseException) {
	i := toIntUnsafe(o).Value()
	return NewFloat(float64(i)).ToObject(), nil
}

func intHash(f *Frame, o *Object) (*Object, *BaseException) {
	return o, nil
}

func intHex(f *Frame, o *Object) (*Object, *BaseException) {
	val := numberToBase("0x", 16, o)
	return NewStr(val).ToObject(), nil
}

func intIndex(f *Frame, o *Object) (*Object, *BaseException) {
	return o, nil
}

func intInt(f *Frame, o *Object) (*Object, *BaseException) {
	if o.typ == IntType {
		return o, nil
	}
	return NewInt(toIntUnsafe(o).Value()).ToObject(), nil
}

func intInvert(f *Frame, o *Object) (*Object, *BaseException) {
	return NewInt(^toIntUnsafe(o).Value()).ToObject(), nil
}

func intLE(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intCompare(compareOpLE, toIntUnsafe(v), w), nil
}

func intLong(f *Frame, o *Object) (*Object, *BaseException) {
	return NewLong(big.NewInt(int64(toIntUnsafe(o).Value()))).ToObject(), nil
}

func intLShift(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intShiftOp(f, v, w, func(v, w int) (int, int, bool) { return v, w, false })
}

func intLT(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intCompare(compareOpLT, toIntUnsafe(v), w), nil
}

func intMod(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intDivModOp(f, "__mod__", v, w, intCheckedMod, longMod)
}

func intMul(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intAddMulOp(f, "__mul__", v, w, intCheckedMul, longMul)
}

func intNative(f *Frame, o *Object) (reflect.Value, *BaseException) {
	return reflect.ValueOf(toIntUnsafe(o).Value()), nil
}

func intNE(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intCompare(compareOpNE, toIntUnsafe(v), w), nil
}

func intNeg(f *Frame, o *Object) (*Object, *BaseException) {
	z := toIntUnsafe(o)
	if z.Value() == MinInt {
		nz := big.NewInt(int64(z.Value()))
		return NewLong(nz.Neg(nz)).ToObject(), nil
	}
	return NewInt(-z.Value()).ToObject(), nil
}

func intNew(f *Frame, t *Type, args Args, _ KWArgs) (*Object, *BaseException) {
	if len(args) == 0 {
		return newObject(t), nil
	}
	o := args[0]
	if len(args) == 1 && o.typ.slots.Int != nil {
		i, raised := ToInt(f, o)
		if raised != nil {
			return nil, raised
		}
		if t == IntType {
			return i, nil
		}
		n := 0
		if i.isInstance(LongType) {
			n, raised = toLongUnsafe(i).IntValue(f)
			if raised != nil {
				return nil, raised
			}
		} else {
			n = toIntUnsafe(i).Value()
		}
		ret := newObject(t)
		toIntUnsafe(ret).value = n
		return ret, nil
	}
	if len(args) > 2 {
		return nil, f.RaiseType(TypeErrorType, fmt.Sprintf("int() takes at most 2 arguments (%d given)", len(args)))
	}
	if !o.isInstance(StrType) {
		if len(args) == 2 {
			return nil, f.RaiseType(TypeErrorType, "int() can't convert non-string with explicit base")
		}
		return nil, f.RaiseType(TypeErrorType, fmt.Sprintf("int() argument must be a string or a number, not '%s'", o.typ.Name()))
	}
	s := toStrUnsafe(o).Value()
	base := 10
	if len(args) == 2 {
		var raised *BaseException
		base, raised = ToIntValue(f, args[1])
		if raised != nil {
			return nil, raised
		}
		if base < 0 || base == 1 || base > 36 {
			return nil, f.RaiseType(ValueErrorType, "int() base must be >= 2 and <= 36")
		}
	}
	i, ok := numParseInteger(new(big.Int), s, base)
	if !ok {
		format := "invalid literal for int() with base %d: %s"
		return nil, f.RaiseType(ValueErrorType, fmt.Sprintf(format, base, s))
	}
	if !numInIntRange(i) {
		if t == IntType {
			return NewLong(i).ToObject(), nil
		}
		return nil, f.RaiseType(OverflowErrorType, "Python int too large to convert to a Go int")
	}
	if t != IntType {
		o := newObject(t)
		toIntUnsafe(o).value = int(i.Int64())
		return o, nil
	}
	return NewInt(int(i.Int64())).ToObject(), nil
}

func intNonZero(f *Frame, o *Object) (*Object, *BaseException) {
	return GetBool(toIntUnsafe(o).Value() != 0).ToObject(), nil
}

func intOct(f *Frame, o *Object) (*Object, *BaseException) {
	val := numberToBase("0", 8, o)
	if val == "00" {
		val = "0"
	}
	return NewStr(val).ToObject(), nil
}

func intOr(f *Frame, v, w *Object) (*Object, *BaseException) {
	if !w.isInstance(IntType) {
		return NotImplemented, nil
	}
	return NewInt(toIntUnsafe(v).Value() | toIntUnsafe(w).Value()).ToObject(), nil
}

func intPow(f *Frame, v, w *Object) (*Object, *BaseException) {
	if w.isInstance(IntType) {
		// First try to use the faster floating point arithmetic
		// on the CPU, then falls back to slower methods.
		// IEEE float64 has 52bit of precision, so the result should be
		// less than MaxInt32 to be representable as an exact integer.
		// This assumes that int is at least 32bit.
		vInt := toIntUnsafe(v).Value()
		wInt := toIntUnsafe(w).Value()
		if 0 < vInt && vInt <= math.MaxInt32 && 0 < wInt && wInt <= math.MaxInt32 {
			res := math.Pow(float64(vInt), float64(wInt))
			// Can the result be interpreted as an int?
			if !math.IsNaN(res) && !math.IsInf(res, 0) && res <= math.MaxInt32 {
				return NewInt(int(res)).ToObject(), nil
			}
		}
		// Special cases.
		if vInt == 0 {
			if wInt < 0 {
				return nil, f.RaiseType(ZeroDivisionErrorType, "0.0 cannot be raised to a negative power")
			}
			if wInt == 0 {
				return NewInt(1).ToObject(), nil
			}
			return NewInt(0).ToObject(), nil
		}
		// If w < 0, the result must be a floating point number.
		// We convert both arguments to float and continue.
		if wInt < 0 {
			return floatPow(f, NewFloat(float64(vInt)).ToObject(), NewFloat(float64(wInt)).ToObject())
		}
		// Else we convert to Long and continue there.
		return longPow(f, NewLong(big.NewInt(int64(vInt))).ToObject(), NewLong(big.NewInt(int64(wInt))).ToObject())
	}
	return NotImplemented, nil
}

func intRAdd(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intAddMulOp(f, "__radd__", v, w, intCheckedAdd, longAdd)
}

func intRDiv(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intDivModOp(f, "__rdiv__", v, w, func(v, w int) (int, divModResult) {
		return intCheckedDiv(w, v)
	}, func(z, x, y *big.Int) {
		longDiv(z, y, x)
	})
}

func intRepr(f *Frame, o *Object) (*Object, *BaseException) {
	return NewStr(strconv.FormatInt(int64(toIntUnsafe(o).Value()), 10)).ToObject(), nil
}

func intRMod(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intDivModOp(f, "__rmod__", v, w, func(v, w int) (int, divModResult) {
		return intCheckedMod(w, v)
	}, func(z, x, y *big.Int) {
		longMod(z, y, x)
	})
}

func intRMul(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intAddMulOp(f, "__rmul__", v, w, intCheckedMul, longMul)
}

func intRLShift(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intShiftOp(f, v, w, func(v, w int) (int, int, bool) { return w, v, false })
}

func intRRShift(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intShiftOp(f, v, w, func(v, w int) (int, int, bool) { return w, v, true })
}

func intRShift(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intShiftOp(f, v, w, func(v, w int) (int, int, bool) { return v, w, true })
}

func intRSub(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intAddMulOp(f, "__rsub__", v, w, func(v, w int) (int, bool) {
		return intCheckedSub(w, v)
	}, func(z, x, y *big.Int) {
		longSub(z, y, x)
	})
}

func intSub(f *Frame, v, w *Object) (*Object, *BaseException) {
	return intAddMulOp(f, "__sub__", v, w, intCheckedSub, longSub)
}

func intXor(f *Frame, v, w *Object) (*Object, *BaseException) {
	if !w.isInstance(IntType) {
		return NotImplemented, nil
	}
	return NewInt(toIntUnsafe(v).Value() ^ toIntUnsafe(w).Value()).ToObject(), nil
}

func initIntType(dict map[string]*Object) {
	dict["__getnewargs__"] = newBuiltinFunction("__getnewargs__", intGetNewArgs).ToObject()
	IntType.slots.Abs = &unaryOpSlot{intAbs}
	IntType.slots.Add = &binaryOpSlot{intAdd}
	IntType.slots.And = &binaryOpSlot{intAnd}
	IntType.slots.Div = &binaryOpSlot{intDiv}
	IntType.slots.Eq = &binaryOpSlot{intEq}
	IntType.slots.GE = &binaryOpSlot{intGE}
	IntType.slots.GT = &binaryOpSlot{intGT}
	IntType.slots.Float = &unaryOpSlot{intFloat}
	IntType.slots.Hash = &unaryOpSlot{intHash}
	IntType.slots.Hex = &unaryOpSlot{intHex}
	IntType.slots.Index = &unaryOpSlot{intIndex}
	IntType.slots.Int = &unaryOpSlot{intInt}
	IntType.slots.Invert = &unaryOpSlot{intInvert}
	IntType.slots.LE = &binaryOpSlot{intLE}
	IntType.slots.LShift = &binaryOpSlot{intLShift}
	IntType.slots.LT = &binaryOpSlot{intLT}
	IntType.slots.Long = &unaryOpSlot{intLong}
	IntType.slots.Mod = &binaryOpSlot{intMod}
	IntType.slots.Mul = &binaryOpSlot{intMul}
	IntType.slots.Native = &nativeSlot{intNative}
	IntType.slots.NE = &binaryOpSlot{intNE}
	IntType.slots.Neg = &unaryOpSlot{intNeg}
	IntType.slots.New = &newSlot{intNew}
	IntType.slots.NonZero = &unaryOpSlot{intNonZero}
	IntType.slots.Oct = &unaryOpSlot{intOct}
	IntType.slots.Or = &binaryOpSlot{intOr}
	IntType.slots.Pow = &binaryOpSlot{intPow}
	IntType.slots.RAdd = &binaryOpSlot{intRAdd}
	IntType.slots.RAnd = &binaryOpSlot{intAnd}
	IntType.slots.RDiv = &binaryOpSlot{intRDiv}
	IntType.slots.Repr = &unaryOpSlot{intRepr}
	IntType.slots.RMod = &binaryOpSlot{intRMod}
	IntType.slots.RMul = &binaryOpSlot{intRMul}
	IntType.slots.ROr = &binaryOpSlot{intOr}
	IntType.slots.RLShift = &binaryOpSlot{intRLShift}
	IntType.slots.RRShift = &binaryOpSlot{intRRShift}
	IntType.slots.RShift = &binaryOpSlot{intRShift}
	IntType.slots.RSub = &binaryOpSlot{intRSub}
	IntType.slots.RXor = &binaryOpSlot{intXor}
	IntType.slots.Sub = &binaryOpSlot{intSub}
	IntType.slots.Xor = &binaryOpSlot{intXor}
}

type divModResult int

const (
	divModOK           divModResult = iota
	divModOverflow                  = iota
	divModZeroDivision              = iota
)

func intCompare(op compareOp, v *Int, w *Object) *Object {
	if !w.isInstance(IntType) {
		return NotImplemented
	}
	lhs, rhs := v.Value(), toIntUnsafe(w).Value()
	result := false
	switch op {
	case compareOpLT:
		result = lhs < rhs
	case compareOpLE:
		result = lhs <= rhs
	case compareOpEq:
		result = lhs == rhs
	case compareOpNE:
		result = lhs != rhs
	case compareOpGE:
		result = lhs >= rhs
	case compareOpGT:
		result = lhs > rhs
	}
	return GetBool(result).ToObject()
}

func intAddMulOp(f *Frame, method string, v, w *Object, fun func(v, w int) (int, bool), bigFun func(z, x, y *big.Int)) (*Object, *BaseException) {
	if !w.isInstance(IntType) {
		return NotImplemented, nil
	}
	r, ok := fun(toIntUnsafe(v).Value(), toIntUnsafe(w).Value())
	if !ok {
		return longCallBinary(bigFun, intToLong(toIntUnsafe(v)), intToLong(toIntUnsafe(w))), nil
	}
	return NewInt(r).ToObject(), nil
}

func intCheckedDiv(v, w int) (int, divModResult) {
	q, _, r := intCheckedDivMod(v, w)
	return q, r
}

func intCheckedDivMod(v, w int) (int, int, divModResult) {
	if w == 0 {
		return 0, 0, divModZeroDivision
	}
	if v == MinInt && w == -1 {
		return 0, 0, divModOverflow
	}
	q := v / w
	m := v % w
	if m != 0 && (w^m) < 0 {
		// In Python the result of the modulo operator is always the
		// same sign as the divisor, whereas in Go, the result is
		// always the same sign as the dividend. Therefore we need to
		// do an adjustment when the sign of the modulo result differs
		// from that of the divisor.
		m += w
		// Relatedly, in Python the result of division truncates toward
		// negative infinity whereas it truncates toward zero in Go.
		// The fact that the signs of the divisor and the modulo result
		// differ implies that the quotient is also negative so we also
		// adjust the quotient here.
		q--
	}
	return q, m, divModOK
}

func intCheckedAdd(v, w int) (int, bool) {
	if (v > 0 && w > MaxInt-v) || (v < 0 && w < MinInt-v) {
		return 0, false
	}
	return v + w, true
}

func intCheckedMod(v, w int) (int, divModResult) {
	_, m, r := intCheckedDivMod(v, w)
	return m, r
}

func intCheckedMul(v, w int) (int, bool) {
	if v == 0 || w == 0 || v == 1 || w == 1 {
		return v * w, true
	}
	// Since MinInt can only be multiplied by zero and one safely and we've
	// already handled that case above, we know this multiplication will
	// overflow. Unfortunately the division check below will fail to catch
	// this by coincidence: MinInt * -1 overflows to MinInt, causing the
	// expression x/w to overflow, coincidentally producing MinInt which
	// makes it seem as though the multiplication was correct.
	if v == MinInt || w == MinInt {
		return 0, false
	}
	x := v * w
	if x/w != v {
		return 0, false
	}
	return x, true
}

func intCheckedSub(v, w int) (int, bool) {
	if (w > 0 && v < MinInt+w) || (w < 0 && v > MaxInt+w) {
		return 0, false
	}
	return v - w, true
}

func intDivModOp(f *Frame, method string, v, w *Object, fun func(v, w int) (int, divModResult), bigFun func(z, x, y *big.Int)) (*Object, *BaseException) {
	if !w.isInstance(IntType) {
		return NotImplemented, nil
	}
	x, r := fun(toIntUnsafe(v).Value(), toIntUnsafe(w).Value())
	switch r {
	case divModOverflow:
		return longCallBinary(bigFun, intToLong(toIntUnsafe(v)), intToLong(toIntUnsafe(w))), nil
	case divModZeroDivision:
		return nil, f.RaiseType(ZeroDivisionErrorType, "integer division or modulo by zero")
	}
	return NewInt(x).ToObject(), nil
}

func intShiftOp(f *Frame, v, w *Object, fun func(int, int) (int, int, bool)) (*Object, *BaseException) {
	if !w.isInstance(IntType) {
		return NotImplemented, nil
	}
	lhs, rhs, rshift := fun(toIntUnsafe(v).Value(), toIntUnsafe(w).Value())
	if rhs < 0 {
		return nil, f.RaiseType(ValueErrorType, "negative shift count")
	}
	var result int
	n := uint(rhs)
	if rshift {
		result = lhs >> n
	} else {
		result = lhs << n
		if result>>n != lhs {
			return NewLong(new(big.Int).Lsh(big.NewInt(int64(lhs)), n)).ToObject(), nil
		}
	}
	return NewInt(result).ToObject(), nil
}

func intToLong(o *Int) *Long {
	return NewLong(big.NewInt(int64(o.Value())))
}

func makeInternedInts() [internedIntMax - internedIntMin + 1]Int {
	var ints [internedIntMax - internedIntMin + 1]Int
	for i := internedIntMin; i <= internedIntMax; i++ {
		ints[i-internedIntMin] = Int{Object{typ: IntType}, i}
	}
	return ints
}


text:
use cocoa::base::id;

pub trait MTLFunction {
    unsafe fn name(self) -> id;
    unsafe fn functionType(self) -> MTLFunctionType;
    unsafe fn device(self) -> id;
    unsafe fn vertexAttributes(self) -> id;
}

impl MTLFunction for id {
    unsafe fn name(self) -> id {
        msg_send![self, name]
    }

    unsafe fn functionType(self) -> MTLFunctionType {
        msg_send![self, functionType]
    }

    unsafe fn device(self) -> id {
        msg_send![self, device]
    }

    unsafe fn vertexAttributes(self) -> id {
        msg_send![self, vertexAttributes]
    }
}

#[repr(usize)]
#[derive(Clone, Copy, Eq, Hash, PartialEq)]
pub enum MTLFunctionType {
    MTLFunctionTypeVertex = 1,
    MTLFunctionTypeFragment = 2,
    MTLFunctionTypeKernel = 3
}


text:
layout: product
category: dream
color: red
size: 4in x 7in
feather: real
image: photos/dream/red.jpg
name: Red Dreamcatcher
price: $35.00
---
## Red Dreamcatcher

![ car dreamcatcher ]({{site.baseurl}}/images/photos/dream/red.jpg)

### Description

These dreamer catchers are a unique and creative way to recycle old horseshoes into a useful and creative piece of artwork.


text:
#include "icd.h"
#include "icd_envvars.h"

#include <dlfcn.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <pthread.h>
#include <limits.h>

static pthread_once_t initialized = PTHREAD_ONCE_INIT;

/*
 *
 * Vendor enumeration functions
 *
 */

typedef void khrIcdFileAdd(const char *);

static inline void khrIcdOsDirEntryValidateAndAdd(const char *d_name, const char *path,
                                                  const char *extension, khrIcdFileAdd addFunc)
{
    struct stat statBuff;
    char* fileName = NULL;

    // make sure the file name ends in `extension` (eg. .icd, or .lay)
    if (strlen(extension) > strlen(d_name))
    {
        return;
    }
    if (strcmp(d_name + strlen(d_name) - strlen(extension), extension))
    {
        return;
    }

    // allocate space for the full path of the vendor library name
    fileName = malloc(strlen(d_name) + strlen(path) + 2);
    if (!fileName)
    {
        KHR_ICD_TRACE("Failed allocate space for ICD file path\n");
        return;
    }
    sprintf(fileName, "%s/%s", path, d_name);

    if (stat(fileName, &statBuff))
    {
        KHR_ICD_TRACE("Failed stat for: %s, continuing\n", fileName);
        free(fileName);
        return;
    }

    if (S_ISREG(statBuff.st_mode) || S_ISLNK(statBuff.st_mode))
    {
        FILE *fin = NULL;
        char* buffer = NULL;
        long bufferSize = 0;

        // open the file and read its contents
        fin = fopen(fileName, "r");
        if (!fin)
        {
            free(fileName);
            return;
        }
        fseek(fin, 0, SEEK_END);
        bufferSize = ftell(fin);

        buffer = malloc(bufferSize+1);
        if (!buffer)
        {
            free(fileName);
            fclose(fin);
            return;
        }
        memset(buffer, 0, bufferSize+1);
        fseek(fin, 0, SEEK_SET);
        if (bufferSize != (long)fread(buffer, 1, bufferSize, fin))
        {
            free(fileName);
            free(buffer);
            fclose(fin);
            return;
        }
        // ignore a newline at the end of the file
        if (buffer[bufferSize-1] == '\n') buffer[bufferSize-1] = '\0';

        // load the string read from the file
        addFunc(buffer);

        free(fileName);
        free(buffer);
        fclose(fin);
     }
     else
     {
         KHR_ICD_TRACE("File %s is not a regular file nor symbolic link, continuing\n", fileName);
         free(fileName);
     }
}

struct dirElem
{
    char *d_name;
    unsigned char d_type;
};

static int compareDirElem(const void *a, const void *b)
{
    // sort files the same way libc alpahnumerically sorts directory entries.
    return strcoll(((struct dirElem *)a)->d_name, ((struct dirElem *)b)->d_name);
}

static inline void khrIcdOsDirEnumerate(char *path, char *env, const char *extension,
                                        khrIcdFileAdd addFunc, int bSort)
{
    DIR *dir = NULL;
    char* envPath = NULL;

    envPath = khrIcd_secure_getenv(env);
    if (NULL != envPath)
    {
        path = envPath;
    }

    dir = opendir(path);
    if (NULL == dir)
    {
        KHR_ICD_TRACE("Failed to open path %s, continuing\n", path);
    }
    else
    {
        struct dirent *dirEntry = NULL;

        // attempt to load all files in the directory
        if (bSort) {
            // store the entries name and type in a buffer for sorting
            size_t sz = 0;
            size_t elemCount = 0;
            size_t elemAlloc = 0;
            struct dirElem *dirElems = NULL;
            struct dirElem *newDirElems = NULL;
            const size_t startupAlloc = 8;

            // start with a small buffer
            dirElems = (struct dirElem *)malloc(startupAlloc*sizeof(struct dirElem));
            if (NULL != dirElems) {
                elemAlloc = startupAlloc;
                for (dirEntry = readdir(dir); dirEntry; dirEntry = readdir(dir) ) {
                    char *nameCopy = NULL;

                    if (elemCount + 1 > elemAlloc) {
                        // double buffer size if necessary and possible
                        if (elemAlloc >= UINT_MAX/2)
                            break;
                        newDirElems = (struct dirElem *)realloc(dirElems, elemAlloc*2*sizeof(struct dirElem));
                        if (NULL == newDirElems)
                            break;
                        dirElems = newDirElems;
                        elemAlloc *= 2;
                    }
                    sz = strlen(dirEntry->d_name) + 1;
                    nameCopy = (char *)malloc(sz);
                    if (NULL == nameCopy)
                         break;
                    memcpy(nameCopy, dirEntry->d_name, sz);
                    dirElems[elemCount].d_name = nameCopy;
                    dirElems[elemCount].d_type = dirEntry->d_type;
                    elemCount++;
                }
                qsort(dirElems, elemCount, sizeof(struct dirElem), compareDirElem);
                for (struct dirElem *elem = dirElems; elem < dirElems + elemCount; ++elem) {
                    khrIcdOsDirEntryValidateAndAdd(elem->d_name, path, extension, addFunc);
                    free(elem->d_name);
                }
                free(dirElems);
            }
        } else
            // use system provided ordering
            for (dirEntry = readdir(dir); dirEntry; dirEntry = readdir(dir) )
                khrIcdOsDirEntryValidateAndAdd(dirEntry->d_name, path, extension, addFunc);

        closedir(dir);
    }

    if (NULL != envPath)
    {
        khrIcd_free_getenv(envPath);
    }
}

// go through the list of vendors in the two configuration files
void khrIcdOsVendorsEnumerate(void)
{
    khrIcdInitializeTrace();
    khrIcdVendorsEnumerateEnv();

    khrIcdOsDirEnumerate(ICD_VENDOR_PATH, "OCL_ICD_VENDORS", ".icd", khrIcdVendorAdd, 0);

#if defined(CL_ENABLE_LAYERS)
    // system layers should be closer to the driver
    khrIcdOsDirEnumerate(LAYER_PATH, "OPENCL_LAYER_PATH", ".lay", khrIcdLayerAdd, 1);

    khrIcdLayersEnumerateEnv();
#endif // defined(CL_ENABLE_LAYERS)
}

// go through the list of vendors only once
void khrIcdOsVendorsEnumerateOnce(void)
{
    pthread_once(&initialized, khrIcdOsVendorsEnumerate);
}

/*
 *
 * Dynamic library loading functions
 *
 */

// dynamically load a library.  returns NULL on failure
void *khrIcdOsLibraryLoad(const char *libraryName)
{
    void* ret = dlopen (libraryName, RTLD_NOW);
    if (NULL == ret)
    {
        KHR_ICD_TRACE("Failed to load driver because %s.\n", dlerror());
    }
    return ret;
}

// get a function pointer from a loaded library.  returns NULL on failure.
void *khrIcdOsLibraryGetFunctionAddress(void *library, const char *functionName)
{
    return dlsym(library, functionName);
}

// unload a library
void khrIcdOsLibraryUnload(void *library)
{
    dlclose(library);
}


text:
'''A full-screen minute:second timer.  Leave it in charge of your conference
lighting talks.

After 5 minutes, the timer goes red.  This limit is easily adjustable by
hacking the source code.

Press spacebar to start, stop and reset the timer.
'''

import pyglet

window = pyglet.window.Window(fullscreen=True)

class Timer(object):
    def __init__(self):
        self.label = pyglet.text.Label('00:00', font_size=360,
                                       x=window.width//2, y=window.height//2,
                                       anchor_x='center', anchor_y='center')
        self.reset()

    def reset(self):
        self.time = 0
        self.running = False
        self.label.text = '00:00'
        self.label.color = (255, 255, 255, 255)

    def update(self, dt):
        if self.running:
            self.time += dt
            m, s = divmod(self.time, 60)
            self.label.text = '%02d:%02d' % (m, s)
            if m >= 5:
                self.label.color = (180, 0, 0, 255)

@window.event
def on_key_press(symbol, modifiers):
    if symbol == pyglet.window.key.SPACE:
        if timer.running:
            timer.running = False
        else:
            if timer.time > 0:
                timer.reset()
            else:
                timer.running = True
    elif symbol == pyglet.window.key.ESCAPE:
        window.close()

@window.event
def on_draw():
    window.clear()
    timer.label.draw()

timer = Timer()
pyglet.clock.schedule_interval(timer.update, 1)
pyglet.app.run()


text:
package br.ufmg.dcc.labsoft.methods.returns;

import java.util.ArrayList;
import java.util.List;

@Deprecated
public class Method14 {

	//List<String> --> List<Integer>
	@Deprecated
	public List<Integer> m4(){
		 List<Integer>  list = new ArrayList<Integer>();
		 return list;
	}

}