text:
/*	$NetBSD: aic_isapnp.c,v 1.21 2009/09/22 13:20:36 tsutsui Exp $	*/

/*-
 * Copyright (c) 1998 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Enami Tsugutomo <enami@but-b.or.jp>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: aic_isapnp.c,v 1.21 2009/09/22 13:20:36 tsutsui Exp $");

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>

#include <sys/bus.h>

#include <dev/isa/isavar.h>

#include <dev/isapnp/isapnpreg.h>
#include <dev/isapnp/isapnpvar.h>
#include <dev/isapnp/isapnpdevs.h>

#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsipiconf.h>
#include <dev/scsipi/scsi_all.h>

#include <dev/ic/aic6360var.h>

struct aic_isapnp_softc {
	struct	aic_softc sc_aic;	/* real "com" softc */

	/* ISAPnP-specific goo. */
	void	*sc_ih;			/* interrupt handler */
};

static int	aic_isapnp_match(device_t, cfdata_t, void *);
static void	aic_isapnp_attach(device_t, device_t, void *);

CFATTACH_DECL_NEW(aic_isapnp, sizeof(struct aic_isapnp_softc),
    aic_isapnp_match, aic_isapnp_attach, NULL, NULL);

int
aic_isapnp_match(device_t parent, cfdata_t match, void *aux)
{
	int pri, variant;

	pri = isapnp_devmatch(aux, &isapnp_aic_devinfo, &variant);
	if (pri && variant > 0)
		pri = 0;
	return (pri);
}

void
aic_isapnp_attach(device_t parent, device_t self, void *aux)
{
	struct aic_isapnp_softc *isc = device_private(self);
	struct aic_softc *sc = &isc->sc_aic;
	struct isapnp_attach_args *ipa = aux;

	sc->sc_dev = self;

	printf("\n");

	if (isapnp_config(ipa->ipa_iot, ipa->ipa_memt, ipa)) {
		aprint_error_dev(self, "error in region allocation\n");
		return;
	}

	sc->sc_iot = ipa->ipa_iot;
	sc->sc_ioh = ipa->ipa_io[0].h;

	if (!aic_find(sc->sc_iot, sc->sc_ioh)) {
		aprint_error_dev(self, "couldn't find device\n");
		return;
	}

	aicattach(sc);

	/* Establish the interrupt handler. */
	isc->sc_ih = isa_intr_establish(ipa->ipa_ic, ipa->ipa_irq[0].num,
	    ipa->ipa_irq[0].type, IPL_BIO, aicintr, sc);
	if (isc->sc_ih == NULL)
		aprint_error_dev(self, "couldn't establish interrupt\n");
}

redpajama_set_name: RedPajamaGithub


text:
@interface OTPageScrollViewTests : XCTestCase

@end

@implementation OTPageScrollViewTests

- (void)setUp
{
    [super setUp];
    // Put setup code here. This method is called before the invocation of each test method in the class.
}

- (void)tearDown
{
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testExample
{
    XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
}

@end


text:
class CreateIngredients < ActiveRecord::Migration[5.0]
  def change
    create_table :ingredients do |t|
      t.string :name
    end
  end
end


text:
Email Address Office  Address Home Phone  Cell Phone  Term Expires
Scott Anderson, Jr. President 4010 Club House Drive 355-6831  840-8390  May 2012
John Ison Vice President  1907 Trout Valley Road  355-8005  202-1635  May 2013
Ann Webbink Treasurer 3909 Far Hills Drive  351-4062  840-9190  May 2012
Jennace Linton  Secretary 3103 Valley Brook Drive 355-6215  493-6215  May 2013
Jeff Hays Newletter Editor  2008 Byrnebruk Road 359-1169  351-4040 (work) May 2013
Max Mitchell    3345 Stoneybrook Drive  359-4244  369-0376  May 2014
Paul Kane   3804 Deerfield Drive  359-3641  840-3641  May 2014


text:
'use strict';

/**
 * Module dependencies.
 */
var mongoose = require('mongoose'),
    Schema = mongoose.Schema;

/**
 * Character Schema
 */
var characterSchema = new Schema({
    age: {
        type: Number,
        default: 0
    },
    name: {
        type: String,
        default: '',
        trim: true
    },
    health: {
        type: Number,
        default: 100
    },
    speed: {
        type: Number,
        default: 1
    },
    strength: {
        type: Number,
        default: 1
    },
    hunger: {
        type: Number,
        default: 0
    },
    locationx: {
        type: Number,
        default: 0
    },
    locationy: {
        type: Number,
        default: 0
    },
    icon: {
        type: String,
        default: 'H'
    }
});

/**
 * Validations
 */
// - we must have a name
characterSchema.path('name').validate(function(name) {
    return name.length;
}, 'name cannot be blank');
// - the age should be a positive number (or zero)
characterSchema.path('age').validate(function(age) {
    return age >= 0;
}, 'age must be a positive number');
// - the health should be a number between 0 and 100
characterSchema.path('health').validate(function(health) {
    return health >= 0 && health <= 100;
}, 'health must be a number between 0 and 100');
// - the speed should be a number between 0 and 100
characterSchema.path('speed').validate(function(speed) {
    return speed >= 0 && speed <= 100;
}, 'speed must be a number between 0 and 100');
// - the strength should be a number between 0 and 100
characterSchema.path('strength').validate(function(strength) {
    return strength >= 0 && strength <= 100;
}, 'strength must be a number between 0 and 100');
// - the hunger should be a number between 0 and 100
characterSchema.path('hunger').validate(function(hunger) {
    return hunger >= 0 && hunger <= 100;
}, 'hunger must be a number between 0 and 100');
// - the locationx should be a positive number
characterSchema.path('locationx').validate(function(locationx) {
    return locationx >= 0;
}, 'locationx must be a positive number');
// - the locationy should be a positive number
characterSchema.path('locationy').validate(function(locationy) {
    return locationy >= 0;
}, 'locationy must be a positive number');

/**
 * Statics
 */
characterSchema.statics.load = function(id, cb) {
    this.findOne({
        _id: id
    }).exec(cb);
};

mongoose.model('Character', characterSchema);


text:
import { Pipe, PipeTransform } from "@angular/core";

@Pipe({
  name: "eventSeverityToBootstrapClass",
})
export class EventSeverityToBootstrapClass implements PipeTransform {
  transform(event: any, prefix?: string, defaultClass?: string) {
    prefix = prefix || "";
    let className = "default";

    if (defaultClass) {
      className = defaultClass;
    }

    if (event._source.event_type === "alert") {
      switch (event._source.alert.severity) {
        case 1:
          className = "danger";
          break;
        case 2:
          className = "warning";
          break;
        case 3:
          className = "info";
          break;
      }
    }

    return `${prefix}${className}`;
  }
}


text:
using Entitas;

public class BonusModelComponent : IComponent {
    public int id;
    public int type;
	public int minAmount;
	public int maxAmount;
	public float probability;
	public string resource;
}


text:
<?php

namespace Kanboard\Controller;

/**
 * Two Factor Auth controller
 *
 * @package  controller
 * @author   Frederic Guillot
 */
class Twofactor extends User
{
    /**
     * Only the current user can access to 2FA settings
     *
     * @access private
     */
    private function checkCurrentUser(array $user)
    {
        if ($user['id'] != $this->userSession->getId()) {
            $this->forbidden();
        }
    }

    /**
     * Show form to disable/enable 2FA
     *
     * @access public
     */
    public function index()
    {
        $user = $this->getUser();
        $this->checkCurrentUser($user);
        unset($this->sessionStorage->twoFactorSecret);

        $this->response->html($this->helper->layout->user('twofactor/index', array(
            'user' => $user,
            'provider' => $this->authenticationManager->getPostAuthenticationProvider()->getName(),
        )));
    }

    /**
     * Show page with secret and test form
     *
     * @access public
     */
    public function show()
    {
        $user = $this->getUser();
        $this->checkCurrentUser($user);

        $label = $user['email'] ?: $user['username'];
        $provider = $this->authenticationManager->getPostAuthenticationProvider();

        if (! isset($this->sessionStorage->twoFactorSecret)) {
            $provider->generateSecret();
            $provider->beforeCode();
            $this->sessionStorage->twoFactorSecret = $provider->getSecret();
        } else {
            $provider->setSecret($this->sessionStorage->twoFactorSecret);
        }

        $this->response->html($this->helper->layout->user('twofactor/show', array(
            'user' => $user,
            'secret' => $this->sessionStorage->twoFactorSecret,
            'qrcode_url' => $provider->getQrCodeUrl($label),
            'key_url' => $provider->getKeyUrl($label),
        )));
    }

    /**
     * Test code and save secret
     *
     * @access public
     */
    public function test()
    {
        $user = $this->getUser();
        $this->checkCurrentUser($user);

        $values = $this->request->getValues();

        $provider = $this->authenticationManager->getPostAuthenticationProvider();
        $provider->setCode(empty($values['code']) ? '' : $values['code']);
        $provider->setSecret($this->sessionStorage->twoFactorSecret);

        if ($provider->authenticate()) {
            $this->flash->success(t('The two factor authentication code is valid.'));

            $this->user->update(array(
                'id' => $user['id'],
                'twofactor_activated' => 1,
                'twofactor_secret' => $this->authenticationManager->getPostAuthenticationProvider()->getSecret(),
            ));

            unset($this->sessionStorage->twoFactorSecret);
            $this->userSession->disablePostAuthentication();

            $this->response->redirect($this->helper->url->to('twofactor', 'index', array('user_id' => $user['id'])));
        } else {
            $this->flash->failure(t('The two factor authentication code is not valid.'));
            $this->response->redirect($this->helper->url->to('twofactor', 'show', array('user_id' => $user['id'])));
        }
    }

    /**
     * Disable 2FA for the current user
     *
     * @access public
     */
    public function deactivate()
    {
        $user = $this->getUser();
        $this->checkCurrentUser($user);

        $this->user->update(array(
            'id' => $user['id'],
            'twofactor_activated' => 0,
            'twofactor_secret' => '',
        ));

        // Allow the user to test or disable the feature
        $this->userSession->disablePostAuthentication();

        $this->flash->success(t('User updated successfully.'));
        $this->response->redirect($this->helper->url->to('twofactor', 'index', array('user_id' => $user['id'])));
    }

    /**
     * Check 2FA
     *
     * @access public
     */
    public function check()
    {
        $user = $this->getUser();
        $this->checkCurrentUser($user);

        $values = $this->request->getValues();

        $provider = $this->authenticationManager->getPostAuthenticationProvider();
        $provider->setCode(empty($values['code']) ? '' : $values['code']);
        $provider->setSecret($user['twofactor_secret']);

        if ($provider->authenticate()) {
            $this->userSession->validatePostAuthentication();
            $this->flash->success(t('The two factor authentication code is valid.'));
            $this->response->redirect($this->helper->url->to('app', 'index'));
        } else {
            $this->flash->failure(t('The two factor authentication code is not valid.'));
            $this->response->redirect($this->helper->url->to('twofactor', 'code'));
        }
    }

    /**
     * Ask the 2FA code
     *
     * @access public
     */
    public function code()
    {
        if (! isset($this->sessionStorage->twoFactorBeforeCodeCalled)) {
            $provider = $this->authenticationManager->getPostAuthenticationProvider();
            $provider->beforeCode();
            $this->sessionStorage->twoFactorBeforeCodeCalled = true;
        }

        $this->response->html($this->helper->layout->app('twofactor/check', array(
            'title' => t('Check two factor authentication code'),
        )));
    }

    /**
     * Disable 2FA for a user
     *
     * @access public
     */
    public function disable()
    {
        $user = $this->getUser();

        if ($this->request->getStringParam('disable') === 'yes') {
            $this->checkCSRFParam();

            $this->user->update(array(
                'id' => $user['id'],
                'twofactor_activated' => 0,
                'twofactor_secret' => '',
            ));

            $this->response->redirect($this->helper->url->to('user', 'show', array('user_id' => $user['id'])));
        }

        $this->response->html($this->helper->layout->user('twofactor/disable', array(
            'user' => $user,
        )));
    }
}


text:
{-# LANGUAGE OverloadedStrings #-}

module Redmine.Get ( getTimeEntries
                   , getTimeEntry
                   , getTimeEntriesForIssue
                   , getIssue
                   , getIssues
                   , getProjects
                   , getProjectForId
                   , getProject
                   , getTrackers
                   , getVersions
                   , getUser
                   , expandOptions
                   , increaseQueryRange
                   ) where

import Data.Monoid
import qualified Data.Map as Map
import Redmine.JSON
import Redmine.Types
import Redmine.Manager
import Redmine.Rest
import qualified Data.ByteString as S
import qualified Data.ByteString.Char8 as S8
import Network.HTTP.Conduit
import Network.HTTP.Base (RequestMethod(..))
import Network.HTTP.Client.TLS
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Trans.Maybe
import Debug.Trace

-- |The function 'getTimeEntries' fetches all the time entries.
--  They can be filtered by spenton date using spent_on=%3E%3C2013-05-01|2013-05-31
getTimeEntries :: RedmineMng -> ParamRest -> MaybeT IO [TimeEntry]
getTimeEntries mng param = MaybeT $ do
   mngConn <- newManager tlsManagerSettings
   res <- queryRedmineAvecOptions mng GET requete ( Map.union param initOpt) Nothing mngConn
   return $ fmap time_entries res
   where requete = "/time_entries.json"

getTimeEntry :: RedmineMng -> Integer -> MaybeT IO TimeEntry
getTimeEntry mng elemId =
   fmap time_entry (MaybeT $ runQuery mng GET requete Nothing)
   where requete = "/time_entries/" <> S8.pack (show elemId) <> ".json"

getTimeEntriesForIssue :: RedmineMng -> Integer-> MaybeT IO [TimeEntry]
getTimeEntriesForIssue mng issueid = MaybeT $ do
   mngConn <- newManager tlsManagerSettings
   res <- queryRedmineAvecOptions mng GET requete initOpt Nothing mngConn
   return $ fmap time_entries res
   where requete = "/time_entries/" <> S8.pack (show issueid) <> ".json"

getIssues :: RedmineMng -> ParamRest -> MaybeT IO [Issue]
getIssues mng param = MaybeT $ do
   mngConn <- liftIO $ newManager tlsManagerSettings
   res <- queryRedmineAvecOptions mng GET requete ( Map.union param initOpt) Nothing mngConn
   return $ fmap issues res
   where requete = "/issues.json"

getIssue :: RedmineMng -> Integer -> ParamRest -> MaybeT IO Issue
getIssue mng elemId param =
   fmap issue (MaybeT $ runQuery mng GET requete Nothing)
   where requete = "/issues/" <> S8.pack (show elemId) <> ".json" <> expandOptions param

getTrackers :: RedmineMng -> MaybeT IO [Tracker]
getTrackers mng = MaybeT $ runQuery mng GET (trace (show requete) requete) Nothing
  where requete = rmhost mng <> "/trackers.json"
--   mngConn <- newManager tlsManagerSettings
--   res <- queryRedmineAvecOptions mng GET requete initOpt Nothing mngConn
--   return $ fmap trackers res
--   where requete = "/trackers.json"

getProjects :: RedmineMng -> MaybeT IO [Project]
getProjects mng = MaybeT $ do
   mngConn <- newManager tlsManagerSettings
   res <- queryRedmineAvecOptions mng GET requete initOpt Nothing mngConn
   return $ fmap projects res
   where requete = "/projects.json"

getProjectForId :: RedmineMng -> Integer -> MaybeT IO Project
getProjectForId mng elemId =
   MaybeT $ runQuery mng GET requete Nothing
   where requete = rmhost mng <> "/projects/" <> S8.pack (show elemId) <> ".json"

getProject :: RedmineMng -> S.ByteString -> MaybeT IO Project
getProject mng projId =
   MaybeT $ runQuery mng GET requete Nothing
   where requete = "/projects/" <> projId <> ".json"

--Get all the versions associated to a project
getVersions :: RedmineMng --The connection manager
            -> S.ByteString --The project
            -> MaybeT IO [Version]
getVersions mng proj =
   fmap versions (MaybeT $ runQuery mng GET requete Nothing)
   where requete = "/projects/" <> proj <> "/versions.json"

getVersion:: RedmineMng -> Integer -> ParamRest -> MaybeT IO Version
getVersion mng elemId param =
   fmap version (MaybeT $ runQuery mng GET requete Nothing)
   where requete = "/versions/" <> S8.pack (show elemId) <> ".json" <> expandOptions param

getUser :: RedmineMng -> Integer -> MaybeT IO User
getUser mng elemId =
    fmap user (MaybeT $ runQuery mng GET requete Nothing)
    where requete = "/users/" <> S8.pack (show elemId) <> ".json"


text:
from cx_Freeze import setup,Executable

setup(
	name= "nombre",
	version = "0.1",
	descripcion = "gtdfe",
	executables = [Executable("clase2.py")]
	)


text:
"""
python2to3.py

By Paul Malmsten, 2011

Helper functions for handling Python 2 and Python 3 datatype shenanigans.
"""

def byteToInt(byte):
	"""
	byte -> int

	Determines whether to use ord() or not to get a byte's value.
	"""
	if hasattr(byte, 'bit_length'):
		# This is already an int
		return byte
	return ord(byte) if hasattr(byte, 'encode') else byte[0]

def intToByte(i):
	"""
	int -> byte

	Determines whether to use chr() or bytes() to return a bytes object.
	"""
	return chr(i) if hasattr(bytes(), 'encode') else bytes([i])

def stringToBytes(s):
	"""
	string -> bytes

	Converts a string into an appropriate bytes object
	"""
	return s.encode('ascii')


text:
vgController

controller in module com.2fdevs.videogular

Description

Videogular controller.
This controller offers a public API:

Methods

play(): Plays media.

pause(): Pause media.

stop(): Stops media.

playPause(): Toggles play and pause.

seekTime(value, byPercent): Seeks to a specified time position. Param value must be an integer representing the target position in seconds or a percentage. By default seekTime seeks by seconds, if you want to seek by percentage just pass byPercent to true.

setVolume(volume): Sets volume. Param volume must be an integer with a value between 0 and 1.

setPlayback(playback): Sets playback. Param plaback must be an integer with a value between 0 and 2.

setState(state): Sets a new state. Param state mus be an string with 'play', 'pause' or 'stop'. This method only changes the state of the player, but doesn't plays, pauses or stops the media file.

toggleFullScreen(): Toggles between fullscreen and normal mode.

updateTheme(css-url): Removes previous CSS theme and sets a new one.

clearMedia(): Cleans the current media file.

changeSource(array): Updates current media source. Param array must be an array of media source objects.
A media source is an object with two properties src and type. The src property must contains a trustful url resource.

{src: $sce.trustAsResourceUrl("http://static.videogular.com/assets/videos/videogular.mp4"), type: "video/mp4"}

Properties

config: String with a url to JSON config file.

isReady: Boolean value with current player initialization state.

isBuffering: Boolean value to know if player is buffering media.

isCompleted: Boolean value to know if current media file has been completed.

isLive: Boolean value to know if current media file is a Live Streaming.

playsInline: Boolean value to know if Videogular is using inline playing or not.

nativeFullscreen: Boolean value to know if Videogular if fullscreen mode will use native mode or emulated mode.

mediaElement: Reference to video/audio object.

videogularElement: Reference to videogular tag.

sources: Array with current sources.

tracks: Array with current tracks.

cuePoints: Object containing a list of timelines with cue points. Each property in the object represents a timeline, which is an Array of objects with the next definition:

{
   timeLapse:{
     start: 0,
     end: 10
   },
   onLeave: callback(currentTime, timeLapse, params),
   onUpdate: callback(currentTime, timeLapse, params),
   onComplete: callback(currentTime, timeLapse, params),
   params: {
     // Custom object with desired structure and data
   }
}

timeLapse: Object with start and end properties to define in seconds when this timeline is active.\n

onLeave: Callback function that will be called when user seeks and the new time doesn't reach to the timeLapse.start property.

onUpdate: Callback function that will be called when the progress is in the middle of timeLapse.start and timeLapse.end.

onComplete: Callback function that will be called when the progress is bigger than timeLapse.end.

params: Custom object with data to pass to the callbacks.

isFullScreen: Boolean value to know if we're in fullscreen mode.

currentState: String value with "play", "pause" or "stop".

currentTime: Number value with current media time progress.

totalTime: Number value with total media time.

timeLeft: Number value with current media time left.

volume: Number value with current volume between 0 and 1.

playback: Number value with current playback between 0 and 2.


text:
package org.kuali.rice.krad.demo.travel.application;

import org.kuali.rice.krad.demo.ViewDemoAftBase;
import org.junit.Test;

/**
 * @author Kuali Rice Team (rice.collab@kuali.org)
 */
public class DemoTravelMileageLookUpAft extends ViewDemoAftBase {

    /**
     * /kr-krad/lookup?methodToCall=start&dataObjectClassName=edu.sampleu.travel.dataobject.TravelMileageRate
     */
    public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&dataObjectClassName=edu.sampleu.travel.dataobject.TravelMileageRate";

    /**
     * Search
     */
    public static final String SEARCH = "Search";

    /**
     * Clear Values
     */
    public static final String CLEAR_VALUES = "Clear Values";

    @Override
    public String getBookmarkUrl() {
        return BOOKMARK_URL;
    }

    @Override
    protected void navigate() throws Exception {
        waitAndClickDemoLink();
        waitAndClickByLinkText("Travel Mileage Lookup");
    }

    protected void testTravelMileageLookUp() throws Exception {
    	waitAndTypeByName("lookupCriteria[mileageRateId]","1");
    	waitAndTypeByName("lookupCriteria[mileageRateCd]","a*");
    	waitAndTypeByName("lookupCriteria[mileageRateName]","a*");
    	waitAndClickButtonByText(SEARCH);
        waitForProgressLoading();
    	waitForTextPresent("No values match this search.");
    	waitForTextPresent("You have entered the primary key for this table (Id) in the search criteria. Since these fields can be used to uniquely identify a row in this table, the other search criteria entered will be ignored.");
        waitForTextPresent("Lookup Results: 2 messages");
    	waitAndClickButtonByText(CLEAR_VALUES);
    	waitAndClickByXpath("//input[@name='lookupCriteria[active]' and @value='Y']");
    	waitAndClickButtonByText(SEARCH);
    	String activeResults [] ={"10000","DO","Domestic","0.305","true"};
    	Thread.sleep(1000); //Required as the below method "only waits for first element" in array. Here first element gets loaded and second takes a while.
    	assertTextPresent(activeResults);
    	waitAndClickButtonByText(CLEAR_VALUES);
    	waitAndClickByXpath("//input[@name='lookupCriteria[active]' and @value='N']");
    	waitAndClickButtonByText(SEARCH);
        waitForProgressLoading();
    	waitForTextPresent("No values match this search.");
        waitForTextNotPresent("Lookup Results: 1 messages");
        //No value present so asserting the message.
		//    	String activeResults [] ={"10000","DO","Domestic","0.305","true"};
		//    	Thread.sleep(1000); //Required as the below method "only waits for first element" in array. Here first element gets loaded and second takes a while.
		//    	assertTextPresent(activeResults);
    }

    protected void testTravelMileageLookUpPreserveLockingKeysOnCopy() throws Exception {
        waitAndTypeByName("lookupCriteria[mileageRateId]","10000");
        waitAndClickButtonByText(SEARCH);
        waitForProgressLoading();
        waitAndClickByLinkText("copy");
        waitForElementPresentByXpath("//a[contains(text(),'10000')]");
        waitForElementPresentByXpath("//input[@name='document.newMaintainableObject.dataObject.mileageRateId' and @value='10000']");
        waitAndTypeByName("document.documentHeader.documentDescription","Description");
        waitAndClickByXpath("//button[contains(text(),'Submit')]");
        waitAndClickConfirmSubmitOk();
        waitForTextPresent("This document cannot be Saved or Routed because a record with the same primary key already exists.");
    }

    @Test
    public void testTravelMileageLookUpBookmark() throws Exception {
        testTravelMileageLookUp();
        passed();
    }

    @Test
    public void testTravelMileageLookUpNav() throws Exception {
        testTravelMileageLookUp();
        passed();
    }

    @Test
    public void testTravelMileageLookUpPreserveLockingKeysOnCopyBookmark() throws Exception {
        testTravelMileageLookUpPreserveLockingKeysOnCopy();
        passed();
    }

    @Test
    public void testTravelMileageLookUpPreserveLockingKeysOnCopyNav() throws Exception {
        testTravelMileageLookUpPreserveLockingKeysOnCopy();
        passed();
    }
}


text:
from django.apps import AppConfig

class CourseConfig(AppConfig):
    name = 'course'
    verbose_name = '课程模块'


text:
<?xml version="1.0"?>

<bindings id="textBindings"
   xmlns="http://www.mozilla.org/xbl"
   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
   xmlns:html="http://www.w3.org/1999/xhtml">

  <binding id="text-base">
    <implementation implements="nsIDOMXULDescriptionElement, nsIAccessibleProvider">
      <property name="accessibleType" readonly="true">
        <getter>
          <![CDATA[
            return Components.interfaces.nsIAccessibleProvider.XULText;
          ]]>
        </getter>
      </property>
      <property name="disabled" onset="if (val) this.setAttribute('disabled', 'true');
                                       else this.removeAttribute('disabled');
                                       return val;"
                                onget="return this.getAttribute('disabled') == 'true';"/>
      <property name="value" onget="return this.getAttribute('value');"
                             onset="this.setAttribute('value', val); return val;"/>
      <property name="crop" onget="return this.getAttribute('crop');"
                            onset="this.setAttribute('crop', val); return val;"/>
    </implementation>
  </binding>

  <binding id="text-label" extends="chrome://global/content/bindings/text.xml#text-base">
    <implementation implements="nsIDOMXULLabelElement">
      <property name="accessKey">
        <getter>
          <![CDATA[
            var accessKey = this.getAttribute('accesskey');
            return accessKey ? accessKey[0] : null;
          ]]>
        </getter>
        <setter>
          <![CDATA[
            this.setAttribute('accesskey', val);
            return val;
          ]]>
        </setter>
      </property>

      <property name="control" onget="return getAttribute('control');">
        <setter>
          <![CDATA[
            // After this gets set, the label will use the binding #label-control
            this.setAttribute('control', val);
            return val;
          ]]>
        </setter>
      </property>
    </implementation>
  </binding>

  <binding id="label-control" extends="chrome://global/content/bindings/text.xml#text-label">
    <content>
      <children/>
    </content>
    <implementation implements="nsIDOMXULLabelElement">
      <constructor>
        <![CDATA[
          try {
            var prefs = Components.classes["@mozilla.org/preferences-service;1"].
                                   getService(Components.interfaces.nsIPrefBranch);
            this.mUnderlineAccesskey = (prefs.getIntPref("ui.key.menuAccessKey") != 0);

            const nsIPrefLocalizedString =
              Components.interfaces.nsIPrefLocalizedString;

            const prefNameInsertSeparator =
              "intl.menuitems.insertseparatorbeforeaccesskeys";
            const prefNameAlwaysAppendAccessKey =
              "intl.menuitems.alwaysappendaccesskeys";

            var val = prefs.getComplexValue(prefNameInsertSeparator,
                                            nsIPrefLocalizedString).data;
            this.mInsertSeparator = (val == "true");

            val = prefs.getComplexValue(prefNameAlwaysAppendAccessKey,
                                        nsIPrefLocalizedString).data;
            this.mAlwaysAppendAccessKey = (val == "true");
          }
          catch (e) { }
          this.formatAccessKey();
        ]]>
      </constructor>

      <method name="formatAccessKey">

          <![CDATA[
            if (!this.mUnderlineAccesskey)
              return;

            var control = this.labeledControlElement;
            if (!control) {
              var bindingParent = document.getBindingParent(this);
              if (bindingParent instanceof Components.interfaces.nsIDOMXULLabeledControlElement) {
                control = bindingParent; // For controls that make the  an anon child
              }
            }
            if (control) {
              control.labelElement = this;
            }

            var afterLabel = document.getAnonymousElementByAttribute(this, "anonid", "accessKeyParens");
            afterLabel.textContent = ""; // This does not clear real nodes!

            var oldAccessKey = this.getElementsByAttribute('class', 'accesskey').item(0);
            if (oldAccessKey) { // Clear old accesskey
              this.mergeElement(oldAccessKey);
            }

            var oldHiddenSpan =
              this.getElementsByAttribute('class', 'hiddenColon').item(0);
            if (oldHiddenSpan) {
              this.mergeElement(oldHiddenSpan);
            }

            var accessKey = this.accessKey;
            var labelText = this.textContent;
            if (!accessKey || !labelText || !control) {
              return;
            }
            var accessKeyIndex = -1;
            if (!this.mAlwaysAppendAccessKey) {
              accessKeyIndex = labelText.indexOf(accessKey);
              if (accessKeyIndex < 0) { // Try again in upper case
                accessKeyIndex =
                  labelText.toUpperCase().indexOf(accessKey.toUpperCase());
              }
            }

            const HTML_NS = "http://www.w3.org/1999/xhtml";
            var span = document.createElementNS(HTML_NS, "span");
            span.className = "accesskey";

            // Note that if you change the following code, see the comment of
            // nsTextBoxFrame::UpdateAccessTitle.

            // If accesskey is not in string, append in parentheses
            if (accessKeyIndex < 0) {
              // If end is colon, we should insert before colon.
              // i.e., "label:" -> "label(X):"
              var colonHidden = false;
              if (/:$/.test(labelText)) {
                labelText = labelText.slice(0, -1);
                var hiddenSpan = document.createElementNS(HTML_NS, "span");
                hiddenSpan.className = "hiddenColon";
                hiddenSpan.style.display = "none";
                // Hide the last colon by using span element.
                // I.e., label:
                this.wrapChar(hiddenSpan, labelText.length);
                colonHidden = true;
              }
              // If end is space(U+20),
              // we should not add space before parentheses.
              var endIsSpace = false;
              if (/ $/.test(labelText)) {
                endIsSpace = true;
              }
              if (this.mInsertSeparator && !endIsSpace)
                afterLabel.textContent = " (";
              else
                afterLabel.textContent = "(";
              span.textContent = accessKey.toUpperCase();
              afterLabel.appendChild(span);
              if (!colonHidden)
                afterLabel.appendChild(document.createTextNode(")"));
              else
                afterLabel.appendChild(document.createTextNode("):"));
              return;
            }
            this.wrapChar(span, accessKeyIndex);
          ]]>

      </method>

      <method name="wrapChar">
        <parameter name="element"/>
        <parameter name="index"/>

          <![CDATA[
             var treeWalker = document.createTreeWalker(this,
                                                        NodeFilter.SHOW_TEXT,
                                                        null,
                                                        true);
             var node = treeWalker.nextNode();
             while (index >= node.length) {
               index -= node.length;
               node = treeWalker.nextNode();
             }
             if (index) {
               node = node.splitText(index);
             }
             node.parentNode.insertBefore(element, node);
             if (node.length > 1) {
               node.splitText(1);
             }
             element.appendChild(node);
          ]]>

      </method>

      <method name="mergeElement">
        <parameter name="element"/>

          <![CDATA[
            if (element.previousSibling instanceof Text) {
              element.previousSibling.appendData(element.textContent)
            }
            else {
              element.parentNode.insertBefore(element.firstChild, element);
            }
            element.parentNode.removeChild(element);
          ]]>

      </method>

      <field name="mUnderlineAccesskey">
        !/Mac/.test(navigator.platform)
      </field>
      <field name="mInsertSeparator">true</field>
      <field name="mAlwaysAppendAccessKey">false</field>

      <property name="accessKey">
        <getter>
          <![CDATA[
            var accessKey = null;
            var labeledEl = this.labeledControlElement;
            if (labeledEl) {
              accessKey = labeledEl.getAttribute('accesskey');
            }
            if (!accessKey) {
              accessKey = this.getAttribute('accesskey');
            }
            return accessKey ? accessKey[0] : null;
          ]]>
        </getter>
        <setter>
          <![CDATA[
            // If this label already has an accesskey attribute store it here as well
            if (this.hasAttribute('accesskey')) {
              this.setAttribute('accesskey', val);
            }
            var control = this.labeledControlElement;
            if (control) {
              control.setAttribute('accesskey', val);
            }
            this.formatAccessKey();
            return val;
          ]]>
        </setter>
      </property>

      <property name="labeledControlElement" readonly="true"
                onget="var control = this.control; return control ? document.getElementById(control) : null;" />

      <property name="control" onget="return this.getAttribute('control');">
        <setter>
          <![CDATA[
            var control = this.labeledControlElement;
            if (control) {
              control.labelElement = null; // No longer pointed to be this label
            }
            this.setAttribute('control', val);
            this.formatAccessKey();
            return val;
          ]]>
        </setter>
      </property>

    </implementation>

    <handlers>
      <handler event="click" action="if (this.disabled) return;
                                     var controlElement = this.labeledControlElement;
                                     if(controlElement)
                                       controlElement.focus();
                                    "/>
    </handlers>
  </binding>

  <binding id="text-link" extends="chrome://global/content/bindings/text.xml#text-label">
    <implementation implements="nsIAccessibleProvider">
      <property name="accessibleType" readonly="true">
        <getter>
          <![CDATA[
            return Components.interfaces.nsIAccessibleProvider.XULLink;
          ]]>
        </getter>
      </property>
      <property name="href" onget="return this.getAttribute('href');"
                            onset="this.setAttribute('href', val); return val;" />
      <method name="open">
        <parameter name="aEvent"/>

        <![CDATA[
          var href = this.href;
          if (!href || this.disabled || aEvent.defaultPrevented)
            return;

          var uri = null;
          try {
            const nsISSM = Components.interfaces.nsIScriptSecurityManager;
            const secMan =
                     Components.classes["@mozilla.org/scriptsecuritymanager;1"]
                               .getService(nsISSM);

            const ioService =
                     Components.classes["@mozilla.org/network/io-service;1"]
                               .getService(Components.interfaces.nsIIOService);

            uri = ioService.newURI(href, null, null);

            var nullPrincipal =
              Components.classes["@mozilla.org/nullprincipal;1"]
                        .createInstance(Components.interfaces.nsIPrincipal);
            try {
              secMan.checkLoadURIWithPrincipal(nullPrincipal, uri,
                                               nsISSM.DISALLOW_INHERIT_PRINCIPAL)
            }
            catch (ex) {
              var msg = "Error: Cannot open a " + uri.scheme + ": link using \
                         the text-link binding.";
              Components.utils.reportError(msg);
              return;
            }

            const cID = "@mozilla.org/uriloader/external-protocol-service;1";
            const nsIEPS = Components.interfaces.nsIExternalProtocolService;
            var protocolSvc = Components.classes[cID].getService(nsIEPS);

            // if the scheme is not an exposed protocol, then opening this link
            // should be deferred to the system's external protocol handler
            if (!protocolSvc.isExposedProtocol(uri.scheme)) {
              protocolSvc.loadUrl(uri);
              aEvent.preventDefault()
              return;
            }

          }
          catch (ex) {
            Components.utils.reportError(ex);
          }

          // otherwise, fall back to opening the anchor directly
          var win = window;
          if (window instanceof Components.interfaces.nsIDOMChromeWindow) {
            while (win.opener && !win.opener.closed)
              win = win.opener;
          }

          if (uri)
            win.open(uri.spec);
          else
            win.open(href);

          aEvent.preventDefault();
        ]]>

      </method>
    </implementation>

    <handlers>
      <handler event="click" phase="capturing" button="0" action="this.open(event)"/>
      <handler event="keypress" preventdefault="true" keycode="VK_ENTER"  action="this.click()" />
      <handler event="keypress" preventdefault="true" keycode="VK_RETURN" action="this.click()" />
    </handlers>
  </binding>

</bindings>


text:
/**
 * @file allow_empty_clusters.hpp
 * @author Ryan Curtin
 *
 * This very simple policy is used when K-Means is allowed to return empty
 * clusters.
 */
#ifndef MLPACK_METHODS_KMEANS_ALLOW_EMPTY_CLUSTERS_HPP
#define MLPACK_METHODS_KMEANS_ALLOW_EMPTY_CLUSTERS_HPP

#include <mlpack/core.hpp>

namespace mlpack {
namespace kmeans {

/**
 * Policy which allows K-Means to create empty clusters without any error being
 * reported.
 */
class AllowEmptyClusters
{
 public:
  //! Default constructor required by EmptyClusterPolicy policy.
  AllowEmptyClusters() { }

  /**
   * This function does nothing.  It is called by K-Means when K-Means detects
   * an empty cluster.
   *
   * @tparam MatType Type of data (arma::mat or arma::spmat).
   * @param data Dataset on which clustering is being performed.
   * @param emptyCluster Index of cluster which is empty.
   * @param oldCentroids Centroids of each cluster (one per column) at the start
   *      of the iteration.
   * @param newCentroids Centroids of each cluster (one per column) at the end
   *      of the iteration.
   * @param clusterCounts Number of points in each cluster.
   * @param assignments Cluster assignments of each point.
   * @param iteration Number of iteration.
   *
   * @return Number of points changed (0).
   */
  template<typename MetricType, typename MatType>
  static inline force_inline size_t EmptyCluster(
      const MatType& /* data */,
      const size_t /* emptyCluster */,
      const arma::mat& /* oldCentroids */,
      arma::mat& /* newCentroids */,
      arma::Col<size_t>& /* clusterCounts */,
      MetricType& /* metric */,
      const size_t /* iteration */)
  {
    // Empty clusters are okay!  Do nothing.
    return 0;
  }

  //! Serialize the empty cluster policy (nothing to do).
  template<typename Archive>
  void Serialize(Archive& /* ar */, const unsigned int /* version */) { }
};

} // namespace kmeans
} // namespace mlpack

#endif


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FoodOrdering.BLL.Requests.DTO;
using FoodOrdering.BLL.Responses.DTO;

namespace FoodOrdering.WEB.Models
{
	public class MenuModel
	{
		private readonly string[] _availableDays = new[] { "Ponedeljak", "Utorak", "Sreda", "Cetvrtak", "Petak", "Subota" };

		public long Id { get; set; }
		public DateTime StartDate { get; set; }
		public DateTime EndDate { get; set; }
		public IList<MenuMeal> MenuMeals { get; set; }

		public string DisplayName
		{
			get { return "Nedeljni jelovnik " + StartDate.ToShortDateString() + " - " + EndDate.ToShortDateString(); }
		}

		public MenuModel Adapt(Menu menuToAdapt)
		{
			if (menuToAdapt == null) throw new ArgumentNullException("menuToAdapt");

			return new MenuModel
			{
				Id = menuToAdapt.Id,
				StartDate = menuToAdapt.StartDate,
				EndDate = menuToAdapt.EndDate,
			};
		}

		public IList<MenuModel> Adapt(IList<Menu> menusToAdapt)
		{
			if (menusToAdapt == null) throw new ArgumentNullException("menusToAdapt");

			return menusToAdapt.Select(Adapt).ToList();
		}

		public IEnumerable<SelectListItem> AvailableMeals { get; set; }

		public IEnumerable<SelectListItem> AvailableDays
		{
			get
			{
				return _availableDays.Select(d => new SelectListItem { Value = d, Text = d });
			}
		}

		public long SelectedMealId { get; set; }
		public string SelectedDay { get; set; }
	}
}


text:
<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="stylesheets/default.css">
    <meta charset="UTF-8">
    <title>About Ben Morimoto</title>
  </head>
  <body>
    THIS IS MY BIO!
  </body>
</html>


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

     Copyright 2005-2014 Red Hat, Inc.

     Red Hat licenses this file to you under the Apache License, version
     2.0 (the "License"); you may not use this file except in compliance
     with the License.  You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
     implied.  See the License for the specific language governing
     permissions and limitations under the License.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>io.fabric8.jube</groupId>
    <artifactId>parent-project</artifactId>
    <version>2.2-SNAPSHOT</version>
  </parent>

  <artifactId>war</artifactId>
  <packaging>war</packaging>

  <name>Jube :: War</name>

  <properties>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>fabric8-cxf</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-servlet_3.0_spec</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>io.fabric8.jube</groupId>
      <artifactId>node</artifactId>
      <version>${project.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.jboss.weld</groupId>
          <artifactId>weld-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jboss.weld.se</groupId>
          <artifactId>weld-se</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>io.fabric8.jube</groupId>
      <artifactId>core</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.fabric8.jube</groupId>
      <artifactId>process-manager</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-integration-cdi</artifactId>
      <exclusions>
        <exclusion>
          <groupId>javax.inject</groupId>
          <artifactId>javax.inject</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javax.enterprise</groupId>
          <artifactId>cdi-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- testing -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>false</filtering>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-java2wadl-plugin</artifactId>
        <version>${cxf.plugin.version}</version>
        <executions>
          <execution>
            <id>process-classes</id>
            <phase>process-classes</phase>
            <goals>
              <goal>java2wadl</goal>
            </goals>
            <configuration>
              <classResourceNames>
                <classResourceName>io.fabric8.jube.apimaster.ApiMasterService</classResourceName>
              </classResourceNames>
              <attachWadl>false</attachWadl>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
         <artifactId>maven-clean-plugin</artifactId>
         <version>2.6</version>
         <configuration>
           <filesets>
             <fileset>
               <directory>processes</directory>
               <followSymlinks>false</followSymlinks>
             </fileset>
             <fileset>
               <directory>ensemble</directory>
               <followSymlinks>false</followSymlinks>
             </fileset>
           </filesets>
         </configuration>
       </plugin>

      <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.1</version>
        <configuration>
          <port>9090</port>
          <path>/kubernetes/api</path>
          <systemProperties>
          </systemProperties>
          <useTestClasspath>false</useTestClasspath>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>${jetty9.version}</version>
        <configuration>
          <webApp>
            <contextPath>/</contextPath>
          </webApp>
          <systemProperties>
            <systemProperty>
              <key>hawtio.config.dir</key>
              <value>${basedir}/target/hawtioConfig</value>
            </systemProperty>
          </systemProperties>
        </configuration>
      </plugin>

    </plugins>
  </build>

</project>


text:
<?php

use Illuminate\Support\MessageBag;

class ProfileController extends BaseController {  // changed to BaseController!

    public function profileAction() {
        return View::make("user/profile/index"); # return profile page
    }

    public function getProfile() {
        $uid = Auth::user()->id;
        $uuser = User::find($uid)->profile()->first();
        $countries = Countrie::all();

        foreach ($countries as $countrie) {
            if ($countrie->id == $uuser->countrie_id) {
                $ucountrie = $countrie;
            }
        }

        return View::make('user/profile/profile')
            ->with('profile', $uuser)
            ->with('countries', $countries)
            ->with('ucountrie', $ucountrie)
        ;
    }

    public function addProfile() {
        $uid = Auth::user()->id;
        $userinput = Input::all();
        $v = Profile::validateAdd( $userinput );

        if ( $v->passes() ) {
            $prrofile = User::find($uid)->profile()->first();

            $prrofile->frontname = Input::get( 'frontname' );
            $prrofile->backname = Input::get( 'backname' );
            $prrofile->email = Input::get( 'email' );
            $prrofile->born = Input::get( 'born' );
            $prrofile->family = Input::get( 'family' );
            $prrofile->strasse = Input::get( 'strasse' );
            $prrofile->plz = Input::get( 'plz' );
            $prrofile->ort = Input::get( 'ort' );
            $prrofile->countrie_id = Input::get( 'countrie' );
            $prrofile->sprache = Input::get( 'sprache' );
            $prrofile->handy = Input::get( 'handy' );
            $prrofile->tel = Input::get( 'tel' );
            $prrofile->icq = Input::get( 'icq' );
            $prrofile->firma = Input::get( 'firma' );
            $prrofile->job = Input::get( 'job' );
            $prrofile->project = Input::get( 'project' );

            #print $profile;

            $prrofile->save();

            return Redirect::to('admin/profile')->with('reset', "True");
        } else {
            $messages = $v->messages()->all('
:message
');

            return Redirect::to('admin/profile/profile')
                ->withErrors($v->messages())
                ->with('mars', $messages)
            ;
           }
    }

    public function getPassword() {
        $uid = Auth::user()->id;
        $usser = User::find($uid);

        return View::make("user/profile/password")
            ->with('usser', $usser)
        ; # return profile page
    }

    public function updatePassword() {
        $uid = Auth::user()->id;
        $userinput = Input::all();
        $v = Profile::validatePassword( $userinput, $uid );

        if ( $v->passes() ) {
          $pprofile = User::find($uid);
          if (Hash::check(Input::get('oldpassword'), $pprofile->password)) {

            $data = array(
                'user' => $pprofile->username,
                'email' => $pprofile->email,
                'newemail' => Input::get('email')
            );

            Mail::send('emails.password', $data, function($message) {
               $message->to(Input::get('email'), Input::get('username'))->subject('Changed PW and eMail adress!');
               #$message->to('taniswebb@googlemail.com', 'Tanis Webb')->subject('Welcome to the Laravel 4 Auth App!');
            });

            $pprofile->name     = Input::get( 'name'  );
            $pprofile->username = Input::get( 'username'  );
            $pprofile->email    = Input::get( 'email'  );
            $pprofile->password = Hash::make(Input::get( 'password'  ));
            $pprofile->save();

            $messages = array(                                                    // Generate a success message
                'event'  => 'Updating Password',
                'state'  => 'Successfully'
            );

          } else {
            $messages = array(                                                    // Generate a success message
                'event'  => 'Updating Password',
                'state'  => 'Failed - wrong password'
            );
            return Redirect::to('admin/profile/password')->with('alert', $messages);

          }
            return Redirect::to('admin/profile/index')->with('alert', $messages)->with('reset', "True");
        } else {
            $messages = $v->messages()->all('
:message
');

            return Redirect::to('admin/profile/password')
                ->withErrors($v->messages())
                ->with('mars', $messages)
            ;
           }
    }

}


text:
#ifndef __test_yaffs_unlink_ENOENT_h__
#define __test_yaffs_unlink_ENOENT_h__

#include "lib.h"
#include "yaffsfs.h"
#include "test_yaffs_open.h"

int test_yaffs_unlink_ENOENT(void);
int test_yaffs_unlink_ENOENT_clean(void);

#endif


text:
FROM jenkins:latest
MAINTAINER Yves Hwang <yveshwang@gmail.com>
LABEL name=jenkins-docker-2step
USER root
RUN apt-get update
RUN apt-get install python-pip -y
RUN pip install jenkins-job-builder
USER jenkins


text:
Inspired by Ward Cunningham's [Signature Survey: A Method for Browsing
Unfamiliar Code](http://c2.com/doc/SignatureSurvey/), "puncsig" is
short for "punctuation signature": it parses ruby code, and shows you
just the punctuation from the methods. It gives you a rough idea of
the length of each method, and helps you spot similar methods.

## Install

In your Gemfile:

```
gem 'puncsig'
```

...or on your command line:

```
$ gem install puncsig
```

You know, the basics.

## Use It

In your rails app:

```
$ bundle exec rake -T puncsig
rake puncsig:all          # Run puncsig on the whole app
rake puncsig:controllers  # Run puncsig on just the controllers
rake puncsig:helpers      # Run puncsig on just the helpers
rake puncsig:lib          # Run puncsig on just the files in lib
rake puncsig:models       # Run puncsig on just the models
```

TODO In a normal ruby app. It's not quite here yet, I want to separate
it out a bit more. Coming soon, promise!

## Example: rstat.us

Just for fun, let's take a look at the [rstat.us
source](https://github.com/hotsh/rstat.us). I chose rstat.us strictly
because a) it was open-source ruby, and b) it cleanly installed, so
whatever puncsig says about the source, that's a great start - and I
gave up on several others, because I couldn't get them installed
easily. We _all_ have code that needs some love, and I have much love
for the people behind rstat.us.

```
$ be rake puncsig:models

[...]

app/models/salmon_author.rb
author_attributes:  {:=>,:=>,:=>,:=>,:=>,:=>,:=>}==().==.==.==.&&==.&&==.&&==.&&==.&&==.
avatar_url:         @..{||..==}..
email:              =@.==
initialize:         ()@=
bio:                @..
name:               @..
uri:                @.
username:           @.

[...]

app/models/user.rb
no_malformed_username:                   (=~/[@!#$\%&()*,^~{}|`=:;\\\/\[\]\?]/).?&&(=~/^[.]/).?&&(=~/[.]$/).?&&(=~/[.]{,}/).?.(:,.,,.)
send_mention_notification:               (,)=.:=>=.:=>=://#{.}/=::.(.())=..=.(..)=::.(.,.)=.(.,,{-=>/-+})
edit_user_profile:                       ()[:].?[:].?[:]==[:].=[:]..=.==[:].=[:]..=[:].=[:].=[:].=[:]...
following_url?:                          ()=.(:=>).?.?(://#{.}/)=[/\/\/(.+)$/,]=[.(:=>)].?!(&).?!
send_unfollow_notification:              ()=.:=>=::.(.,..)=..=.(..)=::.(.,.)=.(.,,{-=>/-+})
send_follow_notification:                ()=.:=>=::.(.,..)=..=.(..)=::.(.,.)=.(.,,{-=>/-+})

[...]
```

Look at these two signatures from app/models/discussion_list.rb:

```
send_unfollow_notification:              ()=.:=>=::.(.,..)=..=.(..)=::.(.,.)=.(.,,{-=>/-+})
send_follow_notification:                ()=.:=>=::.(.,..)=..=.(..)=::.(.,.)=.(.,,{-=>/-+})
```

There's clearly something similar about them. Here's the source:

```
  # Send Salmon notification so that the remote user
  # knows this user is following them
  def send_follow_notification(to_feed_id)
    f = Feed.first :id => to_feed_id

    salmon = OStatus::Salmon.from_follow(author.to_atom, f.author.to_atom)

    envelope = salmon.to_xml self.to_rsa_keypair

    # Send envelope to Author's Salmon endpoint
    uri = URI.parse(f.author.salmon_url)
    http = Net::HTTP.new(uri.host, uri.port)
    res = http.post(uri.path, envelope, {"Content-Type" => "application/magic-envelope+xml"})
  end

  # Send Salmon notification so that the remote user
  # knows this user has stopped following them
  def send_unfollow_notification(to_feed_id)
    f = Feed.first :id => to_feed_id

    salmon = OStatus::Salmon.from_unfollow(author.to_atom, f.author.to_atom)

    envelope = salmon.to_xml self.to_rsa_keypair

    # Send envelope to Author's Salmon endpoint
    uri = URI.parse(f.author.salmon_url)
    http = Net::HTTP.new(uri.host, uri.port)
    res = http.post(uri.path, envelope, {"Content-Type" => "application/magic-envelope+xml"})
  end
```

Definitely some kind of duplication there, and these methods aren't
right next to each other in the source.

And it helps us find really long methods, like these bad boys:

```
app/models/update.rb
generate_html:              =.().!(/([]?:\/\/\+[---\/}])/,<=\\>\\</>).!()||$=.(:=>/^#{$}$/,:=>/^#{$}$/)=..?(/)=://#{.}#{}#{$}<=#{}>@#{$}@#{$}</>$=.(:=>/^#{$}$/)=..?(/)=://#{.}#{}#{$}<=#{}>@#{$}</>.!(/(^|\+)#(\+)/)||#{$}<=/?=%#{$}>##{$}</>.=
```

## TODOS

* break it up & test it a bit.


text:
class InputMergeNode : public MPxNode
{
public:
    static void *creator();
    static MStatus initialize();

public:
    static MString typeName;
    static MTypeId typeId;

    static MObject inputTransform;
    static MObject inputNode;

    static MObject outputNodeId;

public:
    InputMergeNode();
    virtual ~InputMergeNode();

    virtual MStatus compute(const MPlug &plug, MDataBlock &dataBlock);

private:
    void clearInput();
    bool checkInput(MDataBlock &dataBlock);

private:
    HAPI_NodeId myGeometryNodeId;
};

#endif


text:
"use strict";

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

const convert = require("./convert"),
    convertComments = require("./convert-comments").convertComments,
    nodeUtils = require("./node-utils");

//------------------------------------------------------------------------------
// Private
//------------------------------------------------------------------------------

/**
 * Extends and formats a given error object
 * @param  {Object} error the error object
 * @returns {Object}       converted error object
 */
function convertError(error) {
    const loc = error.file.getLineAndCharacterOfPosition(error.start);
    return {
        index: error.start,
        lineNumber: loc.line + 1,
        column: loc.character,
        message: error.message || error.messageText
    };
}

//------------------------------------------------------------------------------
// Public
//------------------------------------------------------------------------------

module.exports = (ast, extra) => {

    /**
     * The TypeScript compiler produced fundamental parse errors when parsing the
     * source.
     */
    if (ast.parseDiagnostics.length) {
        throw convertError(ast.parseDiagnostics[0]);
    }

    /**
     * Recursively convert the TypeScript AST into an ESTree-compatible AST
     */
    const estree = convert({
        node: ast,
        parent: null,
        ast,
        additionalOptions: {
            errorOnUnknownASTType: extra.errorOnUnknownASTType || false
        }
    });

    /**
     * Optionally convert and include all tokens in the AST
     */
    if (extra.tokens) {
        estree.tokens = nodeUtils.convertTokens(ast);
    }

    /**
     * Optionally convert and include all comments in the AST
     */
    if (extra.comment) {
        estree.comments = convertComments(ast, extra.code);
    }

    return estree;

};


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.jupyterkernel.json.messages;

import org.json.JSONObject;
import org.json.JSONArray;
import org.jupyterkernel.util.JSONField;

/**
 *
 * @author kay schluehr
 */
public class T_execute_reply extends T_JSON {
    @JSONField
    public String status;

    @JSONField
    public Integer execution_count;

    @JSONField(type = "Choice")
    public JSONObject user_expression;

    @JSONField(type = "Choice")
    public String ename;

    @JSONField(type = "Choice")
    public String evalue;

    @JSONField(type = "Choice")
    public JSONArray traceback;

    public void setAnswer(T_execute_reply_ok reply)
    {
        this.user_expression = reply.user_expressions;
    }

    public void setAnswer(T_execute_reply_err reply)
    {
        this.ename  = reply.ename;
        this.evalue = reply.evalue;
        this.traceback = reply.traceback;
    }
}


text:
<?php

declare(strict_types=1);

namespace GoetasWebservices\SoapServices\SoapClient\Tests\Stub;

use GoetasWebservices\SoapServices\SoapClient\Builder\SoapContainerBuilder;
use PHPUnit\Framework\TestCase;

class StubGeneratorTest extends TestCase
{
    public function testDI(): void
    {
        $builder = new SoapContainerBuilder(__DIR__ . '/../Fixtures/config.yml');
        $debugContainer = $builder->getDebugContainer();

        /**
         * @var $clientStubGenerator \GoetasWebservices\SoapServices\SoapClient\StubGeneration\ClientStubGenerator
         */
        $clientStubGenerator = $debugContainer->get('goetas_webservices.soap.stub.client_generator');

        $wsdlMetadata = $debugContainer->getParameter('goetas_webservices.soap.config')['metadata'];
        $schemas = [];
        $portTypes = [];
        $wsdlReader = $debugContainer->get('goetas_webservices.wsdl2php.wsdl_reader');

        foreach (array_keys($wsdlMetadata) as $src) {
            $definitions = $wsdlReader->readFile($src);
            $schemas[] = $definitions->getSchema();
            $portTypes = array_merge($portTypes, $definitions->getAllPortTypes());
        }

        $classDefinitions = $clientStubGenerator->generate($portTypes);

        $this->assertCount(2, $classDefinitions);
    }
}


text:
require 'spec_helper'

describe "User pages" do

  let(:user) { create(:user) }
  let(:area_editor) { create(:area_editor) }
  let(:managing_editor) { create(:managing_editor) }
  let(:submit) { 'Register' }
  subject { page }

  shared_examples_for "all actions are accessible" do
    # new
    describe "signup page" do
      before { visit signup_path }
      it { should have_content('New user') }
      it { should have_content('First name') }
    end

    describe "new user page" do
      before { visit new_user_path }
      it { should have_content('New user') }
      it { should have_content('First name') }
    end

    # create
    describe "create a new user" do
      before { visit new_user_path }

      context "entering valid information" do
        before do
          fill_in 'First name', with: 'Jane'
          fill_in 'Middle name', with: 'J.'
          fill_in 'Last name', with: 'Doe'
          fill_in 'Email', with: 'jane.doe@example.com'
          fill_in 'Affiliation', with: 'University of Janesville'
        end

        it "should create a new author/referee" do
          expect { click_button submit }.to change(User, :count).by(1)
          expect(User.last.referee?).to be_true
        end

        describe "after creating the new author/referee" do
          before { click_button submit }
          it { should have_success_message('successfully registered') }
        end
      end

      context "entering invalid information" do
        before do
          fill_in 'First name', with: ''
          fill_in 'Middle name', with: 'J.'
          fill_in 'Last name', with: 'Doe'
          fill_in 'Email', with: 'jane.doe@example.com'
          fill_in 'Affiliation', with: 'University of Janesville'
          click_button 'Register'
        end

        it "should not create a new user" do
          expect { click_button submit }.not_to change(User, :count)
        end

        describe "after failing to create a new user" do
          it { should have_error_message }
        end
      end
    end

    # fuzzy search
    describe "fuzzy search", js: true do
      before do
        @joe_schmo = create(:user, first_name: 'Joe', last_name: 'Schmo', email: 'jomo@example.com')
        visit users_path
      end

      it "has a search field" do
        expect(page).to have_field('Search')
      end

      context "when searching for an editor", js: true do
        before { fill_in 'Search', with: managing_editor.full_name }
        it "does show them in the search results" do
          expect(page).to have_link(managing_editor.full_name_affiliation_email)
        end
      end

      it "finds users fuzzily matched by name or email" do
        fill_in 'Search', with: 'Jo'
        click_link @joe_schmo.full_name_affiliation_email
        click_button('Go')
        expect(current_path).to eq(user_path(@joe_schmo))
      end
    end

    # show
    describe "show profile page" do
      before { visit user_path(user) }

      it { should have_content(user.first_name) }
      it { should have_link('Edit profile') }
    end

    # index
    describe "index page" do
      before do
        30.times { FactoryGirl.create(:user) }
        visit users_path
      end

      it { should have_link('New User') }
      it { should have_link('Next') }
    end
  end

  context "when logged in as a managing editor" do
    before { valid_sign_in(managing_editor) }

    it_behaves_like "all actions are accessible"

    describe "show profile" do
      before { visit user_path(area_editor) }

      it { should have_content('Area Editor') }
    end

    # create editor
    describe "create editor" do
      before { visit new_user_path }

      context "with valid information for a new managing editor" do
        before do
          fill_in 'First name', with: 'Jane'
          fill_in 'Middle name', with: 'J.'
          fill_in 'Last name', with: 'Doe'
          fill_in 'Email', with: 'jane.doe@example.com'
          fill_in 'Affiliation', with: 'University of Janesville'
          choose('Managing editor')
        end

        it "should create the user" do
          expect { click_button submit }.to change(User, :count).by(1)
          expect(User.last.email).to eq('jane.doe@example.com')
        end

        describe "after creating the user" do
          before { click_button submit }
          it { should have_success_message }
        end
      end

      context "with valid information for a new area editor" do
        before do
          fill_in 'First name', with: 'Jane'
          fill_in 'Middle name', with: 'J.'
          fill_in 'Last name', with: 'Doe'
          fill_in 'Email', with: 'jane.doe@example.com'
          fill_in 'Affiliation', with: 'University of Janesville'
          choose('Area editor')
        end

        it "should create a new area editor" do
          expect { click_button submit }.to change(User, :count).by(1)
          expect(User.last.email).to eq('jane.doe@example.com')
        end

        describe "after creating the user" do
          before { click_button submit }
          it { should have_success_message }
        end
      end
    end

    # edit
    describe "edit page" do
      before{ visit edit_user_path(user) }

      it { should have_content('Edit profile') }
      it { should have_content('Password') }
    end

    # update
    describe "update profile" do

      context "when the profile is own's" do
        before { visit edit_user_path(managing_editor) }

        describe "with invalid info" do
          before do
            fill_in 'First name', with: ''
            click_button 'Save'
          end
          it { should have_error_message }
        end

        describe "with valid info" do
          before do
            fill_in 'First name', with: user.first_name + '2'
            fill_in 'Middle name', with: 'X.'
            fill_in 'Last name', with: user.last_name + '2'
            fill_in 'Email', with: user.email + '.ca'
            fill_in 'Affiliation', with: 'Foo'
            fill_in 'Password', with: user.password + '2'
            fill_in 'Confirm password', with: user.password + '2'
            choose 'Female'
            click_button 'Save'
          end

          it { should have_success_message }
          it { should have_content(user.first_name + '2') }
          it { should have_content('X.') }
          it { should have_content(user.last_name + '2') }
          it { should have_content(user.email + '.ca') }
          it { should have_content('Foo') }
          it { should have_content('Female') }
        end
      end

      context "when the profile is another managing editor's" do
        before do
          other_managing_editor = create(:managing_editor)
          visit edit_user_path(other_managing_editor)
        end

        describe "with valid info" do
          before do
            fill_in 'First name', with: user.first_name + '2'
            fill_in 'Middle name', with: 'X.'
            fill_in 'Last name', with: user.last_name + '2'
            fill_in 'Email', with: user.email + '.ca'
            fill_in 'Affiliation', with: 'Foo'
            fill_in 'Password', with: user.password + '2'
            fill_in 'Confirm password', with: user.password + '2'
            choose 'Male'
            click_button 'Save'
          end

          it { should have_success_message }
          it { should have_content(user.first_name + '2') }
          it { should have_content('X.') }
          it { should have_content(user.last_name + '2') }
          it { should have_content(user.email + '.ca') }
          it { should have_content('Male') }
          it { should have_content('Foo') }
        end
      end

      context "when the profile is an area editor's" do
        before do
          @area = create(:area)
          visit edit_user_path(area_editor)
        end

        describe "with valid info" do
          before do
            fill_in 'First name', with: user.first_name + '2'
            fill_in 'Middle name', with: 'X.'
            fill_in 'Last name', with: user.last_name + '2'
            fill_in 'Email', with: user.email + '.ca'
            fill_in 'Affiliation', with: 'Foo'
            fill_in 'Password', with: user.password + '2'
            fill_in 'Confirm password', with: user.password + '2'
            select @area.name
            choose 'Female'
            click_button 'Save'
          end

          it { should have_success_message }
          it { should have_content(user.first_name + '2') }
          it { should have_content('X.') }
          it { should have_content(user.last_name + '2') }
          it { should have_content(user.email + '.ca') }
          it { should have_content('Female') }
          it { should have_content('Foo') }
          it { should have_content(@area.name) }
        end
      end

      context "when the profile is an author/referee's" do
        before { visit edit_user_path(user) }

        describe "with valid info" do
          before do
            fill_in 'First name', with: user.first_name + '2'
            fill_in 'Middle name', with: 'X.'
            fill_in 'Last name', with: user.last_name + '2'
            fill_in 'Email', with: user.email + '.ca'
            fill_in 'Affiliation', with: 'Foo'
            fill_in 'Password', with: user.password + '2'
            fill_in 'Confirm password', with: user.password + '2'
            choose 'Male'
            click_button 'Save'
          end

          it { should have_success_message }
          it { should have_content(user.first_name + '2') }
          it { should have_content('X.') }
          it { should have_content(user.last_name + '2') }
          it { should have_content(user.email + '.ca') }
          it { should have_content('Foo') }
          it { should have_content('Male') }
        end
      end
    end
  end

  shared_examples_for "updating gender info is not possible" do |redirect_path|
    describe "via the #update action" do
      before do
        put user_path(area_editor), user: { gender: 'Female' }
      end

      it "doesn't update the record; redirects to security breach" do
        expect(area_editor.reload.gender).not_to eq 'Female'
      end
    end

    describe "via the #update_gender action" do
      before do
        put update_gender_user_path(area_editor), user: { gender: 'Female' }
      end

      it "doesn't update the record; redirects to security breach" do
        expect(area_editor.reload.gender).not_to eq 'Female'
        expect(response).to redirect_to(send(redirect_path))
      end
    end
  end

  context "when logged in as an area editor" do
    before { valid_sign_in(area_editor) }

    it_behaves_like "all actions are accessible"

    # create editor
    describe "attempt to create a new editor" do
      before do
        @params = { first_name: 'Jane',
                   middle_name: 'J.',
                   last_name: 'Doe',
                   email: 'jane.doe@example.com',
                   affiliation: 'University of Janesville',
                   role: 'Managing editor'}
      end

      it "creates an author/referee, not an editor" do
        expect { post users_path, user: @params }.to change(User, :count)
        expect(User.last.editor?).to eq(false)
      end
    end

    describe "show editor's profile page" do
      before { visit user_path(managing_editor) }

      it { should have_content(managing_editor.first_name) }
      it { should_not have_content('Managing Editor') }
      it { should_not have_link('Edit profile') }
    end

    #edit
    describe "edit profile page for author/referee" do
      before{ visit edit_user_path(user) }

      it { should have_content('Edit profile') }
      it { should_not have_content ('Gender') }
    end

    describe "edit profile page for editor" do
      before{ visit edit_user_path(managing_editor) }

      it "redirects to security_breach_path" do
        expect(current_path).to eq(security_breach_path)
      end
    end

    #update
    describe "update profile" do

      context "when the profile is own's" do
        before { visit edit_user_path(area_editor) }

        describe "with invalid info" do
          before do
            fill_in 'First name', with: ''
            click_button 'Save'
          end
          it { should have_error_message }
        end

        describe "with valid info" do
          before do
            fill_in 'First name', with: user.first_name + '2'
            fill_in 'Middle name', with: 'X.'
            fill_in 'Last name', with: user.last_name + '2'
            fill_in 'Email', with: user.email + '.ca'
            fill_in 'Affiliation', with: 'Foo'
            fill_in 'Password', with: user.password + '2'
            fill_in 'Confirm password', with: user.password + '2'
            click_button 'Save'
          end

          it { should have_success_message }
          it { should have_content(user.first_name + '2') }
          it { should have_content('X.') }
          it { should have_content(user.last_name + '2') }
          it { should have_content(user.email + '.ca') }
          it { should have_content('Foo') }
        end
      end

      context "when the profile is an editor's" do
        before do
          @other_area_editor = create(:area_editor)
          params = { first_name: 'changed',
                     last_name: 'different',
                     email: 'changed.different@altered.com' }
          put user_path(@other_area_editor), user: params
        end

        it "does not change the editor's profile" do
          @other_area_editor.reload
          expect(@other_area_editor.first_name).not_to eq('changed')
        end

        it "redirects to security_breach_path" do
          expect(response).to redirect_to(security_breach_path)
        end
      end

      context "when the profile is an author/referee's" do
        before { visit edit_user_path(user) }

        describe "with valid info" do
          before do
            fill_in 'First name', with: user.first_name + '2'
            fill_in 'Middle name', with: 'X.'
            fill_in 'Last name', with: user.last_name + '2'
            fill_in 'Email', with: user.email + '.ca'
            fill_in 'Affiliation', with: 'Foo'
            click_button 'Save'
          end

          it { should have_success_message }
          it { should have_content(user.first_name + '2') }
          it { should have_content('X.') }
          it { should have_content(user.last_name + '2') }
          it { should have_content(user.email + '.ca') }
          it { should have_content('Foo') }
        end

        describe "with forbidden params" do
          before do
            @old_digest = user.password_digest
            params = { first_name: 'changed',
                       last_name: 'different',
                       email: 'changed.different@altered.com',
                       password: 'secret',
                       password_confirmation: 'secret' }
            put user_path(user), user: params
          end

          it "should change the permitted attributes" do
            expect(user.reload.first_name).to eq('changed')
          end

          it "should not change the forbidden attributes" do
            expect(user.reload.password_digest).to eq(@old_digest)
          end
        end
      end

      it_behaves_like "updating gender info is not possible", :security_breach_path
    end
  end

  context "when logged in as an author/referee" do
    before { valid_sign_in(user) }

    #new
    describe "signup page" do
      before { visit signup_path }
      it "should redirect to author center index" do
        expect(current_path).to eq(author_center_index_path)
      end
    end

    describe "new user page" do
      before { visit new_user_path }
      it "should redirect to author center" do
        expect(current_path).to eq(author_center_index_path)
      end
    end

    # fuzzy_search
    describe "fuzzy search" do
      before { post fuzzy_search_users_path, query: 'Jo Shmo' }

      it "redirects to signin" do
        expect(response).to redirect_to(security_breach_path)
      end
    end

    #create
    describe "attempt to create a new user" do
      before do
        @params = { first_name: 'Jane',
                    middle_name: 'J.',
                    last_name: 'Doe',
                    email: 'jane.doe@example.com',
                    affiliation: 'University of Janesville' }
      end

      it "fails to create a user" do
        expect { post users_path, user: @params }.not_to change(User, :count)
      end

      it "renders the new user page" do
        post users_path, user: @params
        expect(response.body).to match('New user')
      end
    end

    #show
    describe "show own profile page" do
      before { visit user_path(user) }

      it { should have_content(user.first_name) }
      it { should_not have_content('Role') }
      it { should have_link('Edit profile') }
    end

    describe "show another user's profile page" do
      before do
        @other_user = create(:user)
        visit user_path(@other_user)
      end

      it "redirects to security_breach_path" do
        expect(current_path).to eq(security_breach_path)
      end
    end

    #index
    describe "index page" do
      before { visit users_path }

      it "should redirect to security_breach_path" do
        expect(current_path).to eq(security_breach_path)
      end
    end

    #edit
    describe "edit profile page for self" do
      before{ visit edit_user_path(user) }

      it { should have_content('Edit profile') }
      it { should have_button('Save') }
      it { should_not have_content('Gender') }
    end

    describe "edit profile page for other author/referee" do
      before{ visit edit_user_path(create(:user)) }

      it "redirects to security_breach_path" do
        expect(current_path).to eq(security_breach_path)
      end
    end

    describe "edit profile page for editor" do
      before{ visit edit_user_path(area_editor) }

      it "redirects to security_breach_path" do
        expect(current_path).to eq(security_breach_path)
      end
    end

    #update
    describe "update profile" do

      context "when the profile is self's" do
        before { visit edit_user_path(user) }

        describe "with invalid info" do
          before do
            fill_in 'First name', with: ''
            click_button 'Save'
          end
          it { should have_error_message }
          it { should have_content('Edit profile') }
        end

        describe "with valid info" do
          before do
            fill_in 'First name', with: user.first_name + '2'
            fill_in 'Middle name', with: 'X.'
            fill_in 'Last name', with: user.last_name + '2'
            fill_in 'Email', with: user.email + '.ca'
            fill_in 'Affiliation', with: 'Foo'
            fill_in 'Password', with: user.password + '2'
            fill_in 'Confirm password', with: user.password + '2'
            click_button 'Save'
          end

          it { should have_success_message }
          it { should have_content(user.first_name + '2') }
          it { should have_content('X.') }
          it { should have_content(user.last_name + '2') }
          it { should have_content(user.email + '.ca') }
          it { should have_content('Foo') }
        end
      end

      context "when the profile is another user's" do
        before do
          @other_user = create(:user)
          @params = { first_name: 'changed',
                      last_name: 'altered',
                      email: 'changed.altered@example.com' }
          put user_path(@other_user), user: @params
        end

        it "fails to edit the user" do
          expect(@other_user.reload.first_name).not_to eq('changed')
        end

        it "redirects to security_breach_path" do
          expect(response).to redirect_to(security_breach_path)
        end
      end
    end

    it_behaves_like "updating gender info is not possible", :security_breach_path
  end

  context "when not logged in" do

    #new
    describe "signup page" do
      before { visit signup_path }
      it { should have_content('New user') }
      it { should have_content('First name') }
      it { should have_content('Middle name') }
      it { should have_content('Last name') }
      it { should have_content('Email') }
      it { should have_content('Affiliation') }
      it { should have_content('Password') }
      it { should have_content('Confirm password') }
      it { should have_button('Register') }
    end

    describe "new user page" do
      before { visit new_user_path }
      it { should have_content('New user') }
      it { should have_content('First name') }
      it { should have_content('Middle name') }
      it { should have_content('Last name') }
      it { should have_content('Email') }
      it { should have_content('Affiliation') }
      it { should have_content('Password') }
      it { should have_content('Confirm password') }
      it { should have_button('Register') }
    end

    # fuzzy_search
    describe "fuzzy search" do
      before { post fuzzy_search_users_path, query: 'Jo Shmo' }

      it "redirects to signin" do
        expect(response).to redirect_to(signin_path)
      end
    end

    #create
    describe "create user" do
      context "when going through signup page" do
        before do
          visit signup_path
          fill_in 'First name', with: 'New'
          fill_in 'Middle name', with: 'N.'
          fill_in 'Last name', with: 'User'
          fill_in 'Email', with: 'jane.doe@example.com'
          fill_in 'Affiliation', with: 'University of Janesville'
          fill_in 'Password', with: 'secret'
          fill_in 'Confirm password', with: 'secret'
          click_button submit
        end

        it "creates the user" do
          expect(User.last.first_name).to eq('New')
        end

        it { should have_success_message}

        it "redirects to author center" do
          expect(current_path).to eq(author_center_index_path)
        end
      end

      context "when already registered" do
        before do
          User.create(first_name: 'Existing', last_name: 'User', email: 'jane.doe@example.com', password: 'secret', password_confirmation: 'secret')
          visit signup_path
          fill_in 'First name', with: 'New'
          fill_in 'Last name', with: 'User'
          fill_in 'Email', with: 'jane.doe@example.com'
          fill_in 'Password', with: 'secret'
          fill_in 'Confirm password', with: 'secret'
          click_button submit
        end

        it "flashes an explanation and sends a password reset email instead of creating the user" do
          expect(page).to have_error_message('we\'re sending you an email')
          expect(User.where(first_name: 'New')).to be_empty
          expect(deliveries.last.body).to match('To reset your password, follow this')
        end
      end

      context "when posting directly with illicit attributes" do
        before do
          @params = { first_name: 'Jane',
                      middle_name: 'J.',
                      last_name: 'Doe',
                      email: 'jane.doe@example.com',
                      affiliation: 'University of Janesville',
                      role: 'Managing editor' }
        end

        it "fails to create a user" do
          expect { post users_path, user: @params }.not_to change(User, :count)
        end

        it "renders the new user page" do
          post users_path, user: @params
          expect(response.body).to match('New user')
        end
      end
    end

    #show
    describe "show profile page" do
      before do
        visit user_path(user)
      end

      it "redirects to signin path" do
        expect(current_path).to eq(signin_path)
      end
    end

    #index
    describe "index page" do
      before { visit users_path }

      it "should redirect to signin path" do
        expect(current_path).to eq(signin_path)
      end
    end

    #edit
    describe "edit profile page of some user" do
      before{ visit edit_user_path(create(:user)) }

      it "redirects to signin path" do
        expect(current_path).to eq(signin_path)
      end
    end

    #update
    describe "update profile of some user" do
      before do
        @params = { first_name: 'changed',
                    last_name: 'altered',
                    email: 'changed.altered@example.com' }
        put user_path(user), user: @params
      end

      it "fails to edit the user" do
        expect(user.reload.first_name).not_to eq('changed')
      end

      it "redirects to signin page" do
        expect(response).to redirect_to(signin_path)
      end
    end

    it_behaves_like "updating gender info is not possible", :signin_path
  end

end


text:
package com.google.api.ads.adwords.jaxws.v201406.cm;

import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for AdxError.Reason.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *

 *

 * <simpleType name="AdxError.Reason">
 *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *     <enumeration value="UNSUPPORTED_FEATURE"/>
 *   </restriction>
 * </simpleType>
 *

 *
 */
@XmlType(name = "AdxError.Reason")
@XmlEnum
public enum AdxErrorReason {

    /**
     *
     *                 Attempt to use non-AdX feature by AdX customer.
     *
     *
     */
    UNSUPPORTED_FEATURE;

    public String value() {
        return name();
    }

    public static AdxErrorReason fromValue(String v) {
        return valueOf(v);
    }

}


text:
Sets log text when an exception breakpoint is hit. When log condition is not specified, it will always be logged regardless of the break condition, otherwise it will be logged when the logging condition is satisfied.

## arguments

`arg1` The name, exception name or code of the exception breakpoint.

`[arg2]` The log format string (see introduction/formatting).

## result

This command does not set any result variables.


text:
include ../../makefile.conf

ifdef $(PD_INCLUDES)
    PDINCLUDEDIR=$(PD_INCLUDES)
endif

# Makefile to build class 'rtcmix' for Pure Data.
# Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build
# settings and rules.

# library name
lib.name = rtcmix~

# input source file (class name == source file basename)
class.sources = rtcmix~.c

# all extra files to be included in binary distribution of the library
datafiles = rtcmix~-help.pd rtcmix~-meta.pd README.md

# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder'
PDLIBBUILDER_DIR=pd-lib-builder/
include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder


text:
/**
 * Represents a Twitter search query. This model contains a reference to two instances of
 * TweetCollection. The first instance, "latestTweets", represents a cache of the most recent
 * results returned by a search. The second instance, "displayedTweets", represents the set
 * of Tweets visible on the page. After a query has been initially executed, new results are
 * fetched into the "latestTweets" collection on an interval. The number of new Tweets is calculated
 * by comparing the number of Tweets in the "latestTweets" collection with and ID greater than
 * the maximum ID in the "displayedTweets" collection. When the user elects to view the new Tweets
 * the contents of the "latestTweets" collection are cloned into the "displayedTweets" collection.
 */
var TwitterSearch = Backbone.Model.extend({
	newItemCheckInterval: 30000,
	queryPageSize: 26,
	initialize: function(attributes) {
		_.bindAll(this, 'clear', 'executeTwitterSearch', 'revealLatestTweets', 'fetchNewItemCountCallback');
		this.bind('change:query', this.queryChanged);

		this.displayedTweets = new TweetCollection();
		this.displayedTweets.queryPageSize = this.queryPageSize;

		this.latestTweets = new TweetCollection();
		this.latestTweets.queryPageSize = this.queryPageSize;
		this.latestTweets.bind('change', this.fetchNewItemCountCallback);
	},
	queryChanged: function() {
		// Do initial fetch
		this.executeTwitterSearch();

		// Set refresh
		this.fetchTimer = setInterval(this.executeTwitterSearch, this.newItemCheckInterval);
	},
	executeTwitterSearch: function() {
		this.latestTweets.query = this.get('query');
		this.latestTweets.fetch();
	},
	fetchNewItemCountCallback: function(response) {
		var newItems = 0,
			me = this;

		if(!this.get('lastRead')) {
			this.set({ 'lastRead': this.latestTweets.maxId().get('id') });
		}

		newItems = this.latestTweets.filter(function(tweet) {
			return tweet.id > me.get('lastRead');
		}).length;

		if(newItems == 0) {
	       	me.revealLatestTweets();
        }

		this.set({
			'newItemCount': newItems
		});
	},
	revealLatestTweets: function() {
		this.displayedTweets.reset();
	   	var me = this,
	   		maxId = 0;
	   	$.each(this.latestTweets.models, function(i, val) {
	   		if(val.get('id') > maxId) {
	   			maxId = val.get('id');
	   		}
	    	me.displayedTweets.add(val);
	   	});
	   	me.set({ 'lastRead': maxId });
	},
	clear: function() {
		clearInterval(this.fetchTimer);
	}
});