text:
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using IKende.com.core;
namespace Peanut.Mappings
{
    class DObjectToBObject
    {
        public DObjectToBObject(Type dtype, Type btype)
        {
            foreach (PropertyInfo pi in dtype.GetProperties(BindingFlags.Public | BindingFlags.Instance))
            {
                PropertyInfo bpi = btype.GetProperty(pi.Name, BindingFlags.Public | BindingFlags.Instance);
                if (bpi != null && bpi.PropertyType == pi.PropertyType)
                {
                    DTBProperty dtbp = new DTBProperty();
                    dtbp.DProperty = new PropertyHandler(pi);
                    dtbp.BProperty = new PropertyHandler(bpi);
                    Properties.Add(dtbp);
                }
            }
        }
        private List<DTBProperty> Properties = new List<DTBProperty>();
        public void Cast(object dobj, object bobj)
        {
            for (int i = 0; i < Properties.Count; i++)
            {
                DTBProperty dtb = Properties[i];
                dtb.BProperty.Set(bobj, dtb.DProperty.Get(dobj));
            }
        }
        class DTBProperty
        {
            public PropertyHandler DProperty;
            public PropertyHandler BProperty;
        }
    }
}


text:
const proxyquire = require('proxyquire')

const investmentData = { investor_company: { name: 'company' } }
const paths = require('../../paths')

describe('investment uk company', () => {
  beforeEach(() => {
    this.updateInvestmentStub = sinon.stub().resolves(investmentData)
    this.searchStub = sinon.stub().resolves()
    this.transformerStub = sinon.stub()

    this.controller = proxyquire('../ukcompany', {
      '../../../modules/search/services': {
        searchCompanies: this.searchStub,
      },
      '../repos': {
        updateInvestment: this.updateInvestmentStub,
      },
      '../../../modules/search/transformers': {
        transformApiResponseToSearchCollection: this.transformerStub,
      },
    })

    this.req = {
      params: {
        investmentId: '1',
      },
      query: {},
      session: {
        token: 'abcd',
      },
      flash: sinon.spy(),
    }
    this.res = {
      locals: {
        paths,
        investment: {
          name: 'investment',
        },
      },
      render: sinon.spy(),
      breadcrumb: sinon.stub().returnsThis(),
      redirect: sinon.spy(),
    }
    this.next = sinon.spy()
  })

  describe('#selectUKCompany', () => {
    context('when a uk company is selected', () => {
      context('server has no errors', () => {
        beforeEach(async () => {
          this.req.query.company = '1234'

          await this.controller.selectUKCompany(this.req, this.res, this.next)
        })

        it('should save the change to the investment project', () => {
          expect(this.updateInvestmentStub).to.be.calledWith(this.req, '1', {
            uk_company: '1234',
          })
        })

        it('should set a flash message to say it updated', () => {
          expect(this.req.flash).to.be.calledWith(
            'success',
            'Investment details updated'
          )
        })

        it('should redirect the user back to the investment details page.', () => {
          expect(this.res.redirect).to.be.calledWith(
            '/investments/projects/1/details'
          )
        })
      })

      context('server returns an error', () => {
        beforeEach(async () => {
          this.req.query.company = '1234'
          this.error = sinon.stub()

          this.updateInvestmentStub.rejects(this.error)

          await this.controller.selectUKCompany(this.req, this.res, this.next)
        })

        it('should call next with the error', () => {
          expect(this.next).to.be.calledWith(this.error)
        })

        it('should not redirect the user', () => {
          expect(this.res.redirect).to.not.be.called
        })
      })
    })

    context('when a uk company is not selected', () => {
      beforeEach(async () => {
        await this.controller.selectUKCompany(this.req, this.res, this.next)
      })

      it('should not save anything', () => {
        expect(this.updateInvestmentStub).to.not.be.called
      })

      it('should not redirect the user', () => {
        expect(this.res.redirect).to.not.be.called
      })

      it('should just call next', () => {
        expect(this.next).to.be.calledWith()
      })
    })
  })

  describe('#searchForUKCompany', () => {
    context('when a search term is provided', () => {
      beforeEach(async () => {
        this.req.query.term = 'test'
        await this.controller.searchForUKCompany(this.req, this.res, this.next)
      })

      it('should call search', () => {
        expect(this.searchStub).to.be.called
      })

      it('should search for the term provided', () => {
        const searchParams = this.searchStub.firstCall.args[0]
        expect(searchParams.searchTerm).to.equal('test')
      })

      it('should search for a uk company', () => {
        const searchParams = this.searchStub.firstCall.args[0]
        expect(searchParams.isUkBased).to.equal(true)
      })
    })

    context('when a different page is requested', () => {
      beforeEach(async () => {
        this.req.query.term = 'test'
        this.req.query.page = '2'
        await this.controller.searchForUKCompany(this.req, this.res, this.next)
      })

      it('should search the requested page', () => {
        const searchParams = this.searchStub.firstCall.args[0]
        expect(searchParams.page).to.equal('2')
      })
    })

    context('when search returns results', () => {
      beforeEach(async () => {
        this.req.query.term = 'test'
        await this.controller.searchForUKCompany(this.req, this.res, this.next)
      })

      it('should transform the result', () => {
        expect(this.transformerStub).to.be.calledOnce
      })

      it('should pass the result onto the next controller', () => {
        expect(this.res.locals).to.have.property('results')
      })
    })

    context('when search causes an error', () => {
      beforeEach(async () => {
        this.req.query.term = 'test'
        this.error = sinon.stub()
        this.searchStub.rejects(this.error)
        await this.controller.searchForUKCompany(this.req, this.res, this.next)
      })

      it('should pass the error to next', () => {
        expect(this.next).to.be.calledWith(this.error)
      })
    })

    context('when no search term is provided', () => {
      beforeEach(async () => {
        await this.controller.searchForUKCompany(this.req, this.res, this.next)
      })

      it('should not call search', () => {
        expect(this.searchStub).to.not.be.called
      })

      it('should call next', () => {
        expect(this.next).to.be.calledWith()
      })
    })
  })

  describe('#renderCompanyResults', () => {
    beforeEach(() => {
      this.controller.renderCompanyResults(this.req, this.res, this.next)
    })

    it('should render the correct template', () => {
      expect(this.res.render).to.be.calledWith('investments/views/ukcompany')
    })
  })

  describe('#removeUKCompany', () => {
    context('when there is an id', () => {
      beforeEach(async () => {
        await this.controller.removeUKCompany(this.req, this.res, this.next)
      })

      it('should update the investment record', () => {
        expect(this.updateInvestmentStub).to.be.calledWith(this.req, '1', {
          uk_company: null,
        })
      })

      it('should redirect back to the details page', () => {
        expect(this.res.redirect).to.be.calledWith(
          '/investments/projects/1/details'
        )
      })
    })

    context(
      'when there is an error removing the company from the investment',
      () => {
        beforeEach(async () => {
          this.error = sinon.stub()

          this.updateInvestmentStub.rejects(this.error)
          await this.controller.removeUKCompany(this.req, this.res, this.next)
        })

        it('should call next with the error', () => {
          expect(this.next).to.be.calledWith(this.error)
        })

        it('should not redirect the user', () => {
          expect(this.res.redirect).to.not.be.called
        })
      }
    )
  })
})

redpajama_set_name: RedPajamaGithub


text:
#include <Uefi.h>
#include "ShowAcpiCommand.h"
#include <Debug.h>
#include <Types.h>
#include <Utility.h>
#include <NvmInterface.h>
#include <NvmTables.h>
#include "Common.h"
#include "NvmDimmCli.h"
#include <Library/HiiLib.h>
#include <ShowAcpi.h>

 /*
     *  PRINT LIST ATTRIBUTES (2 levels: Target-->Type)
     *  ---NVDIMM Firmware Interface Table---
     *     ---TableType=0X0
     *        Length: 56 bytes
     *        TypeEquals: SpaRange
     *        ...
     */
PRINTER_LIST_ATTRIB ShowAcpiListAttributes =
{
 {
    {
      ACPI_MODE_STR,                                                              //GROUP LEVEL TYPE
      L"---$(" SYSTEM_TARGET_STR L")---",                                         //NULL or GROUP LEVEL HEADER
      SHOW_LIST_IDENT FORMAT_STR L": " FORMAT_STR,                                //NULL or KEY VAL FORMAT STR
      SYSTEM_TARGET_STR                                                           //NULL or IGNORE KEY LIST (K1;K2)
    },
    {
      ACPITYPE_MODE_STR,                                                          //GROUP LEVEL TYPE
      SHOW_LIST_IDENT L"---" ACPI_TYPE_STR L"=$(" ACPI_TYPE_STR L")",             //NULL or GROUP LEVEL HEADER
      SHOW_LIST_IDENT SHOW_LIST_IDENT FORMAT_STR L": " FORMAT_STR,                //NULL or KEY VAL FORMAT STR
      ACPI_TYPE_STR                                                               //NULL or IGNORE KEY LIST (K1;K2)
    }
  }
};

PRINTER_DATA_SET_ATTRIBS ShowAcpiDataSetAttribs =
{
  &ShowAcpiListAttributes,
  NULL
};

/* Command syntax definition */
struct Command showAcpiCommand =
{
  SHOW_VERB,                                                           //!< verb
  {                                                                    //!< options
    {VERBOSE_OPTION_SHORT, VERBOSE_OPTION, L"", L"", HELP_VERBOSE_DETAILS_TEXT,FALSE, ValueEmpty},
    {L"", PROTOCOL_OPTION_DDRT, L"", L"",HELP_DDRT_DETAILS_TEXT, FALSE, ValueEmpty},
    {L"", PROTOCOL_OPTION_SMBUS, L"", L"",HELP_SMBUS_DETAILS_TEXT, FALSE, ValueEmpty},
#ifdef OS_BUILD
    { OUTPUT_OPTION_SHORT, OUTPUT_OPTION, L"", OUTPUT_OPTION_HELP,HELP_OPTIONS_DETAILS_TEXT, FALSE, ValueRequired }
#else
    {L"", L"", L"", L"",L"", FALSE, ValueOptional}
#endif
  },                        //!< options
  {{SYSTEM_TARGET, L"", SYSTEM_ACPI_TARGETS, TRUE, ValueOptional}},    //!< targets
  {{L"", L"", L"", FALSE, ValueOptional}},                             //!< properties
  L"Show the ACPI tables related to the " PMEM_MODULES_STR L" in the system.",        //!< help
  showAcpi,                                                            //!< run function
  TRUE                                                                 //!< enable print control support
};

/*
 * Register the show acpi command
 */
EFI_STATUS RegisterShowAcpiCommand() {
  EFI_STATUS rc = EFI_SUCCESS;
  NVDIMM_ENTRY();

  rc = RegisterCommand(&showAcpiCommand);

  NVDIMM_EXIT_I64(rc);
  return rc;
}

/**
  PrintInvalidAcpiRevisionString - Prints the invalid ACPI revision string

  @param[in] Revision ACPI Table Revision
  @param[in] AcpiTableType ACPI Table (NFIT/PCAT/PMTT)
  @param[in] DisplayAsMajorMinor flag to indicate if Revision needs to be printed as Major & Minor
  @param[in] pPrinterCtx pointer to command's printer context
**/
VOID
PrintInvalidAcpiRevisionString(
  IN     ACPI_REVISION Revision,
  IN     AcpiType AcpiTableType,
  IN     BOOLEAN DisplayAsMajorMinor,
  IN     PRINT_CONTEXT *pPrinterCtx
)
{
  CHAR16 *pInvalidAcpiRevisionMessage = NULL;
  CHAR16 *pAcpiTableTypeString = NULL;

  if (pPrinterCtx == NULL) {
    return;
  }

  switch (AcpiTableType) {
  case AcpiNfit:
    pAcpiTableTypeString = HiiGetString(gNvmDimmCliHiiHandle, STRING_TOKEN(STR_ACPI_STATUS_NFIT), NULL);
    break;
  case AcpiPcat:
    pAcpiTableTypeString = HiiGetString(gNvmDimmCliHiiHandle, STRING_TOKEN(STR_ACPI_STATUS_PCAT), NULL);
    break;
  case AcpiPMTT:
    pAcpiTableTypeString = HiiGetString(gNvmDimmCliHiiHandle, STRING_TOKEN(STR_ACPI_STATUS_PMTT), NULL);
    break;
  default:
    pAcpiTableTypeString = HiiGetString(gNvmDimmCliHiiHandle, STRING_TOKEN(STR_ACPI_STATUS_UNKNOWN_TABLE), NULL);
    break;
  }

  if (DisplayAsMajorMinor) {
    pInvalidAcpiRevisionMessage = HiiGetString(gNvmDimmCliHiiHandle, STRING_TOKEN(STR_ACPI_STATUS_ERR_INVALID_MAJOR_MINOR_REVISION), NULL);
    pInvalidAcpiRevisionMessage = CatSPrintClean(NULL, pInvalidAcpiRevisionMessage, pAcpiTableTypeString, Revision.Split.Major, Revision.Split.Minor);
  }
  else {
    pInvalidAcpiRevisionMessage = HiiGetString(gNvmDimmCliHiiHandle, STRING_TOKEN(STR_ACPI_STATUS_ERR_INVALID_REVISION), NULL);
    pInvalidAcpiRevisionMessage = CatSPrintClean(NULL, pInvalidAcpiRevisionMessage, pAcpiTableTypeString, Revision.AsUint8);
  }

  PRINTER_SET_MSG(pPrinterCtx, EFI_INVALID_PARAMETER, FORMAT_STR, pInvalidAcpiRevisionMessage);

  FREE_POOL_SAFE(pInvalidAcpiRevisionMessage);
  FREE_POOL_SAFE(pAcpiTableTypeString);
}

/*
 * Execute the show acpi command
 */
EFI_STATUS showAcpi(struct Command *pCmd) {
  EFI_STATUS ReturnCode = EFI_SUCCESS;
  EFI_DCPMM_CONFIG2_PROTOCOL *pNvmDimmConfigProtocol = NULL;
  ParsedFitHeader *pNFit = NULL;
  ParsedPcatHeader *pPcat = NULL;
  TABLE_HEADER *pPMTT = NULL;
  CHAR16 *pSystemTargetValue = NULL;
  CHAR16 **ppStringElements = NULL;
  UINT32 ElementsCount = 0;
  UINT8 ChosenAcpiSystem = AcpiUnknown;
  UINT16 Index = 0;
  PRINT_CONTEXT *pPrinterCtx = NULL;

  NVDIMM_ENTRY();

  if (pCmd == NULL) {
    ReturnCode = EFI_INVALID_PARAMETER;
    PRINTER_SET_MSG(pPrinterCtx, ReturnCode, CLI_ERR_NO_COMMAND);
    goto Finish;
  }

  pPrinterCtx = pCmd->pPrintCtx;

  ReturnCode = OpenNvmDimmProtocol(gNvmDimmConfigProtocolGuid, (VOID **)&pNvmDimmConfigProtocol, NULL);
  if (EFI_ERROR(ReturnCode)) {
    PRINTER_SET_MSG(pPrinterCtx, ReturnCode, CLI_ERR_OPENING_CONFIG_PROTOCOL);
    ReturnCode = EFI_NOT_FOUND;
    goto Finish;
  }

  if (!ContainTarget(pCmd, SYSTEM_TARGET)) {
    ReturnCode = EFI_INVALID_PARAMETER;
    goto Finish;
  }

  pSystemTargetValue = GetTargetValue(pCmd, SYSTEM_TARGET);

  ppStringElements = StrSplit(pSystemTargetValue, L',', &ElementsCount);
  if (ppStringElements != NULL) {
    for (Index = 0; Index < ElementsCount; ++Index) {
      if (StrICmp(ppStringElements[Index], NFIT_TARGET_VALUE) == 0) {
        ChosenAcpiSystem |= AcpiNfit;
      } else if (StrICmp(ppStringElements[Index], PCAT_TARGET_VALUE) == 0) {
        ChosenAcpiSystem |= AcpiPcat;
      } else if (StrICmp(ppStringElements[Index], PMTT_TARGET_VALUE) == 0) {
        ChosenAcpiSystem |= AcpiPMTT;
      } else {
        PRINTER_SET_MSG(pPrinterCtx, ReturnCode, L"The provided system ACPI Table: " FORMAT_STR L" is not valid\n", pSystemTargetValue);
        ReturnCode = EFI_INVALID_PARAMETER;
        goto Finish;
      }
    }
  } else {
    /* If no target value is mentioned, then print all */
    ChosenAcpiSystem = AcpiAll;
  }

  if (ChosenAcpiSystem == AcpiAll || ChosenAcpiSystem == AcpiNfit) {
    ReturnCode = pNvmDimmConfigProtocol->GetAcpiNFit(pNvmDimmConfigProtocol, &pNFit);
    if (EFI_ERROR(ReturnCode) || pNFit == NULL) {
      PRINTER_SET_MSG(pPrinterCtx, ReturnCode, L"Error: Failed to find the NVDIMM Firmware Interface ACPI tables\n");
      ReturnCode = EFI_ABORTED;
    } else if (IS_NFIT_REVISION_INVALID(pNFit->pFit->Header.Revision)) {
      PrintInvalidAcpiRevisionString(pNFit->pFit->Header.Revision, AcpiNfit, FALSE, pCmd->pPrintCtx);
      ReturnCode = EFI_UNSUPPORTED;
    } else {
      PrintNFit(pNFit, pPrinterCtx);
    }
  }

  if (ChosenAcpiSystem == AcpiAll || ChosenAcpiSystem == AcpiPcat) {
    ReturnCode = pNvmDimmConfigProtocol->GetAcpiPcat(pNvmDimmConfigProtocol, &pPcat);
    if (EFI_ERROR(ReturnCode) || pPcat == NULL) {
      PRINTER_SET_MSG(pPrinterCtx, ReturnCode, L"Error: Failed to find the PCAT tables\n");
    } else if (IS_PCAT_REVISION_INVALID(pPcat->pPlatformConfigAttr->Header.Revision)) {
      PrintInvalidAcpiRevisionString(pPcat->pPlatformConfigAttr->Header.Revision, AcpiPcat, TRUE, pCmd->pPrintCtx);
      ReturnCode = EFI_UNSUPPORTED;
    } else {
      PrintPcat(pPcat, pPrinterCtx);
    }
  }

  if (ChosenAcpiSystem == AcpiAll || ChosenAcpiSystem == AcpiPMTT) {
    ReturnCode = pNvmDimmConfigProtocol->GetAcpiPMTT(pNvmDimmConfigProtocol, (VOID *)&pPMTT);
    if (ReturnCode == EFI_NOT_FOUND) {
      PRINTER_SET_MSG(pPrinterCtx, ReturnCode, L"PMTT table not found.\n");
      ReturnCode = EFI_SUCCESS;
    } else if (EFI_ERROR(ReturnCode)|| pPMTT == NULL) {
      PRINTER_SET_MSG(pPrinterCtx, ReturnCode, L"Error: Failed to find the PMTT tables\n");
    } else if (IS_PMTT_REVISION_INVALID(pPMTT->Revision)) {
      PrintInvalidAcpiRevisionString(pPMTT->Revision, AcpiPMTT, FALSE, pCmd->pPrintCtx);
      FREE_POOL_SAFE(pPMTT);
      ReturnCode = EFI_UNSUPPORTED;
    } else {
      PrintPmtt(pPMTT, pPrinterCtx);
      FREE_POOL_SAFE(pPMTT);
    }
  }

  //Specify list attributes & display dataset as a list
  PRINTER_CONFIGURE_DATA_ATTRIBUTES(pPrinterCtx, DS_ROOT_PATH, &ShowAcpiDataSetAttribs);
  PRINTER_ENABLE_LIST_TABLE_FORMAT(pPrinterCtx);
Finish:
  PRINTER_PROCESS_SET_BUFFER(pPrinterCtx);
  if (ppStringElements != NULL) {
    FreeStringArray(ppStringElements, ElementsCount);
  }
  NVDIMM_EXIT_I64(ReturnCode);
  return ReturnCode;
}


text:
# Plasmidjs
[![Build Status](https://travis-ci.org/theideasmith/plasmidjs.svg?m)](https://travis-ci.org/theideasmith/plasmidjs)

[![NPM](https://nodei.co/npm-dl/plasmidjs.png?height=3&months=1)](https://nodei.co/npm/<plasmidjs>/)
[![NPM](https://nodei.co/npm/plasmidjs.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/plasmidjs/)

Plasmidjs allows you to treat an object as a cell and each of its methods as genes allowing you to control which methods/genes are switched on, and what happens if an *switched-off* method is called.

This is the child of synthetic biology and nodejs and was inspired by the author's experience at Cooper Union's Summer STEM iGem track as well as by [conduitjs](https://github.com/ifandelse/ConduitJS).

Some modules that make for excellent integrations with plasmidjs are:

+ **machina.js** finite state machine
+ **is.js** check if a string is X (a url, an email, a date, etc.)
+ **conduit.js** wrap pre and post invocation functions around a function
+ **joi.js** validate object against JSON schema

`npm install plasmidjs`

## Background

Synthetic biology is defined as:
> an interdisciplinary branch of biology, combining disciplines such as biotechnology, evolutionary biology, molecular biology, systems biology, biophysics, computer engineering, and is in many ways related to genetic engineering.

Synthetic biologists study the construction of new biological mechanisms and ways to optimize their design and development. More specifically, synthetic biologists can design custom DNA and insert it into a cell to engineer organisms to their liking and solve many of the world's problems.

Usually, the type of DNA used is a plasmid – hence the name *Plasmidjs* . After DNA insertion, the cell begins to express whichever functions are encoded by the genes in this DNA. Sometimes, it is necessary that only certain genes be activated at a time. This feat is accomplished by the use of a special part of DNA called a promoter which can switch genes on and off.

Very simply, the promoter is either induced or repressed. If it is repressed, the gene it controls is not expressed. If it is induced, the gene it controls is expressed.

## So what?

Concepts from synthetic biology provide the perfect metaphor for a javascript library that enables you to switch on and off object functions.

```javascript
var plasmid = require('plasmidjs')

var organism = {
    height: 50,
    grow: function(){
        this.height+=3
        return this.height
    },

    ideas: [
        "never let your schooling interfere with your eduction",
        "you dont get what you don't ask for",
        "be persistent",
        "take advantage of the fact you exist",
        "automate things"
    ],
    think: function(){
        return this.ideas.pop() || "I'm all out of ideas"
    },

    position: {x: 0, y: 0},
    walk: function(x, y){
        this.position.x = x
        this.position.y = y
        return this.position
    }
}

/*
 * Create our plasmid
 *
 */
var cell = plasmid.assemble( organism )

```
Start simple

```javascript
cell.think() //=> "never let your schooling interfere with your eduction"

/*
 * Turn a gene off
 */
cell.think.repress()() //=> undefined

/*
 * Turn a gene on
 */
cell.think.induce()()//=> "you dont get what you don't ask for"

```

Let's get complicated

```javascript

/*
 * Only one gene is on.
 */
cell.only('grow').think()//=> undefined
cell.induced()//=> ['grow']
cell.repressed()//=> ['think','walk']
cell.grow()//=> 53

/*
 * Turning all genes on
 */
cell.all(true).think()//=> "be persistent"

/*
 * All genes except walk
 */
cell.except('grow').grow()//=> undefined
cell.walk(20,15)//=> {x: 20, y:15}
```

Hopefully you're impressed.

## Docs

The module is broken into two parts: `Plasmid`, which wraps an entire object, and `Gene` which wraps each function of the newly created plasmid object. Methods can be repressed and induced. When induced, genes perform as expected i.e, mimicking the behavior of the function they wrap. When repressed, genes do nothing at all or perform whichever behavior is specified by their failure function.

+ Plasmid
  + `var obj = new plasmid.Plasmid( old_obj, [options])`
  + `var obj = plasmid.assemble(old_obj, [options])`
  + `obj.fail( failure_func )`
  + `obj.all( state )`
  + `obj.only( method, ... `)
  + `obj.except( method, ... )`
  + `obj.induced()`
  + `obj.repressed()`

+ Gene
  + `var gene = new plasmid.Gene( function, [options])`
  + `gene.connect( matcher, responder)`
  + `gene.induce()`
  + `gene.repress()`
  + `gene.fail( failure_func )`
  + `gene.induced()`
  + `gene.repressed()`
  + `gene.destroy()`

## Plasmid
### var obj = new plasmid.Plasmid( target, [options])

Creates a new plasmid that wraps `target`. Note: creating a new plasmid will not modify the original object. Instead, the module creates a new object with the plasmid instance functions as well as the wrapped object's own functions, that when called execute with the `this` context of the wrapped object.

`old_obj`: the object to wrap
`options`: an optional options object with the following (all optional) fields:
```javascript
    {
        exposed: ["method", [ "another method"]],
        induced: <true | false>
    }
```
`options.exposed`: and array containing the names of the functions of the target that should be wrapped.
`options.induced`: whether the wrapped methods should start induced. Otherwise, they are repressed. Defaults to true.

### var obj = plasmid.assemble(old_obj, [options])

Creates a new plasmid just like `new plasmid.Plasmid` but without the need for the `new` keyword. This method was created for the sake of language, allowing you to write such elaborate code as `var recombinant_dna = plasmid.assemble( insert )`. If you are familiar with synthetic biology, you should be really excited.

### obj.fail( failure_func )

Pass a failure function to be called when any repressed method is called. Under the hood, it uses `gene.failure`

```javascript
cell.fail( function(method_name, args{
   /*----( Your code here )----*/
})

```

### obj.all( true | false )
Set the state of all genes
`true`: induced
`false`: repressed
**Returns** the plasmid object, for chaining

### obj.only( method, ... )

Induce the genes specified by their name
**Returns** the plasmid object, for chaining

### obj.except( method, ... )

Turn every gene on except for those specified by their name
**Returns** the plasmid object, for chaining

### obj.induced()

Returns an array of induced genes

### obj.repressed()

Returns an array of repressed genes

##Gene

Genes wrap regular functions in `Gene` instances that can be switched on and off with ease.

### var gene = new plasmid.Gene( function, [options])

Wraps a function in a gene instance function, allowing you to add meta-functionality to the original function.

Options:

```javascript
{
  context: object,
  name: the name of the gene,
  induced: < true | false >,

}
```

`context` the object in whose context to run the wrapped function,
`name`: the name of the gene, used to identify it as well as when failure functions are called
`induced`: whether the gene should start as being induced.

### gene.connect( matcher, responder)

SConnects a matcher function to a specific responder, allowing you to very easily determine which function should handle a specific instance of arguments. Note: the responder will be called instead of the regular gene function.

```javascript

function matchStr(a){
  return typeof a === 'string'
}

var insert = {

    mirror: function(arg){
        // args = Array.prototype.slice.call(arguments, 0)
        // return args
        return arg
    }
}

var recombinant = plasmid.assemble(insert)
var string = "old eagles only order out"
var integer = 42

recombinant.mirror.connect(matchStr, function(a){
  console.log("Handling string: ", string)
  return "mirrored STRING"
})

recombinant.mirror.connect(matchNum, function(a){
    console.log("Handling number: ", a)
    return "mirrored INTEGER"
})

/*
 * Look below
 */
 recombinant.mirror("Hello")//=>"Hello"
recombinant.mirror(string)//=>  "mirrored STRING"
recombinant.mirror(integer)//=> "mirrored INTEGER"

```

### gene.induce()

Turn the gene one

### gene.repress()

Turn the gene off

### gene.fail( function )

Called when the gene function is invoked while simultaneously being repressed. Whatever the failure function returns will be returned when the repressed gene is invoked.

```javascript

function hello(thing){
  return "Hello, " + thing
}

var hi = new plasmid.Gene(hello, {name: "hello"})
hi('world')//=> "Hello, world"

hi.fail(function(function_name, arguments){

  return "Function " + function_name + "failed with: " + arguments.toString()

})

hi.repress()('bob')//=> "Function hello failed with: 'bob'"

```

### gene.induced()

**Returns** whether the gene is induced

### gene.repressed()

**Returns** whether the gene is repressed

### gene.destroy()

Prevent the gene from ever being used again!

## Contributions

Yes! Contribute!

On a more serious note, I would like to see plasmidjs become the de-facto module for meta - functions. I'd like to add the ability to create waterfalls of async and sync functions, add pre and post gene invocation functions, typecheckers, more complex state management capablities, etc.

If you have any ideas, please submit a pull request or file an issue explaining your idea and I'll do my best to add it.

-------------

## License

The MIT License (MIT)

Copyright (c) 2015 Akiva Lipshitz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


text:
/**
 * This attribute is used to mark class/method/field as deprecated.
 * @author $Author: jonmeyerny $
 * @version $Revision: 1.1 $
 */

package jas;

import java.io.*;

public class DeprecatedAttr
{
  static final CP attr = new AsciiCP("Deprecated");

  /**
   * Create a deprecated attribute.
   * @see ClassEnv#setDeprecated
   */

  public DeprecatedAttr() { }

  void resolve(ClassEnv e)
     { e.addCPItem(attr); }

  void write(ClassEnv e, DataOutputStream out)
    throws IOException, jasError
  {
    out.writeShort(e.getCPIndex(attr));
    out.writeInt(0);
  }
}


text:
package org.motechproject.mds.helper;

import org.joda.time.DateTime;
import org.motechproject.mds.domain.Entity;
import org.motechproject.mds.domain.Field;
import org.motechproject.mds.domain.FieldMetadata;
import org.motechproject.mds.domain.Lookup;
import org.motechproject.mds.domain.RelationshipHolder;
import org.motechproject.mds.domain.Type;
import org.motechproject.mds.repository.internal.AllTypes;
import org.motechproject.mds.util.Constants;

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

import static org.motechproject.mds.util.Constants.Util.AUTO_GENERATED;
import static org.motechproject.mds.util.Constants.Util.AUTO_GENERATED_EDITABLE;
import static org.motechproject.mds.util.Constants.Util.TRUE;

/**
 * The EntityHelper class contains useful methods that helps managing entities.
 *
 * @see org.motechproject.mds.domain.Entity
 */
public final class EntityHelper {

    private EntityHelper() {
    }

    /**
     * Adds default fields to entity
     * @param entity entity to add fields to
     * @param allTypes types repository
     */
    public static void addDefaultFields(Entity entity, AllTypes allTypes) {
        Type longType = allTypes.retrieveByClassName(Long.class.getName());
        Type stringType = allTypes.retrieveByClassName(String.class.getName());
        Type dateTimeType = allTypes.retrieveByClassName(DateTime.class.getName());

        Field idField = new Field(entity, Constants.Util.ID_FIELD_NAME, Constants.Util.ID_DISPLAY_FIELD_NAME, longType,
                true, true, true);
        idField.addMetadata(new FieldMetadata(idField, AUTO_GENERATED, TRUE));

        Field creatorField = new Field(entity, Constants.Util.CREATOR_FIELD_NAME, Constants.Util.CREATOR_DISPLAY_FIELD_NAME, stringType, true, false, true);
        creatorField.addMetadata(new FieldMetadata(creatorField, AUTO_GENERATED, TRUE));

        Field ownerField = new Field(entity, Constants.Util.OWNER_FIELD_NAME, Constants.Util.OWNER_DISPLAY_FIELD_NAME, stringType, false, false, true);
        ownerField.addMetadata(new FieldMetadata(ownerField, AUTO_GENERATED_EDITABLE, TRUE));

                Field modifiedByField = new Field(entity, Constants.Util.MODIFIED_BY_FIELD_NAME, Constants.Util.MODIFIED_BY_DISPLAY_FIELD_NAME, stringType, true, false, true);
        modifiedByField.addMetadata(new FieldMetadata(modifiedByField, AUTO_GENERATED, TRUE));

        Field modificationDateField = new Field(entity, Constants.Util.MODIFICATION_DATE_FIELD_NAME, Constants.Util.MODIFICATION_DATE_DISPLAY_FIELD_NAME, dateTimeType, true, false, true);
        modificationDateField.addMetadata(new FieldMetadata(modificationDateField, AUTO_GENERATED, TRUE));

        Field creationDateField = new Field(entity, Constants.Util.CREATION_DATE_FIELD_NAME, Constants.Util.CREATION_DATE_DISPLAY_FIELD_NAME, dateTimeType, true, false, true);
        creationDateField.addMetadata(new FieldMetadata(creationDateField, AUTO_GENERATED, TRUE));

        entity.addField(idField);
        entity.addField(creatorField);
        entity.addField(ownerField);
        entity.addField(modifiedByField);
        entity.addField(creationDateField);
        entity.addField(modificationDateField);
    }

    /**
     * In case of DDE, removes all fields and lookups that are not part of the original schema (was added later).
     * In case of EUDE, removes all fields and lookups.
     * @param entity entity to remove fields and lookups from
     */
    public static void removeAdditionalFieldsAndLookups(Entity entity) {
        Iterator<Field> fieldIterator = entity.getFields().iterator();
        while (fieldIterator.hasNext()) {
            Field field = fieldIterator.next();
            if (!field.isAutoGenerated() && !field.isReadOnly()) {
                fieldIterator.remove();
            }
        }

        Iterator<Lookup> lookupIterator = entity.getLookups().iterator();
        while (lookupIterator.hasNext()) {
            Lookup lookup = lookupIterator.next();
            if (!lookup.isReadOnly()) {
                lookupIterator.remove();
            }
        }
    }

    /**
     * Retrieves all entity classes that are referenced from entity.
     * @param entity entity for which related classes will be retrieved
     * @return related entity classes names
     */
    public static List<String> getRelatedEntityClasses(Entity entity) {
        List<String> relatedEntityClasses = new ArrayList<>();
        for (Field field : entity.getFields()) {
            if (field.getType().isRelationship()) {
                relatedEntityClasses.add(new RelationshipHolder(field).getRelatedClass());
            }
        }
        return relatedEntityClasses;
    }
}


text:
enum UniformId
{
    ModelViewProjectionMatrix,
    TextureMatrix,
    VertexColor,
    NUM_UNIFORMS
};

struct ShaderProgram
{
    GLuint id;
    GLuint vertShader;
    GLuint fragShader;
    GLuint geomShader;

    GLint uniforms[NUM_UNIFORMS];

    ShaderProgram() : id(0), vertShader(0), fragShader(0), geomShader(0)
    {
        for (int i = 0; i < NUM_UNIFORMS; i++)
        {
            uniforms[i] = -1;
        }
    }
};

#endif


text:
namespace restart_browser {

// Puts up an alert telling the user to restart their browser.  The alert
// will be hung off |parent| or global otherise.
void RequestRestart(NSWindow* parent);

}  // namespace restart_browser

#endif  // CHROME_BROWSER_UI_COCOA_RESTART_BROWSER_H_


text:
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("VersionOne ServiceHost Core Services")]

#if !DEBUG
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
#endif
[assembly: ComVisibleAttribute(false)]


text:
ActiveRecord extension makes has_many parent keeps the children's ids in the PostgreSQL array column.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'array_acts_as_has_many'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install array_acts_as_has_many

## Usage

TODO: Write usage instructions here

## Contributing

1. Fork it ( https://github.com/[my-github-username]/array_acts_as_has_many/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request


text:
/**
 * jQuery itemSearch Service Object
 * YouTubeSearchService (YouTube Search API V3)
 * Version 0.2
 */
var YouTubeSearchService = function(options) {
  var options = $.extend({}, options);
  var key     = this.key;
  var params  = options.params || {};
  var url     = 'https://www.googleapis.com/youtube/v3/search';
  var $form   = options.form;

  /**
   * Fills in default settings for search query parameters
   * @param  {PlainObject} settings
   * @return {PlainObject} query parameters for ajax call
   */
  var prepareQueryParams = function(settings) {
    return $.extend({
      key: key,
      part: 'snippet',
      order: 'relevance',
      maxResults: '5',
      type: 'video',
    }, settings)
  };

  /**
   * format an individual result's object and add it to the results array
   * @param {PlainObject}        result
   * @param {Array{PlainObject}} results
   */
  var formatResult = function(result, results) {
    results.push({
      url: 'http://youtu.be/' + result.id.videoId,
      title: result.snippet.title,
      description: result.snippet.description,
      meta: {
        id: result.id.videoId,
        thumbnails : {
          m: result.snippet.thumbnails.medium.url
        },
        more: result.snippet
      }
    });
  };

  /**
   * Run query using search term and query parameters
   * @param  {String}  term
   * @return {Boolean} false, as this is an asynchronous request
   */
  this.performQuery = function(term) {
    console.log(term);
    // with no API key, an error should be shown
    if (!key) {
      alert('No YouTube API Key provided');
    }

    var results = [];

    // get the data
    $.ajax({
      url: url,
      data: prepareQueryParams({q: term}),
      dataType: 'json',
      success: function(json) {
        if (json.items.length) {
          $.each(json.items, function(key, item) {
            formatResult(item, results);
          });
        }
      },
      complete: function() {
        $form.setResults(results);
      }
    });

    return false;
  };
};

/**
 * Sets the key for all YouTubeSearchService objects
 * @param  {String}  key
 * @return {Boolean} success of whether the key was set
 */
YouTubeSearchService.setKey = function(apiKey) {
  YouTubeSearchService.prototype.key = apiKey;
  return YouTubeSearchService.prototype.key == apiKey;
};


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

namespace NBouncer.Tools.IO
{
    public static class StreamExtensions
    {
        public static void WriteArray(this Stream stream, byte[] array)
        {
            stream.Write(array, 0, array.Length);
        }

        public static StreamReader CreateTextReader(this Stream stream)
        {
            return new StreamReader(stream);
        }

        public static StreamWriter CreateTextWriter(this Stream stream)
        {
            return new StreamWriter(stream);
        }

        public static BinaryReader CreateBinaryReader(this Stream stream)
        {
            return new BinaryReader(stream);
        }

        public static BinaryWriter CreateBinaryWriter(this Stream stream)
        {
            return new BinaryWriter(stream);
        }

        public static NonClosingBinaryReader CreateNonClosingReader(this Stream stream)
        {
            return new NonClosingBinaryReader(stream);
        }

        public static NonClosingBinaryWriter CreateNonClosingWriter(this Stream stream)
        {
            return new NonClosingBinaryWriter(stream);
        }

        public static void WriteInt32(this Stream stream, int val)
        {
            stream.Write(BitConverter.GetBytes(val), 0, sizeof(int));
        }

        public static int ReadInt32(this Stream stream)
        {
            byte[] buff = new byte[sizeof(int)];

            stream.Read(buff, 0, sizeof(int));

            return BitConverter.ToInt32(buff, 0);
        }

        public static short ReadInt16(this Stream stream)
        {
            byte[] buff = new byte[sizeof(short)];

            stream.Read(buff, 0, sizeof(short));

            return BitConverter.ToInt16(buff, 0);
        }

        public static void ReadToBuffer(this Stream stream, byte[] buffer, int need)
        {
            if (buffer.Length < need)
            {
                throw new ArgumentOutOfRangeException("need");
            }

            int received = 0;

            while (received < need)
            {
                received += stream.Read(buffer, received, need - received);
            }
        }

    }
}


text:
/**
* Offline Search Result contains the result of performing a scan of all the project layer files.
*/
var Layer = (function () {
    function Layer(groupTitle, index, id, title, path, type) {
        this.groupTitle = groupTitle;
        this.index = index;
        this.id = id;
        this.title = title;
        this.path = path;
        this.type = type;
        /**
         * Names of all the features.
         * @type {string[]}
         */
        this.featureNames = [];
    }
    return Layer;
})();
exports.Layer = Layer;
/**
* An index entry that contains a search result.
*/
var Entry = (function () {
    function Entry(layerIndexOrArray, featureIndex) {
        this.v = Array(2);
        if (typeof layerIndexOrArray === 'number') {
            this.v[0] = layerIndexOrArray;
            this.v[1] = featureIndex;
        }
        else {
            this.v = layerIndexOrArray;
        }
    }
    Object.defineProperty(Entry.prototype, "layerIndex", {
        get: function () {
            return this.v[0];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Entry.prototype, "featureIndex", {
        get: function () {
            return this.v[1];
        },
        enumerable: true,
        configurable: true
    });
    /**
     * This function is called when serializing the Entry object to JSON, which is
     * much less verbose than the default JSON. In the constructor, I've used a
     * Union type to deserialize it again.
     */
    Entry.prototype.toJSON = function () {
        return this.v;
    };
    return Entry;
})();
exports.Entry = Entry;
var KeywordIndex = (function () {
    function KeywordIndex() {
    }
    return KeywordIndex;
})();
exports.KeywordIndex = KeywordIndex;
var OfflineSearchResult = (function () {
    function OfflineSearchResult(project, options) {
        this.project = project;
        this.options = options;
        this.layers = [];
        this.keywordIndex = {};
    }
    return OfflineSearchResult;
})();
exports.OfflineSearchResult = OfflineSearchResult;


text:
namespace Nancy.Demo.NoPassword.Authentication
{
    using System.Collections.Generic;
    using Nancy.Security;

    public class Identity : IUserIdentity
    {
        public Identity(string email)
        {
            this.UserName = email;
        }

        public string UserName { get; set; }

        public IEnumerable<string> Claims { get; set; }
    }
}


text:
<BroadcastMonitor>
  <updated>2015-08-04T13:32:31</updated>
  <stationName>Radio 6</stationName>
  <Current>
    <startTime>2015-08-04T13:32:30</startTime>
    <itemId>1000080523:1241133</itemId>
    <titleId>216138625</titleId>
    <itemCode>10590</itemCode>
    <itemReference></itemReference>
    <titleName>Standing By Your Side</titleName>
    <artistName>Lee Fields & The Expressions</artistName>
    <albumName></albumName>
    <CategoryCode>736</CategoryCode>
    <CategoryName>SOUL</CategoryName>
    <itemDuration>169</itemDuration>
    <MultiMedia1></MultiMedia1>
    <MultiMedia2></MultiMedia2>
    <MultiMedia3></MultiMedia3>
    <MultiMedia4></MultiMedia4>
  </Current>
  <Next>
    <startTime>2015-08-04T13:35:15</startTime>
    <itemId>1000080523:1241134</itemId>
    <titleId>216058758</titleId>
    <itemCode>01521</itemCode>
    <itemReference></itemReference>
    <titleName>Foxy Lady</titleName>
    <artistName>Alain Clark</artistName>
    <albumName></albumName>
    <CategoryCode>736</CategoryCode>
    <CategoryName>SOUL</CategoryName>
    <itemDuration>207</itemDuration>
    <MultiMedia1></MultiMedia1>
    <MultiMedia2></MultiMedia2>
    <MultiMedia3></MultiMedia3>
    <MultiMedia4></MultiMedia4>
  </Next>
</BroadcastMonitor>


text:
<!--
  ~ Copyright (c) 2010-2017 Evolveum and contributors
  ~
  ~ This work is dual-licensed under the Apache License 2.0
  ~ and European Union Public License. See LICENSE file for details.
  -->

<role xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
      xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
      xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oid="6646eed6-4985-4a54-8275-fd7523df3170"
      xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3" xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3">
    <name>IT-2</name>

    <assignment>
        <targetRef oid="d3d029f2-09b4-4b32-9abb-fe4d98b9f4fe" type="RoleType"/> <!-- k10-tpu-10 -->
    </assignment>
</role>


text:
<?php
header("Content-Type:text/html;charset=utf-8");
// Charset: utf-8

 //get the xml data from google api
$city = $_GET['city'];
$aim_file = "http://www.google.com/ig/api?weather=".$city."&hl=zh-cn";
//$content = file_get_contents($aim_file);//此处需要用curl实现

$ch = curl_init();

$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, $aim_file);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, $timeout);
$contents = curl_exec($ch);
curl_close($ch);

echo $contents;//此处用curl替换了file_get_contents()

$content = mb_convert_encoding($content, 'UTF-8', 'GB2312');
$xml = simplexml_load_string($content);
//if can't get the data
if(!$xml->weather->forecast_information){
	die("Google cannot get the weather info at present!");
}

$arr_today['date'] = $xml->weather->forecast_information->forecast_date->attributes();
$current = $xml->weather->current_conditions;
$arr_today['condition'] = $current->condition->attributes();
//temp_c 为摄氏度,temp_f为华氏度
$arr_today['temp_c'] = $current->temp_c->attributes();
$arr_today['humidity'] = $current->humidity->attributes();
$arr_today['icon'] = $current->icon->attributes();
$arr_today['wind'] = $current->wind_condition->attributes();

foreach($xml->weather->forecast_conditions as $forecast) {
    $date_unit = array();
    $date_unit['low'] = $forecast->low->attributes();
    $date_unit['high'] = $forecast->high->attributes();
    $date_unit['icon'] = $forecast->icon->attributes();
    $date_unit['condition'] = $forecast->condition->attributes();
    $date_unit['day_of_week'] = $forecast->day_of_week->attributes();

    $arr_forecast[] = $date_unit;
}

require ('./Smarty/libs/Smarty.class.php');
//create
$smarty = new Smarty;
//assign
$smarty->assign('arr_forecast',$arr_forecast);
$smarty->assign('arr_today',$arr_today);
$city_name ='zhuhai';
$smarty->assign('city_name',$city_name);
//display
$smarty->display('weather.html');
?>


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>

	<groupId>org.openhds</groupId>
	<artifactId>specialstudy</artifactId>
	<version>1.0.0-SNAPSHOT</version>
	<packaging>war</packaging>
	<name>OpenHDS Special Study</name>

	<dependencies>
		<!-- General dependencies for standard applications -->
		<dependency>
			<groupId>org.junit</groupId>
			<artifactId>com.springsource.org.junit</artifactId>
			<version>4.7.0</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.log4j</groupId>
			<artifactId>com.springsource.org.apache.log4j</artifactId>
			<version>1.2.15</version>
		</dependency>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>com.springsource.org.apache.commons.logging</artifactId>
			<version>1.1.1</version>
		</dependency>
		<dependency>
			<groupId>org.aspectj</groupId>
			<artifactId>com.springsource.org.aspectj.runtime</artifactId>
			<version>${aspectj.version}</version>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>com.springsource.javax.servlet</artifactId>
			<version>2.5.0</version>
			<scope>provided</scope>
		</dependency>
		<!-- ROO dependencies -->
		<dependency>
			<groupId>org.springframework.roo</groupId>
			<artifactId>org.springframework.roo.annotations</artifactId>
			<version>1.0.2.RELEASE</version>
			<scope>provided</scope>
		</dependency>
		<!-- Spring dependencies -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>org.springframework.core</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>org.springframework.test</artifactId>
			<version>${spring.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>org.springframework.context</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>org.springframework.aop</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>org.springframework.aspects</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>org.springframework.transaction</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>com.springsource.org.hsqldb</artifactId>
            <version>1.8.0.9</version>
        </dependency>
    	<dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>com.springsource.org.hibernate.annotations</artifactId>
            <version>3.3.1.ga</version>
        </dependency>
    	<dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>com.springsource.org.hibernate.ejb</artifactId>
            <version>3.3.2.GA</version>
        </dependency>
    	<dependency>
            <groupId>net.sourceforge.ehcache</groupId>
            <artifactId>com.springsource.net.sf.ehcache</artifactId>
            <version>1.4.1</version>
        </dependency>
    	<dependency>
            <groupId>edu.emory.mathcs.backport</groupId>
            <artifactId>com.springsource.edu.emory.mathcs.backport</artifactId>
            <version>3.1.0</version>
        </dependency>
    	<dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>com.springsource.slf4j.log4j</artifactId>
            <version>1.5.6</version>
        </dependency>
    	<dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>com.springsource.javax.persistence</artifactId>
            <version>1.0.0</version>
        </dependency>
    	<dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>com.springsource.slf4j.api</artifactId>
            <version>1.5.6</version>
        </dependency>
    	<dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>com.springsource.org.hibernate.validator</artifactId>
            <version>4.0.0.GA</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    	<dependency>
            <groupId>javax.validation</groupId>
            <artifactId>com.springsource.javax.validation</artifactId>
            <version>1.0.0.GA</version>
        </dependency>
    	<dependency>
            <groupId>javax.transaction</groupId>
            <artifactId>com.springsource.javax.transaction</artifactId>
            <version>1.1.0</version>
        </dependency>
    	<dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>com.springsource.org.apache.commons.dbcp</artifactId>
            <version>1.2.2.osgi</version>
        </dependency>
    	<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.jdbc</artifactId>
            <version>${spring.version}</version>
        </dependency>
    	<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.orm</artifactId>
            <version>${spring.version}</version>
        </dependency>
    	<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.web</artifactId>
            <version>${spring.version}</version>
        </dependency>
    	<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.web.servlet</artifactId>
            <version>${spring.version}</version>
        </dependency>
    	<dependency>
            <groupId>org.springframework.webflow</groupId>
            <artifactId>org.springframework.js</artifactId>
            <version>2.0.8.RELEASE</version>
        </dependency>
    	<dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>com.springsource.org.apache.commons.fileupload</artifactId>
            <version>1.2.0</version>
        </dependency>
    	<dependency>
            <groupId>org.tuckey</groupId>
            <artifactId>com.springsource.org.tuckey.web.filters.urlrewrite</artifactId>
            <version>3.1.0</version>
        </dependency>
    	<dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>com.springsource.javax.servlet.jsp.jstl</artifactId>
            <version>1.2.0</version>
        </dependency>
    	<dependency>
            <groupId>org.apache.el</groupId>
            <artifactId>com.springsource.org.apache.el</artifactId>
            <version>6.0.20</version>
        </dependency>
    	<dependency>
            <groupId>org.joda</groupId>
            <artifactId>com.springsource.org.joda.time</artifactId>
            <version>1.6.0</version>
        </dependency>
    	<dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>com.springsource.org.apache.tiles</artifactId>
            <version>2.1.3</version>
        </dependency>
    	<dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>com.springsource.org.apache.tiles.jsp</artifactId>
            <version>2.1.3</version>
        </dependency>
    	<dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>com.springsource.org.apache.tiles.core</artifactId>
            <version>2.1.3</version>
        </dependency>
    	<dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>org.springframework.security.core</artifactId>
            <version>3.0.0.RELEASE</version>
        </dependency>
    	<dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>org.springframework.security.config</artifactId>
            <version>3.0.0.RELEASE</version>
        </dependency>
    	<dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>org.springframework.security.web</artifactId>
            <version>3.0.0.RELEASE</version>
        </dependency>
    	<dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>org.springframework.security.taglibs</artifactId>
            <version>3.0.0.RELEASE</version>
        </dependency>
    	<dependency>
            <groupId>com.mysql.jdbc</groupId>
            <artifactId>com.springsource.com.mysql.jdbc</artifactId>
            <version>5.1.6</version>
        </dependency>
          <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-common-utilities</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-management</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-jms</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http-jetty</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-databinding-aegis</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-local</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-core</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-simple</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jettison</groupId>
            <artifactId>jettison</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.2.2</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.0.1</version>
        </dependency>
        <dependency>
    		<groupId>org.codehaus.jra</groupId>
   			<artifactId>jra</artifactId>
    		<version>1.0-alpha-4</version>
		</dependency>
		<dependency>
			<groupId>com.sun.xml.stream.buffer</groupId>
			<artifactId>streambuffer</artifactId>
			<version>0.8</version>
		</dependency>
		<dependency>
			<groupId>org.jvnet.staxex</groupId>
			<artifactId>stax-ex</artifactId>
			<version>1.2</version>
		</dependency>
		<dependency>
			<groupId>com.sun.xml.bind</groupId>
			<artifactId>jaxb-impl</artifactId>
			<version>2.2.2</version>
		</dependency>
		<dependency>
		  <groupId>org.apache.poi</groupId>
		  <artifactId>poi</artifactId>
		  <version>3.2-FINAL</version>
		  <exclusions>
		  	<exclusion>
		  		<groupId>commons-logging</groupId>
		  		<artifactId>commons-logging</artifactId>
		  	</exclusion>
		  </exclusions>
		</dependency>
    </dependencies>

	<build>
		<finalName>${artifactId}</finalName>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>2.0.2</version>
				<!--
					<configuration> <webXml>target/web.xml</webXml> </configuration>
				-->
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.0.2</version>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>aspectj-maven-plugin</artifactId>
				<version>1.0</version>
				<dependencies>
					<!-- NB: You must use Maven 2.0.9 or above or these are ignored (see MNG-2972) -->
					<dependency>
						<groupId>org.aspectj</groupId>
						<artifactId>com.springsource.org.aspectj.runtime</artifactId>
						<version>${aspectj.version}</version>
					</dependency>
					<dependency>
						<groupId>org.aspectj</groupId>
						<artifactId>com.springsource.org.aspectj.tools</artifactId>
						<version>${aspectj.version}</version>
					</dependency>
				</dependencies>
				<executions>
					<execution>
						<goals>
							<goal>compile</goal>
							<goal>test-compile</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<outxml>true</outxml>
					<aspectLibraries>
						<aspectLibrary>
							<groupId>org.springframework</groupId>
							<artifactId>org.springframework.aspects</artifactId>
						</aspectLibrary>
					</aspectLibraries>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>2.4.3</version>
				<configuration>
				    <skipTests>true</skipTests>
					<junitArtifactName>org.junit:com.springsource.org.junit</junitArtifactName>
					<excludes>
						<exclude>**/*_Roo_*</exclude>
					</excludes>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>2.1</version>
				<configuration>
					<descriptorRefs>
						<descriptorRef>
							jar-with-dependencies
						</descriptorRef>
					</descriptorRefs>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-deploy-plugin</artifactId>
				<version>2.4</version>
			</plugin>
			<!-- IDE -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-eclipse-plugin</artifactId>
				<version>2.6</version>
				<configuration>
					<downloadSources>true</downloadSources>
					<downloadJavadocs>false</downloadJavadocs>
					<wtpversion>2.0</wtpversion>
					<additionalBuildcommands>
						<buildCommand>
							<name>org.eclipse.ajdt.core.ajbuilder</name>
							<arguments>
								<aspectPath>org.springframework.aspects</aspectPath>
							</arguments>
						</buildCommand>
						<buildCommand>
							<name>org.springframework.ide.eclipse.core.springbuilder</name>
						</buildCommand>
					</additionalBuildcommands>
					<additionalProjectnatures>
						<projectnature>org.eclipse.ajdt.ui.ajnature</projectnature>
						<projectnature>com.springsource.sts.roo.core.nature</projectnature>
						<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
					</additionalProjectnatures>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-idea-plugin</artifactId>
				<version>2.2</version>
				<configuration>
					<downloadSources>true</downloadSources>
					<dependenciesAsLibraries>true</dependenciesAsLibraries>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>tomcat-maven-plugin</artifactId>
				<version>1.0-beta-1</version>
			</plugin>
			<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>maven-jetty-plugin</artifactId>
				<version>6.1.10</version>
			</plugin>
		</plugins>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<includes>
					<include>META-INF/persistence.xml</include>
				</includes>
				<filtering>true</filtering>
			</resource>
			<resource>
				<directory>src/main/resources</directory>
				<excludes>
					<exclude>META-INF/persistence.xml</exclude>
				</excludes>
			</resource>
		</resources>
	</build>

	<profiles>
		<profile>
			<id>developer</id>
			<properties>
				<hibernate.hbm2ddl>create</hibernate.hbm2ddl>
			</properties>
		</profile>
	</profiles>

	<properties>
		<spring.version>3.0.0.RELEASE</spring.version>
		<aspectj.version>1.6.6.RELEASE</aspectj.version>
		<hibernate.hbm2ddl>update</hibernate.hbm2ddl>
	</properties>
</project>


text:
package com.sfs.jbtimporter;

import org.apache.commons.lang.StringUtils;

/**
 * The Class JBTIssue.
 */
public class JBTIssue {

    /** The id. */
    private String id;

    /** The base. */
    private String base;

    /** The file name. */
    private String fileName;

    /** The export base. */
    private String exportBase = "";

    /**
     * Instantiates a new jBT issue.
     *
     * @param jbt the jbt
     */
    public JBTIssue(final JBTProcessor jbt) {
        if (StringUtils.isNotBlank(jbt.getExportBase())) {
            this.exportBase = jbt.getExportBase();
        }
    }

    /**
     * Sets the id.
     *
     * @param idValue the new id
     */
    public final void setId(final String idValue) {
        this.id = idValue;
    }

    /**
     * Gets the id.
     *
     * @return the id
     */
    public final String getId() {
        if (this.id == null) {
            this.id = "";
        }
        return this.id;
    }

    /**
     * Sets the base.
     *
     * @param baseValue the new base
     */
    public final void setBase(final String baseValue) {
        this.base = baseValue;
    }

    /**
     * Gets the base.
     *
     * @return the base
     */
    public final String getBase() {
        if (this.base == null) {
            this.base = "";
        }
        return this.base;
    }

    /**
     * Sets the file name.
     *
     * @param fileNameValue the new file name
     */
    public final void setFileName(final String fileNameValue) {
        this.fileName = fileNameValue;
    }

    /**
     * Gets the file name.
     *
     * @return the file name
     */
    public final String getFileName() {
        if (this.fileName == null) {
            this.fileName = "";
        }
        return this.fileName;
    }

    /**
     * Gets the full file name.
     *
     * @return the full file name
     */
    public final String getFullFileName() {

        return StringUtils.replace(this.exportBase + this.getBase(), "\\", "/")
                + "/" + this.getFileName();
    }
}


text:
#ifndef WEBRTC_VIDEO_ENGINE_VIE_FRAME_PROVIDER_BASE_H_
#define WEBRTC_VIDEO_ENGINE_VIE_FRAME_PROVIDER_BASE_H_

#include <vector>

#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread_checker.h"
#include "webrtc/common_types.h"
#include "webrtc/typedefs.h"

namespace webrtc {

class CriticalSectionWrapper;
class VideoEncoder;
class I420VideoFrame;

// ViEFrameCallback shall be implemented by all classes receiving frames from a
// frame provider.
class ViEFrameCallback {
 public:
  virtual void DeliverFrame(int id,
                            I420VideoFrame* video_frame,
                            const std::vector<uint32_t>& csrcs) = 0;

  // The capture delay has changed from the provider. |frame_delay| is given in
  // ms.
  virtual void DelayChanged(int id, int frame_delay) = 0;

  // Get the width, height and frame rate preferred by this observer.
  virtual int GetPreferedFrameSettings(int* width,
                                       int* height,
                                       int* frame_rate) = 0;

  // ProviderDestroyed is called when the frame is about to be destroyed. There
  // must not be any more calls to the frame provider after this.
  virtual void ProviderDestroyed(int id) = 0;

  virtual ~ViEFrameCallback() {}
};

// ViEFrameProviderBase is a base class that will deliver frames to all
// registered ViEFrameCallbacks.
class ViEFrameProviderBase {
 public:
  ViEFrameProviderBase(int Id, int engine_id);
  virtual ~ViEFrameProviderBase();

  // Returns the frame provider id.
  int Id() const;

  // Register frame callbacks, i.e. a receiver of the captured frame.
  // Must be called on the same thread as the provider was constructed on.
  int RegisterFrameCallback(int observer_id, ViEFrameCallback* callback);

  // Unregisters a previously registered callback.  Returns -1 if the callback
  // object hasn't been registered.
  // Must be called on the same thread as the provider was constructed on.
  int DeregisterFrameCallback(const ViEFrameCallback* callback);

  // Determines if a callback is currently registered.
  // Must be called on the same thread as the provider was constructed on.
  bool IsFrameCallbackRegistered(const ViEFrameCallback* callback);

  // FrameCallbackChanged
  // Inherited classes should check for new frame_settings and reconfigure
  // output if possible.
  virtual int FrameCallbackChanged() = 0;

 protected:
  void DeliverFrame(I420VideoFrame* video_frame,
                    const std::vector<uint32_t>& csrcs);
  void SetFrameDelay(int frame_delay);
  int FrameDelay();
  int GetBestFormat(int* best_width,
                    int* best_height,
                    int* best_frame_rate);

  rtc::ThreadChecker thread_checker_;
  rtc::ThreadChecker frame_delivery_thread_checker_;

  const int id_;
  const int engine_id_;

  // Frame callbacks.
  typedef std::vector<ViEFrameCallback*> FrameCallbacks;
  FrameCallbacks frame_callbacks_;
  const rtc::scoped_ptr<CriticalSectionWrapper> provider_cs_;

 private:
  rtc::scoped_ptr<I420VideoFrame> extra_frame_;
  int frame_delay_;
};

}  // namespace webrtc

#endif  // WEBRTC_VIDEO_ENGINE_VIE_FRAME_PROVIDER_BASE_H_


text:
package de.japkit.tutorial.valueobject;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class City {
	@Id
	private Long id;

	private String name;

	public City(String name) {
		super();
		this.name = name;
	}

	public String getName() {
		return name;
	}

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace JagerekukibeHelcewhalay;
/// <summary>
/// SelectionCanvas.xaml 的交互逻辑
/// </summary>
public partial class SelectionCanvas : Canvas
{
    public SelectionCanvas()
    {
        InitializeComponent();

        SetSelectionCanvas(this, this);

        SizeChanged += SelectionCanvas_SizeChanged;
    }

    private void SelectionCanvas_SizeChanged(object sender, SizeChangedEventArgs e)
    {
    }

    public static SelectionCanvas GetSelectionCanvas(DependencyObject obj)
    {
        return (SelectionCanvas) obj.GetValue(SelectionCanvasProperty);
    }

    public static void SetSelectionCanvas(DependencyObject obj, SelectionCanvas value)
    {
        obj.SetValue(SelectionCanvasProperty, value);
    }

    public static readonly DependencyProperty SelectionCanvasProperty =
        DependencyProperty.RegisterAttached("SelectionCanvas", typeof(SelectionCanvas), typeof(SelectionCanvas), new FrameworkPropertyMetadata(default(SelectionCanvas), FrameworkPropertyMetadataOptions.Inherits));
}

public class LeftTopThumb : FrameworkElement
{
    public LeftTopThumb()
    {
        IsManipulationEnabled = true;

        Width = 20;
        Height = 20;

        ManipulationStarting += LeftTopThumb_ManipulationStarting;
    }

    protected override void OnMouseDown(MouseButtonEventArgs e)
    {
        base.OnMouseDown(e);
    }

    private void LeftTopThumb_ManipulationStarting(object? sender, ManipulationStartingEventArgs e)
    {
        Manipulation.SetManipulationMode(this, ManipulationModes.Translate);
    }

    protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
    {
        return new PointHitTestResult(this, new Point());
    }

    protected override void OnRender(DrawingContext drawingContext)
    {
        Pen pen = new Pen(Brushes.Black, 2);
        drawingContext.DrawLine(pen, new Point(), new Point(0, 10));
        drawingContext.DrawLine(pen, new Point(), new Point(10, 0));
    }
}


text:
layout: update
published: true

collection: updates
category: chrome
product: chrome
type: news
date: 2014-05-21

title: "A More Compatible, Smoother Touch"
description: "You and your users want mobile web apps that react and scroll smoothly to the
touch. Developing them should be easy but, unfortunately, how mobile web
browsers react to touch events during scrolling is left as an implementation
detail in the [TouchEvent](http://www.w3.org/TR/touch-events/) specification. "
article:
  written_on: 2014-05-21
  updated_on: 2014-05-21
authors:
  - paulkinlan
tags:
  - mobile
  - touchevent
permalink: /updates/2014/05/A-More-Compatible-Smoother-Touch.html
---
You and your users want mobile web apps that react and scroll smoothly to the
touch. Developing them [should be easy](https://developers.google.com/web/fundamentals/documentation/user-input/touch-input/) but, unfortunately, how mobile web
browsers react to touch events during scrolling is left as an implementation
detail in the [TouchEvent](http://www.w3.org/TR/touch-events/) specification. As
a result, approaches can be broken down roughly into 4 categories. This
situation exposes a fundamental tension between delivering scroll smoothness and
maintaining developer control.

## Four different models of touch event processing?

The behavior differences between the browsers break down into four models.

1. **Normal synchronous event processing**

    Touchmove events are sent during scrolling and each scroll update blocks until touchmove handling has completed. This is good as the simplest to understand and the most powerful but bad for scroll performance because it means that each frame during the scroll must block on the main thread.

    > Browsers: Android Browser (Android 4.0.4, 4.3), Mobile Safari (when
      scrolling div)

1. **Asynchronous touchmove processing**

    Touchmove events are sent during scrolling, but scrolling can proceed asynchronously (the touchmove event is ignored after scrolling has begun). This can result in "double handling" of events, for example, continuing to  scroll after the web site does something with the touchmove and calls [preventDefault](https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault) on the event, telling the browser not to handle it.

    > Browsers: Mobile Safari (when scrolling Document), Firefox

1. **Touchmove suppressed while scrolling**

    Touchmove events are not sent after scrolling starts and do not resume until after the touchend event. In this model, it's hard to tell the difference between a stationary touch and a scroll.

    > Browsers: Samsung Browser (mousemove events sent)

1. **Touchcancel on scroll start**

    You can't have it both ways -- scroll smoothness and developer control -- and this model makes clear the trade-off between smooth scrolling and event handling, similar to the semantics of the [Pointer Events](http://www.w3.org/TR/pointerevents/) specification. Some experiences that may need to track the finger, like pull-to-refresh, are not possible.

    > Browsers: Chrome Desktop M32+, Chrome Android

## Why Change?

Chrome for Android currently uses Chrome's Old Model: touchcancel on scroll
start, which enhances scrolling performance, but leads to developer confusion.
In particular, some developers aren't aware of the touchcancel event or how to
deal with it, and this has caused some web sites to break. More importantly, an
entire class of UI scrolling effects and behaviors, such as **pull-to-refresh**,
**hidey bars**, and **snap points** are difficult or impossible to implement
well.

Rather than adding specifically hardcoded features to support these effects,
Chrome aims to concentrate on adding platform primitives that allow developers
to implement these effects directly. See [A Rational Web
Platform](https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/4jBAnIVwrt0)
for a general exposition of this philosophy.

## Chrome's New Model: The Throttled Async Touchmove Model

Chrome is introducing [a new
behavior](https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/wHnyukcYBcA)
designed to improve compatibility with code written for other browsers when
scrolling, as well as enabling other scenarios that depend on getting touchmove
events while scrolling. This feature is enabled by default and you can turn it
off with the following flag,  **chrome://flags\#touch-scrolling-mode**.

The new behavior is:

* The **first** touchmove is sent **synchronously** to allow scroll to be
  **canceled**
* During active scrolling
    * touchmove events are sent **asynchronously**
    * **throttled** to 1 event per **200ms**, or if a CSS **15px** slop region
      is exceeded
    * **Event.cancelable** is **false**
* Otherwise, touchmove events fire synchronously as normal when active scrolling
  terminates or isn't possible because the scroll limit has been hit
* A touchend event **always** occurs when the user lifts their finger

You can try this [demo](http://www.rbyers.net/touchevent-scroll.html) in Chrome for Android and toggle the
chrome://flags\#touch-scrolling-mode flag to see the difference.

## Let us know what you think

The Async Touchmove Model has the potential to improve cross-browser
compatibility and enable a new class of touch gesture effects. We're interested
in hearing what developers think, and in seeing the creative things you can do
with it.


text:
"""
    nyanbot.nyanbot
    ~~~~~~~~~~~~~~~

    A chatbot that simplifies your life.

    :copyright: (c) 2014 by Maverick Chan.
    :license: MIT License, see LICENSE for more details.
"""

from scripts import nyanbot_function


text:
package com.colobu.kafka

import java.util.concurrent._
import java.util.{Collections, Properties}

import kafka.consumer.KafkaStream
import kafka.utils.Logging
import org.apache.kafka.clients.consumer.{ConsumerConfig, KafkaConsumer}

import scala.collection.JavaConversions._

class ScalaConsumerExample(val brokers: String,
                           val groupId: String,
                           val topic: String) extends Logging {

  val props = createConsumerConfig(brokers, groupId)
  val consumer = new KafkaConsumer[String, String](props)
  var executor: ExecutorService = null

  def shutdown() = {
    if (consumer != null)
      consumer.close();
    if (executor != null)
      executor.shutdown();
  }

  def createConsumerConfig(brokers: String, groupId: String): Properties = {
    val props = new Properties()
    props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, brokers)
    props.put(ConsumerConfig.GROUP_ID_CONFIG, groupId)
    props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "true")
    props.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, "1000")
    props.put(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, "30000")
    props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer")
    props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer")
    props
  }

  def run() = {
    consumer.subscribe(Collections.singletonList(this.topic))

    Executors.newSingleThreadExecutor.execute(    new Runnable {
      override def run(): Unit = {
        while (true) {
          val records = consumer.poll(1000)

          for (record <- records) {
            System.out.println("Received message: (" + record.key() + ", " + record.value() + ") at offset " + record.offset())
          }
        }
      }
    })
  }
}

object ScalaConsumerExample extends App {
  val example = new ScalaConsumerExample(args(0), args(1), args(2))
  example.run()
}


text:
#ifndef WINPTY_H
#define WINPTY_H

#include <stdlib.h>
#include <windows.h>

#ifdef WINPTY
#define WINPTY_API __declspec(dllexport)
#else
#define WINPTY_API __declspec(dllimport)
#endif

#ifdef __cplusplus
extern "C" {
#endif

typedef struct winpty_s winpty_t;

/*
 * winpty API.
 */

/*
 * Starts a new winpty instance with the given size.
 *
 * This function creates a new agent process and connects to it.
 */
WINPTY_API winpty_t *winpty_open(int cols, int rows);

/**
* Starts a new winpty instance with the given size.
*
* This function creates a new agent process and connects to it.
* By using this method you are responsible for creating your own named
* pipe server for communicating with the child process.
*
*/
WINPTY_API winpty_t *winpty_open_use_own_datapipe(const wchar_t *dataPipe, int cols, int rows);

/*
 * Start a child process.  Either (but not both) of appname and cmdline may
 * be NULL.  cwd and env may be NULL.  env is a pointer to an environment
 * block like that passed to CreateProcess.
 *
 * This function never modifies the cmdline, unlike CreateProcess.
 *
 * Only one child process may be started.  After the child process exits, the
 * agent will scrape the console output one last time, then close the data pipe
 * once all remaining data has been sent.
 *
 * Returns 0 on success or a Win32 error code on failure.
 */
WINPTY_API int winpty_start_process(winpty_t *pc,
                                    const wchar_t *appname,
                                    const wchar_t *cmdline,
                                    const wchar_t *cwd,
                                    const wchar_t *env);

/*
 * Returns the exit code of the process started with winpty_start_process,
 * or -1 none is available.
 */
WINPTY_API int winpty_get_exit_code(winpty_t *pc);

/*
 * Returns an overlapped-mode pipe handle that can be read and written
 * like a Unix terminal.
 */
WINPTY_API HANDLE winpty_get_data_pipe(winpty_t *pc);

/*
 * Change the size of the Windows console.
 */
WINPTY_API int winpty_set_size(winpty_t *pc, int cols, int rows);

/*
 * Closes the winpty.
 */
WINPTY_API void winpty_exit(winpty_t *pc);

#ifdef __cplusplus
}
#endif

#endif /* WINPTY_H */


text:
<?php
namespace AppBundle\Security;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Guard\Authenticator\AbstractFormLoginAuthenticator;
use Symfony\Component\Security\Core\Security;

class FormLoginAuthenticator extends AbstractFormLoginAuthenticator
{
    private $router;
    private $encoder;

    public function __construct(RouterInterface $router, UserPasswordEncoderInterface $encoder)
    {
        $this->router = $router;
        $this->encoder = $encoder;
    }

    public function getCredentials(Request $request)
    {
        if ($request->getPathInfo() != '/login_check') {
            return;
        }

        $email = $request->request->get('_username');
        $request->getSession()->set(Security::LAST_USERNAME, $email);
        $password = $request->request->get('_password');

        return [
            'email' => $email,
            'password' => $password,
        ];
    }

    public function getUser($credentials, UserProviderInterface $userProvider)
    {
        $email = $credentials['email'];

        return $userProvider->loadUserByUsername($email);
    }

    public function checkCredentials($credentials, UserInterface $user)
    {
        $plainPassword = $credentials['password'];
        if ($this->encoder->isPasswordValid($user, $plainPassword)) {
            return true;
        }

        throw new BadCredentialsException();
    }

    protected function getLoginUrl()
    {
        return $this->router->generate('login');
    }

    protected function getDefaultSuccessRedirectUrl()
    {
        return $this->router->generate('users_index');
    }
}


text:
<?php

namespace JanMaennig\ExtbaseViewExample\Controller;

use JanMaennig\ExtbaseViewExample\Domain\Model\Record;
use JanMaennig\ExtbaseViewExample\View\TwigView;

class RecordTwigController extends RecordController
{
    protected $defaultViewObjectName = TwigView::class;

    public function singleAction(Record $record)
    {
        parent::singleAction($record);

        $this->view->assign('test', 'hallo welt');
    }
}


text:
<title>DatabaseID</title>

DatabaseID()

Syntax

DatabaseID = DatabaseID(#Database)

Description

Returns the unique ID which identifies the given '#Database' in the operating system. This
function is useful when another library needs a database reference.

Parameters

#Database

The database to use.

Return value

Returns the ID for this database connection.

Supported OS
All

<- DatabaseError() - Database Index - DatabaseQuery() ->


text:
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">

  </button>

      {% assign pages = site.html_pages | sort: 'weight' %}
      {% for site_page in pages %}
        {% if site_page.title %}
          {% unless site_page.url contains 'page' or site_page.url contains 'tags' or site_page.url contains 'what' or site_page.url contains 'articles' or site_page.url contains 'elements' or site_page.url contains 'docs'%}
            {{ site_page.title }}
          {% endunless %}
        {% endif %}
      {% endfor %}


text:
AppKit.register Customer do
    show_in_navigation true
    icon 'user'

    action :deactivate, :if => :active do |customer|
        customer.update(active: false)
    end
    action :deactivate2, :if => :active do |customer|
        customer.update(active: false)
    end

    field :name, editable: false, :sort_field => :first_name,
      show_in_filters: false
    field :first_name, show_in_table: false, show_in_details: false
    field :last_name, show_in_table: false, show_in_details: false
    field :email, formatter: :email
    field :phone_number, :formatter => :phone
    field :active
    field :created_at, show_in_table: false, editable: false
    field :updated_at, show_in_table: false, editable: false

end