text:
import { toLength, toObject, toBoolean } from "../../utils/native";
import { assertIsFunction, assertIsNotNullOrUndefined } from "../../utils/contracts";
import iterate from "../../iterators/";
import { executeCallback } from "./array-helpers";

export default function ($target, env, factory) {
  $target.define("some", factory.createBuiltInFunction(function* (callback, thisArg) {
    assertIsNotNullOrUndefined(this.object, "Array.prototype.some");
    let arr = toObject(this.object);
    let length = yield toLength(this.object);
    assertIsFunction(callback, this.object);

    for (let entry of iterate.forward(arr, 0, length)) {
      let passed = toBoolean(yield executeCallback(env, callback, entry, thisArg, arr));
      if (passed) {
        return factory.createPrimitive(true);
      }
    }

    return factory.createPrimitive(false);
  }, 1, "Array.prototype.some"));
}


text:
package org.locationtech.geomesa.convert.text

import java.io.{InputStreamReader, ByteArrayInputStream}
import java.nio.charset.StandardCharsets

import com.google.common.io.Resources
import com.typesafe.config.ConfigFactory
import com.vividsolutions.jts.geom.{Coordinate, GeometryFactory}
import org.apache.commons.csv.CSVFormat
import org.junit.runner.RunWith
import org.locationtech.geomesa.convert.SimpleFeatureConverters
import org.locationtech.geomesa.convert.Transformers.DefaultCounter
import org.locationtech.geomesa.utils.geotools.SimpleFeatureTypes
import org.specs2.mutable.Specification
import org.specs2.runner.JUnitRunner

@RunWith(classOf[JUnitRunner])
class DelimitedTextConverterTest extends Specification {

  sequential

  "DelimitedTextConverter" should {

    val data =
      """
        |1,hello,45.0,45.0
        |2,world,90.0,90.0
        |willfail,hello
      """.stripMargin

    val conf = ConfigFactory.parseString(
      """
        | converter = {
        |   type         = "delimited-text",
        |   format       = "DEFAULT",
        |   id-field     = "md5(string2bytes($0))",
        |   fields = [
        |     { name = "oneup",    transform = "$1" },
        |     { name = "phrase",   transform = "concat($1, $2)" },
        |     { name = "lat",      transform = "$3::double" },
        |     { name = "lon",      transform = "$4::double" },
        |     { name = "lit",      transform = "'hello'" },
        |     { name = "geom",     transform = "point($lat, $lon)" }
        |     { name = "l1",       transform = "concat($lit, $lit)" }
        |     { name = "l2",       transform = "concat($l1,  $lit)" }
        |     { name = "l3",       transform = "concat($l2,  $lit)" }
        |   ]
        | }
      """.stripMargin)

    val sft = SimpleFeatureTypes.createType(ConfigFactory.load("sft_testsft.conf"))
    "be built from a conf" >> {
      val converter = SimpleFeatureConverters.build[String](sft, conf)
      converter must not beNull

      val res = converter.processInput(data.split("\n").toIterator.filterNot( s => "^\\s*$".r.findFirstIn(s).size > 0)).toList
      converter.close()

      "and process some data" >> {
        res.size must be equalTo 2
        res(0).getAttribute("phrase").asInstanceOf[String] must be equalTo "1hello"
        res(1).getAttribute("phrase").asInstanceOf[String] must be equalTo "2world"
      }

      "handle more derived fields than input fields" >> {
        res(0).getAttribute("oneup").asInstanceOf[String] must be equalTo "1"
      }
    }

    "handle tab delimited files" >> {
      val conf = ConfigFactory.parseString(
        """
          | converter = {
          |   type         = "delimited-text",
          |   format       = "TDF",
          |   id-field     = "md5(string2bytes($0))",
          |   fields = [
          |     { name = "phrase", transform = "concat($1, $2)" },
          |     { name = "lat",    transform = "$3::double" },
          |     { name = "lon",    transform = "$4::double" },
          |     { name = "geom",   transform = "point($lat, $lon)" }
          |   ]
          | }
        """.stripMargin)
      val sft = SimpleFeatureTypes.createType(ConfigFactory.load("sft_testsft.conf"))
      val converter = SimpleFeatureConverters.build[String](sft, conf)
      converter must not beNull
      val res = converter.processInput(data.split("\n").toIterator.filterNot( s => "^\\s*$".r.findFirstIn(s).size > 0).map(_.replaceAll(",", "\t"))).toList
      converter.close()
      res.size must be equalTo 2
      res(0).getAttribute("phrase").asInstanceOf[String] must be equalTo "1hello"
      res(1).getAttribute("phrase").asInstanceOf[String] must be equalTo "2world"
    }

    "handle line number transform and filename global parameter correctly " >> {
      val conf = ConfigFactory.parseString(
        """
          | converter = {
          |   type         = "delimited-text",
          |   format       = "TDF",
          |   id-field     = "md5(string2bytes($0))",
          |   fields = [
          |     { name = "phrase", transform = "concat($1, $2)" },
          |     { name = "lineNr", transform = "lineNo()"},
          |     { name = "fn",     transform = "$filename"},
          |     { name = "lat",    transform = "$3::double" },
          |     { name = "lon",    transform = "$4::double" },
          |     { name = "geom",   transform = "point($lat, $lon)" }
          |   ]
          | }
        """.stripMargin)
      val sft = SimpleFeatureTypes.createType(ConfigFactory.load("sft_testsft.conf"))
      val converter = SimpleFeatureConverters.build[String](sft, conf)
      converter must not beNull
      val input = data.split("\n").toIterator.filterNot( s => "^\\s*$".r.findFirstIn(s).size > 0).map(_.replaceAll(",", "\t"))
      val ec = converter.createEvaluationContext(Map("filename"-> "/some/file/path/testfile.txt"))
      val res = converter.processInput(input, ec).toList
      converter.close()
      res.size must be equalTo 2
      res(0).getAttribute("phrase").asInstanceOf[String] must be equalTo "1hello"
      res(0).getAttribute("lineNr").asInstanceOf[Int] must be equalTo 1
      res(0).getAttribute("fn").asInstanceOf[String] must be equalTo "/some/file/path/testfile.txt"
      res(1).getAttribute("phrase").asInstanceOf[String] must be equalTo "2world"
      res(1).getAttribute("lineNr").asInstanceOf[Int] must be equalTo 2
      res(1).getAttribute("fn").asInstanceOf[String] must be equalTo "/some/file/path/testfile.txt"
    }

    "handle line number transform and filename global in id-field " >> {
      val conf = ConfigFactory.parseString(
        """
          | converter = {
          |   type         = "delimited-text",
          |   format       = "TDF",
          |   id-field     = "concat($filename, lineNo())",
          |   fields = [
          |     { name = "phrase", transform = "concat($1, $2)" },
          |     { name = "lineNr", transform = "lineNo()"},
          |     { name = "fn",     transform = "$filename"},
          |     { name = "lat",    transform = "$3::double" },
          |     { name = "lon",    transform = "$4::double" },
          |     { name = "geom",   transform = "point($lat, $lon)" }
          |   ]
          | }
        """.stripMargin)

      val sft = SimpleFeatureTypes.createType(ConfigFactory.load("sft_testsft.conf"))
      val converter = SimpleFeatureConverters.build[String](sft, conf)
      converter must not beNull
      val input = data.split("\n").toIterator.filterNot( s => "^\\s*$".r.findFirstIn(s).size > 0).map(_.replaceAll(",", "\t"))
      val ec = converter.createEvaluationContext(Map("filename"-> "/some/file/path/testfile.txt"))
      val res = converter.processInput(input, ec).toList
      converter.close()
      res.size must be equalTo 2
      res(0).getAttribute("phrase").asInstanceOf[String] must be equalTo "1hello"
      res(0).getAttribute("lineNr").asInstanceOf[Int] must be equalTo 1
      res(0).getAttribute("fn").asInstanceOf[String] must be equalTo "/some/file/path/testfile.txt"
      res(1).getAttribute("phrase").asInstanceOf[String] must be equalTo "2world"
      res(1).getAttribute("lineNr").asInstanceOf[Int] must be equalTo 2
      res(1).getAttribute("fn").asInstanceOf[String] must be equalTo "/some/file/path/testfile.txt"
    }

    "handle projecting to just the attributes in the SFT (and associated input dependencies)" >> {
      // l3 has cascading dependencies
      val subsft = SimpleFeatureTypes.createType("subsettest", "l3:String,geom:Point:srid=4326")
      val conv = SimpleFeatureConverters.build[String](subsft, conf)
      val res = conv.processInput(data.split("\n").toIterator.filterNot( s => "^\\s*$".r.findFirstIn(s).size > 0)).toList
      conv.close()

      res.length must be equalTo 2
    }

    "handle horrible quoting and nested separators" >> {
      val conf = ConfigFactory.parseString(
        """
          | converter = {
          |   type         = "delimited-text",
          |   format       = "EXCEL",
          |   id-field     = "md5(string2bytes($0))",
          |   fields = [
          |     { name = "phrase", transform = "concat($1, $2)" },
          |     { name = "lat",    transform = "$3::double" },
          |     { name = "lon",    transform = "$4::double" },
          |     { name = "geom",   transform = "point($lat, $lon)" }
          |   ]
          | }
        """.stripMargin)

      import scala.collection.JavaConversions._
      val data = Resources.readLines(Resources.getResource("messydata.csv"), StandardCharsets.UTF_8)

      val sft = SimpleFeatureTypes.createType(ConfigFactory.load("sft_testsft.conf"))
      val converter = SimpleFeatureConverters.build[String](sft, conf)
      converter must not beNull
      val res = converter.processInput(data.iterator()).toList
      converter.close()
      res.size must be equalTo 2
      res(0).getAttribute("phrase").asInstanceOf[String] must be equalTo "1hello, \"foo\""
      res(1).getAttribute("phrase").asInstanceOf[String] must be equalTo "2world"
    }

    "handle records bigger than buffer size" >> {
      // set the buffer size to 16 bytes and try to write records that are bigger than the buffer size

      val sizeConf = ConfigFactory.parseString(
        """
          | converter = {
          |   type         = "delimited-text",
          |   format       = "DEFAULT",
          |   id-field     = "md5(string2bytes($0))",
          |   options = {
          |       pipe-size    = 16 // 16 bytes
          |   },
          |   fields = [
          |     { name = "oneup",  transform = "$1" },
          |     { name = "phrase", transform = "concat($1, $2)" },
          |     { name = "lat",    transform = "$3::double" },
          |     { name = "lon",    transform = "$4::double" },
          |     { name = "lit",    transform = "'hello'" },
          |     { name = "geom",   transform = "point($lat, $lon)" }
          |   ]
          | }
        """.stripMargin)

      val converter = SimpleFeatureConverters.build[String](sft, sizeConf)
      converter.asInstanceOf[DelimitedTextConverter]
      val data =
        """
          |1,hello,45.0,45.0
          |2,world,90.0,90.0
          |willfail,hello
        """.stripMargin

      val nonEmptyData = data.split("\n").toIterator.filterNot(s => "^\\s*$".r.findFirstIn(s).size > 0)
      val res = converter.processInput(nonEmptyData).toList
      converter.close()

      res.size must be greaterThan 0
    }

    "handle wkt" >> {
      val wktData =
        """
          |1,hello,Point(46.0 45.0)
          |2,world,Point(90.0 90.0)
        """.stripMargin

      val wktConf = ConfigFactory.parseString(
        """
          | converter = {
          |   type         = "delimited-text",
          |   format       = "DEFAULT",
          |   id-field     = "md5(string2bytes($0))",
          |   fields = [
          |     { name = "oneup",    transform = "$1" },
          |     { name = "phrase",   transform = "concat($1, $2)" },
          |     { name = "geom",     transform = "geometry($3)" }
          |   ]
          | }
        """.stripMargin)

      val wktSft = SimpleFeatureTypes.createType(ConfigFactory.load("sft_testsft.conf"))
      val converter = SimpleFeatureConverters.build[String](wktSft, wktConf)

      val res = converter.processInput(wktData.split("\n").toIterator.filterNot( s => "^\\s*$".r.findFirstIn(s).size > 0)).toList
      res.length mustEqual 2
      converter.close()

      val geoFac = new GeometryFactory()
      res(0).getDefaultGeometry mustEqual geoFac.createPoint(new Coordinate(46, 45))
      res(1).getDefaultGeometry mustEqual geoFac.createPoint(new Coordinate(90, 90))
    }

    "skip header lines" >> {
       val conf =
        """
          | converter = {
          |   type         = "delimited-text",
          |   format       = "DEFAULT",
          |   id-field     = "md5(string2bytes($0))",
          |   options = {
          |       skip-lines = SKIP
          |   },
          |   fields = [
          |     { name = "oneup",    transform = "$1" },
          |     { name = "phrase",   transform = "concat($1, $2)" },
          |     { name = "geom",     transform = "geometry($3)" }
          |   ]
          | }
        """.stripMargin
      val wktSft = SimpleFeatureTypes.createType(ConfigFactory.load("sft_testsft.conf"))

      "csv parser failblog or misunderstanding test" >> {
        val format = CSVFormat.DEFAULT.withSkipHeaderRecord(true).withIgnoreEmptyLines(true)
        val trueData =
          """
            |num,msg,geom
            |1,hello,Point(46.0 45.0)
            |2,world,Point(90.0 90.0)
          """.stripMargin

        import scala.collection.JavaConversions._
        val sz = format.parse(new InputStreamReader(new ByteArrayInputStream(trueData.getBytes))).iterator().toList.size

        // prove that skipHeader and empty lines doesn't work (at least as I think) and that we are safe to
        // consume the header record and empty lines as part of our config
        sz mustEqual 4
      }
      "with single line header" >> {
        val trueConf = ConfigFactory.parseString(conf.replaceAllLiterally("SKIP", "1"))
        val trueData =
          """
            |num,msg,geom
            |1,hello,Point(46.0 45.0)
            |2,world,Point(90.0 90.0)
          """.stripMargin
        val converter = SimpleFeatureConverters.build[String](wktSft, trueConf)

        val counter = new DefaultCounter
        val ec = converter.createEvaluationContext(counter = counter)
        val res = converter.processInput(trueData.split("\n").toIterator.filterNot( s => "^\\s*$".r.findFirstIn(s).size > 0), ec).toList
        res.length mustEqual 2
        converter.close()

        counter.getLineCount mustEqual 3
        counter.getSuccess mustEqual 2
        counter.getFailure mustEqual 0

        val geoFac = new GeometryFactory()
        res(0).getDefaultGeometry mustEqual geoFac.createPoint(new Coordinate(46, 45))
        res(1).getDefaultGeometry mustEqual geoFac.createPoint(new Coordinate(90, 90))
      }

      "with header set to 0" >> {
        val falseConf = ConfigFactory.parseString(conf.replaceAllLiterally("SKIP", "0"))
        val falseData =
          """
            |1,hello,Point(46.0 45.0)
            |2,world,Point(90.0 90.0)
          """.stripMargin
        val converter = SimpleFeatureConverters.build[String](wktSft, falseConf)

        val counter = new DefaultCounter
        val ec = converter.createEvaluationContext(counter = counter)
        val res = converter.processInput(falseData.split("\n").toIterator.filterNot( s => "^\\s*$".r.findFirstIn(s).size > 0), ec).toList
        res.length mustEqual 2
        converter.close()

        counter.getLineCount mustEqual 2
        counter.getSuccess mustEqual 2
        counter.getFailure mustEqual 0

        val geoFac = new GeometryFactory()
        res(0).getDefaultGeometry mustEqual geoFac.createPoint(new Coordinate(46, 45))
        res(1).getDefaultGeometry mustEqual geoFac.createPoint(new Coordinate(90, 90))
      }
      "with header set to 3" >> {
        val falseConf = ConfigFactory.parseString(conf.replaceAllLiterally("SKIP", "3"))
        val falseData =
          """
            |num,msg,geom
            |some other garbage
            |that somebody placed in my file maybe as a comment
            |1,hello,Point(46.0 45.0)
            |2,world,Point(90.0 90.0)
          """.stripMargin
        val converter = SimpleFeatureConverters.build[String](wktSft, falseConf)

        val counter = new DefaultCounter
        val ec = converter.createEvaluationContext(counter = counter)
        val res = converter.processInput(falseData.split("\n").toIterator.filterNot( s => "^\\s*$".r.findFirstIn(s).size > 0), ec).toList
        res.length mustEqual 2
        converter.close()

        counter.getLineCount mustEqual 5
        counter.getSuccess mustEqual 2
        counter.getFailure mustEqual 0

        val geoFac = new GeometryFactory()
        res(0).getDefaultGeometry mustEqual geoFac.createPoint(new Coordinate(46, 45))
        res(1).getDefaultGeometry mustEqual geoFac.createPoint(new Coordinate(90, 90))
      }
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
package util

import (
	"fmt"
	"reflect"
)

type (
	Getfunc func() interface{}
	// Defines an interface for Getable types
	Getable interface {
		// Should return the current value of this type
		Get() interface{}
	}
	// Defines an interface for Setable types
	Setable interface {
		// Should set the value of the current type to
		// the provided interface value.
		Set(v interface{})
	}
	// Classic observer callback
	Observer interface {
		Changed(data interface{})
	}

	// A type that is observable keeps its own list of
	// active observers which should be notified upon
	// changes being made to this type
	Observable interface {
		AddObserver(Observer)
		RemoveObserver(Observer)
		NotifyObservers(data interface{})
	}

	// BasicObservable implements the Observable interface,
	// and is suitable to use as an embedded struct.
	BasicObservable struct {
		observers []Observer
	}

	// The "poll" type deals with observed values that do
	// not satisfy the Observable interface.
	//
	// For these values we have to actively check their value
	// and compare it to a stored value to detect whether it
	// has changed or not. Aka polling.
	poll struct {
		BasicObservable
		current interface{}
		get     Getfunc
	}

	// The Observatory type deals with connecting source and
	// target values (via Connect) and manually polling for
	// source value changes if needed.
	//
	// Users will have to call the Update function as appropriate
	// for polling and comparing the non-observable source values
	// that are hooked up with the help of this Observatory.
	Observatory struct {
		pollers map[interface{}]poll
	}

	funcObserver struct {
		obs func()
	}
)

func (o funcObserver) Changed(data interface{}) {
	o.obs()
}
func (o *BasicObservable) AddObserver(obs Observer) {
	o.observers = append(o.observers, obs)
}

func (o *BasicObservable) RemoveObserver(obs Observer) {
	for i, v := range o.observers {
		if v == obs {
			copy(o.observers[i:], o.observers[i+1:])
			o.observers = o.observers[:len(o.observers)-1]
			return
		}
	}
}

func (o *BasicObservable) NotifyObservers(data interface{}) {
	for _, obs := range o.observers {
		obs.Changed(data)
	}
}

// Creates a function that returns the current value of the provided source parameter.
func (o *Observatory) CreateGetfunc(source interface{}) (get Getfunc) {
	if sg, ok := source.(Getable); ok {
		get = sg.Get
	} else if t := reflect.ValueOf(source); t.Kind() == reflect.Ptr {
		get = func() interface{} {
			return t.Elem().Interface()
		}
	} else {
		panic(fmt.Errorf("Can't deal with that non-getable source type: %s", reflect.TypeOf(source)))
	}
	return
}

// Observes a source value for changes, invoking the provided Observer upon changes.
// If the source is not satisfying the Observable interface, the source will be added
// to this Observatory's local polling list where it will use "get" and compare the
// returned value with a stored value copy.
func (o *Observatory) Observe(source interface{}, get Getfunc, obsfunc Observer) {
	obs, _ := source.(Observable)
	if obs != nil {
		obs.AddObserver(obsfunc)
		return
	}
	// add to manual poll list instead
	if o.pollers == nil {
		o.pollers = make(map[interface{}]poll)
	}
	p := o.pollers[source]
	p.current = get()
	p.get = get

	p.AddObserver(obsfunc)
	o.pollers[source] = p
}

// Connects a source value with a target value. In other words, if
// the source value changes, the target will be set to match.
func (o *Observatory) Connect(source, target interface{}) {
	set, _ := target.(Setable)

	var (
		obsfunc func()
		get     = o.CreateGetfunc(source)
	)

	if set != nil {
		obsfunc = func() {
			set.Set(get())
		}
	} else if t := reflect.ValueOf(target); t.Kind() == reflect.Ptr {
		switch t := t.Interface().(type) {
		case (*float32):
			obsfunc = func() {
				*t = float32(reflect.ValueOf(get()).Convert(reflect.TypeOf(*t)).Float())
			}
		case (*float64):
			obsfunc = func() {
				*t = float64(reflect.ValueOf(get()).Convert(reflect.TypeOf(*t)).Float())
			}
		case (*int8):
			obsfunc = func() {
				*t = int8(reflect.ValueOf(get()).Convert(reflect.TypeOf(*t)).Int())
			}
		case (*int16):
			obsfunc = func() {
				*t = int16(reflect.ValueOf(get()).Convert(reflect.TypeOf(*t)).Int())
			}
		case (*int32):
			obsfunc = func() {
				*t = int32(reflect.ValueOf(get()).Convert(reflect.TypeOf(*t)).Int())
			}
		case (*int64):
			obsfunc = func() {
				*t = int64(reflect.ValueOf(get()).Convert(reflect.TypeOf(*t)).Int())
			}
		case (*int):
			obsfunc = func() {
				*t = int(reflect.ValueOf(get()).Convert(reflect.TypeOf(*t)).Int())
			}
		case (*uint8):
			obsfunc = func() {
				*t = uint8(reflect.ValueOf(get()).Convert(reflect.TypeOf(*t)).Uint())
			}
		case (*uint16):
			obsfunc = func() {
				*t = uint16(reflect.ValueOf(get()).Convert(reflect.TypeOf(*t)).Uint())
			}
		case (*uint32):
			obsfunc = func() {
				*t = uint32(reflect.ValueOf(get()).Convert(reflect.TypeOf(*t)).Uint())
			}
		case (*uint64):
			obsfunc = func() {
				*t = uint64(reflect.ValueOf(get()).Convert(reflect.TypeOf(*t)).Uint())
			}
		case (*uint):
			obsfunc = func() {
				*t = uint(reflect.ValueOf(get()).Convert(reflect.TypeOf(*t)).Uint())
			}
		case (*bool):
			obsfunc = func() {
				*t = bool(reflect.ValueOf(get()).Convert(reflect.TypeOf(*t)).Bool())
			}
		default:
			panic(fmt.Errorf("Can't deal with that non-setable target type: %s", reflect.TypeOf(target)))
		}
	} else {
		panic(fmt.Errorf("Can't deal with that non-setable target type: %s", reflect.TypeOf(target)))
	}
	o.Observe(source, get, funcObserver{obsfunc})
}

// Checks all poll sources for changes, and invokes
// the observers as needed.
func (o *Observatory) Update() {
	redo := true
	const maxLoops = 1000
	for i := 0; i < maxLoops && redo; i++ {
		redo = false
		for k, p := range o.pollers {
			nv := p.get()
			if nv == p.current {
				continue
			}
			p.current = nv
			o.pollers[k] = p
			p.NotifyObservers(nil)
			redo = true
		}
	}
}


text:
<?php

namespace libphonenumber\Tests\Issues;

use libphonenumber\PhoneNumberType;
use libphonenumber\PhoneNumberUtil;

class Issue14Test extends \PHPUnit_Framework_TestCase
{
    /**
     * @var PhoneNumberUtil
     */
    private $phoneUtil;

    public function setUp()
    {
        PhoneNumberUtil::resetInstance();
        $this->phoneUtil = PhoneNumberUtil::getInstance();
    }

    public function testKWMobileNumber()
    {
        $number = "51440519";
        $phoneNumber = $this->phoneUtil->parse($number, "KW");

        $this->assertTrue($this->phoneUtil->isValidNumber($phoneNumber));
        $this->assertEquals(PhoneNumberType::MOBILE, $this->phoneUtil->getNumberType($phoneNumber));
    }
}

/* EOF */


text:
[![Author](http://img.shields.io/badge/author-@mhetreramesh-blue.svg?style=flat-square)](https://twitter.com/mhetreramesh)
[![Latest Version on Packagist](https://img.shields.io/packagist/v/gliterd/backblaze-b2.svg?style=flat-square)](https://packagist.org/packages/gliterd/backblaze-b2)
[![Software License][ico-license]](LICENSE.md)
[![Build Status](https://img.shields.io/travis/gliterd/backblaze-b2/master.svg?style=flat-square)](https://travis-ci.org/gliterd/backblaze-b2)
[![Coverage Status][ico-scrutinizer]][link-scrutinizer]
[![Quality Score][ico-code-quality]][link-code-quality]
[![Total Downloads](https://img.shields.io/packagist/dt/gliterd/backblaze-b2.svg?style=flat-square)](https://packagist.org/packages/gliterd/backblaze-b2)

`backblaze-b2` is the SDK for working with Backblaze's B2 storage service.

## Install

Via Composer

``` bash
$ composer require gliterd/backblaze-b2
```

## Usage

``` php
use BackblazeB2\Client;
use BackblazeB2\Bucket;

$client = new Client('accountId', 'applicationKey');
```
#### Returns a bucket details
``` php
$bucket = $client->createBucket([
    'BucketName' => 'my-special-bucket',
    'BucketType' => Bucket::TYPE_PRIVATE // or TYPE_PUBLIC
]);
```

#### Change the bucket Type
``` php
$updatedBucket = $client->updateBucket([
    'BucketId' => $bucket->getId(),
    'BucketType' => Bucket::TYPE_PUBLIC
]);
```

#### List all buckets
``` php
$buckets = $client->listBuckets();
```
#### Delete a bucket
``` php
$client->deleteBucket([
    'BucketId' => 'YOUR_BUCKET_ID'
]);
```

#### File Upload
``` php
$file = $client->upload([
    'BucketName' => 'my-special-bucket',
    'FileName' => 'path/to/upload/to',
    'Body' => 'I am the file content'

    // The file content can also be provided via a resource.
    // 'Body' => fopen('/path/to/input', 'r')
]);
```

#### File Download
``` php
$fileContent = $client->download([
    'FileId' => $file->getId()

    // Can also identify the file via bucket and path:
    // 'BucketName' => 'my-special-bucket',
    // 'FileName' => 'path/to/file'

    // Can also save directly to a location on disk. This will cause download() to not return file content.
    // 'SaveAs' => '/path/to/save/location'
]);
```

#### File Delete
``` php
$fileDelete = $client->deleteFile([
    'FileId' => $file->getId()

    // Can also identify the file via bucket and path:
    // 'BucketName' => 'my-special-bucket',
    // 'FileName' => 'path/to/file'
]);
```

#### List all files
``` php
$fileList = $client->listFiles([
    'BucketId' => 'YOUR_BUCKET_ID'
]);
```

## Change log

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

## Testing

```bash
$ vendor/bin/phpunit
```

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

## Security

If you discover any security related issues, please email mhetreramesh@gmail.com instead of using the issue tracker.

## Credits

- [All Contributors][link-contributors]

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[ico-version]: https://img.shields.io/packagist/v/gliterd/backblaze-b2.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/gliterd/backblaze-b2/master.svg?style=flat-square
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/gliterd/backblaze-b2.svg?style=flat-square
[ico-code-quality]: https://img.shields.io/scrutinizer/g/gliterd/backblaze-b2.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/gliterd/backblaze-b2.svg?style=flat-square

[link-packagist]: https://packagist.org/packages/gliterd/backblaze-b2
[link-travis]: https://travis-ci.org/gliterd/backblaze-b2
[link-scrutinizer]: https://scrutinizer-ci.com/g/gliterd/backblaze-b2/code-structure
[link-code-quality]: https://scrutinizer-ci.com/g/gliterd/backblaze-b2
[link-downloads]: https://packagist.org/packages/gliterd/backblaze-b2
[link-author]: https://github.com/gliterd
[link-contributors]: ../../contributors


text:
package cn.gsgsoft.ldtm.coodinator.transport;

/**
 *
 * @author guosg
 *
 */
public interface Router {
	public byte getAction();

	public void routing(TransportDTO dto);

}


text:
<?php
define('IN_SAESPOT', 1);
define('CURRENT_DIR', pathinfo(__FILE__, PATHINFO_DIRNAME));

include(CURRENT_DIR . '/config.php');
include(CURRENT_DIR . '/common.php');

if($cur_user){
    setcookie("cur_uid", '', $timestamp-86400 * 365, '/');
    setcookie("cur_uname", '', $timestamp-86400 * 365, '/');
    setcookie("cur_ucode", '', $timestamp-86400 * 365, '/');
    header('location: /');
}else{
    header('location: /');
}
exit;

?>


text:
<?php
# MantisBT - A PHP based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.

require_once( 'core.php' );
require_api( 'config_api.php' );
require_api( 'gpc_api.php' );
require_api( 'print_api.php' );
require_api( 'string_api.php' );

$f_return = gpc_get_string( 'return', '' );

$t_anonymous_account = config_get( 'anonymous_account' );

if( $f_return !== '' ) {
	$t_return = string_url( string_sanitize_url( $f_return ) );
	print_header_redirect( 'login.php?username=' . $t_anonymous_account . '&perm_login=false&return=' . $t_return );
} else {
	print_header_redirect( 'login.php?username=' . $t_anonymous_account . '&perm_login=false' );
}


text:
'use strict';

var Consumer = require('..');
var assert = require('assert');
var sinon = require('sinon');

describe('Consumer', function () {
  var consumer;
  var handleMessage;
  var sqs;
  var response = {
    Messages: [{
      ReceiptHandle: 'receipt-handle',
      MessageId: '123',
      Body: 'body'
    }]
  };

  beforeEach(function () {
    handleMessage = sinon.stub().yieldsAsync(null);
    sqs = sinon.mock();
    sqs.receiveMessage = sinon.stub().yieldsAsync(null, response);
    sqs.receiveMessage.onSecondCall().returns();
    sqs.deleteMessage = sinon.stub().yieldsAsync(null);
    consumer = new Consumer({
      queueUrl: 'some-queue-url',
      region: 'some-region',
      handleMessage: handleMessage,
      sqs: sqs,
      authenticationErrorTimeout: 20
    });
  });

  it('requires a queueUrl to be set', function () {
    assert.throws(function () {
      new Consumer({
        region: 'some-region',
        handleMessage: handleMessage
      });
    });
  });

  it('requires a handleMessage function to be set', function () {
    assert.throws(function () {
      new Consumer({
        region: 'some-region',
        queueUrl: 'some-queue-url'
      });
    });
  });

  it('requires the batchSize option to be no greater than 10', function () {
    assert.throws(function () {
      new Consumer({
        region: 'some-region',
        queueUrl: 'some-queue-url',
        handleMessage: handleMessage,
        batchSize: 11
      });
    });
  });

  it('requires the batchSize option to be greater than 0', function () {
    assert.throws(function () {
      new Consumer({
        region: 'some-region',
        queueUrl: 'some-queue-url',
        handleMessage: handleMessage,
        batchSize: -1
      });
    });
  });

  describe('.create', function () {
    it('creates a new instance of a Consumer object', function () {
      var consumer = Consumer.create({
        region: 'some-region',
        queueUrl: 'some-queue-url',
        batchSize: 1,
        visibilityTimeout: 10,
        waitTimeSeconds: 10,
        handleMessage: handleMessage
      });

      assert(consumer instanceof Consumer);
    });
  });

  describe('.start', function () {
    it('fires an error event when an error occurs receiving a message', function (done) {
      var receiveErr = new Error('Receive error');

      sqs.receiveMessage.yields(receiveErr);

      consumer.on('error', function (err) {
        assert.ok(err);
        assert.equal(err.message, 'SQS receive message failed: Receive error');
        done();
      });

      consumer.start();
    });

    it('fires an error event when an error occurs deleting a message', function (done) {
      var deleteErr = new Error('Delete error');

      handleMessage.yields(null);
      sqs.deleteMessage.yields(deleteErr);

      consumer.on('error', function (err) {
        assert.ok(err);
        assert.equal(err.message, 'SQS delete message failed: Delete error');
        done();
      });

      consumer.start();
    });

    it('fires an error event when an error occurs processing a message', function (done) {
      var processingErr = new Error('Processing error');

      handleMessage.yields(processingErr);

      consumer.on('processing_error', function (err) {
        assert.equal(err, processingErr);
        done();
      });

      consumer.start();
    });

    it('waits before repolling when a credentials error occurs', function (done) {
      var credentialsErr = {
        code: 'CredentialsError',
        message: 'Missing credentials in config'
      };

      sqs.receiveMessage.yields(credentialsErr);

      consumer.on('error', function () {
        setTimeout(function () {
          sinon.assert.calledOnce(sqs.receiveMessage);
        }, 10);
        setTimeout(function () {
          sinon.assert.calledTwice(sqs.receiveMessage);
          done();
        }, 30);
      });

      consumer.start();
    });

    it('waits before repolling when a 403 error occurs', function (done) {
      var invalidSignatureErr = {
        statusCode: 403,
        message: 'The security token included in the request is invalid'
      };

      sqs.receiveMessage.yields(invalidSignatureErr);

      consumer.on('error', function () {
        setTimeout(function () {
          sinon.assert.calledOnce(sqs.receiveMessage);
        }, 10);
        setTimeout(function () {
          sinon.assert.calledTwice(sqs.receiveMessage);
          done();
        }, 30);
      });

      consumer.start();
    });

    it('fires a message_received event when a message is received', function (done) {
      consumer.on('message_received', function (message) {
        assert.equal(message, response.Messages[0]);
        done();
      });

      consumer.start();
    });

    it('fires a message_processed event when a message is successfully deleted', function (done) {
      handleMessage.yields(null);

      consumer.on('message_processed', function (message) {
        assert.equal(message, response.Messages[0]);
        done();
      });

      consumer.start();
    });

    it('calls the handleMessage function when a message is received', function (done) {
      consumer.start();

      consumer.on('message_processed', function () {
        sinon.assert.calledWith(handleMessage, response.Messages[0]);
        done();
      });
    });

    it('deletes the message when the handleMessage callback is called', function (done) {
      handleMessage.yields(null);

      consumer.start();

      consumer.on('message_processed', function () {
        sinon.assert.calledWith(sqs.deleteMessage, {
          QueueUrl: 'some-queue-url',
          ReceiptHandle: 'receipt-handle'
        });
        done();
      });
    });

    it('doesn\'t delete the message when a processing error is reported', function () {
      handleMessage.yields(new Error('Processing error'));

      consumer.on('processing_error', function () {
        // ignore the error
      });

      consumer.start();

      sinon.assert.notCalled(sqs.deleteMessage);
    });

    it('consumes another message once one is processed', function (done) {
      sqs.receiveMessage.onSecondCall().yields(null, response);
      sqs.receiveMessage.onThirdCall().returns();

      consumer.start();
      setTimeout(function () {
        sinon.assert.calledTwice(handleMessage);
        done();
      }, 10);
    });

    it('doesn\'t consume more messages when called multiple times', function () {
      sqs.receiveMessage = sinon.stub().returns();
      consumer.start();
      consumer.start();
      consumer.start();
      consumer.start();
      consumer.start();

      sinon.assert.calledOnce(sqs.receiveMessage);
    });

    it('consumes multiple messages when the batchSize is greater than 1', function (done) {
      sqs.receiveMessage.yieldsAsync(null, {
        Messages: [
          {
            ReceiptHandle: 'receipt-handle-1',
            MessageId: '1',
            Body: 'body-1'
          },
          {
            ReceiptHandle: 'receipt-handle-2',
            MessageId: '2',
            Body: 'body-2'
          },
          {
            ReceiptHandle: 'receipt-handle-3',
            MessageId: '3',
            Body: 'body-3'
          }
        ]
      });

      consumer = new Consumer({
        queueUrl: 'some-queue-url',
        messageAttributeNames: ['attribute-1', 'attribute-2'],
        region: 'some-region',
        handleMessage: handleMessage,
        batchSize: 3,
        sqs: sqs
      });

      consumer.start();

      setTimeout(function () {
        sinon.assert.calledWith(sqs.receiveMessage, {
          QueueUrl: 'some-queue-url',
          AttributeNames: [],
          MessageAttributeNames: ['attribute-1', 'attribute-2'],
          MaxNumberOfMessages: 3,
          WaitTimeSeconds: 20,
          VisibilityTimeout: undefined
        });
        sinon.assert.callCount(handleMessage, 3);
        done();
      }, 10);
    });

    it('consumes messages with message attibute \'ApproximateReceiveCount\'', function (done) {

      var messageWithAttr = {
        ReceiptHandle: 'receipt-handle-1',
        MessageId: '1',
        Body: 'body-1',
        Attributes: {
          ApproximateReceiveCount: 1
        }
      };

      sqs.receiveMessage.yieldsAsync(null, {
        Messages: [messageWithAttr]
      });

      consumer = new Consumer({
        queueUrl: 'some-queue-url',
        attributeNames: ['ApproximateReceiveCount'],
        region: 'some-region',
        handleMessage: handleMessage,
        sqs: sqs
      });

      consumer.on('message_received', function (message) {
        sinon.assert.calledWith(sqs.receiveMessage, {
          QueueUrl: 'some-queue-url',
          AttributeNames: ['ApproximateReceiveCount'],
          MessageAttributeNames: [],
          MaxNumberOfMessages: 1,
          WaitTimeSeconds: 20,
          VisibilityTimeout: undefined
        });
        assert.equal(message, messageWithAttr);
        done();
      });

      consumer.start();
    });
  });

  describe('.stop', function () {
    it('stops the consumer polling for messages', function (done) {
      sqs.receiveMessage.onSecondCall().yieldsAsync(null, response);
      sqs.receiveMessage.onThirdCall().returns();

      consumer.start();
      consumer.stop();

      setTimeout(function () {
        sinon.assert.calledOnce(handleMessage);
        done();
      }, 10);
    });
  });
});


text:
Parking Messages v1.0.5

 CarInfo: {{currentUser.first_name}} / {{currentUser.no}}
    {{currentUser.make}}    {{currentUser.model}}    {{currentUser.year}}   {{currentUser.plate}}
    {{currentUser.state}}
    {{currentUser.color}}
    {{currentUser.bodytype}}

Register to post a message!

        <form role="form" ng-submit="createMessage(newMessage)">

                Your Message
                <input type="text" ng-model="newMessage.title" class="form-control" id="messageTitle"
                       ng-disabled="!currentUser">

                Date/Time

                            <input type="text" class="form-control" datepicker-popup="EEE MM/dd/yyyy"
                                   ng-model="newMessage.cardate" is-open="opened" min="minDate" max="'2015-06-22'"
                                   datepicker-options="dateOptions" date-disabled="disabled(date, mode)"
                                   ng-required="true" close-text="Close"/>
                            <button class="btn btn-default" ng-click="open($event)"></button>

                            <timepicker hour-step="hstep" minute-step="mstep" show-meridian="ismeridian"></timepicker>

                    <button class="btn btn-sm btn-info" ng-click="today()">Today</button>
                    <button class="btn btn-sm btn-danger" ng-click="clear()">Clear</button>

                        Hours step is:
                        <select class="form-control" ng-model="hstep"
                                ng-options="opt for opt in options.hstep"></select>

                        Minutes step:
                        <select class="form-control" ng-model="mstep"
                                ng-options="opt for opt in options.mstep"></select>

            <button type="submit" class="btn btn-primary" ng-disabled="!currentUser || !newMessage.title">Submit
            </button>
        </form>

                        {{ group.value }}

{{ message.diff}}

                   = 12,'minus': message.diff <= 12 }">{{ message.diff}}

                    {{ message.title}}

                    {{message.cardate |  date : format }}

                    {{message.cartime | date:'shortTime' }}

                {{message.user.username  }}/ {{message.user.no}}/ {{message.user.color}}/ {{message.user.model}}

                    {{message.status  }} {{stats[message.status].name}}

                    <button type="button" class="btn btn-primary btn-xs" ng-click="fetchMessage(message)"
                            ng-show="currentUser.role ==='4'"></button>

                    <button type="button" class="btn btn-success btn-xs" ng-click="fetchedMessage(message)"
                            ng-show="currentUser.role ==='4'"></button>

                    <button type="button" class="btn btn-danger btn-xs" ng-click="destroyMessage(message)"
                            ng-show="currentUser.role ==='4' || currentUser.id === message.user.id"></button>


text:
var GameObject = require('../../gameobjects/GameObject');

/**
 * Renders this Game Object with the Canvas Renderer to the given Camera.
 * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera.
 * This method should not be called directly. It is a utility function of the Render module.
 *
 * @method Phaser.Tilemaps.DynamicTilemapLayer#renderCanvas
 * @since 3.0.0
 * @private
 *
 * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer.
 * @param {Phaser.Tilemaps.DynamicTilemapLayer} src - The Game Object being rendered in this call.
 * @param {number} interpolationPercentage - Reserved for future use and custom pipelines.
 * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object.
 */
var DynamicTilemapLayerCanvasRenderer = function (renderer, src, interpolationPercentage, camera)
{
    if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
    {
        return;
    }

    src.cull(camera);

    var renderTiles = src.culledTiles;
    var length = renderTiles.length;
    var image = src.tileset.image.getSourceImage();
    var tileset = this.tileset;

    var tx = src.x - camera.scrollX * src.scrollFactorX;
    var ty = src.y - camera.scrollY * src.scrollFactorY;
    var ctx = renderer.gameContext;

    ctx.save();
    ctx.translate(tx, ty);
    ctx.rotate(src.rotation);
    ctx.scale(src.scaleX, src.scaleY);
    ctx.scale(src.flipX ? -1 : 1, src.flipY ? -1 : 1);

    for (var index = 0; index < length; ++index)
    {
        var tile = renderTiles[index];

        var tileTexCoords = tileset.getTileTextureCoordinates(tile.index);
        if (tileTexCoords === null) { continue; }

        var halfWidth = tile.width / 2;
        var halfHeight = tile.height / 2;

        ctx.save();
        ctx.translate(tile.pixelX + halfWidth, tile.pixelY + halfHeight);

        if (tile.rotation !== 0)
        {
            ctx.rotate(tile.rotation);
        }

        if (tile.flipX || tile.flipY)
        {
            ctx.scale(tile.flipX ? -1 : 1, tile.flipY ? -1 : 1);
        }

        ctx.globalAlpha = camera.alpha * src.alpha * tile.alpha;

        ctx.drawImage(
            image,
            tileTexCoords.x, tileTexCoords.y,
            tile.width, tile.height,
            -halfWidth, -halfHeight,
            tile.width, tile.height
        );

        ctx.restore();
    }

    ctx.restore();
};

module.exports = DynamicTilemapLayerCanvasRenderer;


text:
<?php namespace CodeIgniter\Exceptions;

/**
 * Error: Action must be taken immediately (system/db down, etc)
 */

class AlertError extends \Error
{

}


text:
require File.join(File.dirname(__FILE__), '/spec_helper')

module CleanFiles
  describe Cleaner do

    it 'find files older than threshold' do
      cleaner = Cleaner.new('/path', :threshold => 5.days.ago)
      expect(cleaner).to receive(:files).and_return(mock_files(7.days.ago, 4.days.ago))
      expect(cleaner.files_before_threshold).to eq(mock_files(7.days.ago))
    end

    it 'deletes files' do
       cleaner = Cleaner.new('/path')
       files = mock_files(3.days.ago, 2.days.ago, 7.days.ago)
       expect(cleaner).to receive(:files_to_delete).and_return(files)
       expect(FileUtils).to receive(:rm_rf).with(files.map(&:path), :noop => false)
       cleaner.start
    end

    it 'does not delete any files if specifying pretend => true' do
       cleaner = Cleaner.new('/path', :pretend => true)
       files = mock_files(3.days.ago, 2.days.ago, 7.days.ago)
       expect(cleaner).to receive(:files_to_delete).and_return(files)
       expect(FileUtils).to receive(:rm_rf).with(files.map(&:path), :noop => true)
       cleaner.start
    end

    it 'has has files to delete' do
      cleaner = Cleaner.new('/path')
      expect(cleaner).to receive(:files_before_threshold).and_return(mock_files('12:00', '13:00'))
      expect(cleaner).to receive(:files_to_preserve).and_return(mock_files('13:00'))
      expect(cleaner.files_to_delete).to eq(mock_files('12:00'))
    end

    it 'prints name of file to be deleted if specifying verbose => true' do
       cleaner = Cleaner.new('/path', :verbose => true)
       files = mock_files('00:50', '13:30')
       expect(cleaner).to receive(:files_to_delete).and_return(files)
       expect(FileUtils).to receive(:rm_rf).with(files.map(&:path), :noop => false)
       expect(cleaner).to receive(:puts).with("01 May 00:50\n01 May 13:30")
       cleaner.start
    end

    it 'preserves the first file of the hour' do
      should_preserve(:hourly,
        '12:05' => true,
        '12:10' => false,
        '13:15' => true,
        '13:16' => false)
    end

    it 'preserves the first file of the day' do
      should_preserve(:daily,
        '01 10:00' => true,
        '01 12:00' => false,
        '02 00:00' => true,
        '02 00:01' => false)
    end

    it 'preserves the first file of the week' do
      should_preserve(:weekly,
        'Sun Jan 02 03:40 00' => true,
        'Tue Jan 04 03:40 00' => true,
        'Wed Jan 05 03:40 00' => false)
    end

    it 'preserves the first file of the month' do
      should_preserve(:monthly,
        'Sun Jan 02 12:00 00' => true,
        'Tue Feb 01 12:00 00' => true,
        'Wed Feb 02 12:00 00' => false)
    end

    it 'preserves the first file of the year' do
      should_preserve(:yearly,
        'Sun Jan 02 03:40 01' => true,
        'Tue Jan 04 03:40 02' => true,
        'Wed Jan 05 03:40 02' => false)
    end

    MockFile = Struct.new(:ctime) do
      def ==(other)
        (ctime.to_i - other.ctime.to_i) < 2
      end

      def inspect
        ctime.to_s(:short)
      end

      def stat
        stat = Object.new
        def stat.file?
          true
        end
        stat
      end

      alias path inspect
    end

    def mock_files(*ctimes)
      ctimes.map do |ctime|
        if ctime.is_a?(String)
          ctime = "1 May #{ctime}" unless ctime =~ /\d\d /
          ctime = "May #{ctime} 2009" unless ctime =~  /\d{2}/
          ctime = Time.parse(ctime)
        end
        MockFile.new(ctime)
      end
    end

    def should_preserve(interval, files)
      cleaner = Cleaner.new('/path', interval => true)
      expect(cleaner).to receive(:files_before_threshold).and_return(mock_files(*files.keys.sort))
      expected_files = files.select{|_, select| select == true}.map{|file, _| file}
      expect(cleaner.files_to_preserve.to_set).to eq(mock_files(*expected_files).to_set)
    end
  end
end


text:
layout: page
title: Robert Booker's 76th Birthday
date: 2016-05-24
author: Susan Garrett
tags: weekly links, java
status: published
summary: Vivamus mattis nulla quis velit semper suscipit. Cras lobortis.
banner: images/banner/meeting-01.jpg
booking:
  startDate: 03/30/2017
  endDate: 04/03/2017
  ctyhocn: MGMACHX
  groupCode: RB7B
published: true
---
Curabitur bibendum felis sit amet risus vehicula cursus. Proin gravida dolor sed mattis lacinia. Donec erat purus, scelerisque et sodales non, eleifend hendrerit dolor. Praesent fermentum lectus id erat rutrum condimentum. Maecenas placerat, justo eu ultrices imperdiet, metus nunc lacinia nibh, nec euismod felis libero eget ipsum. Praesent pharetra enim vel felis efficitur, eu tempus sem cursus. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

1 Nullam ac massa semper, ullamcorper mauris ac, consectetur ligula
1 Cras finibus lacus laoreet eleifend finibus.

Nulla facilisi. Curabitur pulvinar sapien vel sem viverra euismod. Vivamus finibus mauris dolor, et feugiat libero rhoncus quis. Cras venenatis mi ut dignissim hendrerit. Mauris ut justo lacus. Ut vulputate efficitur turpis ut eleifend. Mauris gravida nulla magna, sed vehicula dolor pulvinar non. Integer non viverra quam. Mauris feugiat, nisl ac iaculis suscipit, libero nulla gravida lacus, id euismod arcu felis eget enim.


text:
package com.vico.license.dao.test;

import com.vico.license.dao.UserDao;
import com.vico.license.pojo.User;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

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

@RunWith(SpringJUnit4ClassRunner.class) // = extends SpringJUnit4ClassRunner
@ContextConfiguration(locations = {"classpath:spring-mybatis.xml"})
public class UserDaoTest {

    private static final Logger LOGGER = LoggerFactory.getLogger(UserDaoTest.class);
    @Autowired
    UserDao uDao;

    @Test
    public void testGetTotal() {
        System.out.println("获取到的总数是" + uDao.getTotal());
    }

    @Test
    public void testgetUserByPage() {
        int i = 1;
        List<User> list = new ArrayList<User>();
        list = uDao.getUserByPage(8, 5);
        for (User user : list) {
            System.out.println("jieguo:  " + user.getUsername() + "  " + i++);
        }
    }

    //@Test
    public void testModifyUser() {
        int i = 1;
        User user = new User();
        user.setUserID(2);
        user.setUsername("tstette");
        user.setPassword("12321321");
        i = uDao.modifyUserByID(user);
        System.out.println(">>>>>>>>>" + i);
    }
}


text:
namespace cc {
class Layer;
}

namespace blimp {

// A test class that drives changes to a layer every 16ms.  This can be used to
// make sure the compositor is rendering layers properly.  In this case, colors
// are constantly changed over time.
class DummyLayerDriver {
 public:
  DummyLayerDriver();
  virtual ~DummyLayerDriver();

  // Adds a cc::SolidColorLayer to |layer| and animates it's color until the
  // layer is detached from it's cc::LayerTreeHost.
  void SetParentLayer(scoped_refptr<cc::Layer> layer);

 private:
  void StepAnimation();

  scoped_refptr<cc::Layer> layer_;
  bool animation_running_;

  base::WeakPtrFactory<DummyLayerDriver> weak_factory_;

  DISALLOW_COPY_AND_ASSIGN(DummyLayerDriver);
};

}  // namespace blimp

#endif  // BLIMP_CLIENT_COMPOSITOR_TEST_DUMMY_LAYER_DRIVER_H_