text:
#import "SyphonServerDirectory.h"
#import "SyphonServer.h"
#import "SyphonClient.h"
#import "SyphonImage.h"

/*! \mainpage Syphon Framework
 @section intro_sec Developing with Syphon

 Developing with Syphon

Servers

Finding Servers

Clients

Syphon.framework in a Plugin

More examples and help

Framework development

 @section introduction Developing with Syphon

 The Syphon framework provides the classes necessary to add Syphon support to your application. SyphonServer is used to make frames available to other applications. SyphonServerDirectory is used to discover available servers. SyphonClient is used to connect to and receive frames from a SyphonServer.

 The framework requires MacOS X 10.6 or later. Syphon makes use of IOSurface, which is a 10.6-only technology. Syphon takes advantage of other 10.6 features such as blocks, and is compatible with garbage-collection.

 To include Syphon in your application, follow these steps:

Add the framework to your Xcode project.

The simplest way is to drag it to the Frameworks group in the project window.

Link your application with Syphon at build time.

Add the framework to the Link Binary With Libraries build phase of your application's target.

Copy the framework into your application's bundle.

Add a new Copy Files build phase to your application's target.

 Select Frameworks as the destination.

 Drag the Syphon framework into the build phase.

Import the headers.

\#import <Syphon/Syphon.h> in any file where you want to use Syphon classes.

 @section servers Servers

 Class documentation: SyphonServer

 Create a server:

 @code
 SyphonServer *myServer = [[SyphonServer alloc] initWithName:@"My Output" context:myContext options:nil];
 @endcode

 and then publish new frames (you can also use GL_TEXTURE_2D textures):

 @code
 [myServer publishFrameTexture:myTex textureTarget:GL_TEXTURE_RECTANGLE_EXT imageRegion:NSMakeRect(0, 0, width, height) textureDimensions:NSMakeSize(width, height) flipped:NO];
 @endcode

 Alternatively there are methods to bind and unbind the server to the OpenGL context, so you can draw into it directly.
 You can publish new frames as often as you like, but if you only publish when you have a frame different from the previous one, then clients can do less work.
 You must stop the server when you are finished with it:

 @code
 [myServer stop];
 @endcode

 @section finding-servers Finding Servers

 Class documentation: SyphonServerDirectory

 SyphonServerDirectory handles server discovery for you. You can get an array of dictionaries describing available servers:

 @code
 NSArray *available = [[SyphonServerDirectory sharedDirectory] servers];
 @endcode

 The servers property can be observed for changes, or you can register to receive the notifications posted by SyphonServerDirectory.

 Server description dictionaries are used by Syphon when you create a client, and also contain information you can use to describe available servers in your UI:

 @code
 [myMenuItem setTitle:[description objectForKey:SyphonServerDescriptionNameKey]];
 @endcode

 @section clients Clients

 Class documentation: SyphonClient, SyphonImage

 Usually you create a client with a server description dictionary you obtained from SyphonServerDirectory:

 @code
 SyphonClient *myClient = [[SyphonClient alloc] initWithServerDescription:description options:nil newFrameHandler:^(SyphonClient *client) {
	[myView setNeedsDisplay:YES];
 }];
 @endcode

 The new-frame handler is optional: you can pass in nil. Here we use it to tell a view it needs to draw whenever the client receives a frame.

 When you are ready to draw:

 @code
 SyphonImage *myFrame = [myClient newFrameImageForContext:cgl_ctx];
 if (myFrame)
 {
	GLuint tex = myFrame.textureName;
	NSSize dimensions = myFrame.textureSize;

	// YOUR OPENGL DRAWING CODE HERE

	[myFrame release];
 }
 @endcode

 As with servers, you must stop the client when you are finished with it:

 @code
 [myClient stop];
 @endcode

 @section plugins Syphon.framework in a Plugin

 If you are using Syphon in any sort of plugin, please download the framework source and compile a version of the framework with unique class names. This avoids class-name conflicts if another plugin or the host application also embeds the Syphon framework. The framework source is set up to make this easy for you: you just need to change one build setting.

Open the framework's Xcode project.

Define SYPHON_UNIQUE_CLASS_NAME_PREFIX using the Preprocessor Macros build setting.

Select the Syphon target in the project window.

 Click the Build Settings tab to display the build settings.

 Scroll down (or use the search field) to find the Preprocessor Macros (GCC_PREPROCESSOR_DEFINITIONS) setting.

 Double click the setting to add SYPHON_UNIQUE_CLASS_NAME_PREFIX=MyPluginName as a macro.

Build the framework.

The built framework will have custom class names. The headers alias the custom names, so you can use SyphonServer, SyphonClient, SyphonImage and SyphonServerDirectory as normal in your code.

 @section help More examples and help

 Example projects implementing a server and client are included with the Syphon SDK. You can also examine the source to the provided Syphon implementations at their Google Code project.

 Use the Syphon developer forum to ask questions, and for any development related discussion.

 Good luck!

 @section framework_dev Framework development

 If you'd like to examine the framework's source code, report a bug, or get involved in development, head on over to the Syphon framework Google Code project.

 */


text:
category: egr202-2017
layout: project
---

redpajama_set_name: RedPajamaGithub


text:
Fabricator(:testimonial) do
  member
  text { Faker::Lorem.paragraph }
end


text:
package com.lesson.hometask;

public class Square {

    public double l;

    public Square(double len) {
        this.l = len;
    }

    public double area() {
        return this.l * this.l;
    }
}


text:
Template.signUp.events({
  'submit form#sign-up-form': function(event) {
    event.preventDefault();

    //@todo: Validate signup form
    var item = {
      email: event.target.email.value,
      username: event.target.username.value,
      password: event.target.password.value,
      profile: {}
    };

    Accounts.createUser(item, function(error) {
      if (error) {
        //@todo: toast the error
        console.log(error);
      }

      Router.go('profile');
    });
  }
});


text:
using namespace llvm;

#define DEBUG_TYPE "sink"

STATISTIC(NumSunk, "Number of instructions sunk");
STATISTIC(NumSinkIter, "Number of sinking iterations");

namespace {
  class Sinking : public FunctionPass {
    DominatorTree *DT;
    LoopInfo *LI;
    AliasAnalysis *AA;

  public:
    static char ID; // Pass identification
    Sinking() : FunctionPass(ID) {
      initializeSinkingPass(*PassRegistry::getPassRegistry());
    }

    bool runOnFunction(Function &F) override;

    void getAnalysisUsage(AnalysisUsage &AU) const override {
      AU.setPreservesCFG();
      FunctionPass::getAnalysisUsage(AU);
      AU.addRequired<AAResultsWrapperPass>();
      AU.addRequired<DominatorTreeWrapperPass>();
      AU.addRequired<LoopInfoWrapperPass>();
      AU.addPreserved<DominatorTreeWrapperPass>();
      AU.addPreserved<LoopInfoWrapperPass>();
    }
  private:
    bool ProcessBlock(BasicBlock &BB);
    bool SinkInstruction(Instruction *I, SmallPtrSetImpl<Instruction*> &Stores);
    bool AllUsesDominatedByBlock(Instruction *Inst, BasicBlock *BB) const;
    bool IsAcceptableTarget(Instruction *Inst, BasicBlock *SuccToSinkTo) const;
  };
} // end anonymous namespace

char Sinking::ID = 0;
INITIALIZE_PASS_BEGIN(Sinking, "sink", "Code sinking", false, false)
INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
INITIALIZE_PASS_END(Sinking, "sink", "Code sinking", false, false)

FunctionPass *llvm::createSinkingPass() { return new Sinking(); }

/// AllUsesDominatedByBlock - Return true if all uses of the specified value
/// occur in blocks dominated by the specified block.
bool Sinking::AllUsesDominatedByBlock(Instruction *Inst,
                                      BasicBlock *BB) const {
  // Ignoring debug uses is necessary so debug info doesn't affect the code.
  // This may leave a referencing dbg_value in the original block, before
  // the definition of the vreg.  Dwarf generator handles this although the
  // user might not get the right info at runtime.
  for (Use &U : Inst->uses()) {
    // Determine the block of the use.
    Instruction *UseInst = cast<Instruction>(U.getUser());
    BasicBlock *UseBlock = UseInst->getParent();
    if (PHINode *PN = dyn_cast<PHINode>(UseInst)) {
      // PHI nodes use the operand in the predecessor block, not the block with
      // the PHI.
      unsigned Num = PHINode::getIncomingValueNumForOperand(U.getOperandNo());
      UseBlock = PN->getIncomingBlock(Num);
    }
    // Check that it dominates.
    if (!DT->dominates(BB, UseBlock))
      return false;
  }
  return true;
}

bool Sinking::runOnFunction(Function &F) {
  DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
  LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
  AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();

  bool MadeChange, EverMadeChange = false;

  do {
    MadeChange = false;
    DEBUG(dbgs() << "Sinking iteration " << NumSinkIter << "\n");
    // Process all basic blocks.
    for (Function::iterator I = F.begin(), E = F.end();
         I != E; ++I)
      MadeChange |= ProcessBlock(*I);
    EverMadeChange |= MadeChange;
    NumSinkIter++;
  } while (MadeChange);

  return EverMadeChange;
}

bool Sinking::ProcessBlock(BasicBlock &BB) {
  // Can't sink anything out of a block that has less than two successors.
  if (BB.getTerminator()->getNumSuccessors() <= 1) return false;

  // Don't bother sinking code out of unreachable blocks. In addition to being
  // unprofitable, it can also lead to infinite looping, because in an
  // unreachable loop there may be nowhere to stop.
  if (!DT->isReachableFromEntry(&BB)) return false;

  bool MadeChange = false;

  // Walk the basic block bottom-up.  Remember if we saw a store.
  BasicBlock::iterator I = BB.end();
  --I;
  bool ProcessedBegin = false;
  SmallPtrSet<Instruction *, 8> Stores;
  do {
    Instruction *Inst = &*I; // The instruction to sink.

    // Predecrement I (if it's not begin) so that it isn't invalidated by
    // sinking.
    ProcessedBegin = I == BB.begin();
    if (!ProcessedBegin)
      --I;

    if (isa<DbgInfoIntrinsic>(Inst))
      continue;

    if (SinkInstruction(Inst, Stores))
      ++NumSunk, MadeChange = true;

    // If we just processed the first instruction in the block, we're done.
  } while (!ProcessedBegin);

  return MadeChange;
}

static bool isSafeToMove(Instruction *Inst, AliasAnalysis *AA,
                         SmallPtrSetImpl<Instruction *> &Stores) {

  if (Inst->mayWriteToMemory()) {
    Stores.insert(Inst);
    return false;
  }

  if (LoadInst *L = dyn_cast<LoadInst>(Inst)) {
    MemoryLocation Loc = MemoryLocation::get(L);
    for (Instruction *S : Stores)
      if (AA->getModRefInfo(S, Loc) & MRI_Mod)
        return false;
  }

  if (isa<TerminatorInst>(Inst) || isa<PHINode>(Inst) || Inst->isEHPad() ||
      Inst->mayThrow())
    return false;

  // Convergent operations cannot be made control-dependent on additional
  // values.
  if (auto CS = CallSite(Inst)) {
    if (CS.hasFnAttr(Attribute::Convergent))
      return false;
  }

  return true;
}

/// IsAcceptableTarget - Return true if it is possible to sink the instruction
/// in the specified basic block.
bool Sinking::IsAcceptableTarget(Instruction *Inst,
                                 BasicBlock *SuccToSinkTo) const {
  assert(Inst && "Instruction to be sunk is null");
  assert(SuccToSinkTo && "Candidate sink target is null");

  // It is not possible to sink an instruction into its own block.  This can
  // happen with loops.
  if (Inst->getParent() == SuccToSinkTo)
    return false;

  // It's never legal to sink an instruction into a block which terminates in an
  // EH-pad.
  if (SuccToSinkTo->getTerminator()->isExceptional())
    return false;

  // If the block has multiple predecessors, this would introduce computation
  // on different code paths.  We could split the critical edge, but for now we
  // just punt.
  // FIXME: Split critical edges if not backedges.
  if (SuccToSinkTo->getUniquePredecessor() != Inst->getParent()) {
    // We cannot sink a load across a critical edge - there may be stores in
    // other code paths.
    if (!isSafeToSpeculativelyExecute(Inst))
      return false;

    // We don't want to sink across a critical edge if we don't dominate the
    // successor. We could be introducing calculations to new code paths.
    if (!DT->dominates(Inst->getParent(), SuccToSinkTo))
      return false;

    // Don't sink instructions into a loop.
    Loop *succ = LI->getLoopFor(SuccToSinkTo);
    Loop *cur = LI->getLoopFor(Inst->getParent());
    if (succ != nullptr && succ != cur)
      return false;
  }

  // Finally, check that all the uses of the instruction are actually
  // dominated by the candidate
  return AllUsesDominatedByBlock(Inst, SuccToSinkTo);
}

/// SinkInstruction - Determine whether it is safe to sink the specified machine
/// instruction out of its current block into a successor.
bool Sinking::SinkInstruction(Instruction *Inst,
                              SmallPtrSetImpl<Instruction *> &Stores) {

  // Don't sink static alloca instructions.  CodeGen assumes allocas outside the
  // entry block are dynamically sized stack objects.
  if (AllocaInst *AI = dyn_cast<AllocaInst>(Inst))
    if (AI->isStaticAlloca())
      return false;

  // Check if it's safe to move the instruction.
  if (!isSafeToMove(Inst, AA, Stores))
    return false;

  // FIXME: This should include support for sinking instructions within the
  // block they are currently in to shorten the live ranges.  We often get
  // instructions sunk into the top of a large block, but it would be better to
  // also sink them down before their first use in the block.  This xform has to
  // be careful not to *increase* register pressure though, e.g. sinking
  // "x = y + z" down if it kills y and z would increase the live ranges of y
  // and z and only shrink the live range of x.

  // SuccToSinkTo - This is the successor to sink this instruction to, once we
  // decide.
  BasicBlock *SuccToSinkTo = nullptr;

  // Instructions can only be sunk if all their uses are in blocks
  // dominated by one of the successors.
  // Look at all the postdominators and see if we can sink it in one.
  DomTreeNode *DTN = DT->getNode(Inst->getParent());
  for (DomTreeNode::iterator I = DTN->begin(), E = DTN->end();
      I != E && SuccToSinkTo == nullptr; ++I) {
    BasicBlock *Candidate = (*I)->getBlock();
    if ((*I)->getIDom()->getBlock() == Inst->getParent() &&
        IsAcceptableTarget(Inst, Candidate))
      SuccToSinkTo = Candidate;
  }

  // If no suitable postdominator was found, look at all the successors and
  // decide which one we should sink to, if any.
  for (succ_iterator I = succ_begin(Inst->getParent()),
      E = succ_end(Inst->getParent()); I != E && !SuccToSinkTo; ++I) {
    if (IsAcceptableTarget(Inst, *I))
      SuccToSinkTo = *I;
  }

  // If we couldn't find a block to sink to, ignore this instruction.
  if (!SuccToSinkTo)
    return false;

  DEBUG(dbgs() << "Sink" << *Inst << " (";
        Inst->getParent()->printAsOperand(dbgs(), false);
        dbgs() << " -> ";
        SuccToSinkTo->printAsOperand(dbgs(), false);
        dbgs() << ")\n");

  // Move the instruction.
  Inst->moveBefore(&*SuccToSinkTo->getFirstInsertionPt());
  return true;
}


text:
package templates

//line examples/basicserver/templates/mainpage.qtpl:3
import "github.com/valyala/fasthttp"

//line examples/basicserver/templates/mainpage.qtpl:5
import (
	qtio422016 "io"

	qt422016 "github.com/valyala/quicktemplate"
)

//line examples/basicserver/templates/mainpage.qtpl:5
var (
	_ = qtio422016.Copy
	_ = qt422016.AcquireByteBuffer
)

//line examples/basicserver/templates/mainpage.qtpl:6
type MainPage struct {
	CTX *fasthttp.RequestCtx
}

//line examples/basicserver/templates/mainpage.qtpl:12
func (p *MainPage) StreamTitle(qw422016 *qt422016.Writer) {
//line examples/basicserver/templates/mainpage.qtpl:12
	qw422016.N().S(`
	This is the main page
`)
//line examples/basicserver/templates/mainpage.qtpl:14
}

//line examples/basicserver/templates/mainpage.qtpl:14
func (p *MainPage) WriteTitle(qq422016 qtio422016.Writer) {
//line examples/basicserver/templates/mainpage.qtpl:14
	qw422016 := qt422016.AcquireWriter(qq422016)
//line examples/basicserver/templates/mainpage.qtpl:14
	p.StreamTitle(qw422016)
//line examples/basicserver/templates/mainpage.qtpl:14
	qt422016.ReleaseWriter(qw422016)
//line examples/basicserver/templates/mainpage.qtpl:14
}

//line examples/basicserver/templates/mainpage.qtpl:14
func (p *MainPage) Title() string {
//line examples/basicserver/templates/mainpage.qtpl:14
	qb422016 := qt422016.AcquireByteBuffer()
//line examples/basicserver/templates/mainpage.qtpl:14
	p.WriteTitle(qb422016)
//line examples/basicserver/templates/mainpage.qtpl:14
	qs422016 := string(qb422016.B)
//line examples/basicserver/templates/mainpage.qtpl:14
	qt422016.ReleaseByteBuffer(qb422016)
//line examples/basicserver/templates/mainpage.qtpl:14
	return qs422016
//line examples/basicserver/templates/mainpage.qtpl:14
}

//line examples/basicserver/templates/mainpage.qtpl:17
func (p *MainPage) StreamBody(qw422016 *qt422016.Writer) {
//line examples/basicserver/templates/mainpage.qtpl:17
	qw422016.N().S(`

Main page

		Click links below:

Table page

Error page

		Some info about you:

		IP: `)
//line examples/basicserver/templates/mainpage.qtpl:28
	qw422016.E().S(p.CTX.RemoteIP().String())
//line examples/basicserver/templates/mainpage.qtpl:28
	qw422016.N().S(`

		User-Agent: `)
//line examples/basicserver/templates/mainpage.qtpl:29
	qw422016.E().Z(p.CTX.UserAgent())
//line examples/basicserver/templates/mainpage.qtpl:29
	qw422016.N().S(`

`)
//line examples/basicserver/templates/mainpage.qtpl:31
}

//line examples/basicserver/templates/mainpage.qtpl:31
func (p *MainPage) WriteBody(qq422016 qtio422016.Writer) {
//line examples/basicserver/templates/mainpage.qtpl:31
	qw422016 := qt422016.AcquireWriter(qq422016)
//line examples/basicserver/templates/mainpage.qtpl:31
	p.StreamBody(qw422016)
//line examples/basicserver/templates/mainpage.qtpl:31
	qt422016.ReleaseWriter(qw422016)
//line examples/basicserver/templates/mainpage.qtpl:31
}

//line examples/basicserver/templates/mainpage.qtpl:31
func (p *MainPage) Body() string {
//line examples/basicserver/templates/mainpage.qtpl:31
	qb422016 := qt422016.AcquireByteBuffer()
//line examples/basicserver/templates/mainpage.qtpl:31
	p.WriteBody(qb422016)
//line examples/basicserver/templates/mainpage.qtpl:31
	qs422016 := string(qb422016.B)
//line examples/basicserver/templates/mainpage.qtpl:31
	qt422016.ReleaseByteBuffer(qb422016)
//line examples/basicserver/templates/mainpage.qtpl:31
	return qs422016
//line examples/basicserver/templates/mainpage.qtpl:31
}


text:
layout: post100adm
title:  Overview
categories: XAP100ADM
parent: replication.html
weight: 50
---

{% summary %}  {% endsummary %}

Replication is the process of duplicating or copying application data and operations, from a source space to a target space, or to multiple target spaces. Replication is used mainly for high-availability, where a replica space is running in backup mode or for sharing local site data with remote sites. The operations that are replicated are the modifying operations, i.e. those that actually affect the data that is stored in the space instance, such as Write/Take/Update and Lease cancel/renewal.

# Replication Topologies

The replication topologies are split into three groups:

1. Primary backup
1. Primary backup with a mirror (reliable asynchronous replication)
1. Active-Active (fully replicated)

## Primary-Backup

This topology consists of a group of space instances that are part of the same replication group, one of the space instances is elected and serves as the primary space instance of the group. The application interaction is done with the primary instance while the other instances are serving as the backups of the primary. The backup space instances are an exact replica of the primary and if the primary instance fails they are ready to immediately replace it. This happens without any data loss and is transparent to the space proxy connected to the space instances.

## Primary-Backup with a Mirror

This topology extends the previous one by having a mirror service that is part of the primary backup replication group. The mirror service receives the replication data from the primary space instance asynchronously. However, the replication data is kept in a backlog both in the primary and the backups space instances until the mirror acknowledge that is received the replication data. This way, in case of a primary failure, the replacing backup space instance will make sure that the mirror does not lose any replication data, hence the terminology - reliable asynchronous replication.

## Active active

This topology consists of a group of space instances that are part of the same replication group, unlike primary backup, all of the space instances are active and the application interacts with all of them. The common usage in this case is to have this topology as part of a multi site deployment where each site is interacting with the local space instance while having all the operations replicated and kept in the other sites as well. Each space instance replicates its data to all the other members thus having all the space instances holding the data of each other.

{% refer %}For more info refer to [Replication Topologies](./replication-topologies.html){% endrefer %}

# Replication Modes

There are two replication modes:

1. Synchronous replication - the data is replicated as part of the modifying space operation
1. Asynchronous replication - the data is replicated asynchronously to the space operation

The common usage of these modes is synchronous for Primary-Backup topology and asynchronous for Active-Active topologies.

## Synchronous Replication

With synchronous replication, the client receives acknowledgement for any replicated operations only after all the space instances in the replication group have performed the operation.
![replication-matrix-IMG503.jpg](/attachment_files/replication-matrix-IMG503.jpg)

{% refer %}For more info refer to [Synchronous Replication](./synchronous-replication.html){% endrefer %}

## Asynchronous replication

With asynchronous replication, operations are performed in the source space instance, and acknowledgement is immediately returned to the client.
![replication-matrix-IMG504.jpg](/attachment_files/replication-matrix-IMG504.jpg)
Operations are accumulated in the source space and sent asynchronously to the target space, after a predefined period of time has elapsed, or after a predefined number of operations have been performed (the first of the two to occur). The downside of this replication mode is the possibility of data loss if the source space fails while transferring the accumulated operations to the target space. Another problem is data consistency - the source and the target do not have identical data at all times.

{% refer %}For more info refer to [Asynchronous Replication](./asynchronous-replication.html){% endrefer %}

## Replication During Disconnections Between Space Instances

In both replication modes, when a target space instance is not available, the client will receive an acknowledgement from the source space instance. The operation on the target space instance is performed only when the source space instance re-establishes the connection with the target space instance. The source space instance keeps a backlog of all replicated operations until it is able to re-establish a connection with the target space instance.

The table below shows a conceptual comparison between synchronous and asynchronous replication.

{: .table .table-bordered}
| Aspect | Synchronous Replication | Asynchronous Replication |
|:-------|:------------------------|:-------------------------|
| Data loss | Each space operation waits until completion is confirmed at the source space instance, as well as the target space instances. | May sometimes lose some data (latest operations) if there is a failure at the source space instance. |
| Latency | Less tolerant to high network latency | Highly tolerant of network latency, and can be used when the space instances are located in different geographical sites (different cities). |
| Performance Impact | Cliensx must wait for confirmation of each space operation from the source and target space instances.{% wbr %}Performance is mainly dependent on source space instances resources (CPU/memory), target space instance resources (CPU/memory), and the network bandwidth and latency between the source space and the target space instances. | Client is acknowledged immediately after the source space instances has processed incoming operations.{% wbr %}Performance is mainly dependent on source space resources (CPU/memory). |
| Data Integrity | Very accurate | Less accurate |

## Configuration

There are many parameters that configure the replication behavior. For a full list of the parameters see [Replication Parameters](./replication-parameters.html).

## Monitoring and Statistics

The replication module can be monitored and exposes various statistics using the [Administration and Monitoring API]({%currentjavaurl%}/administration-and-monitoring-api.html) via [Replication Statistics](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/com/j_spaces/core/filters/ReplicationStatistics.html)


text:
		<form name="myForm" class="form-horizontal" role="form">

cobrancavd.HMO@conduent.com

						<md-input-container class="md-block" flex-gt-sm>
							Cc:
							<input type="text" class="form-control;" data-ng-model="mail.Cc">
						</md-input-container>

						<md-input-container class="md-block" flex-gt-sm>
							Asunto:
							<input type="text" class="form-control;" data-ng-model="mail.Subject" required>
						</md-input-container>

					<md-input-container>
						Seleccionar Plantilla
						<md-select ng-model="mail.Body" required>
							<md-option ng-repeat="route in routes" ng-value="route.Path">
								{{route.Name}}
							</md-option>
							<md-option ng-option value="custom">
								Custom Email
							</md-option>
						</md-select>
					</md-input-container>

							<md-input-container class="md-block; col-sm-5;">
								Custom E-mail
								<textarea required="true" md-maxlength="2000" rows="4" md-select-on-focus style="width: 380px;" ng-model="mail.CustomMail"></textarea>
							</md-input-container>

						<button ng-disabled="myForm.$invalid" type="submit" class="btn btn-success waves-effect" ng-click="sendMails(mail)" style="position:relative; top:230px; left:25px;">Enviar E-mails</button>

		</form>


text:
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
from django.db.backends.mysql.features import (
    DatabaseFeatures as MySQLDatabaseFeatures,
)
from django.utils.functional import cached_property

class DatabaseFeatures(BaseSpatialFeatures, MySQLDatabaseFeatures):
    has_spatialrefsys_table = False
    supports_add_srs_entry = False
    supports_distance_geodetic = False
    supports_length_geodetic = False
    supports_area_geodetic = False
    supports_transform = False
    supports_real_shape_operations = False
    supports_null_geometries = False
    supports_num_points_poly = False

    @cached_property
    def supports_empty_geometry_collection(self):
        return self.connection.mysql_version >= (5, 7, 5)


text:
namespace NSBPerf.Observer.StepA
{
    using System.Threading;
    using Messages;
    using NServiceBus;
    using Producer.Messages;

    /*
		This class configures this endpoint as a Server. More information about how to configure the NServiceBus host
		can be found here: http://particular.net/articles/the-nservicebus-host
	*/
    public class EndpointConfig : IConfigureThisEndpoint, AsA_Server
    {
        public void Customize(BusConfiguration configuration)
        {
            configuration.UsePersistence<NHibernatePersistence>();
        }
    }

    public class WorkReceivedHandler : IHandleMessages<WorkReceived>
    {
        public IBus Bus { get; set; }
        public void Handle(WorkReceived message)
        {
            //Thread.Sleep(150);
            Bus.Publish(new StepADone { WorkId = message.WorkId });
        }
    }
}


text:
using System.Collections.Generic;
using System.Linq;
using Mono.Cecil;

namespace DotAspect.BuildTask.PostProcessing
{
    class ModuleAspectCodeInjector
    {
        private readonly ModuleDefinition _module;
        private readonly IClassAspectInjector _codeInjector;
        private readonly TypeDefinition _objectType;

        public ModuleAspectCodeInjector(ModuleDefinition module, IClassAspectInjector codeInjector)
        {
            _module = module;
            _codeInjector = codeInjector;
            _objectType = _module.ImportReference(typeof(object)).Resolve();
        }

        public void Process()
        {
            var typesToProcess = _module.Types
                .SelectMany(GetTypeTypeAndChildren)
                .Where(t => t.IsClass);

            foreach (var typeDefinition in typesToProcess)
            {
                _codeInjector.Process(typeDefinition);
            }
        }

        IEnumerable<TypeDefinition> GetTypeTypeAndChildren(TypeDefinition type)
        {
            if (type == null || type.FullName == _objectType.FullName)
                return Enumerable.Empty<TypeDefinition>();

            return Enumerable.Repeat(type, 1).Concat(type.NestedTypes);
        }
    }
}


text:
module Heaven
  # Top-level module for providers.
  module Provider
    # The shell provider.
    class Shell < DefaultProvider
      def initialize(guid, payload)
        super
        @name = "shell"
      end

      def execute
        return execute_and_log(["/usr/bin/true"]) if Rails.env.test?

        unless File.exist?(checkout_directory)
          log "Cloning #{repository_url} into #{checkout_directory}"
          execute_and_log(["git", "clone", clone_url, checkout_directory])
        end

        Dir.chdir(checkout_directory) do
          log "Fetching the latest code"
          execute_and_log(%w{git fetch})
          execute_and_log(["git", "reset", "--hard", sha])
          Bundler.with_clean_env do
            log "Executing script: #{deployment_command}"
            execute_and_log([deployment_command], deployment_environment)
          end
        end
      end

      private

      def deployment_command
        script = custom_payload_config.try(:[], "deploy_script")
        fail "No deploy script configured." unless script
        fail "Only deploy scripts from the repo are allowed." unless script =~ /\A([\w-]+\/)*[\w-]+(\.\w+)?\Z/
        fail "Deploy script #{script} not found or not executable" unless File.executable?("./" + script)
        "./" + script
      end

      def deployment_environment
        {
          "BRANCH" => ref,
          "SHA" => sha,
          "DEPLOY_ENV" => environment,
          "DEPLOY_TASK" => task
        }
      end

      def task
        name = deployment_data["task"] || "deploy"
        unless name =~ /deploy(?:\:[\w+:]+)?/
          fail "Invalid taskname: #{name.inspect}"
        end
        name
      end
    end
  end
end


text:
#pragma once

#include "render_factory.h"
#include "radeon_rays_cl.h"
#include "CLW.h"

#include "SceneGraph/clwscene.h"

#include <memory>
#include <string>

namespace Baikal
{
    /**
     \brief RenderFactory class is in charge of render entities creation.

     \details RenderFactory makes sure renderer objects are compatible between
     each other since many of them might use either CPU or GPU implementation.
     Entities create via the same factory are known to be compatible.
     */
    class ClwRenderFactory : public RenderFactory<ClwScene>
    {
    public:
        ClwRenderFactory(CLWContext context, std::string const& cache_path="");

        // Create a renderer of specified type
        std::unique_ptr<Renderer>
            CreateRenderer(RendererType type) const override;
        // Create an output of specified type
        std::unique_ptr<Output>
            CreateOutput(std::uint32_t w, std::uint32_t h) const override;
        // Create post effect of specified type
        std::unique_ptr<PostEffect>
            CreatePostEffect(PostEffectType type) const override;

        std::unique_ptr<SceneController<ClwScene>>
            CreateSceneController() const override;

    private:
        CLWContext m_context;
        std::string m_cache_path;

        using RadeonRaysInstanceDelete = decltype(RadeonRays::IntersectionApi::Delete);

        std::shared_ptr<RadeonRays::IntersectionApi> m_intersector;
    };
}


text:
FactoryGirl.define do
  factory :role do
    name 'manager'

    trait :admin do
      name 'admin'
    end
  end
end


text:
package armapimanagement_test

import (
	"context"
	"testing"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil"
	"github.com/stretchr/testify/suite"
)

type ApimproductsTestSuite struct {
	suite.Suite

	ctx               context.Context
	cred              azcore.TokenCredential
	options           *arm.ClientOptions
	apiId             string
	groupId           string
	productId         string
	serviceName       string
	tagId             string
	location          string
	resourceGroupName string
	subscriptionId    string
}

func (testsuite *ApimproductsTestSuite) SetupSuite() {
	testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/apimanagement/armapimanagement/testdata")
	testsuite.ctx = context.Background()
	testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T())
	testsuite.apiId = testutil.GenerateAlphaNumericID(testsuite.T(), "productapiid", 6)
	testsuite.groupId = testutil.GenerateAlphaNumericID(testsuite.T(), "productgroupid", 6)
	testsuite.productId = testutil.GenerateAlphaNumericID(testsuite.T(), "productid", 6)
	testsuite.serviceName = testutil.GenerateAlphaNumericID(testsuite.T(), "serviceproduct", 6)
	testsuite.tagId = testutil.GenerateAlphaNumericID(testsuite.T(), "producttagid", 6)
	testsuite.location = testutil.GetEnv("LOCATION", "westus")
	testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup")
	testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")

	resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location)
	testsuite.Require().NoError(err)
	testsuite.resourceGroupName = *resourceGroup.Name
	testsuite.Prepare()
}

func (testsuite *ApimproductsTestSuite) TearDownSuite() {
	testsuite.Cleanup()
	_, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName)
	testsuite.Require().NoError(err)
	testutil.StopRecording(testsuite.T())
}

func TestApimproductsTestSuite(t *testing.T) {
	suite.Run(t, new(ApimproductsTestSuite))
}

func (testsuite *ApimproductsTestSuite) Prepare() {
	var err error
	// From step ApiManagementService_CreateOrUpdate
	serviceClient, err := armapimanagement.NewServiceClient(testsuite.subscriptionId, testsuite.cred, testsuite.options)
	testsuite.Require().NoError(err)
	serviceClientCreateOrUpdateResponsePoller, err := serviceClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, armapimanagement.ServiceResource{
		Tags: map[string]*string{
			"Name": to.Ptr("Contoso"),
			"Test": to.Ptr("User"),
		},
		Location: to.Ptr(testsuite.location),
		Properties: &armapimanagement.ServiceProperties{
			PublisherEmail: to.Ptr("foo@contoso.com"),
			PublisherName:  to.Ptr("foo"),
		},
		SKU: &armapimanagement.ServiceSKUProperties{
			Name:     to.Ptr(armapimanagement.SKUTypeStandard),
			Capacity: to.Ptr[int32](1),
		},
	}, nil)
	testsuite.Require().NoError(err)
	_, err = testutil.PollForTest(testsuite.ctx, serviceClientCreateOrUpdateResponsePoller)
	testsuite.Require().NoError(err)

	// From step Product_CreateOrUpdate
	productClient, err := armapimanagement.NewProductClient(testsuite.subscriptionId, testsuite.cred, testsuite.options)
	testsuite.Require().NoError(err)
	_, err = productClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, armapimanagement.ProductContract{
		Properties: &armapimanagement.ProductContractProperties{
			DisplayName: to.Ptr("Test Template ProductName 4"),
		},
	}, &armapimanagement.ProductClientCreateOrUpdateOptions{IfMatch: nil})
	testsuite.Require().NoError(err)
}

// Microsoft.ApiManagement/service/products
func (testsuite *ApimproductsTestSuite) TestProduct() {
	var err error
	// From step Product_GetEntityTag
	productClient, err := armapimanagement.NewProductClient(testsuite.subscriptionId, testsuite.cred, testsuite.options)
	testsuite.Require().NoError(err)
	_, err = productClient.GetEntityTag(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, nil)
	testsuite.Require().NoError(err)

	// From step Product_ListByService
	productClientNewListByServicePager := productClient.NewListByServicePager(testsuite.resourceGroupName, testsuite.serviceName, &armapimanagement.ProductClientListByServiceOptions{Filter: nil,
		Top:          nil,
		Skip:         nil,
		ExpandGroups: nil,
		Tags:         nil,
	})
	for productClientNewListByServicePager.More() {
		_, err := productClientNewListByServicePager.NextPage(testsuite.ctx)
		testsuite.Require().NoError(err)
		break
	}

	// From step Product_Get
	_, err = productClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, nil)
	testsuite.Require().NoError(err)

	// From step Product_ListByTags
	productClientNewListByTagsPager := productClient.NewListByTagsPager(testsuite.resourceGroupName, testsuite.serviceName, &armapimanagement.ProductClientListByTagsOptions{Filter: nil,
		Top:                      nil,
		Skip:                     nil,
		IncludeNotTaggedProducts: nil,
	})
	for productClientNewListByTagsPager.More() {
		_, err := productClientNewListByTagsPager.NextPage(testsuite.ctx)
		testsuite.Require().NoError(err)
		break
	}

	// From step Product_Update
	_, err = productClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, "*", armapimanagement.ProductUpdateParameters{
		Properties: &armapimanagement.ProductUpdateProperties{
			DisplayName: to.Ptr("Test Template ProductName 4"),
		},
	}, nil)
	testsuite.Require().NoError(err)
}

// Microsoft.ApiManagement/service/products/apis
func (testsuite *ApimproductsTestSuite) TestProductapi() {
	var err error
	// From step Api_CreateOrUpdate
	aPIClient, err := armapimanagement.NewAPIClient(testsuite.subscriptionId, testsuite.cred, testsuite.options)
	testsuite.Require().NoError(err)
	aPIClientCreateOrUpdateResponsePoller, err := aPIClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.apiId, armapimanagement.APICreateOrUpdateParameter{
		Properties: &armapimanagement.APICreateOrUpdateProperties{
			Path:   to.Ptr("petstore"),
			Format: to.Ptr(armapimanagement.ContentFormatOpenapiLink),
			Value:  to.Ptr("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml"),
		},
	}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
	testsuite.Require().NoError(err)
	_, err = testutil.PollForTest(testsuite.ctx, aPIClientCreateOrUpdateResponsePoller)
	testsuite.Require().NoError(err)

	// From step ProductApi_CreateOrUpdate
	productAPIClient, err := armapimanagement.NewProductAPIClient(testsuite.subscriptionId, testsuite.cred, testsuite.options)
	testsuite.Require().NoError(err)
	_, err = productAPIClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, testsuite.apiId, nil)
	testsuite.Require().NoError(err)

	// From step ProductApi_CheckEntityExists
	_, err = productAPIClient.CheckEntityExists(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, testsuite.apiId, nil)
	testsuite.Require().NoError(err)

	// From step ProductApi_ListByProduct
	productAPIClientNewListByProductPager := productAPIClient.NewListByProductPager(testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, &armapimanagement.ProductAPIClientListByProductOptions{Filter: nil,
		Top:  nil,
		Skip: nil,
	})
	for productAPIClientNewListByProductPager.More() {
		_, err := productAPIClientNewListByProductPager.NextPage(testsuite.ctx)
		testsuite.Require().NoError(err)
		break
	}

	// From step ProductApi_Delete
	_, err = productAPIClient.Delete(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, testsuite.apiId, nil)
	testsuite.Require().NoError(err)
}

// Microsoft.ApiManagement/service/products/groups
func (testsuite *ApimproductsTestSuite) TestProductgroup() {
	var err error
	// From step Group_CreateOrUpdate
	groupClient, err := armapimanagement.NewGroupClient(testsuite.subscriptionId, testsuite.cred, testsuite.options)
	testsuite.Require().NoError(err)
	_, err = groupClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.groupId, armapimanagement.GroupCreateParameters{
		Properties: &armapimanagement.GroupCreateParametersProperties{
			DisplayName: to.Ptr(testsuite.groupId),
		},
	}, &armapimanagement.GroupClientCreateOrUpdateOptions{IfMatch: nil})
	testsuite.Require().NoError(err)

	// From step ProductGroup_CreateOrUpdate
	productGroupClient, err := armapimanagement.NewProductGroupClient(testsuite.subscriptionId, testsuite.cred, testsuite.options)
	testsuite.Require().NoError(err)
	_, err = productGroupClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, testsuite.groupId, nil)
	testsuite.Require().NoError(err)

	// From step ProductGroup_CheckEntityExists
	_, err = productGroupClient.CheckEntityExists(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, testsuite.groupId, nil)
	testsuite.Require().NoError(err)

	// From step ProductGroup_ListByProduct
	productGroupClientNewListByProductPager := productGroupClient.NewListByProductPager(testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, &armapimanagement.ProductGroupClientListByProductOptions{Filter: nil,
		Top:  nil,
		Skip: nil,
	})
	for productGroupClientNewListByProductPager.More() {
		_, err := productGroupClientNewListByProductPager.NextPage(testsuite.ctx)
		testsuite.Require().NoError(err)
		break
	}

	// From step ProductGroup_Delete
	_, err = productGroupClient.Delete(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, testsuite.groupId, nil)
	testsuite.Require().NoError(err)
}

// Microsoft.ApiManagement/service/products/policies
func (testsuite *ApimproductsTestSuite) TestProductpolicy() {
	var err error
	// From step ProductPolicy_CreateOrUpdate
	productPolicyClient, err := armapimanagement.NewProductPolicyClient(testsuite.subscriptionId, testsuite.cred, testsuite.options)
	testsuite.Require().NoError(err)
	_, err = productPolicyClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, armapimanagement.PolicyIDNamePolicy, armapimanagement.PolicyContract{
		Properties: &armapimanagement.PolicyContractProperties{
			Format: to.Ptr(armapimanagement.PolicyContentFormatXML),
		},
	}, &armapimanagement.ProductPolicyClientCreateOrUpdateOptions{IfMatch: nil})
	testsuite.Require().NoError(err)

	// From step ProductPolicy_GetEntityTag
	_, err = productPolicyClient.GetEntityTag(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, armapimanagement.PolicyIDNamePolicy, nil)
	testsuite.Require().NoError(err)

	// From step ProductPolicy_ListByProduct
	_, err = productPolicyClient.ListByProduct(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, nil)
	testsuite.Require().NoError(err)

	// From step ProductPolicy_Get
	_, err = productPolicyClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, armapimanagement.PolicyIDNamePolicy, &armapimanagement.ProductPolicyClientGetOptions{Format: nil})
	testsuite.Require().NoError(err)

	// From step ProductPolicy_Delete
	_, err = productPolicyClient.Delete(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, armapimanagement.PolicyIDNamePolicy, "*", nil)
	testsuite.Require().NoError(err)
}

// Microsoft.ApiManagement/service/products/tags
func (testsuite *ApimproductsTestSuite) TestProducttag() {
	var err error
	// From step Tag_CreateOrUpdate
	tagClient, err := armapimanagement.NewTagClient(testsuite.subscriptionId, testsuite.cred, testsuite.options)
	testsuite.Require().NoError(err)
	_, err = tagClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.tagId, armapimanagement.TagCreateUpdateParameters{
		Properties: &armapimanagement.TagContractProperties{
			DisplayName: to.Ptr(testsuite.tagId),
		},
	}, &armapimanagement.TagClientCreateOrUpdateOptions{IfMatch: nil})
	testsuite.Require().NoError(err)

	// From step Tag_AssignToProduct
	_, err = tagClient.AssignToProduct(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, testsuite.tagId, nil)
	testsuite.Require().NoError(err)

	// From step Tag_GetEntityStateByProduct
	_, err = tagClient.GetEntityStateByProduct(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, testsuite.tagId, nil)
	testsuite.Require().NoError(err)

	// From step Tag_GetByProduct
	_, err = tagClient.GetByProduct(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, testsuite.tagId, nil)
	testsuite.Require().NoError(err)

	// From step Tag_ListByProduct
	tagClientNewListByProductPager := tagClient.NewListByProductPager(testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, &armapimanagement.TagClientListByProductOptions{Filter: nil,
		Top:  nil,
		Skip: nil,
	})
	for tagClientNewListByProductPager.More() {
		_, err := tagClientNewListByProductPager.NextPage(testsuite.ctx)
		testsuite.Require().NoError(err)
		break
	}

	// From step Tag_DetachFromProduct
	_, err = tagClient.DetachFromProduct(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, testsuite.tagId, nil)
	testsuite.Require().NoError(err)
}

// Microsoft.ApiManagement/service/products/subscriptions
func (testsuite *ApimproductsTestSuite) TestProductsubscriptions() {
	var err error
	// From step ProductSubscriptions_List
	productSubscriptionsClient, err := armapimanagement.NewProductSubscriptionsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options)
	testsuite.Require().NoError(err)
	productSubscriptionsClientNewListPager := productSubscriptionsClient.NewListPager(testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, &armapimanagement.ProductSubscriptionsClientListOptions{Filter: nil,
		Top:  nil,
		Skip: nil,
	})
	for productSubscriptionsClientNewListPager.More() {
		_, err := productSubscriptionsClientNewListPager.NextPage(testsuite.ctx)
		testsuite.Require().NoError(err)
		break
	}
}

func (testsuite *ApimproductsTestSuite) Cleanup() {
	var err error
	// From step Product_Delete
	productClient, err := armapimanagement.NewProductClient(testsuite.subscriptionId, testsuite.cred, testsuite.options)
	testsuite.Require().NoError(err)
	_, err = productClient.Delete(testsuite.ctx, testsuite.resourceGroupName, testsuite.serviceName, testsuite.productId, "*", &armapimanagement.ProductClientDeleteOptions{DeleteSubscriptions: to.Ptr(true)})
	testsuite.Require().NoError(err)
}


text:
<!DOCTYPE HTML>

<meta name="timeout" content="long">
<title>WebStorage Test: StorageEvent - set onstorage as body attribute</title>


text:
class CreateClients < ActiveRecord::Migration[5.0]
  def change
    create_table :clients do |t|
      t.string :name
      t.string :address
      t.string :gender, limit: 1
      t.string :country_of_origin, limit: 2
      t.datetime :started_us_residence_at
      t.boolean :family_in_us
      t.text :notes
      t.string :contact_phone_number
      t.timestamps
    end
  end
end


text:
package io.pravega.controller.eventProcessor;

/**
 * Configuration for creating EventProcessorGroup.
 */
public interface EventProcessorGroupConfig {

    /**
     * Gets name of stream which supplies events for event processors in the EventProcessorGroup.
     * @return Stream name.
     */
    String getStreamName();

    /**
     * Gets name of ReaderGroup to which event processors in the EventProcessorGroup are subscribed.
     * @return ReaderGroup name.
     */
    String getReaderGroupName();

    /**
     * Gets the initial number of event processors in the EventProcessorGroup.
     * @return Initial number of event processors.
     */
    int getEventProcessorCount();

    /**
     * Gets the frequency of persistence of Position objects by event processors in the EventProcessorGroup.
     * @return Frequency of persistence of Position objects.
     */
    CheckpointConfig getCheckpointConfig();
}


text:
package net.sitemorph.protostore.sql;

import net.sitemorph.protostore.CrudException;
import net.sitemorph.protostore.CrudFactory;
import net.sitemorph.protostore.CrudStore;
import net.sitemorph.protostore.SortOrder;

import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
import com.google.protobuf.Message;

import java.sql.Connection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * A store that uses predefined naming conventions to bind proto to storage.
 *
 * It uses:
 *
 * - Message name for table name.
 * - urn field for urn mapping.
 * - fields ending Urn for index fields.
 * - fields named vector for version fields.
 *
 * @author damien@sitemorph.net
 */
public class AutoNamedFactory implements CrudFactory {

  private static final String URN_FIELD = "urn";
  private static final String VECTOR = "vector";
  private static final String URN_SUFFIX = "Urn";

  private Set<String> indexFields;
  private Map<String, SortOrder> sortFields;

  private Connection connection;
  private Map<String, CrudStore<? extends Message>> stores = new HashMap<>();

  private AutoNamedFactory() {}

  public static Builder newBuilder(Connection connection) {
    return new Builder(connection);
  }

  @Override
  public <T extends Message> boolean supported(T.Builder builder) {
    return stores.containsKey(builder.getDescriptorForType().getFullName());
  }

  @Override
  public <T extends Message> CrudStore<T> getCrudStore(T.Builder builder)
      throws CrudException {
    String name = builder.getDescriptorForType().getFullName();
    if (stores.containsKey(name) && null != stores.get(name)) {
      return (CrudStore<T>) stores.get(name);
    }
    UrnCrudStore.Builder<? extends Message> store =
        new UrnCrudStore.Builder<Message>();
    Descriptor descriptor = builder.getDescriptorForType();
    store.setConnection(connection)
        .setPrototype(builder)
        .setTableName(descriptor.getName())
        .setUrnField(URN_FIELD);
    for (FieldDescriptor field : descriptor.getFields()) {
      String fieldName = field.getName();
      if (VECTOR.equals(fieldName)) {
        store.setVectorField(VECTOR);
      }
      if (fieldName.endsWith(URN_SUFFIX) || indexFields.contains(fieldName)) {
        store.addIndexField(fieldName);
      }
      if (sortFields.containsKey(fieldName)) {
        store.setSortOrder(fieldName, sortFields.get(fieldName));
      }
    }
    CrudStore<? extends Message> result = store.build();
    stores.put(name, result);
    return (CrudStore<T>) result;
  }

  public static class Builder {

    private AutoNamedFactory result;

    private Builder(Connection connection) {
      result = new AutoNamedFactory();
      result.connection = connection;
      result.indexFields = new HashSet<>();
      result.sortFields = new HashMap<>();
    }

    public Builder registerSortField(String sortField, SortOrder order) {
      result.sortFields.put(sortField, order);
      return this;
    }

    public Builder registerIndexName(String fieldName) {
      result.indexFields.add(fieldName);
      return this;
    }

    public Builder registerMessage(Message.Builder builder) {
      result.stores.put(builder.getDescriptorForType().getFullName(), null);
      return this;
    }

    public AutoNamedFactory build() {
      return result;
    }
  }
}


text:
* `id` string - The unique id of the shared worker.
* `url` string - The url of the shared worker.


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Rollinia poeppigii Mart.

### Remarks
null


text:
/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */

#ifndef mozilla_dom_XMLHttpRequestBinding_h__
#define mozilla_dom_XMLHttpRequestBinding_h__

#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/DOMJSClass.h"

class XPCWrappedNativeScope;
class nsXMLHttpRequest;

namespace mozilla {
namespace dom {
namespace workers {

class XMLHttpRequest;

} // namespace workers
} // namespace dom
} // namespace mozilla

namespace mozilla {
namespace dom {

template <>
struct PrototypeTraits<prototypes::id::XMLHttpRequest>
{
  enum
  {
    Depth = 2
  };
  typedef nsXMLHttpRequest NativeType;
};

template <>
struct PrototypeTraits<prototypes::id::XMLHttpRequest_workers>
{
  enum
  {
    Depth = 2
  };
  typedef mozilla::dom::workers::XMLHttpRequest NativeType;
};

} // namespace dom
} // namespace mozilla

namespace mozilla {
namespace dom {

namespace XMLHttpRequestResponseTypeValues {

  enum valuelist {
    _empty,
    Arraybuffer,
    Blob,
    Document,
    Json,
    Text,
    Moz_chunked_text,
    Moz_chunked_arraybuffer,
    Moz_blob
  };

  extern const EnumEntry strings[10];
} // namespace XMLHttpRequestResponseTypeValues

typedef XMLHttpRequestResponseTypeValues::valuelist XMLHttpRequestResponseType;

struct MozXMLHttpRequestParametersWorkers {
  MozXMLHttpRequestParametersWorkers() {}
  bool Init(JSContext* cx, JSObject* obj);

  bool mozAnon;
  bool mozSystem;
private:
  // Disallow copy-construction
  MozXMLHttpRequestParametersWorkers(const MozXMLHttpRequestParametersWorkers&) MOZ_DELETE;
  static bool InitIds(JSContext* cx);
  static bool initedIds;
  static jsid mozAnon_id;
  static jsid mozSystem_id;
};

struct MozXMLHttpRequestParameters {
  MozXMLHttpRequestParameters() {}
  bool Init(JSContext* cx, JSObject* obj);

  bool mozAnon;
  bool mozSystem;
private:
  // Disallow copy-construction
  MozXMLHttpRequestParameters(const MozXMLHttpRequestParameters&) MOZ_DELETE;
  static bool InitIds(JSContext* cx);
  static bool initedIds;
  static jsid mozAnon_id;
  static jsid mozSystem_id;
};

namespace XMLHttpRequestBinding {
  extern const NativePropertyHooks NativeHooks;
  extern DOMJSClass Class;

  JSObject* CreateInterfaceObjects(JSContext* aCx, JSObject* aGlobal, JSObject* aReceiver);

  inline JSObject* GetProtoObject(JSContext* aCx, JSObject* aGlobal, JSObject* aReceiver)
  {

    /* Get the interface prototype object for this class.  This will create the
       object as needed. */

    /* aGlobal and aReceiver are usually the same, but they can be different
       too. For example a sandbox often has an xray wrapper for a window as the
       prototype of the sandbox's global. In that case aReceiver is the xray
       wrapper and aGlobal is the sandbox's global.
     */

    /* Make sure our global is sane.  Hopefully we can remove this sometime */
    if (!(js::GetObjectClass(aGlobal)->flags & JSCLASS_DOM_GLOBAL)) {
      return NULL;
    }
    /* Check to see whether the interface objects are already installed */
    JSObject** protoOrIfaceArray = GetProtoOrIfaceArray(aGlobal);
    JSObject* cachedObject = protoOrIfaceArray[prototypes::id::XMLHttpRequest];
    if (!cachedObject) {
      protoOrIfaceArray[prototypes::id::XMLHttpRequest] = cachedObject = CreateInterfaceObjects(aCx, aGlobal, aReceiver);
    }

    /* cachedObject might _still_ be null, but that's OK */
    return cachedObject;
  }

  bool ResolveProperty(JSContext* cx, JSObject* wrapper, jsid id, bool set, JSPropertyDescriptor* desc);

  bool EnumerateProperties(JS::AutoIdVector& props);

  bool DefineDOMInterface(JSContext* aCx, JSObject* aReceiver, bool* aEnabled);

  JSObject* Wrap(JSContext* aCx, JSObject* aScope, nsXMLHttpRequest* aObject, bool* aTriedToWrap);

} // namespace XMLHttpRequestBinding

namespace XMLHttpRequestBinding_workers {
  extern DOMJSClass Class;

  JSObject* CreateInterfaceObjects(JSContext* aCx, JSObject* aGlobal, JSObject* aReceiver);

  inline JSObject* GetProtoObject(JSContext* aCx, JSObject* aGlobal, JSObject* aReceiver)
  {

    /* Get the interface prototype object for this class.  This will create the
       object as needed. */

    /* aGlobal and aReceiver are usually the same, but they can be different
       too. For example a sandbox often has an xray wrapper for a window as the
       prototype of the sandbox's global. In that case aReceiver is the xray
       wrapper and aGlobal is the sandbox's global.
     */

    /* Make sure our global is sane.  Hopefully we can remove this sometime */
    if (!(js::GetObjectClass(aGlobal)->flags & JSCLASS_DOM_GLOBAL)) {
      return NULL;
    }
    /* Check to see whether the interface objects are already installed */
    JSObject** protoOrIfaceArray = GetProtoOrIfaceArray(aGlobal);
    JSObject* cachedObject = protoOrIfaceArray[prototypes::id::XMLHttpRequest_workers];
    if (!cachedObject) {
      protoOrIfaceArray[prototypes::id::XMLHttpRequest_workers] = cachedObject = CreateInterfaceObjects(aCx, aGlobal, aReceiver);
    }

    /* cachedObject might _still_ be null, but that's OK */
    return cachedObject;
  }

  JSObject* Wrap(JSContext* aCx, JSObject* aScope, mozilla::dom::workers::XMLHttpRequest* aObject, bool* aTriedToWrap);

} // namespace XMLHttpRequestBinding_workers

} // namespace dom
} // namespace mozilla

#endif // mozilla_dom_XMLHttpRequestBinding_h__


text:
<?php

/*
* <auto-generated>
*     This code was generated by a Codezu.
*
*     Changes to this file may cause incorrect behavior and will be lost if
*     the code is regenerated.
* </auto-generated>
*/

namespace Mozu\Api\Urls\Commerce\Catalog\Storefront;

use Mozu\Api\MozuUrl;
use Mozu\Api\UrlLocation;

class OrderTaxContextUrl  {

	/**
		* Get Resource Url for EstimateTaxes
		* @param string $responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
		* @return string Resource Url
	*/
	public static function estimateTaxesUrl($responseFields)
	{
		$url = "/api/commerce/catalog/storefront/tax/estimate-order?responseFields={responseFields}";
		$mozuUrl = new MozuUrl($url, UrlLocation::TENANT_POD,"POST", false) ;
		$url = $mozuUrl->formatUrl("responseFields", $responseFields);
		return $mozuUrl;
	}

}

?>


text:
package samplesCodes.proj04AccountSystem;

/**
 * Created by dotcom on 7/31/17.
 */
public class CustomerRunAccount {

    public static void main(String[] args) {
        HsbcUk currentAccount = new HsbcUk("Yes we can", "12 Imiana Street", "White and Red");

        currentAccount.createCustomerAccount("John Doe");
        currentAccount.creditAccount(233, 1000);

    }
}


text:
import { deepMix, each, filter, get } from '@antv/util';
import { DIRECTION } from '../constant';
import { AxisCfg, Datum, MirrorCfg, MirrorData } from '../interface';

import View from '../chart/view';
import { getFactTitleConfig } from '../util/facet';
import { Facet } from './facet';

/**
 * @ignore
 * 镜像分面
 */
export default class Mirror extends Facet<MirrorCfg, MirrorData> {
  protected getDefaultCfg() {
    return deepMix({}, super.getDefaultCfg(), {
      type: 'mirror',
      showTitle: true,
      title: super.getDefaultTitleCfg(),
      transpose: false,
    });
  }

  public render() {
    super.render();

    if (this.cfg.showTitle) {
      this.renderTitle();
    }
  }

  protected beforeEachView(view: View, facet: MirrorData) {
    // 做一下坐标系转化
    if (this.cfg.transpose) {
      if (facet.columnIndex % 2 === 0) {
        view.coordinate().transpose().reflect('x');
      } else {
        view.coordinate().transpose();
      }
    } else {
      if (facet.rowIndex % 2 !== 0) {
        view.coordinate().reflect('y');
      }
    }
  }

  protected afterEachView(view: View, facet: MirrorData) {
    this.processAxis(view, facet);
  }

  protected generateFacets(data: Datum[]): MirrorData[] {
    const [f] = this.cfg.fields;

    const rst = [];
    let columnValuesLength = 1;
    let rowValuesLength = 1;

    let columnValues: string[] = [''];
    let rowValues: string[] = [''];

    let columnField;
    let rowField;

    if (this.cfg.transpose) {
      columnField = f;
      columnValues = this.getFieldValues(data, columnField).slice(0, 2); // 镜像最多两个
      columnValuesLength = columnValues.length;
    } else {
      rowField = f;
      rowValues = this.getFieldValues(data, rowField).slice(0, 2); // 镜像最多两个
      rowValuesLength = rowValues.length;
    }

    // 获取每个维度对应的数据配置片段
    columnValues.forEach((xVal, xIndex) => {
      rowValues.forEach((yVal, yIndex) => {
        const conditions = [
          { field: columnField, value: xVal, values: columnValues },
          { field: rowField, value: yVal, values: rowValues },
        ];

        const facetData = filter(data, this.getFacetDataFilter(conditions));

        const facet: MirrorData = {
          type: this.cfg.type,
          data: facetData,
          region: this.getRegion(rowValuesLength, columnValuesLength, xIndex, yIndex),

          columnValue: xVal,
          rowValue: yVal,
          columnField,
          rowField,
          columnIndex: xIndex,
          rowIndex: yIndex,
          columnValuesLength,
          rowValuesLength,
        };
        rst.push(facet);
      });
    });

    return rst;
  }

  /**
   * 设置 x 坐标轴的文本、title 是否显示
   * @param x
   * @param axes
   * @param option
   * @param facet
   */
  protected getXAxisOption(x: string, axes: any, option: AxisCfg, facet: MirrorData): object {
    // 非最后一行
    // 当是最后一行或者下面没有 view 时文本不显示
    if (facet.columnIndex === 1 || facet.rowIndex === 1) {
      return {
        ...option,
        label: null,
        title: null,
      };
    }

    return option;
  }

  /**
   * 设置 y 坐标轴的文本、title 是否显示
   * @param y
   * @param axes
   * @param option
   * @param facet
   */
  protected getYAxisOption(y: string, axes: any, option: AxisCfg, facet: MirrorData): object {
    // do nothing
    return option;
  }

  private renderTitle() {
    each(this.facets, (facet: MirrorData, facetIndex: number) => {
      const { columnValue, rowValue, view } = facet;
      const formatter = get(this.cfg.title, 'formatter');

      if (this.cfg.transpose) {
        const config = deepMix(
          {
            position: ['50%', '0%'] as [string, string],
            content: formatter ? formatter(columnValue) : columnValue,
          },
          getFactTitleConfig(DIRECTION.TOP),
          this.cfg.title
        );

        view.annotation().text(config);
      } else {
        const config = deepMix(
          {
            position: ['100%', '50%'] as [string, string],
            content: formatter ? formatter(rowValue) : rowValue,
          },
          getFactTitleConfig(DIRECTION.RIGHT),
          this.cfg.title
        );

        view.annotation().text(config);
      }
    });
  }
}


text:
Future Imperfect is a responsive theme tailored for blogging. The name is of no
coincidence, because it is a port of [HTML5 UP's theme](http://html5up.net/future-imperfect)
by the same name. In addition to the original features, there are more features
that have been added for you to utilize.

![Hugo Future Imperfect Screenshot](https://raw.githubusercontent.com/jpescador/hugo-future-imperfect/master/images/screenshot.png)

Check out this [site](https://themes.gohugo.io/theme/future-imperfect/) if you are
interested in seeing a live example.

## Table of Contents

<!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->

- [Table of Contents](#table-of-contents)
- [Getting Started](#getting-started)
	- [exampleSite](#examplesite)
	- [config.toml](#configtoml)
	- [Hugo's Built-In Server](#hugos-built-in-server)
- [Shortcodes](#shortcodes)
	- [fancybox](#fancybox)
	- [img-post](#img-post)
	- [img-fit](#img-fit)
	- [url-link](#url-link)
- [About the Author](#about-the-author)
- [License](#license)

<!-- /TOC -->

## Getting Started

Run the following commands in your Hugo site directory:

```
mkdir themes
cd themes
git clone https://github.com/jpescador/hugo-future-imperfect.git
```

You will then have access to the theme at _themes/hugo-future-imperfect_ from within
your project folder.

### exampleSite

Within the hugo-future-imperfect folder, there will be a folder in this theme called
_exampleSite_. The structure of the folder will look like this:

```
exampleSite
├── config.toml
├── staticman.yml
├── content
|   ├── about
|   |   └── _index.md
|   ├── blog
|   │   ├── creating-a-new-theme.md
|   │   ├── goisforlovers.md
|   │   ├── hugoisforlovers.md
|   │   └── migrate-from-jekyll.md
|   ├── contact
|   │   └── _index.md
|   └── itemized
|       ├── item1.md
|       ├── item2.md
|       ├── item3.md
|       └── item4.md
├── data
│   └── comments
│       └── .gitkeep
└── static
    ├── css
    │   └── add-on.css
    ├── img
    |   ├── 2014
    |   |   ├── 04
    |   |   |   ├── pic02.jpg
    |   |   |   └── pic03.jpg
    |   |   └── 09
    |   |       └── pic01.jpg
    |   └── main
    |       └── logo.jpg
    └── js
        └── add-on.js
```

Copy _config.toml_ from _exampleSite_ to the root directory of your Hugo site.
If you want static comments hosted by [Staticman](https://staticman.net/), also
copy the _staticman.yml_.

### config.toml

This file is the main sorce of customization within the theme. Each parameter has
a comment included to explain its functionality. Typical usage of _true_ means to
turn a function on, while _false_ means to turn a function off.

This file consists of six main sections. The first section contains the site wide
parameters innate to Hugo. The second section, _[params]_, contains site wide
parameter that are custom to the _hugo-future-imperfect_ theme. The third section,
_[params.staticman]_ controls how staticman comments interact with your repository.
The fourth section, _[params.intro]_ and _[params.postAmount]_, control aspects
of the sidebar. The fifth section, _[[menu.main]]_, sets the navigation menu items.
Lastly, the sixth section, _[social]_, allows you to easily link to, and include,
various social platforms.

### Hugo's Built-In Server

Run the following command to start a local server and to view a live version of
the website:

```
hugo server
```

You will then be able to view your live website at [localhost:1313](http://localhost:1313).

## Shortcodes
In addition to the native [Hugo shortcodes](https://gohugo.io/extras/shortcodes/),
the theme also includes the following codes that I hope you find useful:
fancybox, img-post, img-fit, and url-link.

### fancybox
[Fancybox](http://fancyapps.com/fancybox/3/) is a jQuery lightbox script for displaying images, videos and more. It is touch
enabled, responsive and fully customizable. The commands are shown below:

**Named**
```
{{< fancybox path="path" file="file" caption="caption" gallery="gallery" >}}
```

**Positional**
```
{{< fancybox "path" "file" "caption" "gallery" >}}
```

Please refer to _layouts/shortcodes/fancybox.html_ for more details on the function.

Credit: [pacollins]

---

### img-post
Add an image which can be aligned center, left, or right. The commands are shown
below:

**Named**
```
{{< img-post path="date" file="filename.jpg" alt="Alt Text" type="left" >}}
```

**Positional**
```
{{< img-post "title" "filename.jpg" "Alt Text" "left" >}}
```

Please refer to _layouts/shortcodes/img-post.html_ for more details on the function.

Credit: [jpescador]

---

### img-fit
Insert multiple images with the ability to create a gallery if needed. The command
is shown below:

**Positional Only**
```
    {{< img-fit
        "4u" "filename1.jpg" "Alt text 1"
        "4u" "filename2.jpg" "Alt text 2"
        "4u$" "filename3.jpg" "Alt text 3"
        "date" >}}
```

Please refer to _layouts/shortcodes/img-fit.html_ for more details on the function.

Credit: [jpescador]

---

### url-link
Create a hyperlink and set a target value for the link. The default value is
`_blank`. The command is shown below:

**Positional Only**
```
{{< url-link "title" "www.link.com" "target">}}
```

Please refer to _layouts/shortcodes/url-link.html_ for more details on the function.

Credit: [jpescador]

## About the Author

Hugo Future Imperfect was ported by [Julio Pescador](https://jpescador.com). Extra
features implemented by the [project contributors](https://github.com/jpescador/hugo-future-imperfect/graphs/contributors).

Send Julio Pescador a tweet [@julio_pescador](https://twitter.com/julio_pescador),
if you like the theme and are using it for your own personal use.

## License

This theme is released under the MIT license. Please read the [license](https://github.com/jpescador/hugo-future-imperfect/blob/master/LICENSE.md) for more information.

[jpescador]: https://github.com/jpescador
[pacollins]: https://github.com/pacollins


text:
package uk.gov.nationalarchives.droid.core.interfaces.archive;

import java.io.IOException;

import uk.gov.nationalarchives.droid.core.interfaces.IdentificationRequest;
import uk.gov.nationalarchives.droid.core.interfaces.IdentificationResultCollection;

/**
 * @author rflitcroft
 *
 */
public interface ContainerIdentifier {

    /**
     * Submits an input stream for container identification.
     * @param request the request to be identified.
     * @return an Identification result
     * @throws IOException if the input stream could not be read
     */
    IdentificationResultCollection submit(IdentificationRequest request) throws IOException;

    /**
     * Sets the maximum number of bytes to scan from the
     * beginning or end of a file.  If negative, scanning
     * is unlimited.
     * @param maxBytes The number of bytes to scan, or negative meaning unlimited.
     */
    void setMaxBytesToScan(long maxBytes);

}


text:
var __result1, __result2;

 function folderArrayCB(folders) {
    __result1 = folders[0].name;
  }
 function errorCallback(error) {
   __result2 = 2;
 }

function serviceListCB(services){
    var filter = new tizen.AttributeFilter("serviceId", "EXACTLY", services[0].id);
    services[0].messageStorage.findFolders(filter, folderArrayCB, errorCallback);
}

tizen.messaging.getMessageServices("messaging.sms", serviceListCB);

var __expect1 = "aa";
var __expect2 = 2;


text:
/*global define*/
define([
    'jquery',
    'underscore',
    'backbone',
    'backbone.stickit',
    'text!templates/payment.html',
    'app'
], function ($, _, Backbone, Stickit, paymentTemplate, backboneWizard) {
    'use strict';

    var PaymentView = Backbone.View.extend({

        template: _.template( paymentTemplate ),

        className: 'row',

        events: {
            'click #next': 'nextStep',
            'click #back': 'previousStep'
        },

        bindings: {
            '#cc-name': 'ccName',
            '#cc-type': 'ccType',
            '#cc-number': 'ccNumber',
            '#cc-exp-date': 'ccExpDate',
            '#cc-security-code': 'ccSecurityCode'
        },

        initialize: function () {
            var view = this;

            function log() {
                console.log(JSON.stringify(view.model.changed));
            }

            var verify = _.debounce(log, 1000);

            view.listenTo(view.model, 'change', verify);
        },

        render: function () {
            this.$el.html(this.template(this.model.attributes));
            this.stickit();
            return this;
        },

        nextStep: function (event) {
            event.preventDefault();

            if (this.validate()) {
                backboneWizard.state = 'success';
                this.trigger('wizard:success');
            }
        },

        previousStep: function (event) {
            event.preventDefault();

            backboneWizard.state = 'verify';
            this.trigger('wizard:verify');
        },

        validate: function() {
            var valid = true,
                $ccName = this.$('#cc-name'),
                $ccType = this.$('#cc-type'),
                $ccNumber = this.$('#cc-number'),
                $ccExpDate = this.$('#cc-exp-date'),
                $ccSecurityCode = this.$('#cc-security-code');

            if ($ccName.val() === '') {
                if (!$ccName.hasClass('error')) {
                    $ccName.addClass('error')
                        .parents('label').addClass('error')
                        .after('Invalid entry');
                }

                valid = false;

            } else {
                if ($ccName.hasClass('error')) {
                    $ccName.removeClass('error')
                        .parents('label').removeClass('error')
                        .next().remove();
                }
            }

            if ($ccType.val() === '') {
                if (!$ccType.hasClass('error')) {
                    $ccType.addClass('error')
                        .parents('label').addClass('error')
                        .after('Invalid entry');
                }

                valid = false;

            } else {
                if ($ccType.hasClass('error')) {
                    $ccType.removeClass('error')
                        .parents('label').removeClass('error')
                        .next().remove();
                }
            }

            if ($ccNumber.val() === '') {
                if (!$ccNumber.hasClass('error')) {
                    $ccNumber.addClass('error')
                        .parents('label').addClass('error')
                        .after('Invalid entry');
                }

                valid = false;

            } else {
                if ($ccNumber.hasClass('error')) {
                    $ccNumber.removeClass('error')
                        .parents('label').removeClass('error')
                        .next().remove();
                }
            }

            if ($ccExpDate.val() === '') {
                if (!$ccExpDate.hasClass('error')) {
                    $ccExpDate.addClass('error')
                        .parents('label').addClass('error')
                        .after('Invalid entry');
                }

                valid = false;

            } else {
                if ($ccExpDate.hasClass('error')) {
                    $ccExpDate.removeClass('error')
                        .parents('label').removeClass('error')
                        .next().remove();
                }
            }

            if ($ccSecurityCode.val() === '') {
                if (!$ccSecurityCode.hasClass('error')) {
                    $ccSecurityCode.addClass('error')
                        .parents('label').addClass('error')
                        .after('Invalid entry');
                }

                valid = false;

            } else {
                if ($ccSecurityCode.hasClass('error')) {
                    $ccSecurityCode.removeClass('error')
                        .parents('label').removeClass('error')
                        .next().remove();
                }
            }

            return valid;
        }

    });

    return PaymentView;
});


text:
package clientv3test

import (
	"bufio"
	"context"
	"io"
	"net"
	"net/http"
	"strconv"
	"strings"
	"testing"
	"time"

	grpcprom "github.com/grpc-ecosystem/go-grpc-prometheus"
	"github.com/prometheus/client_golang/prometheus/promhttp"
	"go.etcd.io/etcd/client/pkg/v3/transport"
	"go.etcd.io/etcd/client/v3"
	integration2 "go.etcd.io/etcd/tests/v3/framework/integration"
	"google.golang.org/grpc"
)

func TestV3ClientMetrics(t *testing.T) {
	integration2.BeforeTest(t)

	var (
		addr = "localhost:27989"
		ln   net.Listener
	)

	srv := &http.Server{Handler: promhttp.Handler()}
	srv.SetKeepAlivesEnabled(false)

	ln, err := transport.NewUnixListener(addr)
	if err != nil {
		t.Errorf("Error: %v occurred while listening on addr: %v", err, addr)
	}

	donec := make(chan struct{})
	defer func() {
		ln.Close()
		<-donec
	}()

	// listen for all Prometheus metrics

	go func() {
		var err error

		defer close(donec)

		err = srv.Serve(ln)
		if err != nil && !transport.IsClosedConnError(err) {
			t.Errorf("Err serving http requests: %v", err)
		}
	}()

	url := "unix://" + addr + "/metrics"

	clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 1})
	defer clus.Terminate(t)

	cfg := clientv3.Config{
		Endpoints: []string{clus.Members[0].GRPCURL()},
		DialOptions: []grpc.DialOption{
			grpc.WithUnaryInterceptor(grpcprom.UnaryClientInterceptor),
			grpc.WithStreamInterceptor(grpcprom.StreamClientInterceptor),
		},
	}
	cli, cerr := integration2.NewClient(t, cfg)
	if cerr != nil {
		t.Fatal(cerr)
	}
	defer cli.Close()

	wc := cli.Watch(context.Background(), "foo")

	wBefore := sumCountersForMetricAndLabels(t, url, "grpc_client_msg_received_total", "Watch", "bidi_stream")

	pBefore := sumCountersForMetricAndLabels(t, url, "grpc_client_started_total", "Put", "unary")

	_, err = cli.Put(context.Background(), "foo", "bar")
	if err != nil {
		t.Errorf("Error putting value in key store")
	}

	pAfter := sumCountersForMetricAndLabels(t, url, "grpc_client_started_total", "Put", "unary")
	if pBefore+1 != pAfter {
		t.Errorf("grpc_client_started_total expected %d, got %d", 1, pAfter-pBefore)
	}

	// consume watch response
	select {
	case <-wc:
	case <-time.After(10 * time.Second):
		t.Error("Timeout occurred for getting watch response")
	}

	wAfter := sumCountersForMetricAndLabels(t, url, "grpc_client_msg_received_total", "Watch", "bidi_stream")
	if wBefore+1 != wAfter {
		t.Errorf("grpc_client_msg_received_total expected %d, got %d", 1, wAfter-wBefore)
	}
}

func sumCountersForMetricAndLabels(t *testing.T, url string, metricName string, matchingLabelValues ...string) int {
	count := 0
	for _, line := range getHTTPBodyAsLines(t, url) {
		ok := true
		if !strings.HasPrefix(line, metricName) {
			continue
		}

		for _, labelValue := range matchingLabelValues {
			if !strings.Contains(line, `"`+labelValue+`"`) {
				ok = false
				break
			}
		}

		if !ok {
			continue
		}

		valueString := line[strings.LastIndex(line, " ")+1 : len(line)-1]
		valueFloat, err := strconv.ParseFloat(valueString, 32)
		if err != nil {
			t.Fatalf("failed parsing value for line: %v and matchingLabelValues: %v", line, matchingLabelValues)
		}
		count += int(valueFloat)
	}
	return count
}

func getHTTPBodyAsLines(t *testing.T, url string) []string {
	cfgtls := transport.TLSInfo{}
	tr, err := transport.NewTransport(cfgtls, time.Second)
	if err != nil {
		t.Fatalf("Error getting transport: %v", err)
	}

	tr.MaxIdleConns = -1
	tr.DisableKeepAlives = true

	cli := &http.Client{Transport: tr}

	resp, err := cli.Get(url)
	if err != nil {
		t.Fatalf("Error fetching: %v", err)
	}

	reader := bufio.NewReader(resp.Body)
	lines := []string{}
	for {
		line, err := reader.ReadString('\n')
		if err != nil {
			if err == io.EOF {
				break
			} else {
				t.Fatalf("error reading: %v", err)
			}
		}
		lines = append(lines, line)
	}
	resp.Body.Close()
	return lines
}


text:
package nanocad;

import java.lang.System;
import java.io.StreamTokenizer;
import java.io.*;
import java.util.*;

public class Parser {

    StringWriter out = new StringWriter();
    boolean debug = false;
    StringReader in;

    //the numbers of words for the molecules. i.e, carbon dioxide is 2;
    int mol_name_num = 0;
    //begin to count length of molecules
    boolean mol_name_flag = false;

    boolean eof = false;

    //coordinates of atoms
    Vector atomX = new Vector();
    Vector atomY = new Vector();
    Vector atomZ = new Vector();
    Vector sym = new Vector();

    //bonds's atoms and order
    Vector bAtom1 = new Vector();
    Vector bAtom2= new Vector();
    Vector bOrder = new Vector();

    boolean begin_atom = false, begin_bond= false;
    int tmp, col_num_a =0, col_word=0, col_num_b = 0;
    StreamTokenizer inStream;

    /**
     *constructor
     */
    public Parser(String data){
	for (int i =0; i<data.length(); i++){
	    out.write(data.charAt(i));
	}

	in = new StringReader(out.toString());

	inStream = new StreamTokenizer(in);
	inStream.commentChar('#');
    }

    /**
     *process the stream token and words and symbols
     */
    public void process() throws IOException{
	do {
	    int token = inStream.nextToken();
	    switch(token){
	    case StreamTokenizer.TT_EOF :
		eof = true;
		break;

	    case StreamTokenizer.TT_EOL :
		break;

	    case StreamTokenizer.TT_WORD :
		if (debug == true)
		    System.out.println("Word :" + inStream.sval);
		if(inStream.sval.equals("MOLECULE")){
		    mol_name_num = 0;
		    mol_name_flag = true;
		   }
		else if(inStream.sval.equals("ATOM")){
		    begin_atom = true;

		    col_word=0;
		    col_num_a =0;

		}else if(inStream.sval.equals("BOND")){
		    begin_atom = false;
		    begin_bond = true;
		    col_num_b =0;
		    col_num_a =0;
		    col_word =0;
		}else if (inStream.sval.equals("SUBSTRUCTURE")){
		    begin_atom=false;
		    begin_bond = false;
		    col_num_b =0;
		    col_num_a =0;
		    col_word =0;
		}

		if(inStream.sval.equals("ATOM"))
		    col_word = 0;
		else {
		    col_word++;
		    if (debug == true)
		    	System.out.println("now the col_word is :"+col_word +"and the word is:"+inStream.sval+"\n");
		}

		if (mol_name_flag == true){

		    mol_name_num++;
		}else if (begin_atom == true && col_word % (2+mol_name_num) == 1){
		    sym.addElement(inStream.sval);
		}

		break;

	    case StreamTokenizer.TT_NUMBER :
		if (debug == true)
		    System.out.println("Number :" + inStream.nval);
		if(mol_name_flag == true){
		    mol_name_flag = false;
		    if(debug == true)
			System.out.println("the mol is :"+(mol_name_num-1) +" long\n");
		    mol_name_num = mol_name_num-1; //exclude the word "MOLECULE";

		}else if(begin_atom == true){
		    if(col_num_a % 6 ==1){
			atomX.addElement(new Double(inStream.nval));
		    }else if (col_num_a % 6 ==2){
			atomY.addElement(new Double(inStream.nval));
		    }else if (col_num_a % 6 ==3){
			atomZ.addElement(new Double(inStream.nval));
		    }
		}else if(begin_bond == true){
		    if(col_num_b % 4 ==1){
			 bAtom1.addElement(new Double(inStream.nval));
		     }else if (col_num_b % 4 ==2){
			 bAtom2.addElement(new Double(inStream.nval));
		     }else if(col_num_b % 4 ==3){
			 bOrder.addElement(new Double(inStream.nval));
		     }
		}

		col_num_a++;
		col_num_b++;

		break;

	    default:
		if(debug == true)
		    System.out.println((char) token +"encountered \n");
		if (token == '!') eof = true;
	    }
	}while(!eof);

        sym.removeElementAt(sym.size()-1);

	if(debug == true)
	{
	for (int i=0; i< sym.size(); i++){
	    System.out.println("i is :"+i+"\n");
	    System.out.println("Sym contains : "+ sym.elementAt(i));
	    System.out.println(atomX.size() + " " + atomY.size() + " " + atomZ.size());
	    System.out.println("atomX : "+ atomX.elementAt(i));
	    System.out.println("atomY : "+ atomY.elementAt(i));
	    System.out.println("atomZ : "+ atomZ.elementAt(i));
	    System.out.println("\n");
	}

	for (int i=0; i<bAtom1.size(); i++){
	    System.out.println("bAtom1 : "+ bAtom1.elementAt(i));
	    System.out.println("bAtom2 : "+ bAtom2.elementAt(i));
	    System.out.println("bOrder : "+ bOrder.elementAt(i));
	    System.out.println("\n");
	}
	}
    }

    /**
     *read file
     */
    public static String readFile(String name){
	String s =null;

	try{
	    File file = new File(name);
	    char[] arr = new char[(int)file.length()];
	    FileReader in = new FileReader(file);
	    in.read(arr, 0, (int)file.length());
	    s = new String(arr);

	}catch(IOException ex){
	    System.out.println(ex.toString());
	}
	return s;
    }

}


text:
from django.conf import settings
from ..compat import import_string

def get_gateway_class(import_path):
    return import_string(import_path)

def make_call(device, token):
    gateway = get_gateway_class(getattr(settings, 'TWO_FACTOR_CALL_GATEWAY'))()
    gateway.make_call(device=device, token=token)

def send_sms(device, token):
    gateway = get_gateway_class(getattr(settings, 'TWO_FACTOR_SMS_GATEWAY'))()
    gateway.send_sms(device=device, token=token)


text:
module FacturaePrint
  VERSION = "0.0.4"
end


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.camunda.bpm.engine.runtime;

/**
 *
Represent a planned item in a case instance.

 *
 *
Note that a {@link CaseInstance} also is an case execution.

 *
 * @author Roman Smirnov
 *
 */
public interface CaseExecution {

  /**
   *
The unique identifier of the case execution.

   */
  String getId();

  /**
   *
Id of the root of the case execution tree representing the case instance.

   *
   *
It is the same as {@link #getId()} if this case execution is the case instance.

   */
  String getCaseInstanceId();

  /**
   *
The id of the case definition of the case execution.

   */
  String getCaseDefinitionId();

  /**
   *
The id of the activity associated with this case execution.

   */
  String getActivityId();

  /**
   *
The name of the activity associated with this case execution.

   */
  String getActivityName();

  /**
   *
The type of the activity associated with this case execution.

   */
  String getActivityType();

  /**
   *
The description of the activity associated with this case execution.

   */
  String getActivityDescription();

  /**
   *
The id of the parent of this case execution.

   */
  String getParentId();

  /**
   *
Returns true if the case execution is required.

   */
  boolean isRequired();

  /**
   *
Returns true if the case execution is available.

   */
  boolean isAvailable();

  /**
   *
Returns true if the case execution is active.

   */
  boolean isActive();

  /**
   *
Returns true if the case execution is enabled.

   *
   *
Note: If this case execution is the case execution, it will
   * return always false.

   *
   */
  boolean isEnabled();

  /**
   *
Returns true if the case execution is disabled.

   *
   *
Note: If this case execution is the case instance, it will
   * return always false.

   */
  boolean isDisabled();

  /**
   *
Returns true if the case execution is terminated.

   */
  boolean isTerminated();

}


text:
package de.uni_hildesheim.sse.smell.filter;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.sat4j.core.VecInt;
import org.sat4j.maxsat.SolverFactory;
import org.sat4j.reader.DimacsReader;
import org.sat4j.reader.ParseFormatException;
import org.sat4j.reader.Reader;
import org.sat4j.specs.ContradictionException;
import org.sat4j.specs.ISolver;
import org.sat4j.specs.TimeoutException;

import de.uni_hildesheim.sse.smell.IProgressPrinter;
import de.uni_hildesheim.sse.smell.data.IDataElement;
import de.uni_hildesheim.sse.smell.util.ConditionUtils;
import de.uni_hildesheim.sse.smell.util.ConstraintException;
import de.uni_hildesheim.sse.smell.util.ICnfConverter;
import de.uni_hildesheim.sse.smell.util.RecursiveReplacingCnfConverter;
import de.uni_hildesheim.sse.smell.util.VarNotFoundException;
import de.uni_hildesheim.sse.smell.util.VariableToNumberConverter;
import net.ssehub.easy.varModel.cst.ConstraintSyntaxTree;
import net.ssehub.easy.varModel.cst.OCLFeatureCall;
import net.ssehub.easy.varModel.cst.Variable;
import net.ssehub.easy.varModel.model.DecisionVariableDeclaration;
import net.ssehub.easy.varModel.model.datatypes.BooleanType;
import net.ssehub.easy.varModel.model.datatypes.OclKeyWords;

public abstract class AbstractSatSolverFilter implements IFilter {

    private VariableToNumberConverter varConverter;

    private ISolver solver;

    private String dimacsModelFile;

    private ICnfConverter cnfConverter;

    public AbstractSatSolverFilter(String dimacsModelFile) throws IOException {
        this.varConverter = new VariableToNumberConverter(dimacsModelFile, "CONFIG_"); // TODO: ENABLE_ for busybox
        this.dimacsModelFile = dimacsModelFile;
        this.solver = getSolver(dimacsModelFile);
        if (solver == null) {
            throw new IOException("Solver is null!");
        }

        /*
         * Here, can the desired converter be chosen:
         * RecursiveReplacingCnfConverter is currently is the fastest,
         * which terminates in a reasonable time.
         */
        this.cnfConverter = new RecursiveReplacingCnfConverter(varConverter);
    }

    protected void addNewVariableToDimacsModel(String name) {
        varConverter.addVarible(name);
    }

    /**
     * @throws ConstraintException If constraint cannot be parsed.
     */
    protected boolean isSolvable(String constraint) throws VarNotFoundException, ConstraintException, TimeoutException {
        ConstraintSyntaxTree tree = ConditionUtils.parseCString(constraint);
        return isSolvable(tree);
    }

    protected boolean isSolvable(ConstraintSyntaxTree tree) throws VarNotFoundException, TimeoutException {
        try {
            return isSolvable(cnfConverter.convertToCnf(tree));
        } catch (ConstraintException e) {
            // this can't happen, since convertToCnf must return a CNF tree.
            throw new RuntimeException("Illegal state reached; CnfConverter is probably broken!");
        }
    }

    /**
     * @throws ConstraintException If cnfParts are not in CNF format.
     */
    protected boolean isSolvable(List<ConstraintSyntaxTree> cnfParts) throws VarNotFoundException, ConstraintException, TimeoutException {

        varConverter.clearTemporaryVariables(); // clear from previous stuff
        solver = getSolver(dimacsModelFile); // TODO: fix removing of constraints

        try {
            for (int i = 0; i < cnfParts.size(); i++) {
                int[] numbers = null;
                do {
                    try {
                        numbers = varConverter.convertToDimacs(cnfParts.get(i));
                    } catch (VarNotFoundException e) {
                        if (e.getName().startsWith("CONFIG_")) {
                            varConverter.addTemporaryVariable(e.getName());
                            cnfParts.add(new OCLFeatureCall(new Variable(
                                    new DecisionVariableDeclaration(e.getName(), BooleanType.TYPE, null))
                                    , OclKeyWords.NOT));
                        } else {
                            throw e;
                        }
                    }
                } while (numbers == null);
                solver.addClause(new VecInt(numbers));
            }

        } catch (ContradictionException e) {
            // This is thrown if the model is already not solvable
            return false;
        }

        boolean result = false;
        try {
            result = solver.isSatisfiable();
        } catch (TimeoutException e) {
            throw e;
        }
        return result;
    }

    /**
     * Reads the given DIMACS model file.
     *
     * @param path
     *            The DIMACS model file.
     * @return A solver for the model.
     */
    private static ISolver getSolver(String path) {
        ISolver solver = SolverFactory.newDefault();
        solver.setDBSimplificationAllowed(false);
        Reader reader = new DimacsReader(solver);
        boolean successfulParsed = false;
        try {
            reader.parseInstance(path);
            successfulParsed = true;
        } catch (ParseFormatException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ContradictionException e) {
            e.printStackTrace();
        }
        if (successfulParsed) {
            return solver;
        } else {
            return null;
        }
    }

    /**
     * Cleans up the solver by removing the temporary constraints added.
     *
     * @param constraints
     *            The constraints that were added.
     */
//    private void cleanUp(List<IConstr> constraints) {
        // TODO: fix removing of constraints
//         for (IConstr constr : constraints) {
//              solver.removeConstr(constr);
//         }
//    }

    /**
     * Returns a part of a solution for the last {@link #isSolvable(ConstraintSyntaxTree)}
     * call.
     *
     * @param vars The relevant variables; the values for these variables will be returned.
     * @return Only the relevant part of the solution of the VarModel that lead
     *      to a smell as a string.
     * @throws TimeoutException
     */
    public Map<String, Boolean> getSolutionPart(Set<String> variables) throws VarNotFoundException, TimeoutException {
        int[] solution = solver.findModel();

        Map<Integer, String> relatedVarMapping = new HashMap<>((int) (variables.size() * 1.5));

        for (String var : variables) {
            relatedVarMapping.put(varConverter.getNumber(var), var);
        }

        Map<String, Boolean> result = new HashMap<>();

        for (int value : solution) {
            if (relatedVarMapping.containsKey(value)) {
                result.put(relatedVarMapping.get(value), true);
            } else if (relatedVarMapping.containsKey(-value)) {
                result.put(relatedVarMapping.get(-value), false);
            }
        }

        return result;
    }

    @Override
    public abstract List<IDataElement> run(List<IDataElement> data, IProgressPrinter progressPrinter) throws FilterException;

}