text:
import copy
import itertools
import os
import tempfile
import traceback

#conary
from conary.build import cook,loadrecipe,lookaside,recipe,use
from conary.build import errors as builderrors
from conary import conarycfg
from conary import conaryclient
from conary.deps import deps
from conary.lib import log,util
from conary.deps.deps import Flavor
from conary.repository import trovesource

#rmake
from rmake import compat
from rmake import errors
from rmake import failure
from rmake.lib import flavorutil
from rmake.lib import repocache
from rmake.build import buildtrove

def getRecipes(repos, troveTups):
    fileIds = []
    troveSpecs = [ (x[0], x[1], Flavor()) for x in troveTups ]
    troves = repos.getTroves(troveSpecs)
    for i, trove in enumerate(troves):
        filename = trove.getName().split(':')[0] + '.recipe'
        found = False
        for (pathId, filePath, fileId, fileVersion) in trove.iterFileList():
            if filePath == filename:
                fileIds.append((fileId, fileVersion))
                found = True
                break
    repos.getFileContents(fileIds) #caches files
    return troves

def loadRecipe(repos, name, version, flavor, trv,
               defaultFlavor=None, loadInstalledSource=None,
               installLabelPath=None, buildLabel=None, groupRecipeSource=None,
               cfg=None):
    name = name.split(':')[0]
    try:
        if defaultFlavor is not None:
            fullFlavor = deps.overrideFlavor(defaultFlavor, flavor)
        else:
            fullFlavor = flavor
        # set up necessary flavors and track used flags before
        # calling loadRecipe, since even loading the class
        # may check some flags that may never be checked inside
        # the recipe
        recipeObj, loader = getRecipeObj(repos, name,
                                       version, fullFlavor, trv,
                                       loadInstalledSource=loadInstalledSource,
                                       installLabelPath=installLabelPath,
                                       buildLabel=buildLabel,
                                       cfg=cfg)
        relevantFlavor = use.usedFlagsToFlavor(recipeObj.name)
        relevantFlavor = flavorutil.removeInstructionSetFlavor(relevantFlavor)
        # always add in the entire arch flavor.  We need to ensure the
        # relevant flavor is unique per architecture, also, arch flavors
        # can affect the macros used.
        if defaultFlavor is not None:
            relevantFlavor.union(flavor)
        relevantFlavor.union(flavorutil.getArchFlags(fullFlavor))
        relevantFlags = flavorutil.getFlavorUseFlags(relevantFlavor)
        flags = flavorutil.getFlavorUseFlags(fullFlavor)
        use.track(False)

        for flagSet in ('Use',):
        # allow local flags not to be used -- they are set to their default
            if flagSet not in relevantFlags:
                continue
            for flag in relevantFlags[flagSet]:
                if flag not in flags[flagSet]:
                    raise (RuntimeError,
                            "Recipe %s uses Flavor %s but value not known" %(name, flag))
        if 'Arch' in relevantFlags:
            for majarch in relevantFlags['Arch'].keys():
                for subarch in relevantFlags['Arch'][majarch]:
                    if not use.Arch[majarch][subarch]:
                        #negative values for subarches are assumed
                        continue
                    if subarch not in flags['Arch'][majarch]:
                        log.error("arch %s.%s used but not specified" % (
                                                         majarch, subarch))
                        raise RuntimeError, (
                                "arch %s.%s used but not specified" % (
                                                         majarch, subarch))
            use.resetUsed()
    except:
        log.error('Error Loading Recipe (%s, %s, %s):\n%s' %
                                    (name, version, fullFlavor,
                                     ''.join(traceback.format_exc())))
        raise
    return loader, recipeObj, relevantFlavor

def getRecipeObj(repos, name, version, flavor, trv,
                 loadInstalledSource=None, installLabelPath=None,
                 loadRecipeSpecs=None, buildLabel = None,
                 groupRecipeSource=None, cfg=None):
    if cfg:
        cfg = copy.deepcopy(cfg)
    else:
        cfg = conarycfg.ConaryConfiguration(False)
    cfg.initializeFlavors()
    branch = version.branch()
    if not buildLabel:
        buildLabel = version.branch().label()
    if not installLabelPath:
        cfg.installLabelPath = [buildLabel]
    else:
        cfg.installLabelPath = installLabelPath
    cfg.buildFlavor = flavor
    cfg.defaultBasePackages = []
    name = name.split(':')[0]
    use.LocalFlags._clear()
    assert(flavorutil.getArch(flavor))
    use.setBuildFlagsFromFlavor(name, flavor, error=False)
    use.resetUsed()
    use.track(True)
    ignoreInstalled = not loadInstalledSource
    macros = {'buildlabel' : buildLabel.asString(),
              'buildbranch' : version.branch().asString()}
    cfg.lookaside = tempfile.mkdtemp()
    try:
        loader = RecipeLoaderFromSourceTrove(trv, repos, cfg,
                                         name + ':source', branch,
                                         ignoreInstalled=ignoreInstalled,
                                         db=loadInstalledSource,
                                         buildFlavor=flavor)
        recipeClass = loader.getRecipe()
        recipeClass._trove = trv
        if recipe.isGroupRecipe(recipeClass):
            recipeObj = recipeClass(repos, cfg, buildLabel, flavor, None,
                                extraMacros=macros)
            recipeObj.sourceVersion = version
            recipeObj.loadPolicy()
            recipeObj.setup()
        elif (recipe.isPackageRecipe(recipeClass) or
              recipe.isFactoryRecipe(recipeClass) or
              recipe.isCapsuleRecipe(recipeClass)):
            if recipe.isFactoryRecipe(recipeClass):
                #This requires a specific capability in conary
                compat.ConaryVersion().requireFactoryRecipeGeneration()
                #Load the FactoryRecipe
                factoryClass = recipeClass
                loaded = cook.loadFactoryRecipe(factoryClass, cfg, repos, flavor)
                recipeClass = loaded.getRecipe()
            lcache = lookaside.RepositoryCache(repos)
            recipeObj = recipeClass(cfg, lcache, [], macros, lightInstance=True)
            recipeObj.sourceVersion = version
            recipeObj.populateLcache()
            if not recipeObj.needsCrossFlags():
                recipeObj.crossRequires = []
            recipeObj.loadPolicy()
            recipeObj.setup()
        elif recipe.isInfoRecipe(recipeClass):
            recipeObj = recipeClass(cfg, None, None, macros)
            recipeObj.sourceVersion = version
            recipeObj.setup()
        elif recipe.isRedirectRecipe(recipeClass):
            binaryBranch = version.getBinaryVersion().branch()
            recipeObj = recipeClass(repos, cfg, binaryBranch, flavor)
            recipeObj.sourceVersion = version
            recipeObj.setup()
        elif recipe.isFileSetRecipe(recipeClass):
            recipeObj = recipeClass(repos, cfg, buildLabel, flavor, extraMacros=macros)
            recipeObj.sourceVersion = version
            recipeObj.setup()
        else:
            raise RuntimeError, 'Unknown class type %s for recipe %s' % (recipeClass, name)
    finally:
        util.rmtree(cfg.lookaside)
    return recipeObj, loader

def loadRecipeClass(repos, name, version, flavor, trv=None,
                    ignoreInstalled=True, root=None,
                    loadInstalledSource=None, overrides=None,
                    buildLabel=None, cfg=None):
    if trv is None:
        trv = repos.getTrove(name,version,deps.parseFlavor(''), withFiles=True)

    if cfg is None:
        cfg = conarycfg.ConaryConfiguration(False)
    else:
        cfg = copy.deepcopy(cfg)
    cfg.initializeFlavors()
    if root:
        cfg.root = root
    branch = version.branch()
    label = version.branch().label()
    cfg.buildLabel = label
    cfg.buildFlavor = flavor
    name = name.split(':')[0]

    use.LocalFlags._clear()
    use.setBuildFlagsFromFlavor(name, flavor, error=False)
    use.resetUsed()
    use.track(True)

    loader = RecipeLoaderFromSourceTrove(trv, repos, cfg,
                                     name + ':source', branch,
                                     ignoreInstalled=ignoreInstalled,
                                     db=loadInstalledSource,
                                     overrides=overrides,
                                     buildFlavor=flavor)
    recipeClass = loader.getRecipe()
    recipeClass._trove = trv

    use.track(False)
    localFlags = flavorutil.getLocalFlags()
    usedFlags = use.getUsed()
    use.LocalFlags._clear()
    return loader, recipeClass, localFlags, usedFlags

def _getLoadedSpecs(loader, recipeObj):
    loadedSpecsFn = getattr(loader, 'getLoadedSpecs', None)
    if loadedSpecsFn:
        return loader.getLoadedSpecs()
    recipeClass = recipeObj.__class__
    loadedSpecs = getattr(recipeClass, '_loadedSpecs', {})
    if not loadedSpecs:
        return {}
    finalDict = {}
    toParse = [(finalDict, loadedSpecs)]
    while toParse:
        specDict, unparsedSpecs = toParse.pop()
        for troveSpec, (troveTup, recipeClass) in unparsedSpecs.items():
            newDict = {}
            specDict[troveSpec] = (troveTup, newDict)
            toParse.append((newDict, getattr(recipeClass, '_loadedSpecs', {})))
    return finalDict

def loadSourceTroves(job, repos, buildFlavor, troveList,
                     loadInstalledSource=None, installLabelPath=None,
                     groupRecipeSource=None, internalHostName=None,
                     total=0, count=0):
    """
    Load the source troves associated with a set of build troves
    C{troveList}. Returns a mapping of C{(name, version, flavor,
    context)} to L{LoadTroveResult<rmake.build.buildtrove.LoadTroveResult>}
    indicating information loaded from the source such as packages
    and build requirements.
    """
    if not total:
        total = len(troveList)
    job.log('Downloading %s recipes...' % len(troveList))
    troveList = list(sorted(troveList, key=lambda x: x.getName()))
    troves = getRecipes(repos, [x.getNameVersionFlavor() for x in troveList])
    resultSet = {}

    for idx, (buildTrove, trove) in enumerate(itertools.izip(troveList, troves)):
        n,v,f = buildTrove.getNameVersionFlavor()
        job.log('Loading %s out of %s: %s' % (count + idx + 1, total, n))
        relevantFlavor = None
        if v.getHost() == internalHostName:
            buildLabel = v.branch().parentBranch().label()
        else:
            buildLabel = v.trailingLabel()
        try:
            (loader, recipeObj, relevantFlavor) = loadRecipe(repos,
                                 n, v, f,
                                 trove,
                                 buildFlavor,
                                 loadInstalledSource=loadInstalledSource,
                                 installLabelPath=installLabelPath,
                                 buildLabel=buildLabel,
                                 cfg=job.getTroveConfig(buildTrove))
            buildTrove.setFlavor(relevantFlavor)
            buildTrove.setRecipeType(buildtrove.getRecipeType(recipeObj))
            buildTrove.setLoadedSpecsList([_getLoadedSpecs(loader, recipeObj)])
            if hasattr(loader, 'getLoadedTroves'):
                buildTrove.setLoadedTroves(loader.getLoadedTroves())
            else:
                buildTrove.setLoadedTroves(recipeObj.getLoadedTroves())
            buildTrove.setDerivedPackages(set(
                getattr(recipeObj, 'packages', [recipeObj.name])))
            if 'delayedRequires' in recipeObj.__dict__:
                buildTrove.setDelayedRequirements(recipeObj.delayedRequires)
            buildTrove.setBuildRequirements(set(
                getattr(recipeObj, 'buildRequires', [])))
            buildTrove.setCrossRequirements(set(
                getattr(recipeObj, 'crossRequires', [])))

        except Exception, err:
            if isinstance(err, errors.RmakeError):
                # we assume our internal errors have enough info
                # to determine what the bug is.
                fail = failure.LoadFailed(str(err))
            else:
                fail = failure.LoadFailed(str(err), traceback.format_exc())
            buildTrove.troveFailed(fail)

def loadSourceTrovesForJob(job, troveList=None, repos=None, reposName=None):
    cfg = job.getMainConfig()
    if repos:
        cacheDir = None
    else:
        cacheDir = tempfile.mkdtemp(prefix='rmake-trovecache-')
        try:
            client = conaryclient.ConaryClient(cfg)
            repos = repocache.CachingTroveSource(client.getRepos(), cacheDir)
        except:
            util.rmtree(cacheDir)
            raise

    try:
        if troveList is None:
            troveList = list(job.iterLoadableTroves())
        if not troveList:
            return {}
        if reposName is None:
            reposName = cfg.reposName

        tupList = sorted(x.getNameVersionFlavor() for x in troveList)

        # create fake "packages" for all the troves we're building so that
        # they can be found for loadInstalled.
        if not cfg.isolateTroves:
            buildTrovePackages = [ (x[0].split(':')[0], x[1], x[2])
                for x in tupList ]
            buildTroveSource = RemoveHostSource(trovesource.SimpleTroveSource(
                buildTrovePackages), reposName)
        else:
            buildTroveSource = None

        # don't search the internal repository explicitly for loadRecipe
        # sources - they may be a part of some bogus build.
        repos = RemoveHostRepos(repos, reposName)

        trovesByConfig = {}
        for trove in troveList:
            trovesByConfig.setdefault(trove.getContext(), []).append(trove)

        total = len(troveList)
        count = 0
        for context, contextTroves in trovesByConfig.items():
            buildCfg = contextTroves[0].cfg

            loadInstalledList = [ trovesource.TroveListTroveSource(repos, x)
                for x in buildCfg.resolveTroveTups ]
            loadInstalledList.append(repos)

            if buildTroveSource is not None:
                loadInstalledSource = trovesource.stack(buildTroveSource,
                                                        *loadInstalledList)
            else:
                loadInstalledSource = trovesource.stack(*loadInstalledList)

            loadInstalledRepos = trovesource.stack(*loadInstalledList)
            if isinstance(loadInstalledRepos, trovesource.TroveSourceStack):
                for source in loadInstalledRepos.iterSources():
                    source._getLeavesOnly = True
                    source.searchWithFlavor()
                    # keep allowNoLabel set.
            else:
                loadInstalledRepos._getLeavesOnly = True
                loadInstalledRepos.searchWithFlavor()
            cachedRepos = CachingSource(loadInstalledRepos)

            loadSourceTroves(job, cachedRepos,
                buildCfg.buildFlavor, contextTroves, total=total, count=count,
                loadInstalledSource=loadInstalledSource,
                installLabelPath=buildCfg.installLabelPath,
                internalHostName=reposName)
            count += len(contextTroves)
    finally:
        if cacheDir:
            util.rmtree(cacheDir)

class RemoveHostRepos(object):
    def __init__(self, troveSource, host):
        self.troveSource = troveSource
        self.host = host

    def __getattr__(self, attr):
        return getattr(self.troveSource, attr)

    def findTroves(self, labelPath, *args, **kw):
        if labelPath is not None:
            labelPath = [ x for x in labelPath if x.getHost() != self.host]
        return self.troveSource.findTroves(labelPath, *args, **kw)

    def findTrove(self, labelPath, *args, **kw):
        if labelPath is not None:
            labelPath = [ x for x in labelPath if x.getHost() != self.host]
        return self.troveSource.findTrove(labelPath, *args, **kw)

class CachingSource(object):
    """
        Trovesource that caches calls to findTrove(s).
    """
    def __init__(self, troveSource):
        self.troveSource = troveSource
        self._cache = {}

    def __getattr__(self, key):
        return getattr(self.troveSource, key)

    def findTroves(self, installLabelPath, troveTups, *args, **kw):
        """
            Caching findTroves call.
        """
        finalResults = {}
        toFind = []
        # cache is {troveTup : [((ILP, *args, **kw), result)]}
        # first find troveTup in cache then search all the ILP, args, kw
        # pairs we've cached before.
        key = (installLabelPath, args, sorted(kw.items()))
        for troveTup in troveTups:
            if troveTup in self._cache:
                results = [ x[1] for x in self._cache[troveTup] if x[0] == key ]
                if results:
                    finalResults[troveTup] = results[0]
                    continue
            toFind.append(troveTup)
        newResults = self.troveSource.findTroves(installLabelPath, toFind, *args, **kw)
        for troveTup, troveList in newResults.iteritems():
            self._cache.setdefault(troveTup, []).append((key, troveList))
        finalResults.update(newResults)
        return finalResults

    def findTrove(self, labelPath, troveTup, *args, **kw):
        return self.findTroves(labelPath, [troveTup], *args, **kw)[troveTup]

class RemoveHostSource(trovesource.SearchableTroveSource):
    def __init__(self, troveSource, host):
        self.troveSource = troveSource
        self.host = host
        trovesource.SearchableTroveSource.__init__(self)
        self._bestFlavor = troveSource._bestFlavor
        self._getLeavesOnly = troveSource._getLeavesOnly
        self._flavorCheck = troveSource._flavorCheck
        self._allowNoLabel = troveSource._allowNoLabel

    def iterTrovesByPath(self, *args, **kw):
        return []

    def close(self):
        return getattr(self.troveSource, 'close')()

    def resolveDependencies(self, label, *args, **kw):
        if self._allowNoLabel:
            return self.troveSource.resolveDependencies(label, *args, **kw)

        suggMap = self.troveSource.resolveDependencies(None, *args, **kw)
        for depSet, solListList in suggMap.iteritems():
            newSolListList = []
            for solList in solListList:
                newSolList = []
                for sol in solList:
                    trailingLabel = sol[1].trailingLabel()
                    if trailingLabel == label:
                        newSolList.append(sol)
                    if trailingLabel.getHost() != self.host:
                        continue
                    if not sol[1].branch().hasParentBranch():
                        continue
                    if sol[1].branch().parentBranch().label() != label:
                        continue
                    newSolList.append(sol)
                newSolListList.append(newSolList)
            suggMap[depSet] = newSolListList
        return suggMap

    def resolveDependenciesByGroups(self, *args, **kw):
        return self.troveSource.resolveDependenciesByGroups(*args, **kw)

    def trovesByName(self, name):
        return self.troveSource.trovesByName(name)

    def hasTroves(self, *args, **kw):
        return self.troveSource.hasTroves(*args, **kw)

    def findTroves(self, labelPath, *args, **kw):
        if labelPath is not None:
            newPath = []
            for label in labelPath:
                if label.getHost() != self.host:
                    newPath.append(label)
            labelPath = newPath
        return trovesource.SearchableTroveSource.findTroves(self, labelPath,
                                                            *args, **kw)

    def getLabelsForTroveName(self, troveName,
                              troveTypes=trovesource.TROVE_QUERY_PRESENT):
        versionList = self.getTroveVersionList(troveName,
                                               troveTypes=troveTypes)
        labelSet = set()
        for version in versionList:
            if version.getHost() == self.host:
                labelSet.add(self._removeLabel(version).trailingLabel())
            else:
                labelSet.add(version.trailingLabel())
        return labelSet

    def _removeLabel(self, version):
        upVersion = None
        if version.hasParentVersion():
            return version.parentVersion()
        elif version.branch().hasParentBranch():
            branch = version.branch().parentBranch()
            shadowLength = version.shadowLength() - 1
            revision = version.trailingRevision().copy()
            if revision.buildCount is not None:
                revision.buildCount.truncateShadowCount(shadowLength)
            revision.sourceCount.truncateShadowCount(shadowLength)
            upVersion = branch.createVersion(revision)
            if (revision.buildCount is not None
                and list(revision.buildCount.iterCounts())[-1] == 0):
                upVersion.incrementBuildCount()
            return upVersion
        else:
            return version

    def _filterByVersionQuery(self, versionType, versionList, versionQuery):
        versionMap = {}
        for version in versionList:
            upVersion = version
            if version.trailingLabel().getHost() == self.host:
                upVersion = self._removeLabel(version)
            versionMap.setdefault(upVersion, []).append(version)
            versionMap.setdefault(version, []).append(version)
        results = trovesource.SearchableTroveSource._filterByVersionQuery(
                                                        self, versionType,
                                                        versionMap.keys(),
                                                        versionQuery)
        return dict((x[0],
                     list(itertools.chain(*[versionMap[y] for y in x[1]])))
                     for x in results.items())

if hasattr(loadrecipe, 'RecipeLoaderFromSourceTrove'):
    RecipeLoaderFromSourceTrove = loadrecipe.RecipeLoaderFromSourceTrove
else:
    class RecipeLoaderFromSourceTrove(loadrecipe.RecipeLoader):

        @staticmethod
        def findFileByPath(sourceTrove, path):
            for (pathId, filePath, fileId, fileVersion) in sourceTrove.iterFileList():
                if filePath == path:
                    return (fileId, fileVersion)

            return None

        def __init__(self, sourceTrove, repos, cfg, versionStr=None,
                     labelPath=None,
                     ignoreInstalled=False, filterVersions=False,
                     parentDir=None, defaultToLatest = False,
                     buildFlavor = None, db = None, overrides = None,
                     getFileFunction = None, branch = None):
            self.recipes = {}

            if getFileFunction is None:
                getFileFunction = lambda repos, fileId, fileVersion, path: \
                        repos.getFileContents([ (fileId, fileVersion) ])[0].get()

            name = sourceTrove.getName().split(':')[0]

            recipePath = name + '.recipe'
            match = self.findFileByPath(sourceTrove, recipePath)

            if not match:
                # this is just missing the recipe; we need it
                raise builderrors.RecipeFileError("version %s of %s does not "
                                                  "contain %s" %
                          (sourceTrove.getName(),
                           sourceTrove.getVersion().asString(),
                           recipePath))

            (fd, recipeFile) = tempfile.mkstemp(".recipe", 'temp-%s-' %name,
                                                dir=cfg.tmpDir)
            outF = os.fdopen(fd, "w")

            inF = getFileFunction(repos, match[0], match[1], recipePath)

            util.copyfileobj(inF, outF)

            del inF
            outF.close()
            del outF

            if branch is None:
                branch = sourceTrove.getVersion().branch()

            try:
                loadrecipe.RecipeLoader.__init__(self, recipeFile, cfg, repos,
                          sourceTrove.getName(),
                          branch = branch,
                          ignoreInstalled=ignoreInstalled,
                          directory=parentDir, buildFlavor=buildFlavor,
                          db=db, overrides=overrides)
            finally:
                os.unlink(recipeFile)

            self.recipe._trove = sourceTrove.copy()


text:
<?php

namespace OpCacheGUITest\Mocks\Security\Generator;

use OpCacheGUI\Security\Generator as SecurityGenerator;

class Fake implements SecurityGenerator
{
    /**
     * Generates a random string
     *
     * @param int $length The length of the random string to be generated
     */
    public function generate($length)
    {
        $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        $randomString = '';
        for ($i = 0; $i < $length; $i++) {
            $randomString .= $characters[rand(0, strlen($characters) - 1)];
        }

        return $randomString;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.package1;

public class Class2 {
  private boolean myField1;
  public boolean myField2;
  public boolean myField3;
  public boolean myField4;

  public int getValue() {
    return 0;
  }

  public class InnerClass1 {
    public int myInnerClassField;

    public class InnerClass12 {
      public int myInnerClassField;

      public class InnerClass13 {
        public int myInnerClassField;

        public class InnerClass14 {
          public int myInnerClassField;

          public class InnerClass15 {
            public int myInnerClassField;
          }
        }
      }
    }
  }

  public class InnerClass2 {
    public int myInnerClassField;

    public class InnerClass22 {
      public int myInnerClassField;

      public class InnerClass23 {
        public int myInnerClassField;

        public class InnerClass24 {
          public int myFieldToSelect;

          public class InnerClass25 {
            public int myInnerClassField;
          }
        }
      }
    }
  }

}


text:
<!doctype html>

<?php $this->load->view('include/header');?>

		<?php $this->load->view('dashboard/include/nav');?>

			<?php $this->load->view('dashboard/include/sidebar');?>

							<?php $this->load->view('dashboard/include/alert');?>

							  <a class="breadcrumb-item" href="<?php echo site_url('dashboard');?>"> Beranda >
							   <a class="breadcrumb-item" href="<?php echo site_url('student');?>"> Data Pribadi Siswa >
							   Edit Formulir data siswa baru

Edit Formulir data siswa baru

						      <?php foreach($data as $list) { ?>
						      	<form class="form-horizontal" enctype="multipart/form-data" method="post" action="<?php echo base_url('student/update') ;?>">

										NIS

											<input disabled value="<?php echo $list->nis;?>" type="text" name="nis" class="form-control" id="input" placeholder="Masukan NIS..">

										Photo

											 <?php if($list->photo!=='') { ?>
							                <img src="<?php echo base_url().$list->photo;?>" width="100%">
							                <?php }else { ?>
											<img src="<?php echo base_url('public/image/user.png')?>" width="10%">
							                <?php ;};?>

											<input type="file" name="photo" class="form-control" id="input" placeholder="Masukan Photo..">

										Nama

											<input value="<?php echo $list->nama;?>" type="text" name="nama" class="form-control" id="input" placeholder="Masukan nama..">

										Nama Pangilan

											<input value="<?php echo $list->nama_pangilan;?>" type="text" name="nama_pangilan" class="form-control" id="input" placeholder="Masukan Nama Pangilan..">

										Tempat Lahir

											<input type="text" value="<?php echo $list->tempat_lahir;?>" name="tempat_lahir" class="form-control" id="input" placeholder="Masukan Tempat Lahir..">

										Tanggal Lahir

											<input type="date" value="<?php echo $list->tanggal_lahir;?>" name="tanggal_lahir" class="form-control" id="input" placeholder="Masukan Tanggal Lahir..">

										Telepon Rumah

											<input type="text" value="<?php echo $list->telp_rumah;?>" name="telp_rumah" class="form-control" id="input" placeholder="Masukan telepon rumah..">

										Hp

											<input type="text" value="<?php echo $list->hp;?>" name="hp" class="form-control" id="input" placeholder="Masukan Hp..">

										Telepon Kost

											<input type="text" value="<?php echo $list->telp_kost;?>"  name="telp_kost" class="form-control" id="input" placeholder="Masukan Telepon kost..">

										Alamat Rumah

											<textarea style="text-align:justify" name="alamat_rumah" class="text-left control-label form-control" rows="5" cols="30"><?php echo $list->alamat_rumah;?></textarea>

										Alamat Kost

											<textarea style="text-align:justify" name="alamat_kost" class="control-label form-control" rows="5" cols="30"><?php echo $list->alamat_kost;?></textarea>

										Gol Darah

											<input value="<?php echo $list->gol_darah;?>"  type="text" placeholder="golongan darah" name="gol_darah" class="form-control" id="input" placeholder="Masukan NIS..">

										Jenis Kelamin

											<input type="radio"  name="jkel" value="1" <?php echo $list->jkel==1 ? 'checked' :'' ;?>> Laki-Laki
											<input type="radio" name="jkel" value="2" <?php echo $list->jkel==2 ? 'checked' :'' ;?>> Wanita

										Tinggi badan

											<input type="text" value="<?php echo $list->tinggi_badan;?>"  name="tinggi_badan" class="form-control" id="input" placeholder="Masukan tinggi badan..">

										Berat Badan

											<input type="text" value="<?php echo $list->berat_badan;?>"  name="berat_badan" class="form-control" id="input" placeholder="Masukan berat badan..">

										Agama

											<select name="agama" class="form-control">
												<option class="form-control">[ Pilih salah satu ]</option>
												<option value="1" <?php echo $list->agama==1 ? 'selected' :'' ;?>>Islam</option>
												<option value="2" <?php echo $list->agama==2 ? 'selected' :'' ;?>>Katolik</option>
												<option value="3" <?php echo $list->agama==3 ? 'selected' :'' ;?>>Protestan</option>
												<option value="4" <?php echo $list->agama==4 ? 'selected' :'' ;?>>Hindu</option>
												<option value="5" <?php echo $list->agama==5 ? 'selected' :'' ;?>>Budha</option>
												<option value="6" <?php echo $list->agama==6 ? 'selected' :'' ;?>>Konghuchu</option>
											</select>

										Anak ke

											<input type="text" value="<?php echo $list->anak_ke;?>"  name="anak_ke" class="form-control" id="input" placeholder="Masukan Anak ke..">

										Jumlah Saudara

											<input type="text" value="<?php echo $list->jumlah_saudara;?>" name="jumlah_saudara" class="form-control" id="input" placeholder="Masukan Jumlah saudara..">

										Hobby

											<input type="text" value="<?php echo $list->hobby;?>"  name="hobby" class="form-control" id="input" placeholder="Masukan hobby..">

										Riwayat sakit

											<input type="text" value="<?php echo $list->riwayat_sakit;?>" name="riwayat_sakit" class="form-control" id="input" placeholder="Masukan Riwayat sakit..">

										Tinggal Dengan

											<input type="text" value="<?php echo $list->tinggal_dengan;?>" name="tinggal_dengan" class="form-control" id="input" placeholder="Masukan Tinggal dengan..">

											Thn Pelajaran

												<input type="text" value="<?php echo $list->thn_pelajaran;?>" name="thn_pelajaran" class="form-control" id="input" placeholder="Masukan tahun pelajaran..">

											Asal Sekolah

												<input type="text" value="<?php echo $list->asal_sekolah;?>" name="asal_sekolah" class="form-control" id="input" placeholder="Masukan Asal sekolah..">

											Jumlah SKHU

												<input type="text" value="<?php echo $list->jumlah_skhu;?>" name="jumlah_skhu" class="form-control" id="input" placeholder="Masukan Jumlah SKHU..">

											Kelas

												<input type="text" value="<?php echo $list->kelas;?>" name="kelas" class="form-control" id="input" placeholder="Masukan Kelas..">

											Jurusan

												<input type="text" value="<?php echo $list->jurusan;?>" name="jurusan" class="form-control" id="input" placeholder="Masukan Jurusan..">

											IQ Siswa

												<input type="text" value="<?php echo $list->iq_siswa;?>" name="iq_siswa" class="form-control" id="input" placeholder="Masukan IQ siswa..">

											IQ Tanggal

												<input type="date" value="<?php echo $list->iq_tanggal;?>" name="iq_tanggal" class="form-control" id="input" placeholder="Masukan IQ Tanggal ..">

											Prestasi

												<input type="text" name="prestasi" value="<?php echo $list->prestasi;?>" class="form-control" id="input" placeholder="Masukan Prestasi..">

											Prestasi 2

												<input type="text" name="prestasi_2" value="<?php echo $list->prestasi_2;?>" class="form-control" id="input" placeholder="Masukan Prestasi 2..">

												<input type="hidden" name="id_student" value="<?php echo $list->id_student;?>">
												<input type="hidden" name="old_photo" value="<?php echo $list->photo;?>">
												<input type="submit"  class="form-control btn btn-block btn-primary" id="input" value="update">

						      	</form>
						      	<?php };?>

<?php $this->load->view('include/footer');?>


text:
package eu.bryants.anthony.plinth.parser.rules.member;

import java.util.LinkedList;
import java.util.List;

import parser.ParseException;
import parser.Production;
import parser.Rule;
import eu.bryants.anthony.plinth.ast.LexicalPhrase;
import eu.bryants.anthony.plinth.ast.member.Constructor;
import eu.bryants.anthony.plinth.ast.misc.Parameter;
import eu.bryants.anthony.plinth.ast.statement.Block;
import eu.bryants.anthony.plinth.ast.statement.Statement;
import eu.bryants.anthony.plinth.ast.terminal.SinceSpecifier;
import eu.bryants.anthony.plinth.ast.type.NamedType;
import eu.bryants.anthony.plinth.parser.LanguageParseException;
import eu.bryants.anthony.plinth.parser.ParseType;
import eu.bryants.anthony.plinth.parser.parseAST.Modifier;
import eu.bryants.anthony.plinth.parser.parseAST.ParseList;
import eu.bryants.anthony.plinth.parser.parseAST.SinceModifier;
import eu.bryants.anthony.plinth.parser.parseAST.ThrownExceptionType;

/*
 * Created on 11 May 2012
 */

/**
 * @author Anthony Bryant
 */
public class ConstructorRule extends Rule<ParseType>
{
  private static final long serialVersionUID = 1L;

  private static final Production<ParseType> MODIFIERS_PRODUCTION           = new Production<ParseType>(ParseType.MODIFIERS, ParseType.CREATE_KEYWORD, ParseType.PARAMETERS, ParseType.THROWS_CLAUSE, ParseType.BLOCK);
  private static final Production<ParseType> PRODUCTION                     = new Production<ParseType>(                     ParseType.CREATE_KEYWORD, ParseType.PARAMETERS, ParseType.THROWS_CLAUSE, ParseType.BLOCK);
  private static final Production<ParseType> MODIFIERS_SEMICOLON_PRODUCTION = new Production<ParseType>(ParseType.MODIFIERS, ParseType.CREATE_KEYWORD, ParseType.PARAMETERS, ParseType.THROWS_CLAUSE, ParseType.SEMICOLON);
  private static final Production<ParseType> SEMICOLON_PRODUCTION           = new Production<ParseType>(                     ParseType.CREATE_KEYWORD, ParseType.PARAMETERS, ParseType.THROWS_CLAUSE, ParseType.SEMICOLON);

  public ConstructorRule()
  {
    super(ParseType.CONSTRUCTOR, MODIFIERS_PRODUCTION, PRODUCTION, MODIFIERS_SEMICOLON_PRODUCTION, SEMICOLON_PRODUCTION);
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public Object match(Production<ParseType> production, Object[] args) throws ParseException
  {
    if (production == MODIFIERS_PRODUCTION || production == MODIFIERS_SEMICOLON_PRODUCTION)
    {
      @SuppressWarnings("unchecked")
      ParseList<Modifier> modifiers = (ParseList<Modifier>) args[0];
      @SuppressWarnings("unchecked")
      ParseList<Parameter> parameters = (ParseList<Parameter>) args[2];
      @SuppressWarnings("unchecked")
      ParseList<ThrownExceptionType> throwsList = (ParseList<ThrownExceptionType>) args[3];
      List<NamedType> checkedThrownTypes = new LinkedList<NamedType>();
      List<NamedType> uncheckedThrownTypes = new LinkedList<NamedType>();
      for (ThrownExceptionType thrownExceptionType : throwsList)
      {
        if (thrownExceptionType.isUnchecked())
        {
          uncheckedThrownTypes.add(thrownExceptionType.getType());
        }
        else
        {
          checkedThrownTypes.add(thrownExceptionType.getType());
        }
      }
      Block block;
      LexicalPhrase lexicalPhrase;
      if (production == MODIFIERS_PRODUCTION)
      {
        block = (Block) args[4];
        lexicalPhrase = LexicalPhrase.combine(modifiers.getLexicalPhrase(), (LexicalPhrase) args[1], parameters.getLexicalPhrase(), throwsList.getLexicalPhrase(), block.getLexicalPhrase());
      }
      else
      {
        block = new Block(new Statement[0], null);
        lexicalPhrase = LexicalPhrase.combine(modifiers.getLexicalPhrase(), (LexicalPhrase) args[1], parameters.getLexicalPhrase(), throwsList.getLexicalPhrase(), (LexicalPhrase) args[4]);
      }
      return processModifiers(modifiers, parameters.toArray(new Parameter[parameters.size()]),
                              checkedThrownTypes.toArray(new NamedType[checkedThrownTypes.size()]), uncheckedThrownTypes.toArray(new NamedType[uncheckedThrownTypes.size()]),
                              block,
                              lexicalPhrase);
    }
    if (production == PRODUCTION || production == SEMICOLON_PRODUCTION)
    {
      @SuppressWarnings("unchecked")
      ParseList<Parameter> parameters = (ParseList<Parameter>) args[1];
      @SuppressWarnings("unchecked")
      ParseList<ThrownExceptionType> throwsList = (ParseList<ThrownExceptionType>) args[2];
      List<NamedType> checkedThrownTypes = new LinkedList<NamedType>();
      List<NamedType> uncheckedThrownTypes = new LinkedList<NamedType>();
      for (ThrownExceptionType thrownExceptionType : throwsList)
      {
        if (thrownExceptionType.isUnchecked())
        {
          uncheckedThrownTypes.add(thrownExceptionType.getType());
        }
        else
        {
          checkedThrownTypes.add(thrownExceptionType.getType());
        }
      }
      Block block;
      LexicalPhrase lexicalPhrase;
      if (production == PRODUCTION)
      {
        block = (Block) args[3];
        lexicalPhrase = LexicalPhrase.combine((LexicalPhrase) args[0], parameters.getLexicalPhrase(), throwsList.getLexicalPhrase(), block.getLexicalPhrase());
      }
      else
      {
        block = new Block(new Statement[0], null);
        lexicalPhrase = LexicalPhrase.combine((LexicalPhrase) args[0], parameters.getLexicalPhrase(), throwsList.getLexicalPhrase(), (LexicalPhrase) args[3]);
      }
      return new Constructor(false, false, null, parameters.toArray(new Parameter[parameters.size()]),
                             checkedThrownTypes.toArray(new NamedType[checkedThrownTypes.size()]), uncheckedThrownTypes.toArray(new NamedType[uncheckedThrownTypes.size()]),
                             block,
                             lexicalPhrase);
    }
    throw badTypeList();
  }

  private Constructor processModifiers(ParseList<Modifier> modifiers, Parameter[] parameters, NamedType[] checkedThrownTypes, NamedType[] uncheckedThrownTypes, Block block, LexicalPhrase lexicalPhrase) throws LanguageParseException
  {
    boolean isImmutable = false;
    boolean isSelfish = false;
    SinceSpecifier sinceSpecifier = null;
    for (Modifier modifier : modifiers)
    {
      switch (modifier.getModifierType())
      {
      case ABSTRACT:
        throw new LanguageParseException("Unexpected modifier: Constructors cannot be abstract", modifier.getLexicalPhrase());
      case FINAL:
        throw new LanguageParseException("Unexpected modifier: Constructors cannot be final", modifier.getLexicalPhrase());
      case IMMUTABLE:
        if (isImmutable)
        {
          throw new LanguageParseException("Duplicate 'immutable' modifier", modifier.getLexicalPhrase());
        }
        isImmutable = true;
        break;
      case MUTABLE:
        throw new LanguageParseException("Unexpected modifier: Constructors cannot be mutable", modifier.getLexicalPhrase());
      case NATIVE:
        throw new LanguageParseException("Unexpected modifier: Constructors cannot be native functions", modifier.getLexicalPhrase());
      case SELFISH:
        if (isSelfish)
        {
          throw new LanguageParseException("Duplicate 'selfish' modifier", modifier.getLexicalPhrase());
        }
        isSelfish = true;
        break;
      case SINCE:
        if (sinceSpecifier != null)
        {
          throw new LanguageParseException("Duplicate since(...) specifier", modifier.getLexicalPhrase());
        }
        sinceSpecifier = ((SinceModifier) modifier).getSinceSpecifier();
        break;
      case STATIC:
        throw new LanguageParseException("Unexpected modifier: Constructors cannot be static", modifier.getLexicalPhrase());
      case UNBACKED:
        throw new LanguageParseException("Unexpected modifier: Constructors cannot be unbacked", modifier.getLexicalPhrase());
      default:
        throw new IllegalStateException("Unknown modifier: " + modifier);
      }
    }
    return new Constructor(isImmutable, isSelfish, sinceSpecifier, parameters, checkedThrownTypes, uncheckedThrownTypes, block, lexicalPhrase);
  }
}


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

    <parent>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-jvm</artifactId>
        <relativePath>../../pom.xml</relativePath>
        <version>1.1.9-SNAPSHOT</version>
    </parent>

    <artifactId>java-webbit-websockets-selenium</artifactId>
    <packaging>jar</packaging>
    <name>Examples: Webbit WebSockets tested with Selenium</name>

    <!-- skipTests -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- we don't want to run these tests on travis TRAVIS will be set to true in the travis CI
                    They WILL be compiled -->
                    <!-- TODO: there's PhantomJS, and xvfb, so we could maybe re-enable these -->
                    <skipTests>${env.TRAVIS}</skipTests>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.webbitserver</groupId>
            <artifactId>webbit</artifactId>
        </dependency>

        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-jvm-deps</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-picocontainer</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.picocontainer</groupId>
            <artifactId>picocontainer</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-firefox-driver</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>


text:
package krati.core.array.basic;

import java.io.File;
import java.io.IOException;

import org.apache.log4j.Logger;

import krati.array.DynamicArray;
import krati.core.array.AddressArray;
import krati.core.array.entry.EntryLongFactory;
import krati.core.array.entry.EntryPersistListener;
import krati.core.array.entry.EntryValueLong;

/**
 * DynamicLongArray
 *
 * @author jwu
 *
 */
public class DynamicLongArray extends AbstractRecoverableArray<EntryValueLong> implements AddressArray, DynamicArray, ArrayExpandListener
{
    private final static int _subArrayBits = 16;
    private final static int _subArraySize = 1 << _subArrayBits;
    private final static Logger _log = Logger.getLogger(DynamicLongArray.class);
    private MemoryLongArray _internalArray;

    public DynamicLongArray(int entrySize, int maxEntries, File directory) throws Exception
    {
        super(_subArraySize /* initial array length and subArray length */, 8, entrySize, maxEntries, directory, new EntryLongFactory());
    }

    @Override
    protected void loadArrayFileData()
    {
        long maxScn = _arrayFile.getLwmScn();

        try
        {
            _internalArray = new MemoryLongArray(_subArrayBits);
            _arrayFile.load(_internalArray);

            expandCapacity(_internalArray.length() - 1);
            _internalArray.setArrayExpandListener(this);
        }
        catch(Exception e)
        {
            maxScn = 0;
            clear();
        }

        _entryManager.setWaterMarks(maxScn, maxScn);
    }

    /**
     * Sync-up the high water mark to a given value.
     *
     * @param endOfPeriod
     */
    @Override
    public void saveHWMark(long endOfPeriod)
    {
        if (getHWMark() < endOfPeriod)
        {
            try
            {
                set(0, get(0), endOfPeriod);
            }
            catch(Exception e)
            {
                _log.error(e);
            }
        }
    }

    @Override
    public void clear()
    {
        if (_internalArray != null)
        {
            _internalArray.clear();
        }

        // Clear the entry manager
        _entryManager.clear();

        // Clear the underly array file
        try
        {
            _arrayFile.reset(_internalArray, _entryManager.getLWMark());
        }
        catch(IOException e)
        {
            _log.error(e.getMessage(), e);
        }
    }

    @Override
    public long get(int index)
    {
        return _internalArray.get(index);
    }

    @Override
    public void set(int index, long value, long scn) throws Exception
    {
        _internalArray.set(index, value);
        _entryManager.addToPreFillEntryLong(index, value, scn);
    }

    @Override
    public void setCompactionAddress(int index, long address, long scn) throws Exception
    {
        _internalArray.set(index, address);
        _entryManager.addToPreFillEntryLongCompaction(index, address, scn);
    }

    @Override
    public long[] getInternalArray()
    {
        return _internalArray.getInternalArray();
    }

    @Override
    public EntryPersistListener getPersistListener()
    {
      return getEntryManager().getEntryPersistListener();
    }

    @Override
    public void setPersistListener(EntryPersistListener persistListener)
    {
        getEntryManager().setEntryPersistListener(persistListener);
    }

    @Override
    public void expandCapacity(int index) throws Exception
    {
        if(index < _length) return;

        int newLength = ((index >> _subArrayBits) + 1) * _subArraySize;

        // Reset _length
        _length = newLength;

        // Expand internal array in memory
        if(_internalArray.length() < newLength)
        {
            _internalArray.expandCapacity(index);
        }

        // Expand array file on disk
        _arrayFile.setArrayLength(newLength, null /* do not rename */);

        // Add to logging
        _log.info("Expanded: _length=" + _length);
    }

    @Override
    public void arrayExpanded(DynamicArray dynArray)
    {
        if(dynArray == _internalArray)
        {
            try
            {
                expandCapacity(dynArray.length() - 1);
            }
            catch(Exception e)
            {
                _log.error("Failed to expand: length=" + dynArray.length());
            }
        }
    }

    public final int subArrayLength()
    {
        return _subArraySize;
    }
}


text:
gitismerge () {
    local sha=$1
    msha=$(git rev-list -1 --merges ${sha}~1..${sha})
    [ -z "$msha" ] && return 1
    echo "merge commit"
    return 0
}

if [ `git rev-parse origin/release-candidate` != `git merge-base origin/release-candidate HEAD` ]; then
    echo "Please rebase your branch with \"rebase origin/master\" ";
    exit 1
else
    ko=""
    while read -r rev; do
	echo "check " `git log -1 --pretty=oneline  --abbrev-commit  ${rev}`
	ok=`gitismerge $rev`
	if [[ -n $ok ]]; then
	    echo " ${rev} is a merge commit, please rebase and remove (e.g. squash) all merge commits";
	    ko="1"
	fi
    done< <(git rev-list origin/release-candidate..HEAD)
    if [[ -z $ko ]]; then
	echo "congrats your branch history is compatible with our PR guidelines";
	exit 0
    else
	exit 1
    fi
fi


text:
layout: page
title: Ochoa Family Reunion
date: 2016-05-24
author: Martha Randolph
tags: weekly links, java
status: published
summary: In pellentesque dignissim lectus et fringilla. Aliquam tincidunt ut.
banner: images/banner/people.jpg
booking:
  startDate: 02/17/2019
  endDate: 02/18/2019
  ctyhocn: MIACGHX
  groupCode: OFR
published: true
---
Donec eget pulvinar metus. Quisque et nisl et lacus porttitor maximus. Nam non mauris ut erat tristique commodo ac in orci. Maecenas luctus, velit nec gravida volutpat, quam ex ullamcorper tortor, ut eleifend nunc lectus vitae nunc. Donec facilisis sapien sit amet lorem pretium varius. Vestibulum dictum mi a risus placerat, eget lobortis sem dapibus. Etiam interdum pellentesque rhoncus. Nunc et neque a turpis ullamcorper porttitor. Mauris luctus consequat dolor in tincidunt. Curabitur nec tellus fringilla, tempus ligula a, posuere justo. Cras sodales, neque in pharetra sollicitudin, ipsum lorem iaculis tellus, eget dapibus mauris turpis sed quam. Nam placerat tempus rutrum. Ut et ante pharetra, malesuada quam sit amet, tempor odio.

* Praesent luctus orci id nisl accumsan malesuada
* Aliquam vitae odio porttitor, sollicitudin ante vel, tincidunt sapien
* Proin nec mi id eros consequat lacinia
* Integer eget nisi imperdiet, eleifend tellus euismod, cursus libero.

Praesent eu nisl id ligula convallis consectetur ac ac nulla. Donec et odio eget justo convallis consequat nec at velit. Nulla in tortor dictum, sollicitudin sem sed, varius dolor. Maecenas quam lectus, tristique id ex non, fringilla rhoncus velit. Vestibulum dignissim, mi vel feugiat euismod, sem neque interdum erat, id lacinia ligula ligula ut diam. Suspendisse at purus vestibulum, lobortis lectus et, cursus tortor. Morbi turpis metus, pellentesque eu consectetur quis, vehicula a justo. Nullam finibus enim diam, quis euismod odio sagittis sit amet. Nam sit amet justo leo. Nunc accumsan tempus facilisis. Praesent lectus turpis, consequat at lacinia eget, gravida nec tortor. Vivamus tristique sed libero at condimentum. Curabitur pulvinar lacus mauris, et blandit erat semper egestas.


text:
Locality Sensitive Hashing(LSH)
======

## Introduction
This is the CPU and DFE version of LSH
In src/CPUCode/lsh_dfe.cpp, the function 'fit' includes the test of accuracy and performance of LSH.
Data is randomly generated with in a fixed range, you can also read input data from file.

## Algorithms
Implement p-stable LSH on CPU and DFE

## Compile & run
Use the makefile in build directory, this project does not use the makefile template provided by MaxAppTemplate
>  Make a reservation of DFE and change Makefile.Maia.hardware
>  $cd build
>  $make (show all commands)
>  $make runsim
>  $make build

## Dependencies
#### Platform and libraries
1. g++/icpc
2. boost  (boost/numeric/ublas)
3. MaxCompiler2014.1, MAIA dataflow engine environment


text:
<template name="dbsAI_externalSearch">

{{_ "Knowledge_Base"}}

		{{#let helpRequest=helpRequestByRoom }}
			{{#if helpRequest}}
				{{> HelpRequestContext helpRequest }}
				{{> HelpRequestActions helpRequest }}
			{{/if}}
		{{/let}}
		{{#if isLivechat}}
			{{> HelpRequestActions }}
		{{/if}}
		{{#each messages}}
			{{#if prepareResult}}

					{{#each filledQueryTemplate}}

							{{#if dynamicTemplateExists}}
								{{>UI.dynamic template=queryTemplate}}
							{{else}}
								{{>dynamic_redlink_default}}
							{{/if}}
							{{#if queries}}
								{{> redlinkQueries (queriesContext queries @index)}}
							{{/if}}

					{{/each}}

			{{else}}
				<button class="pick-message"></button>
				{{knowledgeProvider}} read failed
			{{/if}}
		{{/each}}

</template>

<template name="dynamic_redlink_default">

{{queryType}}

			{{#each filledQuerySlots }}

					{{role}}
					{{clientValue}}

			{{/each}}

</template>

<template name="dynamic_redlink_Sonstiges">

{{text 'help'}}

			{{#each filledQuerySlots }}

					{{role}}
					{{clientValue}}

			{{/each}}

</template>

<template name="dynamic_redlink_Produkt">

{{queryType}}

			{{>dynamic_tpl_redlinkItem (forItem 'product') }}
			{{>dynamic_tpl_redlinkItem (forItem 'what') }}

</template>

<template name="dynamic_redlink_Reiseplanung">

{{queryType}}

			{{>dynamic_tpl_redlinkItem (forItem 'from') }}

			{{>dynamic_tpl_redlinkItem (forItem 'to') }}

			{{>dynamic_tpl_redlinkItem (forItem 'card') }}
			{{>dynamic_tpl_redlinkItem (forItem 'class') }}

			{{>dynamic_tpl_redlinkItem (forItem 'depart') }}

			{{>dynamic_tpl_redlinkItem (forItem 'arrive') }}

</template>

<template name="dynamic_redlink_Zuginformation">

{{queryType}}

			{{>dynamic_tpl_redlinkItem (forItem 'train') }}

			{{>dynamic_tpl_redlinkItem (forItem 'date') }}

			{{>dynamic_tpl_redlinkItem (forItem 'from') }}

			{{>dynamic_tpl_redlinkItem (forItem 'to') }}

			{{>dynamic_tpl_redlinkItem (forItem 'what') }}

</template>

<template name="dynamic_redlink_Umkreissuche">

{{queryType}}

			{{>dynamic_tpl_redlinkItem (forItem 'location') }}

			{{>dynamic_tpl_redlinkItem (forItem 'what') }}

			{{>dynamic_tpl_redlinkItem (forItem 'start') }}

			{{>dynamic_tpl_redlinkItem (forItem 'end') }}

</template>

<template name="dynamic_tpl_redlinkItem">

		{{_ label}}

			<input id="{{htmlId}}" type="text" class="knowledge-base-value {{itemStyle}}" value="{{item}}"/>

 Editieren

 Löschen

					 Nachfragen

</template>

<template name="dynamic_redlink_ApplicationHelp">

{{_ queryType}}

</template>


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('defcdb', '0031_auto_20160413_1413'),
    ]

    operations = [
        migrations.CreateModel(
            name='Contact',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)),
                ('first_name', models.CharField(null=True, blank=True, max_length=500)),
                ('last_name', models.CharField(null=True, blank=True, max_length=500)),
                ('institution', models.ManyToManyField(blank=True, to='defcdb.ResearchEvent')),
            ],
        ),
        migrations.CreateModel(
            name='Project',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)),
                ('name', models.CharField(null=True, blank=True, max_length=500)),
                ('title', models.CharField(null=True, blank=True, max_length=500)),
                ('source', models.CharField(null=True, blank=True, max_length=500)),
                ('language', models.CharField(null=True, blank=True, max_length=500)),
                ('keywords', models.CharField(null=True, blank=True, max_length=500)),
                ('publisher', models.CharField(null=True, blank=True, max_length=500)),
                ('issued', models.CharField(null=True, blank=True, max_length=500)),
                ('license', models.CharField(null=True, blank=True, max_length=500)),
                ('access_rights', models.CharField(null=True, blank=True, max_length=500)),
                ('contact', models.ManyToManyField(blank=True, to='threedmodels.Contact')),
            ],
        ),
        migrations.CreateModel(
            name='Threedmodel',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)),
                ('part', models.CharField(null=True, blank=True, max_length=500)),
                ('diameter', models.CharField(null=True, blank=True, max_length=500)),
                ('wall_thickness', models.CharField(null=True, blank=True, max_length=500)),
                ('surface_treatment_i', models.CharField(null=True, blank=True, max_length=500)),
                ('surface_treatment_o', models.CharField(null=True, blank=True, max_length=500)),
                ('surface_color_i', models.CharField(null=True, blank=True, max_length=500)),
                ('surface_color_o', models.CharField(null=True, blank=True, max_length=500)),
                ('decoration_color', models.CharField(null=True, blank=True, max_length=500)),
                ('decoration_description', models.CharField(null=True, blank=True, max_length=500)),
                ('fabric_color', models.CharField(null=True, blank=True, max_length=500)),
                ('hardness', models.CharField(null=True, blank=True, max_length=500)),
                ('sorting', models.CharField(null=True, blank=True, max_length=500)),
                ('density', models.CharField(null=True, blank=True, max_length=500)),
                ('pores', models.CharField(null=True, blank=True, max_length=500)),
                ('core_form', models.CharField(null=True, blank=True, max_length=500)),
                ('core_color', models.CharField(null=True, blank=True, max_length=500)),
                ('inclusion_type', models.CharField(null=True, blank=True, max_length=500)),
                ('inclusion_color', models.CharField(null=True, blank=True, max_length=500)),
                ('inclusion_form', models.CharField(null=True, blank=True, max_length=500)),
                ('inclusion_particle_size', models.CharField(null=True, blank=True, max_length=500)),
                ('inclusion_frequency', models.CharField(null=True, blank=True, max_length=500)),
                ('inclusion_hardness', models.CharField(null=True, blank=True, max_length=500)),
                ('finds', models.ForeignKey(null=True, blank=True, to='defcdb.Finds')),
                ('resource_metadata', models.ForeignKey(null=True, blank=True, to='threedmodels.Project')),
            ],
        ),
    ]


text: <?php echo wp_kses_post( $description ) ?>


text:
namespace mxtest
{
    mx::core::PartAbbreviationDisplayPtr tgenPartAbbreviationDisplay( TestMode v );
    void tgenPartAbbreviationDisplayExpected(std::ostream& os, int indentLevel, TestMode v );
}

#endif


text:
import {Pipe, PipeTransform} from 'angular2/core';

@Pipe({name: 'filter'})
export class FilterPipe implements PipeTransform {
    list: Array<any>;
    transform(value: Array<any>, args:string[]){
        this.list = new Array<any>();

        value.forEach((item) => {
            if(!args[1]){
                 Object.getOwnPropertyNames(item).forEach((prop) => {
                   this.searchForItem(item, prop, args[0]);
                });
            }
            else{
                this.searchForItem(item, args[1], args[0]);
            }
        });

        return this.list;
    }

    private searchForItem(item:Object, property, search):void {
        if(item[property].toLowerCase().indexOf(search.toLowerCase()) != -1){
            if(this.list.indexOf(item) == -1){
                this.list.push(item);
            }
        }
    }
}


text:
package com.elfangor1989.FreeLiveView.messages.calls;

import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

import com.elfangor1989.FreeLiveView.messages.EncodingException;
import com.elfangor1989.FreeLiveView.messages.LiveViewCall;
import com.elfangor1989.FreeLiveView.messages.MessageConstants;

public class CapsRequest extends LiveViewCall {

    public CapsRequest() {
        super(MessageConstants.MSG_GETCAPS);
    }

    /*
     * (non-Javadoc)
     * @see net.sourcewalker.olv.LiveViewMessage#getPayload()
     */
    @Override
    protected byte[] getPayload() {
        try {
            byte[] version = MessageConstants.CLIENT_SOFTWARE_VERSION
                    .getBytes("iso-8859-1");
            byte msgLength = (byte) version.length;
            ByteBuffer buffer = ByteBuffer.allocate(msgLength + 1);
            buffer.order(ByteOrder.BIG_ENDIAN);
            buffer.put(msgLength);
            buffer.put(version);
            return buffer.array();
        } catch (UnsupportedEncodingException e) {
            throw new EncodingException(e);
        }
    }
}


text:
package proptools

import (
	"fmt"
	"reflect"
	"sort"
	"strconv"
	"strings"
	"text/scanner"

	"github.com/google/blueprint/parser"
)

const maxUnpackErrors = 10

type UnpackError struct {
	Err error
	Pos scanner.Position
}

func (e *UnpackError) Error() string {
	return fmt.Sprintf("%s: %s", e.Pos, e.Err)
}

// packedProperty helps to track properties usage (`used` will be true)
type packedProperty struct {
	property *parser.Property
	used     bool
}

// unpackContext keeps compound names and their values in a map. It is initialized from
// parsed properties.
type unpackContext struct {
	propertyMap map[string]*packedProperty
	errs        []error
}

// UnpackProperties populates the list of runtime values ("property structs") from the parsed properties.
// If a property a.b.c has a value, a field with the matching name in each runtime value is initialized
// from it. See PropertyNameForField for field and property name matching.
// For instance, if the input contains
//   { foo: "abc", bar: {x: 1},}
// and a runtime value being has been declared as
//   var v struct { Foo string; Bar int }
// then v.Foo will be set to "abc" and v.Bar will be set to 1
// (cf. unpack_test.go for further examples)
//
// The type of a receiving field has to match the property type, i.e., a bool/int/string field
// can be set from a property with bool/int/string value, a struct can be set from a map (only the
// matching fields are set), and an slice can be set from a list.
// If a field of a runtime value has been already set prior to the UnpackProperties, the new value
// is appended to it (see somewhat inappropriately named ExtendBasicType).
// The same property can initialize fields in multiple runtime values. It is an error if any property
// value was not used to initialize at least one field.
func UnpackProperties(properties []*parser.Property, objects ...interface{}) (map[string]*parser.Property, []error) {
	var unpackContext unpackContext
	unpackContext.propertyMap = make(map[string]*packedProperty)
	if !unpackContext.buildPropertyMap("", properties) {
		return nil, unpackContext.errs
	}

	for _, obj := range objects {
		valueObject := reflect.ValueOf(obj)
		if !isStructPtr(valueObject.Type()) {
			panic(fmt.Errorf("properties must be *struct, got %s",
				valueObject.Type()))
		}
		unpackContext.unpackToStruct("", valueObject.Elem())
		if len(unpackContext.errs) >= maxUnpackErrors {
			return nil, unpackContext.errs
		}
	}

	// Gather property map, and collect any unused properties.
	// Avoid reporting subproperties of unused properties.
	result := make(map[string]*parser.Property)
	var unusedNames []string
	for name, v := range unpackContext.propertyMap {
		if v.used {
			result[name] = v.property
		} else {
			unusedNames = append(unusedNames, name)
		}
	}
	if len(unusedNames) == 0 && len(unpackContext.errs) == 0 {
		return result, nil
	}
	return nil, unpackContext.reportUnusedNames(unusedNames)
}

func (ctx *unpackContext) reportUnusedNames(unusedNames []string) []error {
	sort.Strings(unusedNames)
	var lastReported string
	for _, name := range unusedNames {
		// if 'foo' has been reported, ignore 'foo\..*' and 'foo\[.*'
		if lastReported != "" {
			trimmed := strings.TrimPrefix(name, lastReported)
			if trimmed != name && (trimmed[0] == '.' || trimmed[0] == '[') {
				continue
			}
		}
		ctx.errs = append(ctx.errs, &UnpackError{
			fmt.Errorf("unrecognized property %q", name),
			ctx.propertyMap[name].property.ColonPos})
		lastReported = name
	}
	return ctx.errs
}

func (ctx *unpackContext) buildPropertyMap(prefix string, properties []*parser.Property) bool {
	nOldErrors := len(ctx.errs)
	for _, property := range properties {
		name := fieldPath(prefix, property.Name)
		if first, present := ctx.propertyMap[name]; present {
			ctx.addError(
				&UnpackError{fmt.Errorf("property %q already defined", name), property.ColonPos})
			if ctx.addError(
				&UnpackError{fmt.Errorf("<-- previous definition here"), first.property.ColonPos}) {
				return false
			}
			continue
		}

		ctx.propertyMap[name] = &packedProperty{property, false}
		switch propValue := property.Value.Eval().(type) {
		case *parser.Map:
			ctx.buildPropertyMap(name, propValue.Properties)
		case *parser.List:
			// If it is a list, unroll it unless its elements are of primitive type
			// (no further mapping will be needed in that case, so we avoid cluttering
			// the map).
			if len(propValue.Values) == 0 {
				continue
			}
			if t := propValue.Values[0].Type(); t == parser.StringType || t == parser.Int64Type || t == parser.BoolType {
				continue
			}

			itemProperties := make([]*parser.Property, len(propValue.Values), len(propValue.Values))
			for i, expr := range propValue.Values {
				itemProperties[i] = &parser.Property{
					Name:     property.Name + "[" + strconv.Itoa(i) + "]",
					NamePos:  property.NamePos,
					ColonPos: property.ColonPos,
					Value:    expr,
				}
			}
			if !ctx.buildPropertyMap(prefix, itemProperties) {
				return false
			}
		}
	}

	return len(ctx.errs) == nOldErrors
}

func fieldPath(prefix, fieldName string) string {
	if prefix == "" {
		return fieldName
	}
	return prefix + "." + fieldName
}

func (ctx *unpackContext) addError(e error) bool {
	ctx.errs = append(ctx.errs, e)
	return len(ctx.errs) < maxUnpackErrors
}

func (ctx *unpackContext) unpackToStruct(namePrefix string, structValue reflect.Value) {
	structType := structValue.Type()

	for i := 0; i < structValue.NumField(); i++ {
		fieldValue := structValue.Field(i)
		field := structType.Field(i)

		// In Go 1.7, runtime-created structs are unexported, so it's not
		// possible to create an exported anonymous field with a generated
		// type. So workaround this by special-casing "BlueprintEmbed" to
		// behave like an anonymous field for structure unpacking.
		if field.Name == "BlueprintEmbed" {
			field.Name = ""
			field.Anonymous = true
		}

		if field.PkgPath != "" {
			// This is an unexported field, so just skip it.
			continue
		}

		propertyName := fieldPath(namePrefix, PropertyNameForField(field.Name))

		if !fieldValue.CanSet() {
			panic(fmt.Errorf("field %s is not settable", propertyName))
		}

		// Get the property value if it was specified.
		packedProperty, propertyIsSet := ctx.propertyMap[propertyName]

		origFieldValue := fieldValue

		// To make testing easier we validate the struct field's type regardless
		// of whether or not the property was specified in the parsed string.
		// TODO(ccross): we don't validate types inside nil struct pointers
		// Move type validation to a function that runs on each factory once
		switch kind := fieldValue.Kind(); kind {
		case reflect.Bool, reflect.String, reflect.Struct, reflect.Slice:
			// Do nothing
		case reflect.Interface:
			if fieldValue.IsNil() {
				panic(fmt.Errorf("field %s contains a nil interface", propertyName))
			}
			fieldValue = fieldValue.Elem()
			elemType := fieldValue.Type()
			if elemType.Kind() != reflect.Ptr {
				panic(fmt.Errorf("field %s contains a non-pointer interface", propertyName))
			}
			fallthrough
		case reflect.Ptr:
			switch ptrKind := fieldValue.Type().Elem().Kind(); ptrKind {
			case reflect.Struct:
				if fieldValue.IsNil() && (propertyIsSet || field.Anonymous) {
					// Instantiate nil struct pointers
					// Set into origFieldValue in case it was an interface, in which case
					// fieldValue points to the unsettable pointer inside the interface
					fieldValue = reflect.New(fieldValue.Type().Elem())
					origFieldValue.Set(fieldValue)
				}
				fieldValue = fieldValue.Elem()
			case reflect.Bool, reflect.Int64, reflect.String:
				// Nothing
			default:
				panic(fmt.Errorf("field %s contains a pointer to %s", propertyName, ptrKind))
			}

		case reflect.Int, reflect.Uint:
			if !HasTag(field, "blueprint", "mutated") {
				panic(fmt.Errorf(`int field %s must be tagged blueprint:"mutated"`, propertyName))
			}

		default:
			panic(fmt.Errorf("unsupported kind for field %s: %s", propertyName, kind))
		}

		if field.Anonymous && isStruct(fieldValue.Type()) {
			ctx.unpackToStruct(namePrefix, fieldValue)
			continue
		}

		if !propertyIsSet {
			// This property wasn't specified.
			continue
		}

		packedProperty.used = true
		property := packedProperty.property

		if HasTag(field, "blueprint", "mutated") {
			if !ctx.addError(
				&UnpackError{
					fmt.Errorf("mutated field %s cannot be set in a Blueprint file", propertyName),
					property.ColonPos,
				}) {
				return
			}
			continue
		}

		if isStruct(fieldValue.Type()) {
			ctx.unpackToStruct(propertyName, fieldValue)
			if len(ctx.errs) >= maxUnpackErrors {
				return
			}
		} else if isSlice(fieldValue.Type()) {
			if unpackedValue, ok := ctx.unpackToSlice(propertyName, property, fieldValue.Type()); ok {
				ExtendBasicType(fieldValue, unpackedValue, Append)
			}
			if len(ctx.errs) >= maxUnpackErrors {
				return
			}

		} else {
			unpackedValue, err := propertyToValue(fieldValue.Type(), property)
			if err != nil && !ctx.addError(err) {
				return
			}
			ExtendBasicType(fieldValue, unpackedValue, Append)
		}
	}
}

// unpackSlice creates a value of a given slice type from the property which should be a list
func (ctx *unpackContext) unpackToSlice(
	sliceName string, property *parser.Property, sliceType reflect.Type) (reflect.Value, bool) {
	propValueAsList, ok := property.Value.Eval().(*parser.List)
	if !ok {
		ctx.addError(fmt.Errorf("%s: can't assign %s value to list property %q",
			property.Value.Pos(), property.Value.Type(), property.Name))
		return reflect.MakeSlice(sliceType, 0, 0), false
	}
	exprs := propValueAsList.Values
	value := reflect.MakeSlice(sliceType, 0, len(exprs))
	if len(exprs) == 0 {
		return value, true
	}

	// The function to construct an item value depends on the type of list elements.
	var getItemFunc func(*parser.Property, reflect.Type) (reflect.Value, bool)
	switch exprs[0].Type() {
	case parser.BoolType, parser.StringType, parser.Int64Type:
		getItemFunc = func(property *parser.Property, t reflect.Type) (reflect.Value, bool) {
			value, err := propertyToValue(t, property)
			if err != nil {
				ctx.addError(err)
				return value, false
			}
			return value, true
		}
	case parser.ListType:
		getItemFunc = func(property *parser.Property, t reflect.Type) (reflect.Value, bool) {
			return ctx.unpackToSlice(property.Name, property, t)
		}
	case parser.MapType:
		getItemFunc = func(property *parser.Property, t reflect.Type) (reflect.Value, bool) {
			itemValue := reflect.New(t).Elem()
			ctx.unpackToStruct(property.Name, itemValue)
			return itemValue, true
		}
	case parser.NotEvaluatedType:
		getItemFunc = func(property *parser.Property, t reflect.Type) (reflect.Value, bool) {
			return reflect.New(t), false
		}
	default:
		panic(fmt.Errorf("bizarre property expression type: %v", exprs[0].Type()))
	}

	itemProperty := &parser.Property{NamePos: property.NamePos, ColonPos: property.ColonPos}
	elemType := sliceType.Elem()
	isPtr := elemType.Kind() == reflect.Ptr

	for i, expr := range exprs {
		itemProperty.Name = sliceName + "[" + strconv.Itoa(i) + "]"
		itemProperty.Value = expr
		if packedProperty, ok := ctx.propertyMap[itemProperty.Name]; ok {
			packedProperty.used = true
		}
		if isPtr {
			if itemValue, ok := getItemFunc(itemProperty, elemType.Elem()); ok {
				ptrValue := reflect.New(itemValue.Type())
				ptrValue.Elem().Set(itemValue)
				value = reflect.Append(value, ptrValue)
			}
		} else {
			if itemValue, ok := getItemFunc(itemProperty, elemType); ok {
				value = reflect.Append(value, itemValue)
			}
		}
	}
	return value, true
}

// propertyToValue creates a value of a given value type from the property.
func propertyToValue(typ reflect.Type, property *parser.Property) (reflect.Value, error) {
	var value reflect.Value
	var baseType reflect.Type
	isPtr := typ.Kind() == reflect.Ptr
	if isPtr {
		baseType = typ.Elem()
	} else {
		baseType = typ
	}

	switch kind := baseType.Kind(); kind {
	case reflect.Bool:
		b, ok := property.Value.Eval().(*parser.Bool)
		if !ok {
			return value, fmt.Errorf("%s: can't assign %s value to bool property %q",
				property.Value.Pos(), property.Value.Type(), property.Name)
		}
		value = reflect.ValueOf(b.Value)

	case reflect.Int64:
		b, ok := property.Value.Eval().(*parser.Int64)
		if !ok {
			return value, fmt.Errorf("%s: can't assign %s value to int64 property %q",
				property.Value.Pos(), property.Value.Type(), property.Name)
		}
		value = reflect.ValueOf(b.Value)

	case reflect.String:
		s, ok := property.Value.Eval().(*parser.String)
		if !ok {
			return value, fmt.Errorf("%s: can't assign %s value to string property %q",
				property.Value.Pos(), property.Value.Type(), property.Name)
		}
		value = reflect.ValueOf(s.Value)

	default:
		return value, &UnpackError{
			fmt.Errorf("cannot assign %s value %s to %s property %s", property.Value.Type(), property.Value, kind, typ),
			property.NamePos}
	}

	if isPtr {
		ptrValue := reflect.New(value.Type())
		ptrValue.Elem().Set(value)
		return ptrValue, nil
	}
	return value, nil
}


text:
;(function (){
  'use strict';

  var pubsub = {};
  _.extend(Backbone.View.prototype, {
    subscribe: function (eventname, func) {
      if (!pubsub[eventname]) {
        pubsub[eventname] = [];
      }
      pubsub[eventname].push([this, func]);
    },
    unsubscribe: function (eventname) {
      if (!eventname) {
        for (var evname in pubsub) {
          if (pubsub.hasOwnProperty(evname)) {
            this.unsubscribe(evname);
          }
        }
        return;
      }
      var viewAndFuncs = pubsub[eventname];
      var targets = _.filter(viewAndFuncs, function (viewAndFunc) {
        var view = viewAndFunc[0];
        if (view === this) {
          return viewAndFunc;
        }
      }, this);
      _.each(targets, function (viewAndFunc) {
        viewAndFuncs.splice(_.indexOf(viewAndFuncs, viewAndFunc), 1);
      });
    },
    publish: function (eventname) {
      if (_.isUndefined(pubsub[eventname])) {
        return;
      }
      var args = Array.prototype.slice.call(arguments, 1, arguments.length);
      _.each(pubsub[eventname], function (viewAndFunc) {
        var view = viewAndFunc[0];
        var func = viewAndFunc[1];
        func.apply(view, args);
      });
    }
  });

  Backbone.PubSub = {
    publishToViews: Backbone.View.prototype.publish
  };

}());


text:
<?php namespace Yani\Coinbase\Tests;

class TestConfig extends \PHPUnit_Framework_TestCase {
	/**
	 * Coinbase package config
	 *
	 * @var array
	 */
	protected $config = [];

	/**
	 * Setting up the tests
	 */
	public function setUp()
	{
		$this->config = include __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'src' .
		                        DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
	}

	/**
	 * Test if package config has API KEY
	 */
	public function testConfigHasApiKey()
	{
		$this->assertTrue(isset($this->config['apiKey']));
		$this->assertTrue(empty($this->config['apiKey']));
	}

	/**
	 * Test if package config has API SECRET
	 */
	public function testConfigHasApiSecret()
	{
		$this->assertTrue(isset($this->config['apiSecret']));
		$this->assertTrue(empty($this->config['apiSecret']));
	}

	/**
	 * Test if package config has endpoint
	 */
	public function testConfigHasEndpoint()
	{
		$this->assertTrue(isset($this->config['endpoint']));
		$this->assertTrue(empty($this->config['endpoint']));
	}
}


text:
package therian.position.relative.propertymethod;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.function.BiConsumer;
import java.util.function.Function;

import org.apache.commons.weaver.model.ScanRequest;
import org.apache.commons.weaver.model.ScanResult;
import org.apache.commons.weaver.model.Scanner;
import org.apache.commons.weaver.model.WeavableClass;
import org.apache.commons.weaver.model.WeaveEnvironment;
import org.apache.commons.weaver.model.WeaveEnvironment.Resource;
import org.apache.commons.weaver.spi.Weaver;
import org.kohsuke.MetaInfServices;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.ClassNode;

import therian.position.relative.Property;

/**
 * {@link Weaver} to wrap method reference lambdas:
 *

 *
Java bean property accessors as {@link Function}: to {@link Property.Accessor}

 *
Java bean property mutators as {@link BiConsumer}: to {@link Property.Mutator}

 *

 */
@MetaInfServices(Weaver.class)
public class PropertyMethodWeaver implements Weaver {
    /**
     * Convenience structure to hold the environment passed into {@link Weaver#process(WeaveEnvironment, Scanner)}.
     */
    private static class Worker {

        private final class CustomClassWriter extends ClassWriter {
            CustomClassWriter(final ClassReader classReader, final int flags) {
                super(classReader, flags);
            }

            @Override
            protected String getCommonSuperClass(final String type1, final String type2) {
                // https://gitlab.ow2.org/asm/asm/merge_requests/166
                ClassLoader classLoader = env.classLoader;
                Class<?> class1;
                try {
                    class1 = Class.forName(type1.replace('/', '.'), false, classLoader);
                } catch (Exception e) {
                    throw new TypeNotPresentException(type1, e);
                }
                Class<?> class2;
                try {
                    class2 = Class.forName(type2.replace('/', '.'), false, classLoader);
                } catch (Exception e) {
                    throw new TypeNotPresentException(type2, e);
                }
                if (class1.isAssignableFrom(class2)) {
                    return type1;
                }
                if (class2.isAssignableFrom(class1)) {
                    return type2;
                }
                if (class1.isInterface() || class2.isInterface()) {
                    return "java/lang/Object";
                } else {
                    do {
                        class1 = class1.getSuperclass();
                    } while (!class1.isAssignableFrom(class2));
                    return class1.getName().replace('.', '/');
                }
            }
        }

        /**
         * Convenient {@link ClassVisitor} layer to write classfiles into the {@link WeaveEnvironment}.
         */
        class WriteClass extends ClassVisitor {

            private String className;

            WriteClass(final ClassReader classReader, final int flags) {
                super(Opcodes.ASM6, new CustomClassWriter(classReader, flags));
            }

            @Override
            public void visit(int version, int access, String name, String signature, String superName,
                String[] interfaces) {
                super.visit(version, access, name, signature, superName, interfaces);
                this.className = name;
            }

            @Override
            public void visitEnd() {
                super.visitEnd();
                final byte[] bytecode = ((ClassWriter) cv).toByteArray();

                final Resource classfile = env.getClassfile(className);
                env.debug("Writing class %s to resource %s", className, classfile.getName());
                try (OutputStream outputStream = classfile.getOutputStream()) {
                    outputStream.write(bytecode);
                } catch (final IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }

        private final WeaveEnvironment env;

        Worker(WeaveEnvironment env) {
            super();
            this.env = env;
        }

        /**
         * Perform the weaving operations for the specified {@link Class}.
         *
         * @param type
         * @return whether any modification was made
         */
        boolean weave(Class<?> type) {
            env.debug("Wrapping property accessor/mutator method references in %s", type);

            try (final InputStream bytecode = env.getClassfile(type).getInputStream()) {
                final ClassReader reader = new ClassReader(bytecode);

                final ClassNode cn = new ClassNode(Opcodes.ASM6);
                final PropertyMethodWrappingClassVisitor cv = new PropertyMethodWrappingClassVisitor(env, cn);

                reader.accept(cv, ClassReader.EXPAND_FRAMES);

                if (cv.isModified()) {
                    // add marker annotation to sign our work, as it were:
                    cn.visitAnnotation(MARKER_ANNOTATION.getDescriptor(), false).visitEnd();
                    // write new classfile:
                    cn.accept(new WriteClass(reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS));
                    return true;
                }
                env.debug("%s was unmodified", type);
                return false;
            } catch (IOException e) {
                throw new IllegalStateException(e);
            }
        }
    }

    /**
     * ASM {@link Type} representing our marker annotation.
     */
    static final Type MARKER_ANNOTATION = Type.getType(WovenPropertyMethods.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean process(WeaveEnvironment environment, Scanner scanner) {

        // interested in all classes:
        final ScanResult scanResult = scanner.scan(new ScanRequest());

        final Worker w = new Worker(environment);
        boolean result = false;

        for (WeavableClass<?> weavableClass : scanResult.getClasses()) {
            result = w.weave(weavableClass.getTarget()) || result;
        }
        return result;
    }
}


text:
Get the Wallet

                Download now


text:
<!DOCTYPE html>

<my-element></my-element>

<script>
  // Extend an HTMLElement or another custom element
  class MyElement extends HTMLElement {
    // This is called when our element is attached to the DOM
    connectedCallback() {
      this.innerHTML = `<h1>Hello!</h1><p>I am a custom element</p>`;
    }
  }

  // Tell the browser to associate the '<my-element>' tag
  // with our MyElement class
  customElements.define('my-element', MyElement);
</script>


text:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Encoding Hint: 雀の往来 -->
<project>
 <property name="jnlp.title"    value="JST LocalDateTimeでJSpinner作成" />
 <property name="jnlp.Name"     value="SpinnerLocalDateTimeModel " />
 <property name="jnlp.name"     value="spinnerlocaldatetimemodel" />
 <property name="jnlp.codebase" value="http://ateraimemo.com/swing/${jnlp.name}/" />
 <property name="jnlp.homepage" value="http://ateraimemo.com/Swing/${jnlp.Name}.html" />
</project>


text:
package org.hisp.dhis.common;

import org.hisp.dhis.common.ListMap;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.junit.Test;

import com.google.common.collect.Lists;

import static org.junit.Assert.*;

import java.util.List;

/**
 * @author Lars Helge Overland
 */
public class ListMapTest
{
    @Test
    public void testPutValue()
    {
        ListMap<String, Integer> map = new ListMap<>();

        map.putValue( "A", 1 );
        map.putValue( "B", 2 );
        map.putValue( "C", 3 );
        map.putValue( "A", 4 );
        map.putValue( "B", 5 );
        map.putValue( "A", 6 );

        assertEquals( Lists.newArrayList( 1, 4, 6 ), map.get( "A" ) );
        assertEquals( Lists.newArrayList( 2, 5 ), map.get( "B" ) );
        assertEquals( Lists.newArrayList( 3 ), map.get( "C" ) );
        assertNull( map.get( "Z" ) );
    }

    @Test
    public void testGetListMapValueMapper()
    {
        DataElementGroupSet groupSetA = new DataElementGroupSet( "GroupSetA" );
        DataElementGroupSet groupSetB = new DataElementGroupSet( "GroupSetB" );
        DataElementGroupSet groupSetC = new DataElementGroupSet( "GroupSetC" );
        DataElementGroupSet groupSetZ = new DataElementGroupSet( "GroupSetZ" );

        DataElementGroup groupA = new DataElementGroup( "GroupA" );
        DataElementGroup groupB = new DataElementGroup( "GroupB" );
        DataElementGroup groupC = new DataElementGroup( "GroupC" );
        DataElementGroup groupD = new DataElementGroup( "GroupD" );
        DataElementGroup groupE = new DataElementGroup( "GroupE" );
        DataElementGroup groupF = new DataElementGroup( "GroupF" );

        groupA.setGroupSet( groupSetA );
        groupB.setGroupSet( groupSetB );
        groupC.setGroupSet( groupSetC );
        groupD.setGroupSet( groupSetA );
        groupE.setGroupSet( groupSetB );
        groupF.setGroupSet( groupSetA );

        List<DataElementGroup> groups = Lists.newArrayList( groupA, groupB, groupC, groupD, groupE, groupF );

        ListMap<DataElementGroupSet, DataElementGroup> map = ListMap.getListMap( groups, group -> group.getGroupSet() );

        assertEquals( Lists.newArrayList( groupA, groupD, groupF ), map.get( groupSetA ) );
        assertEquals( Lists.newArrayList( groupB, groupE ), map.get( groupSetB ) );
        assertEquals( Lists.newArrayList( groupC ), map.get( groupSetC ) );
        assertNull( map.get( groupSetZ ) );
    }

    @Test
    public void testGetListMapKeyValueMapper()
    {
        DataElementGroupSet groupSetA = new DataElementGroupSet( "GroupSetA" );
        DataElementGroupSet groupSetB = new DataElementGroupSet( "GroupSetB" );
        DataElementGroupSet groupSetC = new DataElementGroupSet( "GroupSetC" );
        DataElementGroupSet groupSetZ = new DataElementGroupSet( "GroupSetZ" );

        DataElementGroup groupA = new DataElementGroup( "GroupA" );
        DataElementGroup groupB = new DataElementGroup( "GroupB" );
        DataElementGroup groupC = new DataElementGroup( "GroupC" );
        DataElementGroup groupD = new DataElementGroup( "GroupD" );
        DataElementGroup groupE = new DataElementGroup( "GroupE" );
        DataElementGroup groupF = new DataElementGroup( "GroupF" );

        groupA.setGroupSet( groupSetA );
        groupB.setGroupSet( groupSetB );
        groupC.setGroupSet( groupSetC );
        groupD.setGroupSet( groupSetA );
        groupE.setGroupSet( groupSetB );
        groupF.setGroupSet( groupSetA );

        List<DataElementGroup> groups = Lists.newArrayList( groupA, groupB, groupC, groupD, groupE, groupF );

        ListMap<DataElementGroupSet, Integer> map = ListMap.getListMap( groups, group -> group.getGroupSet(), group -> group.getId() );

        assertEquals( Lists.newArrayList( groupA.getId(), groupD.getId(), groupF.getId() ), map.get( groupSetA ) );
        assertEquals( Lists.newArrayList( groupB.getId(), groupE.getId() ), map.get( groupSetB ) );
        assertEquals( Lists.newArrayList( groupC.getId() ), map.get( groupSetC ) );
        assertNull( map.get( groupSetZ ) );
    }
}


text:
/**
 * Created by Ben on 6/28/2016.
 */

var Promise = require('bluebird')
var objectAssign = require('object-assign')
var pluginManager = require('./plugin-manager')
var notify = require('./notify')

var defaults = {
  source: "directory",
  directory: __dirname
}

module.exports = DeploytoolSource

/**
 * @param config
 * @property config
 * @constructor
 */
function DeploytoolSource(config) {
  this.config = objectAssign(defaults, config)
}

DeploytoolSource.prototype.getVinyl = function () {
  var self = this

  return pluginManager
    .load(self.config.source, 'source')
    .then(function (plugin) {
      return plugin.getVinyl(self.config)
    })
}


text:
const gcal = require('google-calendar');
const moment = require('moment');

function Calendar() {}

Calendar.prototype.getToday = function callback(accessToken, next) {
  const options = {
    timeMin: moment().startOf('day').format(),
    timeMax: moment().endOf('day').format(),
    singleEvents: true,
    orderBy: 'startTime',
  };
  const googleCalendar = new gcal.GoogleCalendar(accessToken);
  googleCalendar.events.list('primary', options, (err, calendarList) => {
    next(calendarList);
  });
};

const calendar = new Calendar();
module.exports = calendar;


text:
package com.vk.api.sdk.queries.places;

import com.vk.api.sdk.client.AbstractQueryBuilder;
import com.vk.api.sdk.client.Utils;
import com.vk.api.sdk.client.VkApiClient;
import com.vk.api.sdk.client.actors.UserActor;
import com.vk.api.sdk.objects.places.PlaceMin;

import java.util.Arrays;
import java.util.List;

/**
 * Query for Places.getById method
 */
public class PlacesGetByIdQuery extends AbstractQueryBuilder<PlacesGetByIdQuery, List<PlaceMin>> {
    /**
     * Creates a AbstractQueryBuilder instance that can be used to build api request with various parameters
     *
     * @param client VK API client
     * @param actor  actor with access token
     * @param places value of "places" parameter.
     */
    public PlacesGetByIdQuery(VkApiClient client, UserActor actor, int... places) {
        super(client, "places.getById", Utils.buildParametrizedType(List.class, PlaceMin.class));
        accessToken(actor.getAccessToken());
        places(places);
    }

    /**
     * Creates a AbstractQueryBuilder instance that can be used to build api request with various parameters
     *
     * @param client VK API client
     * @param actor  actor with access token
     * @param places value of "places" parameter.
     */
    public PlacesGetByIdQuery(VkApiClient client, UserActor actor, List<Integer> places) {
        super(client, "places.getById", Utils.buildParametrizedType(List.class, PlaceMin.class));
        accessToken(actor.getAccessToken());
        places(places);
    }

    /**
     * Location IDs.
     *
     * @param value value of "places" parameter.
     * @return a reference to this {@code AbstractQueryBuilder} object to fulfill the "Builder" pattern.
     */
    protected PlacesGetByIdQuery places(int... value) {
        return unsafeParam("places", value);
    }

    /**
     * Location IDs.
     *
     * @param value value of "places" parameter.
     * @return a reference to this {@code AbstractQueryBuilder} object to fulfill the "Builder" pattern.
     */
    protected PlacesGetByIdQuery places(List<Integer> value) {
        return unsafeParam("places", value);
    }

    @Override
    protected PlacesGetByIdQuery getThis() {
        return this;
    }

    @Override
    protected List<String> essentialKeys() {
        return Arrays.asList("places", "access_token");
    }
}


text:
@(images: List[models.Image])
	@for(img <- images){

@img.metadata.uuid

@img.filename

	}


text:
package io.udash.component

trait Components {
  type Listenable = io.udash.component.Listenable
  type ListenableEvent = io.udash.component.ListenableEvent
}

object Components extends Components


text:
import Resource from './Resource';

class RemoteResource extends Resource {
  constructor(path) {
    super();
    this.data = null;
    const resource = this;
    fetch(path)
      .then((res) => res.json())
      .then(
        (data) => {
          resource.data = data;
          resource.setLoaded(true);
        },
        (error) => {
          console.log(`Error reading resource ${path}: ${error}`);
        }
      );
  }

  getData() {
    return this.data;
  }
}

export default RemoteResource;


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/parent_view"
    android:orientation="vertical" >

	<LinearLayout
    	android:layout_width = "match_parent"
	    android:layout_height = "40dp"
	    android:orientation = "horizontal"
	    android:background="@drawable/graphic_white_step"
	    >
	    <Button
        	android:text = "Submit"
        	android:id="@+id/recordings_submit_btn"
        	android:background = "@drawable/white_button_selector_background"
        	android:layout_width = "0dp"
        	android:layout_weight = "1"
        	android:textColor = "#00BFFF"
        	android:layout_height = "match_parent"/>
    	<View
	        android:layout_width = "1dp"
    	    android:layout_height = "30dp"
        	android:layout_gravity = "center"
        	android:background = "#CCC"/>
    	<Button
	        android:background = "@drawable/white_button_selector_background"
        	android:layout_width="0dp"
        	android:layout_height = "match_parent"
        	android:layout_weight="1"
        	android:textColor = "#00BFFF"
        	android:id ="@+id/recordings_delete_btn"
        	android:text = "Delete"/>
	</LinearLayout>
	<ProgressBar
	    android:id="@+id/progress_bar"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="40dp"
        android:layout_marginRight = "40dp"
        android:indeterminate="false"
        android:visibility = "gone"
        android:progress = "1"
        android:max="100"
        android:minHeight="30dp" />
    <ListView
       	android:id="@+id/recordings_list"
       	android:layout_width="match_parent"
       	android:layout_height="match_parent"
       	android:layout_gravity="center"
       	android:background = "#F1F1F1"
       	android:choiceMode = "singleChoice"
       	android:divider = "#CCC"
       	android:dividerHeight="1dp"/>
</LinearLayout>


text:
from unittest import TestCase
from lexicon.providers.onapp import Provider
from integration_tests import IntegrationTests

class OnappProviderTests(TestCase, IntegrationTests):

    Provider = Provider
    provider_name = 'onapp'
    domain = 'my-test.org'

    def _filter_headers(self):
        return ['Authorization']

    def _test_options(self):
        options = super(OnappProviderTests, self)._test_options()
        options.update({'auth_server':'https://dashboard.dynomesh.com.au'})
        return options


text:
@interface BTITableRowInfo ()

// Private Properties
@property (nonnull, nonatomic, copy) NSString *UUIDString;

@end

@implementation BTITableRowInfo

#pragma mark - Synthesized Properties

#pragma mark - Dealloc and Memory Management

#pragma mark - Custom Getters and Setters

#pragma mark - Initialization

- (id)init
{
    //BTITrackingLog(@">>> Entering <%p> %s <<<", self, __PRETTY_FUNCTION__);

    self = [super init];
    if (self)
    {
        [self setUUIDString:[[NSUUID UUID] UUIDString]];
        [self setCellAccessoryType:UITableViewCellAccessoryNone];
    }

    //BTITrackingLog(@"<<< Leaving  <%p> %s >>>", self, __PRETTY_FUNCTION__);
    return self;
}

#pragma mark - NSObject Methods

- (NSUInteger)hash
{
    return [[self UUIDString] hash];
}

- (BOOL)isEqual:(id)anObject
{
    BOOL isEqual = NO;

    if ([anObject isKindOfClass:[self class]])
    {
        isEqual = ([[(BTITableRowInfo *)anObject UUIDString] isEqualToString:[self UUIDString]]);
    }

    return isEqual;
}

#pragma mark - Misc Methods

- (void)reset
{
    //BTITrackingLog(@">>> Entering <%p> %s <<<", self, __PRETTY_FUNCTION__);

    [self setIdentifier:nil];

    [self setRepresentedObject:nil];

    [self setParentSectionInfo:nil];

    [self setText:nil];
    [self setDetailText:nil];
    [self setCellAccessoryType:UITableViewCellAccessoryNone];
    [self setRowHeight:0.0];

    [self setImage:nil];
    [self setImageName:nil];
    [self setImageFileURL:nil];

    [self setRowSelectionBlock:nil];
    [self setRowAccessorySelectionBlock:nil];

    //BTITrackingLog(@"<<< Leaving  <%p> %s >>>", self, __PRETTY_FUNCTION__);
}

- (void)populateCell:(nullable UITableViewCell *)cell
{
    //BTITrackingLog(@">>> Entering <%p> %s <<<", self, __PRETTY_FUNCTION__);

    if (cell == nil)
    {
        return;
    }

    [[cell textLabel] setText:[self text]];
    [[cell detailTextLabel] setText:[self detailText]];
    [cell setAccessoryType:[self cellAccessoryType]];

    UIImage *image = nil;

    if ([self image] != nil)
    {
        image = [self image];
    }
    else if ([self imageName] != nil)
    {
        image = [UIImage imageNamed:[self imageName]];
    }
    else if ([self imageFileURL] != nil)
    {
        image = [UIImage imageWithContentsOfFile:[[self imageFileURL] path]];
    }

    [[cell imageView] setImage:image];

    //BTITrackingLog(@"<<< Leaving  <%p> %s >>>", self, __PRETTY_FUNCTION__);
}

- (void)safelyPerformRowSelectionBlock
{
    //BTITrackingLog(@">>> Entering <%p> %s <<<", self, __PRETTY_FUNCTION__);

    if ([self rowSelectionBlock] != nil)
    {
        [self rowSelectionBlock]();
    }

    //BTITrackingLog(@"<<< Leaving  <%p> %s >>>", self, __PRETTY_FUNCTION__);
}

- (void)safelyPerformRowAccessorySelectionBlock
{
    //BTITrackingLog(@">>> Entering <%p> %s <<<", self, __PRETTY_FUNCTION__);

    if ([self rowAccessorySelectionBlock] != nil)
    {
        [self rowAccessorySelectionBlock]();
    }

    //BTITrackingLog(@"<<< Leaving  <%p> %s >>>", self, __PRETTY_FUNCTION__);
}

@end