text:
package hudson.plugins.analysis.util;

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

import org.apache.commons.lang3.exception.ExceptionUtils;

import jenkins.MasterToSlaveFileCallable;

import hudson.FilePath;
import hudson.model.TaskListener;
import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.remoting.VirtualChannel;

/**
 * A base class for {@link Blamer} implementations.
 *
 * @author Lukas Krose
 */
public abstract class AbstractBlamer implements Blamer {
    private final FilePath workspace;
    private final TaskListener listener;

    /**
     * Creates a new blamer.
     *
     * @param workspace workspace of the repository
     * @param listener  task listener to print logging statements to
     */
    public AbstractBlamer(final FilePath workspace, final TaskListener listener) {
        this.workspace = workspace;
        this.listener = listener;
    }

    @Override
    public void blame(final Set<FileAnnotation> annotations) {
        try {
            if (annotations.isEmpty()) {
                return;
            }

            invokeBlamer(annotations);
        }
        catch (IOException e) {
            error("Computing blame information failed with an exception:%n%s%n%s",
                    e.getMessage(), ExceptionUtils.getStackTrace(e));
        }
        catch (InterruptedException e) {
            // nothing to do, already logged
        }
    }

    private void invokeBlamer(final Set<FileAnnotation> annotations) throws IOException, InterruptedException {
        final Map<String, BlameRequest> linesOfConflictingFiles = extractConflictingFiles(annotations);

        Map<String, BlameRequest> blamesOfConflictingFiles = getWorkspace().act(new MasterToSlaveFileCallable<Map<String, BlameRequest>>() {
            @Override
            public Map<String, BlameRequest> invoke(final File workspace, final VirtualChannel channel) throws IOException, InterruptedException {
                return blame(linesOfConflictingFiles);
            }
        });

        setBlameResults(annotations, blamesOfConflictingFiles);
    }

    private void setBlameResults(final Set<FileAnnotation> annotations, final Map<String, BlameRequest> blamesOfConflictingFiles) {
        for (FileAnnotation annotation : annotations) {
            if (blamesOfConflictingFiles.containsKey(annotation.getFileName())) {
                BlameRequest blame = blamesOfConflictingFiles.get(annotation.getFileName());
                int line = annotation.getPrimaryLineNumber();
                annotation.setAuthorName(blame.getName(line));
                annotation.setAuthorEmail(blame.getEmail(line));
                annotation.setCommitId(blame.getCommit(line));
            }
            else {
                log("Skipping file %s, no result found.%n", annotation.getFileName());
            }
        }
    }

    /**
     * Computes for each conflicting file a {@link BlameRequest}. Note that this call is executed on a build agent.
     * I.e., the blamer instance and all transfer objects need to be serializable.
     *
     * @param linesOfConflictingFiles a mapping of file names to blame request. Each blame request defines the lines
     *                                that need to be mapped to an author.
     * @return the same mapping, now filled with blame information
     * @throws InterruptedException if this operation has been canceled
     * @throws IOException          in case of an error
     */
    protected abstract Map<String, BlameRequest> blame(Map<String, BlameRequest> linesOfConflictingFiles) throws InterruptedException, IOException;

    /**
     * Extracts the relative file names of the files that contain annotations
     * to make sure every file is blamed only once.
     *
     * @param annotations the annotations to extract the file names from
     * @return a mapping of absolute to relative file names of the conflicting files
     */
    protected Map<String, BlameRequest> extractConflictingFiles(final Set<FileAnnotation> annotations) {
        Map<String, BlameRequest> pathsByFileName = new HashMap<String, BlameRequest>();

        String workspacePath = getWorkspacePath();
        for (FileAnnotation annotation : annotations) {
            if (annotation.getPrimaryLineNumber() > 0) {
                String storedFileName = annotation.getFileName();
                if (pathsByFileName.containsKey(storedFileName)) {
                    BlameRequest blame = pathsByFileName.get(storedFileName);
                    blame.addLineNumber(annotation.getPrimaryLineNumber());
                }
                else {
                    String absoluteFileName = getCanonicalPath(storedFileName);
                    if (absoluteFileName.startsWith(workspacePath)) {
                        String relativeFileName = absoluteFileName.substring(workspacePath.length());
                        if (relativeFileName.startsWith("/") || relativeFileName.startsWith("\\")) {
                            relativeFileName = relativeFileName.substring(1);
                        }
                        pathsByFileName.put(storedFileName, new BlameRequest(relativeFileName, annotation.getPrimaryLineNumber()));
                    }
                    else {
                        log("Skipping non-workspace file %s (workspace = %s, absolute = %s.%n",
                                storedFileName, workspacePath, absoluteFileName);
                    }
                }
            }
        }
        return pathsByFileName;
    }

    private String getWorkspacePath() {
        return getCanonicalPath(workspace.getRemote());
    }

    private String getCanonicalPath(final String path) {
        try {
            return new File(path).getCanonicalPath().replace('\\', '/');
        }
        catch (IOException e) {
            return path;
        }
    }

    /**
     * Logs the specified message.
     *
     * @param message the message (format string)
     * @param args    the arguments for the message format
     */
    protected final void log(final String message, final Object... args) {
        listener.getLogger().append("<Git Blamer> " + String.format(message, args));
    }

    /**
     * Prints the specified error message.
     *
     * @param message the message (format string)
     * @param args    the arguments for the message format
     */
    protected final void error(final String message, final Object... args) {
        listener.error("<Git Blamer> " + String.format(message, args));
    }

    /**
     * Returns the workspace path on the agent.
     *
     * @return workspace path
     */
    protected FilePath getWorkspace() {
        return workspace;
    }

    /**
     * Returns the listener for logging statements.
     *
     * @return logger
     */
    protected TaskListener getListener() {
        return listener;
    }
}


text:
require("should");
var dataUtil = require("../../data-util/garment-purchasing/garment-currency-data-util");
var helper = require("../../helper");
// var validate = require("dl-models").validator.garmentPurchasing.garmentPurchaseOrder;
var moment = require('moment');

var Manager = require("../../../src/managers/garment-purchasing/garment-currency-manager");
var manager = null;

before('#00. connect db', function (done) {
    helper.getDb()
        .then(db => {
            manager = new Manager(db, {
                username: 'dev'
            });
            done();
        })
        .catch(e => {
            done(e);
        });
});

var createdData = {};
it("#01. should success when create data csv", function (done) {
    dataUtil.getNewDataTest()
        .then((data) => {
            data.should.instanceof(Array);
            data.length.should.not.equal(0);
            createdData.data = data;
            done();
        })
        .catch((e) => {
            done(e);
        });
});

it('#02. should error when insert empty data', function (done) {
    var testData = createdData;
    testData.data[1][0] = "";
    testData.data[1][1] = "";
    testData.data[2][0] = "TEST";
    testData.data[2][1] = "9,123";
    testData.data[3][0] = "TEST";
    testData.data[3][1] = "test";

    manager.insert(testData)
        .then(dataError => {
            dataError.should.instanceof(Array);
            dataError.length.should.not.equal(0);
            done()
        })
        .catch(e => {
            done(e);
        });
});

it('#03. should success when insert csv', function (done) {
    var dataTest = {};
    dataTest.data = [
        ["Mata Uang", "Kurs"],
        ["USD", "9999"],
    ];
    dataTest.date = new Date();
    manager.insert(dataTest)
        .then(result => {
            result.should.instanceof(Array);
            result.length.should.not.equal(0);
            done();
        }).catch(e => {
            done(e);
        });
});

redpajama_set_name: RedPajamaGithub


text:
[![Build Status](http://img.shields.io/travis/silverstripe/silverstripe-fulltextsearch.svg?style=flat)](https://travis-ci.org/silverstripe/silverstripe-fulltextsearch)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/silverstripe/silverstripe-fulltextsearch/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-fulltextsearch/?branch=master)
[![codecov](https://codecov.io/gh/silverstripe/silverstripe-fulltextsearch/branch/master/graph/badge.svg)](https://codecov.io/gh/silverstripe/silverstripe-fulltextsearch)
[![SilverStripe supported module](https://img.shields.io/badge/silverstripe-supported-0071C4.svg)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/)

Adds support for fulltext search engines like Sphinx and Solr to SilverStripe CMS.

## Maintainer Contact

* Hamish Friedlander <hamish (at) silverstripe (dot) com>

## Requirements

* SilverStripe 4.0+

**Note:** For SilverStripe 3.x, please use the [2.x release line](https://github.com/silverstripe/silverstripe-fulltextsearch/tree/2).

## Documentation

For pure Solr docs, check out [the Solr 4.10.4 guide](https://archive.apache.org/dist/lucene/solr/ref-guide/apache-solr-ref-guide-4.10.pdf).

See [the docs](/docs/en/00_index.md) for configuration and setup, or for the quick version see [the quick start guide](/docs/en/01_getting_started.md#quick-start).

For details of updates, bugfixes, and features, please see the [changelog](CHANGELOG.md).

## TODO

* Get rid of includeSubclasses - isn't actually used in practice, makes the codebase uglier, and ClassHierarchy can be
used at query time for most of the same use cases

* Fix field referencing in queries. Should be able to do `$query->search('Text', 'Content')`, not
`$query->search('Text', SiteTree::class . '_Content')` like you have to do now

    - Make sure that when field exists in multiple classes, searching against bare fields searches all of them

    - Allow searching against specific instances too

* Make fields restrictable by class in an index - 'SiteTree#Content' to limit fields to a particular class,
maybe 'Content->Summary' to allow calling a specific method on the field object to get the text

* Allow following user relationships (Children.Foo for example)

* Be clearer about what happens with relationships to stateful objects (e.g. Parent.Foo where Parent is versioned)

* Improvements to SearchUpdater

     - Make it work properly when in-between objects (the A in A.B.Foo) update

     - Allow user logic to cause triggering reindex of documents when field is user generated

* Add generic APIs for spell correction, file text extraction and snippet generation


text:
package com.weather.app.util;

/**
 * Created by hasee on 2016/11/7.
 */

public interface HttpCallbackListener {
    void onFinish(String response);
    void onError(Exception e);
}


text:
package com.intellij.ide.hierarchy;

import com.intellij.ide.util.treeView.AbstractTreeStructure;
import com.intellij.ide.util.treeView.AbstractTreeUi;
import com.intellij.ide.util.treeView.NodeDescriptor;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.TestSourcesFilter;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.ElementDescriptionUtil;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.GlobalSearchScopesCore;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.SearchScope;
import com.intellij.psi.search.scope.packageSet.NamedScope;
import com.intellij.psi.search.scope.packageSet.NamedScopeManager;
import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
import com.intellij.psi.search.scope.packageSet.PackageSet;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.ui.JBColor;
import com.intellij.ui.tree.LeafState;
import com.intellij.usageView.UsageViewLongNameLocation;
import com.intellij.usageView.UsageViewTypeLocation;
import com.intellij.util.ArrayUtilRt;
import org.jetbrains.annotations.NotNull;

public abstract class HierarchyTreeStructure extends AbstractTreeStructure {
  protected HierarchyNodeDescriptor myBaseDescriptor;
  private HierarchyNodeDescriptor myRoot;
  @NotNull
  protected final Project myProject;

  protected HierarchyTreeStructure(@NotNull Project project, HierarchyNodeDescriptor baseDescriptor) {
    myBaseDescriptor = baseDescriptor;
    myProject = project;
    myRoot = baseDescriptor;
  }

  public final HierarchyNodeDescriptor getBaseDescriptor() {
    return myBaseDescriptor;
  }

  protected final void setBaseElement(@NotNull HierarchyNodeDescriptor baseElement) {
    myBaseDescriptor = baseElement;
    myRoot = baseElement;
    while(myRoot.getParentDescriptor() != null){
      myRoot = (HierarchyNodeDescriptor)myRoot.getParentDescriptor();
    }
  }

  @Override
  @NotNull
  public final NodeDescriptor createDescriptor(@NotNull Object element, NodeDescriptor parentDescriptor) {
    if (element instanceof HierarchyNodeDescriptor) {
      return (HierarchyNodeDescriptor)element;
    }
    if (element instanceof String) {
      return new TextInfoNodeDescriptor(parentDescriptor, (String)element, myProject);
    }
    throw new IllegalArgumentException("Unknown element type: " + element);
  }

  @Override
  public final boolean isToBuildChildrenInBackground(@NotNull Object element) {
    if (element instanceof HierarchyNodeDescriptor){
      HierarchyNodeDescriptor descriptor = (HierarchyNodeDescriptor)element;
      Object[] cachedChildren = descriptor.getCachedChildren();
      return cachedChildren == null && descriptor.isValid();
    }
    return false;
  }

  @Override
  public final Object @NotNull [] getChildElements(@NotNull Object element) {
    if (element instanceof HierarchyNodeDescriptor) {
      HierarchyNodeDescriptor descriptor = (HierarchyNodeDescriptor)element;
      Object[] cachedChildren = descriptor.getCachedChildren();
      if (cachedChildren == null) {
        if (descriptor.isValid()) {
          try {
            cachedChildren = AbstractTreeUi.calculateYieldingToWriteAction(() -> buildChildren(descriptor));
          }
          catch (IndexNotReadyException e) {
            return ArrayUtilRt.EMPTY_OBJECT_ARRAY;
          }
        }
        else {
          cachedChildren = ArrayUtilRt.EMPTY_OBJECT_ARRAY;
        }
        descriptor.setCachedChildren(cachedChildren);
      }
      return cachedChildren;
    }
    return ArrayUtilRt.EMPTY_OBJECT_ARRAY;
  }

  @Override
  public final Object getParentElement(@NotNull Object element) {
    if (element instanceof HierarchyNodeDescriptor) {
      return ((HierarchyNodeDescriptor)element).getParentDescriptor();
    }

    return null;
  }

  @Override
  public final void commit() {
    PsiDocumentManager.getInstance(myProject).commitAllDocuments();
  }

  @Override
  public final boolean hasSomethingToCommit() {
    return PsiDocumentManager.getInstance(myProject).hasUncommitedDocuments();
  }
  @NotNull
  @Override
  public ActionCallback asyncCommit() {
    return asyncCommitDocuments(myProject);
  }

  protected abstract Object @NotNull [] buildChildren(@NotNull HierarchyNodeDescriptor descriptor);

  @NotNull
  @Override
  public final Object getRootElement() {
    return myRoot;
  }

  protected SearchScope getSearchScope(String scopeType, PsiElement thisClass) {
    SearchScope searchScope = GlobalSearchScope.allScope(myProject);
    if (HierarchyBrowserBaseEx.SCOPE_CLASS.equals(scopeType)) {
      searchScope = new LocalSearchScope(thisClass);
    }
    else if (HierarchyBrowserBaseEx.SCOPE_MODULE.equals(scopeType)) {
      Module module = ModuleUtilCore.findModuleForPsiElement(thisClass);
      searchScope = module == null ? new LocalSearchScope(thisClass) : module.getModuleScope(true);
    }
    else if (HierarchyBrowserBaseEx.SCOPE_PROJECT.equals(scopeType)) {
      searchScope = GlobalSearchScopesCore.projectProductionScope(myProject);
    }
    else if (HierarchyBrowserBaseEx.SCOPE_TEST.equals(scopeType)) {
      searchScope = GlobalSearchScopesCore.projectTestScope(myProject);
    } else {
      NamedScope namedScope = NamedScopesHolder.getScope(myProject, scopeType);
      if (namedScope != null) {
        searchScope = GlobalSearchScopesCore.filterScope(myProject, namedScope);
      }
    }
    return searchScope;
  }

  protected boolean isInScope(PsiElement baseClass, @NotNull PsiElement srcElement, String scopeType) {
    if (HierarchyBrowserBaseEx.SCOPE_CLASS.equals(scopeType)) {
      return PsiTreeUtil.isAncestor(baseClass, srcElement, true);
    }
    if (HierarchyBrowserBaseEx.SCOPE_MODULE.equals(scopeType)) {
      Module module = ModuleUtilCore.findModuleForPsiElement(baseClass);
      VirtualFile virtualFile = srcElement.getContainingFile().getVirtualFile();
      return module != null && module.getModuleScope().contains(virtualFile);
    }
    if (HierarchyBrowserBaseEx.SCOPE_PROJECT.equals(scopeType)) {
      VirtualFile virtualFile = srcElement.getContainingFile().getVirtualFile();
      return virtualFile == null || !TestSourcesFilter.isTestSources(virtualFile, myProject);
    }
    if (HierarchyBrowserBaseEx.SCOPE_TEST.equals(scopeType)) {
      VirtualFile virtualFile = srcElement.getContainingFile().getVirtualFile();
      return virtualFile == null || TestSourcesFilter.isTestSources(virtualFile, myProject);
    }
    if (HierarchyBrowserBaseEx.SCOPE_ALL.equals(scopeType)) {
      return true;
    }
    NamedScope namedScope = NamedScopesHolder.getScope(myProject, scopeType);
    if (namedScope == null) {
      return false;
    }
    PackageSet namedScopePattern = namedScope.getValue();
    if (namedScopePattern == null) {
      return false;
    }
    PsiFile psiFile = srcElement.getContainingFile();
    if (psiFile == null) {
      return true;
    }
    NamedScopesHolder holder = NamedScopesHolder.getHolder(myProject, scopeType, NamedScopeManager.getInstance(myProject));
    return namedScopePattern.contains(psiFile, holder);
  }

  private static final class TextInfoNodeDescriptor extends NodeDescriptor {
    TextInfoNodeDescriptor(NodeDescriptor parentDescriptor, String text, Project project) {
      super(project, parentDescriptor);
      myName = text;
      myColor = JBColor.RED;
    }

    @Override
    public Object getElement() {
      return myName;
    }

    @Override
    public boolean update() {
      return true;
    }
  }

  @NotNull
  @Override
  public LeafState getLeafState(@NotNull Object element) {
    if (isAlwaysShowPlus()) return LeafState.NEVER;
    LeafState state = super.getLeafState(element);
    return state != LeafState.DEFAULT ? state : LeafState.ASYNC;
  }

  public boolean isAlwaysShowPlus() {
    return false;
  }

  @NotNull
  protected String formatBaseElementText() {
    HierarchyNodeDescriptor descriptor = getBaseDescriptor();
    if (descriptor == null) return toString();
    PsiElement element = descriptor.getPsiElement();
    if (element == null) return descriptor.toString();
    return ElementDescriptionUtil.getElementDescription(element, UsageViewTypeLocation.INSTANCE) + " " +
           ElementDescriptionUtil.getElementDescription(element, UsageViewLongNameLocation.INSTANCE);
  }
}


text:
/*Generated By KISSY Module Compiler*/
config({
'date/format': {requires: ['date/gregorian','i18n!date']}
});


text:
package com.google.cloud.hadoop.gcsio;

import static com.google.cloud.hadoop.gcsio.GoogleCloudStorageItemInfo.ROOT_INFO;
import static com.google.common.truth.Truth.assertThat;

import com.google.common.collect.ImmutableMap;
import com.google.common.testing.EqualsTester;
import com.google.common.truth.Correspondence;
import java.net.URI;
import java.util.Arrays;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public class FileInfoTest {

  @Test
  public void fromItemInfo() throws Exception {
    GoogleCloudStorageItemInfo itemInfo =
        GoogleCloudStorageItemInfo.createObject(
            new StorageResourceId("foo-test-bucket", "bar/test/object"),
            /* creationTime= */ 10L,
            /* modificationTime= */ 15L,
            /* size= */ 200L,
            "text/plain",
            /* contentEncoding= */ "lzma",
            /* metadata= */ ImmutableMap.of("foo-meta", new byte[] {5, 66, 56}),
            /* contentGeneration= */ 312432L,
            /* metaGeneration= */ 2L,
            /* verificationAttributes= */ null);

    FileInfo fileInfo = FileInfo.fromItemInfo(itemInfo);

    assertThat(fileInfo.getPath()).isEqualTo(new URI("gs://foo-test-bucket/bar/test/object"));
    assertThat(fileInfo.getCreationTime()).isEqualTo(10L);
    assertThat(fileInfo.getModificationTime()).isEqualTo(15L);
    assertThat(fileInfo.getSize()).isEqualTo(200);
    assertThat(fileInfo.getAttributes())
        .<byte[], byte[]>comparingValuesUsing(Correspondence.from(Arrays::equals, "Arrays.equals"))
        .containsExactly("foo-meta", new byte[] {5, 66, 56});
    assertThat(fileInfo.getItemInfo()).isEqualTo(itemInfo);
  }

  @Test
  public void testEquals() {
    StorageResourceId testObject = StorageResourceId.fromStringPath("gs://test-bucket/dir/object");
    new EqualsTester()
        .addEqualityGroup(FileInfo.fromItemInfo(ROOT_INFO), FileInfo.fromItemInfo(ROOT_INFO))
        .addEqualityGroup(
            FileInfo.fromItemInfo(
                GoogleCloudStorageItemInfo.createObject(
                    testObject,
                    /* creationTime= */ 100,
                    /* modificationTime= */ 1000,
                    /* size= */ 324,
                    /* contentType= */ "text",
                    /* contentEncoding */ "gzip",
                    /* metadata */ ImmutableMap.of("mkey", new byte[] {1, 6}),
                    /* contentGeneration= */ 122,
                    /* metaGeneration= */ 3,
                    /* verificationAttributes= */ null)))
        .addEqualityGroup(
            FileInfo.fromItemInfo(
                GoogleCloudStorageItemInfo.createObject(
                    testObject,
                    /* creationTime= */ 100,
                    /* modificationTime= */ 1000,
                    /* size= */ 324,
                    /* contentType= */ "text",
                    /* contentEncoding */ "gzip",
                    /* metadata */ ImmutableMap.of("mky", new byte[] {1, 6}),
                    /* contentGeneration= */ 122,
                    /* metaGeneration= */ 3,
                    /* verificationAttributes= */ null)),
            FileInfo.fromItemInfo(
                GoogleCloudStorageItemInfo.createObject(
                    testObject,
                    /* creationTime= */ 100,
                    /* modificationTime= */ 1000,
                    /* size= */ 324,
                    /* contentType= */ "text",
                    /* contentEncoding */ "gzip",
                    /* metadata */ ImmutableMap.of("mky", new byte[] {1, 6}),
                    /* contentGeneration= */ 122,
                    /* metaGeneration= */ 3,
                    /* verificationAttributes= */ null)))
        .testEquals();
  }
}


text:
from openerp.report.render.rml2pdf import utils
import copy

class odt2odt(object):
    def __init__(self, odt, localcontext):
        self.localcontext = localcontext
        self.etree = odt
        self._node = None

    def render(self):
        def process_text(node,new_node):
            for child in utils._child_get(node, self):
                new_child = copy.deepcopy(child)
                new_node.append(new_child)
                if len(child):
                    for n in new_child:
                        new_child.text  = utils._process_text(self, child.text)
                        new_child.tail  = utils._process_text(self, child.tail)
                        new_child.remove(n)
                    process_text(child, new_child)
                else:
                    new_child.text  = utils._process_text(self, child.text)
                    new_child.tail  = utils._process_text(self, child.tail)
        self._node = copy.deepcopy(self.etree)
        for n in self._node:
            self._node.remove(n)
        process_text(self.etree, self._node)
        return self._node

def parseNode(node, localcontext = {}):
    r = odt2odt(node, localcontext)
    return r.render()


text:
class MediaEventSerializer < BaseSerializer
  attributes :id,
    :actor_id,
    :action,
    :generated_started_at_time,
    :generated_ended_at_time,
    :created_at,
    :updated_at
end


text:
    <link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.95.2/css/materialize.css"  media="screen,projection"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>

    <form class="col s12" method="post">

                <input id="username" name="username" type="text" class="validate" autofocus>
                Username

                <input id="password" name="password" type="password" class="validate">
                Password

                <button class="btn waves-effect waves-light" type="submit">Submit

                </button>

        </form>


text:
2.) No explicit license means "all rights reserved". If we do not choose a license our project is not open source as others are restricted in their use of the product under copyright law

3.) If there is no explict license then the poject is under copyright law

4.) I agree. If a product is unable to keep up with demands of consumers it will fail. This is basic economics and you'd have a hard time arguing against it.

5.) Android uses the Apache license so the contributors may practice patent claims. They use this to encourage contributors to contribute

7.) Apache is best for developers because they may sublicense. Companies on the other hand would prefer GPL or LGPL because all modifications must be noted and the original must be included. Apache is better for the common good because its is better for developers. What is better for developers is better for the common good  because more developers will make changes and improve the software for everyone

9.) I'd like to make a project that assists automatically uses Investopedia to make "money" in their games. The users would be anyone that wanted to win a game on investopedia. Potentially it colud be used to learn about stocks and how to make better investment decisions. I'd use the MIT license because its easy and simple.

10.

Website                                   License Present		License

https://github.com/adriancollado/solum          Yes				MIT

https://github.com/jzblee/tally                 Yes				MIT

https://github.com/mmetro/WeirdSideofYouTube    Yes				MIT

https://github.com/rcos/observatory3            Yes				MIT

https://github.com/Stashmatic/ARAS              Yes				MIT


text:
import logging

from oslo_messaging._drivers import base
from oslo_messaging._drivers.zmq_driver.server.consumers\
    import zmq_consumer_base
from oslo_messaging._drivers.zmq_driver.server import zmq_incoming_message
from oslo_messaging._drivers.zmq_driver import zmq_address
from oslo_messaging._drivers.zmq_driver import zmq_async
from oslo_messaging._drivers.zmq_driver import zmq_names
from oslo_messaging._i18n import _LE, _LI

LOG = logging.getLogger(__name__)

zmq = zmq_async.import_zmq()

class RouterIncomingMessage(base.IncomingMessage):

    def __init__(self, listener, context, message, socket, reply_id, msg_id,
                 poller):
        super(RouterIncomingMessage, self).__init__(listener, context, message)
        self.socket = socket
        self.reply_id = reply_id
        self.msg_id = msg_id
        self.message = message
        poller.resume_polling(socket)

    def reply(self, reply=None, failure=None, log_failure=True):
        """Reply is not needed for non-call messages"""

    def acknowledge(self):
        LOG.info("Sending acknowledge for %s", self.msg_id)
        ack_message = {zmq_names.FIELD_ID: self.msg_id}
        self.socket.send(self.reply_id, zmq.SNDMORE)
        self.socket.send(b'', zmq.SNDMORE)
        self.socket.send_pyobj(ack_message)

    def requeue(self):
        """Requeue is not supported"""

class RouterConsumer(zmq_consumer_base.SingleSocketConsumer):

    def __init__(self, conf, poller, server):
        super(RouterConsumer, self).__init__(conf, poller, server, zmq.ROUTER)
        self.matchmaker = server.matchmaker
        self.targets = []
        self.host = zmq_address.combine_address(self.conf.rpc_zmq_host,
                                                self.port)

    def listen(self, target):

        LOG.info("Listen to target %s on %s:%d" %
                 (target, self.address, self.port))

        self.targets.append(target)
        self.matchmaker.register(target=target,
                                 hostname=self.host)

    def cleanup(self):
        super(RouterConsumer, self).cleanup()
        for target in self.targets:
            self.matchmaker.unregister(target, self.host)

    def receive_message(self, socket):
        try:
            reply_id = socket.recv()
            empty = socket.recv()
            assert empty == b'', 'Bad format: empty delimiter expected'
            msg_type = socket.recv_string()
            assert msg_type is not None, 'Bad format: msg type expected'

            msg_id = None
            if msg_type != zmq_names.CALL_TYPE:
                msg_id = socket.recv_string()

            context = socket.recv_pyobj()
            message = socket.recv_pyobj()
            LOG.info(_LI("Received %(msg_type)s message %(msg)s")
                     % {"msg_type": msg_type,
                        "msg": str(message)})

            if msg_type == zmq_names.CALL_TYPE:
                return zmq_incoming_message.ZmqIncomingRequest(
                    self.server, context, message, socket, reply_id,
                    self.poller)
            elif msg_type in (zmq_names.CAST_TYPES + zmq_names.NOTIFY_TYPES):
                return RouterIncomingMessage(
                    self.server, context, message, socket, reply_id,
                    msg_id, self.poller)
            else:
                LOG.error(_LE("Unknown message type: %s") % msg_type)

        except zmq.ZMQError as e:
            LOG.error(_LE("Receiving message failed: %s") % str(e))


text:
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
       android:layout_width="match_parent"
       android:layout_height="wrap_content">

    <LinearLayout
        android:id="@+id/fullscreen_top_bar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/control_bar_height"
        android:background="@color/bg_video_view"
        android:gravity="center_vertical"
        android:orientation="horizontal"
        android:visibility="gone">

        <ImageView
            android:id="@+id/iv_back"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/sel_item_background"
            android:padding="10dp"
            android:src="@drawable/ic_return_back"/>

        <com.dl7.player.widgets.MarqueeTextView
            android:id="@+id/tv_title"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="15dp"
            android:layout_weight="1"
            android:ellipsize="marquee"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:marqueeRepeatLimit="marquee_forever"
            android:singleLine="true"
            android:text="标题"
            android:textColor="@android:color/white"
            android:textSize="16sp"/>

        <ProgressBar
            android:id="@+id/pb_battery"
            style="@style/ProgressBarBattery"
            android:layout_marginRight="10dp"
            android:max="100"/>

        <TextView
            android:id="@+id/tv_system_time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="10dp"
            android:textColor="@android:color/white"
            android:textSize="16sp"/>

        <ImageView
            android:id="@+id/iv_screenshot"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/sel_item_background"
            android:padding="10dp"
            android:src="@drawable/ic_video_screenshot"/>

        <TextView
            android:id="@+id/tv_settings"
            android:layout_width="@dimen/settings_btn_width"
            android:layout_height="wrap_content"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:background="@drawable/sel_item_background"
            android:text="设置"
            android:layout_marginRight="10dp"
            android:gravity="center"
            android:textColor="@android:color/white"
            android:textSize="16sp"/>
    </LinearLayout>

    <FrameLayout
        android:id="@+id/window_top_bar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:visibility="gone">

        <ImageView
            android:id="@+id/iv_back_window"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/sel_item_background"
            android:padding="10dp"
            android:src="@drawable/ic_return_back"/>
    </FrameLayout>

    <RadioGroup
        android:id="@+id/aspect_ratio_group"
        android:layout_width="@dimen/settings_btn_width"
        android:layout_height="0dp"
        android:layout_gravity="right"
        android:layout_marginRight="10dp"
        android:gravity="center_horizontal"
        android:layout_marginTop="@dimen/control_bar_height"
        android:background="@color/bg_video_view"
        android:checkedButton="@id/aspect_fit_parent"
        android:orientation="vertical">

        <RadioButton
            android:id="@+id/aspect_fit_parent"
            style="@style/AspectRatioButton"
            android:background="@drawable/sel_btn_ar_adjust_screen"/>

        <RadioButton
            android:id="@+id/aspect_fit_screen"
            style="@style/AspectRatioButton"
            android:background="@drawable/sel_btn_ar_adjust_video"/>

        <RadioButton
            android:id="@+id/aspect_16_and_9"
            style="@style/AspectRatioButton"
            android:background="@drawable/sel_btn_ar_16_9"/>

        <RadioButton
            android:id="@+id/aspect_4_and_3"
            style="@style/AspectRatioButton"
            android:background="@drawable/sel_btn_ar_4_3"/>
    </RadioGroup>
</merge>


text:
capacitor_web
=============

Web interface for Cloud Capacitor


text:
package io.mycat.net;

/**
 * @author mycat
 */
public interface NIOHandler {

    void handle(byte[] data);

}


text:
Meteor is basically a stack of technologies. A lot of it is open source existing technology. Meteor is a pure JavaScript full stack framework for creating realtime interactive applications. I

ts simplicity allows for quick prototyping and building more complex applications faster than ever. The Meteor Development Group has created a framework which shifts away from the traditional web framework paradigm, while building on trusted open-source technologies. This session will cover the following: What is Meteor what makes it so special How to install and use Meteor Meteor app demo with code examples.

##Key Differences
Here are some key differences with Meteor and traditional web apps:

![Traditional Web Apps](https://dl.dropboxusercontent.com/u/45502976/Markdown%20Images/traditional_web_apps.jpg)

In Meteor, you still have a Database, a server and a client. What's different is that this is a **client-server application**:

![Meteor Web Apps](https://dl.dropboxusercontent.com/u/45502976/Markdown%20Images/meteor_web_apps.jpg)

You're running data models locally, you're running JavaScript locally, _and_ you're running same thing on the _server_. The same code in Meteor is JavaScript that can run identically on the server and client.

==============

**NB: Check out [Why Meteor?](why_meteor.md) section to go over some important principles and foundations of this exciting new platform.**


text:
[![Go Report Card](https://goreportcard.com/badge/github.com/wtfcoderz/chacal)](https://goreportcard.com/report/github.com/wtfcoderz/chacal)
[![Build Status](https://travis-ci.org/wtfcoderz/chacal.svg?branch=master)](https://travis-ci.org/wtfcoderz/chacal)
[![](https://images.microbadger.com/badges/image/wtfcoderz/chacal:master.svg)](https://microbadger.com/images/wtfcoderz/chacal:master)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/wtfcoderz/chacal/blob/master/LICENSE.md)
[![Docker Automated buil](https://img.shields.io/badge/docker--hub-automatic--build-blue.svg)](https://hub.docker.com/r/wtfcoderz/chacal/)

Just a chacal app


text:
<!DOCTYPE html>

	<link href="js/bootstrap.min.css" rel="stylesheet"type="text/css">
	<link href="css/moncss.css" rel="stylesheet"type="text/css">

	<title>Comparison of genealogy software - Languages</title>
	<meta charset="utf-8">

Comparison of genealogy software - Languages

			<fieldset>

					<form action="" method="post">
						<legend style="color:red;font-weight: bold;font-style:italic;text-align: center;" >Formulaire</legend>

								Italian :

 <input type="radio" name="FeatureItalian" value="oui">Yes <input type="radio" name="FeatureItalian" value = "non">No <input type="radio" name="FeatureItalian" value = "non">Partial

											<input  style="display:none;" id ="id2Italian"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Italian','id2Italian');">Changer type</button>

								Norwegian :

 <input type="radio" name="FeatureNorwegian" value="oui">Yes <input type="radio" name="FeatureNorwegian" value = "non">No <input type="radio" name="FeatureNorwegian" value = "non">Partial

											<input  style="display:none;" id ="id2Norwegian"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Norwegian','id2Norwegian');">Changer type</button>

								Danish :

 <input type="radio" name="FeatureDanish" value="oui">Yes <input type="radio" name="FeatureDanish" value = "non">No <input type="radio" name="FeatureDanish" value = "non">Partial

											<input  style="display:none;" id ="id2Danish"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Danish','id2Danish');">Changer type</button>

								Dutch :

 <input type="radio" name="FeatureDutch" value="oui">Yes <input type="radio" name="FeatureDutch" value = "non">No <input type="radio" name="FeatureDutch" value = "non">Partial

											<input  style="display:none;" id ="id2Dutch"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Dutch','id2Dutch');">Changer type</button>

								Afrikaans :

 <input type="radio" name="FeatureAfrikaans" value="oui">Yes <input type="radio" name="FeatureAfrikaans" value = "non">No <input type="radio" name="FeatureAfrikaans" value = "non">Partial

											<input  style="display:none;" id ="id2Afrikaans"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Afrikaans','id2Afrikaans');">Changer type</button>

								French :

 <input type="radio" name="FeatureFrench" value="oui">Yes <input type="radio" name="FeatureFrench" value = "non">No <input type="radio" name="FeatureFrench" value = "non">Partial

											<input  style="display:none;" id ="id2French"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1French','id2French');">Changer type</button>

								Name :
 <input id="0" type="text" name="Feature">

								English :

 <input type="radio" name="FeatureEnglish" value="oui">Yes <input type="radio" name="FeatureEnglish" value = "non">No <input type="radio" name="FeatureEnglish" value = "non">Partial

											<input  style="display:none;" id ="id2English"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1English','id2English');">Changer type</button>

								German :

 <input type="radio" name="FeatureGerman" value="oui">Yes <input type="radio" name="FeatureGerman" value = "non">No <input type="radio" name="FeatureGerman" value = "non">Partial

											<input  style="display:none;" id ="id2German"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1German','id2German');">Changer type</button>

								Spanish :

 <input type="radio" name="FeatureSpanish" value="oui">Yes <input type="radio" name="FeatureSpanish" value = "non">No <input type="radio" name="FeatureSpanish" value = "non">Partial

											<input  style="display:none;" id ="id2Spanish"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Spanish','id2Spanish');">Changer type</button>

								Swedish :

 <input type="radio" name="FeatureSwedish" value="oui">Yes <input type="radio" name="FeatureSwedish" value = "non">No <input type="radio" name="FeatureSwedish" value = "non">Partial

											<input  style="display:none;" id ="id2Swedish"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Swedish','id2Swedish');">Changer type</button>

								Polish :

 <input type="radio" name="FeaturePolish" value="oui">Yes <input type="radio" name="FeaturePolish" value = "non">No <input type="radio" name="FeaturePolish" value = "non">Partial

											<input  style="display:none;" id ="id2Polish"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Polish','id2Polish');">Changer type</button>

<input type="submit" class="btn btn-info" value="Ajouter un produit" />
					</form>

			</fieldset>


text:
import * as tree from '../misc/helpers';

describe('create virtual table', function() {

  it('basic create virtual table', function(done) {
    tree.equals(this, done);
  });

  it('create virtual table alt syntax', function(done) {
    tree.equals(this, done);
  });

});


text:
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;

[Collection(nameof(PubsubFixture))]
public class ResumePublishTest
{
    private readonly PubsubFixture _pubsubFixture;
    private readonly ResumePublishSample _ResumePublishSample;
    private readonly PullMessagesAsyncSample _pullMessagesAsyncSample;

    public ResumePublishTest(PubsubFixture pubsubFixture)
    {
        _pubsubFixture = pubsubFixture;
        _ResumePublishSample = new ResumePublishSample();
        _pullMessagesAsyncSample = new PullMessagesAsyncSample();
    }

    [Fact]
    public async Task PublishMessage()
    {
        string randomName = _pubsubFixture.RandomName();
        string topicId = $"testTopicForResumePublish{randomName}";
        string subscriptionId = $"testSubscriptionForResumePublish{randomName}";

        _pubsubFixture.CreateTopic(topicId);
        _pubsubFixture.CreateSubscription(topicId, subscriptionId);

        List<(string, string)> messages = new List<(string, string)> { ( "Key1", "Hello World!" ), ( "Key2", "Good day." ), ( "Key1", "Bye bye"  ) };

        var publishedMessages = await _ResumePublishSample.PublishOrderedMessagesAsync(_pubsubFixture.ProjectId, topicId, messages);
        Assert.Equal(messages.Count, publishedMessages);

        // Pull the Message to confirm it is valid
        await _pubsubFixture.Pull.Eventually(async () =>
        {
            var pulledMessages = await _pullMessagesAsyncSample.PullMessagesAsync(_pubsubFixture.ProjectId, subscriptionId, false);
            Assert.True(pulledMessages > 0);
        });
    }
}


text:
package org.telegram.telegrambots.meta.api.objects.replykeyboard;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

/**
 * @author Ruben Bermudez
 * @version 1.0
 * Upon receiving a message with this object, Telegram clients will display a reply interface
 * to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be
 * extremely useful if you want to create user-friendly step-by-step interfaces without having to
 * sacrifice privacy mode.
 */
@JsonDeserialize
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@RequiredArgsConstructor
@AllArgsConstructor
@Builder
public class ForceReplyKeyboard implements ReplyKeyboard {
    private static final String FORCEREPLY_FIELD = "force_reply";
    private static final String SELECTIVE_FIELD = "selective";
    private static final String INPUTFIELDPLACEHOLDER_FIELD = "input_field_placeholder";

    /**
     * Shows reply interface to the user, as if they manually selected the bot's message and tapped
     * 'Reply'
     */
    @JsonProperty(FORCEREPLY_FIELD)
    @NonNull
    @Builder.Default
    private Boolean forceReply = true;
    /**
     * Optional.
     *
     * Use this parameter if you want to force reply from specific users only. Targets: 1) users
     * that are @mentioned in the text of the Message object; 2) if the bot's message is a reply
     * (has reply_to_message_id), sender of the original message.
     */
    @JsonProperty(SELECTIVE_FIELD)
    private Boolean selective;
    /**
     * Optional.
     * The placeholder to be shown in the input field when the keyboard is active; 1-64 characters
     */
    @JsonProperty(INPUTFIELDPLACEHOLDER_FIELD)
    private String inputFieldPlaceholder;

    @Override
    public void validate() throws TelegramApiValidationException {
        if (forceReply == null) {
            throw new TelegramApiValidationException("ForceReply parameter can't not be null", this);
        }
        if (inputFieldPlaceholder != null && (inputFieldPlaceholder.length() < 1 || inputFieldPlaceholder.length() > 64)) {
            throw new TelegramApiValidationException("InputFieldPlaceholder must be between 1 and 64 characters", this);
        }
    }
}


text:
while inotifywait -r -e create -e delete -e modify /etc/gridengine/files/exec_hosts; do
    sync_exec_hosts.sh
done


text:
/**
 * Shows general gene info.
 * Such as its name, synonyms, annotation, publications, etc.
 *
 * Gene "instance" info (e.g. coordinates on a particular strain's genome)
 * is in a different widget.
 */
(function( $, undefined ) {
    $.KBWidget({
        name: "KBaseGeneBiochemistry",
        parent: "kbaseWidget",
        version: "1.0.0",

        options: {
            featureID: null,
            embedInCard: false,
            auth: null,
            loadingImage: "assets/img/loading.gif",
            genomeID: null,
            workspaceID: null,
            kbCache: null,
            genomeInfo: null
        },

        cdmiURL: "https://kbase.us/services/cdmi_api",

        init: function(options) {
            this._super(options);

            if (this.options.featureID === null) {
                //throw an error.
                return this;
            }

            this.cdmiClient = new CDMI_API(this.cdmiURL);
            this.entityClient = new CDMI_EntityAPI(this.cdmiURL);

            this.render();
            if (this.options.workspaceID) {
                this.renderWorkspace();
            }
            else
                this.renderCentralStore();

            return this;
        },

        render: function() {
            this.$messagePane = $("
")
                                .addClass("kbwidget-message-pane kbwidget-hide-message");
            this.$elem.append(this.$messagePane);

            this.$infoPanel = $("
").css("overflow","auto");
            this.$infoTable = $("
")
                              .addClass("table table-striped table-bordered");

            this.$elem.append(this.$infoPanel.append(this.$infoTable));
        },

        renderCentralStore: function() {
            var self = this;
            this.$infoPanel.hide();
            this.showMessage("");

            this.cdmiClient.fids_to_roles([this.options.featureID],
                function(roles) {
                    roles = roles[self.options.featureID];
                    var rolesStr = "None found";
                    if (roles) {
                        rolesStr = roles.join("
");
                    }
                    self.$infoTable.append(self.makeRow("Roles", rolesStr));

                    self.cdmiClient.fids_to_subsystems([self.options.featureID],
                        function(subsystems) {
                            subsystems = subsystems[self.options.featureID];
                            var subsysStr = "None found";
                            if (subsystems) {
                                subsysStr = subsystems.join("
");
                            }
                            self.$infoTable.append(self.makeRow("Subsystems", subsysStr));

                            self.hideMessage();
                            self.$infoPanel.show();
                        },

                        self.renderError
                    )
                },

                this.renderError
            );

        },

        makeRow: function(name, value) {
            var $row = $("
")
                       .append($("").append(name))
                       .append($("").append(value));
            return $row;
        },

        renderWorkspace: function() {
            var self = this;
            this.showMessage("");
            this.$infoPanel.hide();

            if (this.options.genomeInfo) {
                self.ready(this.options.genomeInfo);
            } else {
                if (!this.options.kbCache) {
                    if (kb)
                        this.options.kbCache = kb;
                    else
                        console.debug("No cache service found. D'oh!");
                }
                var obj = this.buildObjectIdentity(this.options.workspaceID, this.options.genomeID);

                var prom = this.options.kbCache.req('ws', 'get_objects', [obj]);
                // on ws error
                $.when(prom).fail($.proxy(function(error) {
                    this.renderError(error);
                }, this));
                // on cache success
                $.when(prom).done($.proxy(function(genome) {
                    genome = genome[0];
                    self.ready(genome);
                }, this));
            }
        },

        ready: function(genome) {
            var self = this;
            if (genome.data.features) {
                var feature = null;
                for (var i=0; i<genome.data.features.length; i++) {
                    if (genome.data.features[i].id === this.options.featureID) {
                        feature = genome.data.features[i];
                        break;
                    }
                }

                // Function
                var func = feature['function'];
                if (!func)
                    func = "Unknown";
                this.$infoTable.append(this.makeRow("Function", func));

                // Subsystems, single string
                //var subsysSumStr = "No subsystem summary found.";
                //if (feature.subsystems) {
                //subsysSumStr = feature.subsystems;
                //}
                //this.$infoTable.append(this.makeRow("Subsystems Summary", subsysSumStr));

                // Subsystem, detailed
                var subsysDataStr = "No subsystem data found.";
                if (feature.subsystem_data) {
                    subsysDataStr = "";
                    for (var i=0; i<feature.subsystem_data.length; i++) {
                        var subsys = feature.subsystem_data[i];
                        // typedef tuple<string subsystem, string variant, string role> subsystem_data;
                        subsysDataStr += "
" + "Subsystem: " + subsys[0] + "
" + "Variant: " + subsys[1] + "
" + "Role: " + subsys[2];
                    }
                }
                this.$infoTable.append(this.makeRow("Subsystems", subsysDataStr));

                // Annotation
                var annotationsStr = "No annotation comments found.";
                if (feature.annotations) {
                    annotationsStr = "";
                    for (var i=0; i<feature.annotations.length; i++) {
                        var annot = feature.annotations[i];
                        // typedef tuple<string comment, string annotator, int annotation_time> annotation;
                        annotationsStr += annot[0] + " (" + annot[1] + ", timestamp:" + annot[2] + ")" + "
";
                    }
                }
                this.$infoTable.append(this.makeRow("Annotation Comments", annotationsStr));

                // Protein families list.
                //var proteinFamilies = "None found";
                //if (feature.protein_families) {
                //proteinFamilies = "";
                //for (var i=0; i<feature.protein_families.length; i++) {
                //    var fam = feature.protein_families[i];
                //    proteinFamilies += fam.id + ": " + fam.subject_description + "
";
                //}
                //}
                //this.$infoTable.append(this.makeRow("Protein Families", proteinFamilies));

            }
            else {
                this.renderError({ error: "No genetic features found in the genome with object id: " +
                    this.options.workspaceID + "/" +
                    this.options.genomeID });
            }

            this.hideMessage();
            this.$infoPanel.show();
        },

        buildObjectIdentity: function(workspaceID, objectID) {
            var obj = {};
            if (/^\d+$/.exec(workspaceID))
                obj['wsid'] = workspaceID;
            else
                obj['workspace'] = workspaceID;

            // same for the id
            if (/^\d+$/.exec(objectID))
                obj['objid'] = objectID;
            else
                obj['name'] = objectID;
            return obj;
        },

        getData: function() {
            return {
                type: "Feature",
                id: this.options.featureID,
                workspace: this.options.workspaceID,
                title: "Biochemical Function"
            };
        },

        showMessage: function(message) {
            var span = $("").append(message);

            this.$messagePane.empty()
                             .append(span)
                             .removeClass("kbwidget-hide-message");
        },

        hideMessage: function() {
            this.$messagePane.addClass("kbwidget-hide-message");
        },

        renderError: function(error) {
            errString = "Sorry, an unknown error occurred";
            if (typeof error === "string")
                errString = error;
            else if (error.error && error.error.message)
                errString = error.error.message;

            var $errorDiv = $("
")
                            .addClass("alert alert-danger")
                            .append("Error:")
                            .append("
" + errString);
            this.$elem.empty();
            this.$elem.append($errorDiv);
        },
    })
})( jQuery );


text:
class RandomBase;

// A traits struct needs to define SrcFromPtr only when MergeFrom is called.

template <typename T>
struct AssignableSampleTraits {
  typedef const T& SrcType;
  static SrcType SrcFromPtr(const T* sample) {
    return *sample;
  }
  static void SetSample(SrcType src, T* dest) {
    *dest = src;
  }
};

template <typename T>
struct SwappableSampleTraits {
  typedef T* SrcType;
  static SrcType SrcFromPtr(T* sample) {
    return sample;
  }
  static void SetSample(SrcType src, T* dest) {
    swap(*dest, *src);
  }
};

// For protocol buffers, whose swap method is not specialized by default.
template <typename T>
struct SwappableProtoTraits {
  typedef T* SrcType;
  static SrcType SrcFromPtr(T* sample) {
    return sample;
  }
  static void SetSample(SrcType src, T* dest) {
    dest->Swap(src);
  }
};

// This class is the common base of SimpleWRS, FastWRS, and WRSMerger.
// It is made public only for documentation and code reuse.
// Users must use the above subclasses instead of this class directly.
//
// By default, the input weights are not stored. To have weights stored,
// wrap your data T and the weight into another struct. For example,
// you can use SimpleWRS<pair<T, double> >. It's your responsibility to set
// the weight element before calling ConsiderSample.
template <typename T, typename AlgorithmType, typename SampleTraits>
class WRSBase {
 public:
  // Returns the max_samples used to construct this instance. Never changes.
  int max_sample_size() const {
    return algorithm_.max_sample_size();
  }
  // Returns the current number of stored samples.
  int current_sample_size() const {
    return algorithm_.current_sample_size();
  }

  double key(int sample_index) const {
    DCHECK_GE(sample_index, 0);
    DCHECK_LT(sample_index, current_sample_size());
    return algorithm_.key(sample_index);
  }
  // NOTE: Do not assume that the samples are ordered by any criterion.
  const T& sample(int sample_index) const {
    DCHECK_GE(sample_index, 0);
    DCHECK_LT(sample_index, current_sample_size());
    return reservoir_[sample_index];
  }
  // NOTE: For external users, this method is typically used for conditional
  // initialization (see example usage 2) and for merging samples. The users
  // should be aware that each sample is associated with a constant key. For
  // example, if they pass a sample, mutable or not, to ConsiderSampledDatum,
  // they must also pass the corresponding key. If the users break the
  // correspondence, e.g., by swapping samples externally, then this sampler
  // instance must be quarantined, i.e., no more samples can be passed to this
  // sampler, and this sampler cannot be merged into another sampler instance.
  // Therefore, it would be better to sort an external array of T* pointers
  // or indexes than reordering the samples directly in a sampler instance.
  T* mutable_sample(int sample_index) {
    DCHECK_GE(sample_index, 0);
    DCHECK_LT(sample_index, current_sample_size());
    return &reservoir_[sample_index];
  }

  // Clears the samples, as if no sample had been passed to this sampler
  // instance. current_sample_size() will be 0 but max_sample_size() remains.
  void clear() {
    algorithm_.clear();
    delete [] reservoir_;
    reservoir_ = new T[max_sample_size()];
  }
  // Estimated memory in bytes used by the sampler, excluding sizeof(*this)
  // and the data pointed from the samples. Designed for applications where
  // memory usage is monitored.
  int extra_memory() const {
    return sizeof(T) * max_sample_size() + algorithm_.extra_memory();
  }

 protected:
  WRSBase(int max_sample_size, RandomBase* rnd) :
      algorithm_(max_sample_size, rnd), reservoir_(new T[max_sample_size]) {
  }
  ~WRSBase() {
    delete [] reservoir_;
  }
  // Visit a sample with a weight; the sample may or may not be inserted into
  // the reservoir. The sample must come directly from the population instead
  // of another sampler (if the sample has been selected by another sampler,
  // you must call ConsiderSampledDatum to merge it into "this"; otherwise the
  // result will be incorrect).
  //
  // If weight is <= 0 or = NaN, this sample is definitely not chosen;
  // else, if the current sample size is less than max sample size, this
  // sample is definitely chosen;
  // else, if weight is +infinity and not all chosen samples have
  // weight = +infinity, this sample is definitely chosen.
  // Even if the sample is chosen, future samples might replace it.
  //
  // Returns a negative value to indicate that the sample is not chosen, or
  // a non-negative value as the index in the reservoir where the sample is
  // stored.
  int ConsiderSample(double weight, typename SampleTraits::SrcType sample) {
    if (weight > 0) {
      int sample_index = algorithm_.ConsiderWeight(weight);
      if (sample_index >= 0)
        SampleTraits::SetSample(sample, mutable_sample(sample_index));
      return sample_index;
    }
    return -1;
  }
  // This method is provided for merging samples of different samplers, as if
  // all the population had been passed to this sampler. It may be useful
  // in map-reduction.
  //
  // The key must be the key (not weight) associated with the input sample,
  // both returned from a sampler with the same sample_index.
  //
  // Returns a negative value to indicate that the sample is not chosen, or
  // a non-negative value as the index in the reservoir where the sample is
  // stored.
  //
  // Note: This method's behavior is not random. Since each sampler simply keeps
  // the samples with n largest keys, the merger only needs to merge and find
  // the n largest keys again, without additional random sampling.
  int ConsiderSampledDatum(double key, typename SampleTraits::SrcType sample) {
    int sample_index = algorithm_.ConsiderKey(key);
    if (sample_index >= 0)
      SampleTraits::SetSample(sample, mutable_sample(sample_index));
    return sample_index;
  }
  // Merges samples with another, as if all samples had been passed to "this".
  // Clears another after done.
  // "this" and "another" must have the same max sample size for
  // result correctness.
  // AnotherWRS can be SimpleWRS, FastWRS, or WRSMerger, even with different T
  // and SampleTraits arguments, as long as the static method
  // "SampleTraits::SrcType SampleTraits::SrcFromPtr(AnotherWRS::T*)" is
  // defined for the template argument SampleTraits of "this".
  template <typename AnotherWRS>
  void MergeFrom(AnotherWRS* another) {
    CHECK_EQ(max_sample_size(), another->max_sample_size());
    for (int i = 0; i < another->current_sample_size(); ++i)
      ConsiderSampledDatum(
          another->key(i),
          SampleTraits::SrcFromPtr(another->mutable_sample(i)));
    another->clear();
  }

 private:
  AlgorithmType algorithm_;
  T* reservoir_;
};

template <typename T, typename SampleTraits = AssignableSampleTraits<T> >
class SimpleWRS : public WRSBase<T, SimpleWRSAlgorithm, SampleTraits> {
 public:
  // max_sample_size must be > 0.
  // rnd must not be NULL. This instance does not own rnd.
  // The period of rnd must be far greater than the population size N.
  SimpleWRS(int max_sample_size, RandomBase* rnd) : Base(max_sample_size, rnd) {
  }
  ~SimpleWRS() {
  }
  int ConsiderSample(double weight, typename SampleTraits::SrcType sample) {
    return Base::ConsiderSample(weight, sample);
  }
  int ConsiderSampledDatum(double key, typename SampleTraits::SrcType sample) {
    return Base::ConsiderSampledDatum(key, sample);
  }
  template <typename AnotherWRS>
  void MergeFrom(AnotherWRS* another) {
    Base::MergeFrom(another);
  }
 private:
  typedef WRSBase<T, SimpleWRSAlgorithm, SampleTraits> Base;
};

// "Fast" only means less random number generations. FastWRS is not a
// WRS algorithm in the strict sense but an approximation. If random number
// generation does not cost most of the execution time (such as in
// map-reduction), you should consider using SimpleWRS instead.
template <typename T, typename SampleTraits = AssignableSampleTraits<T> >
class FastWRS : public WRSBase<T, FastWRSAlgorithm, SampleTraits> {
 public:
  // max_sample_size must be > 0.
  // rnd must not be NULL. This instance does not own rnd.
  // The period of rnd must be far greater than the number of random variable
  // generations (see the specifications at the beginning of this file).
  FastWRS(int max_sample_size, RandomBase* rnd) : Base(max_sample_size, rnd) {
  }
  ~FastWRS() {
  }
  int ConsiderSample(double weight, typename SampleTraits::SrcType sample) {
    return Base::ConsiderSample(weight, sample);
  }
  // ConsiderSampledDatum and MergeFrom would break the integrity; not provided.
 private:
  typedef WRSBase<T, FastWRSAlgorithm, SampleTraits> Base;
};

// For merging without random number generators.
template <typename T, typename SampleTraits = AssignableSampleTraits<T> >
class WRSMerger : public WRSBase<T, WRSAlgorithm, SampleTraits> {
 public:
  // max_sample_size must be the same as that of the source sampler instance.
  explicit WRSMerger(int max_sample_size) : Base(max_sample_size, NULL) {
  }
  ~WRSMerger() {
  }
  int ConsiderSampledDatum(double key, typename SampleTraits::SrcType sample) {
    return Base::ConsiderSampledDatum(key, sample);
  }
  template <typename AnotherWRS>
  void MergeFrom(AnotherWRS* another) {
    Base::MergeFrom(another);
  }
 private:
  typedef WRSBase<T, WRSAlgorithm, SampleTraits> Base;
};


text:
require 'sinatra/base'
require 'padrino-helpers'
require 'spongecms/core/route'

module Spongecms

  class Base < Sinatra::Base
    # Use ::Base as Parent
    register Padrino::Helpers
    register Spongecms::Route

    include Spongecms::Route

    enable :sessions, :logging
  end
end


text:
extern crate rustc_serialize;
extern crate docopt;
#[macro_use] extern crate log;
extern crate rasputin;

use std::net::SocketAddr;
use std::process;

use rasputin::Client;
use docopt::Docopt;

static USAGE: &'static str = "
rasputinc - client for rasputin.

This program is the Rasputin DB command line client.

Usage:
    rasputinc --help
    rasputinc [--peers=<peers>] [--get=<key>] [--set=<key>,<value>] [--cas=<key>,<oldvalue>,<value>] [--del=<key>]

Options:
    --help                          Show this help message.
    --peers=<host1:port1,...>       List of comma-delimited peers, e.g:
                                    foo.baz.com:8888,bar.baz.com:8888
    --get=<key>                     Get the current value for <key>, if set.
    --set=<key,value>               Set the key <key> to <value>.
    --cas=<key,oldvalue,value>      Attempt an atomic compare and swap.
    --del=<key>                     Delete the current value for <key>, if set.
";

fn main() {
    let args: Args = Docopt::new(USAGE)
        .and_then(|d| d.decode())
        .unwrap_or_else(|e| e.exit());

    let peers: Vec<SocketAddr> = args.flag_peers.unwrap_or("127.0.0.1:8888".to_string())
        .split(",")
        .map(|s| s.parse().unwrap())
        .collect();

    let nthreads = 1;
    let mut cli = Client::new(peers, nthreads);

    args.flag_set.map(|kv: String| {
        let kvs: Vec<&str> = kv.splitn(2, ",").take(2).collect();
        if kvs.len() != 2 {
            println!("{}", USAGE);
            process::exit(1);
        }
        let (k, v) = (kvs[0], kvs[1]);
        cli.set(k.as_bytes(), v.as_bytes()).unwrap();
    });
}

#[derive(Debug, RustcDecodable)]
struct Args {
    flag_help: bool,
    flag_peers: Option<String>,
    flag_set: Option<String>,
    flag_get: Option<String>,
    flag_cas: Option<String>,
    flag_del: Option<String>,
}


text:
//
//  ZLDefine.h
//  多选相册照片
//
//  Created by long on 15/11/26.
//  Copyright © 2015年 long. All rights reserved.
//

#ifndef ZLDefine_h
#define ZLDefine_h

#import "ZLProgressHUD.h"
#import "NSBundle+ZLPhotoBrowser.h"

#define ZLPhotoBrowserCameraText @"ZLPhotoBrowserCameraText"
#define ZLPhotoBrowserAblumText @"ZLPhotoBrowserAblumText"
#define ZLPhotoBrowserCancelText @"ZLPhotoBrowserCancelText"
#define ZLPhotoBrowserOriginalText @"ZLPhotoBrowserOriginalText"
#define ZLPhotoBrowserDoneText @"ZLPhotoBrowserDoneText"
#define ZLPhotoBrowserOKText @"ZLPhotoBrowserOKText"
#define ZLPhotoBrowserBackText @"ZLPhotoBrowserBackText"
#define ZLPhotoBrowserPhotoText @"ZLPhotoBrowserPhotoText"
#define ZLPhotoBrowserPreviewText @"ZLPhotoBrowserPreviewText"
#define ZLPhotoBrowserLoadingText @"ZLPhotoBrowserLoadingText"
#define ZLPhotoBrowserHandleText @"ZLPhotoBrowserHandleText"
#define ZLPhotoBrowserSaveImageErrorText @"ZLPhotoBrowserSaveImageErrorText"
#define ZLPhotoBrowserMaxSelectCountText @"ZLPhotoBrowserMaxSelectCountText"
#define ZLPhotoBrowserNoCameraAuthorityText @"ZLPhotoBrowserNoCameraAuthorityText"
#define ZLPhotoBrowserNoAblumAuthorityText @"ZLPhotoBrowserNoAblumAuthorityText"
#define ZLPhotoBrowseriCloudPhotoText @"ZLPhotoBrowseriCloudPhotoText"
#define ZLPhotoBrowserGifPreviewText @"ZLPhotoBrowserGifPreviewText"
#define ZLPhotoBrowserVideoPreviewText @"ZLPhotoBrowserVideoPreviewText"
#define ZLPhotoBrowserNoPhotoText @"ZLPhotoBrowserNoPhotoText"
#define ZLPhotoBrowserCannotSelectVideo @"ZLPhotoBrowserCannotSelectVideo"
#define ZLPhotoBrowserCannotSelectGIF @"ZLPhotoBrowserCannotSelectGIF"
#define ZLPhotoBrowseriCloudVideoText @"ZLPhotoBrowseriCloudVideoText"

#define kRGB(r, g, b)   [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]

#define kNavBar_color kRGB(19, 153, 231)
#define kNavBar_tintColor kRGB(255, 255, 255)
#define kBottomView_color kRGB(255, 255, 255)
#define kDoneButton_textColor kRGB(255, 255, 255)
#define kDoneButton_bgColor kRGB(80, 180, 234)
#define kButtonUnable_textColor kRGB(200, 200, 200)

#define weakify(var)   __weak typeof(var) weakSelf = var
#define strongify(var) __strong typeof(var) strongSelf = var

#define kZLPhotoBrowserBundle [NSBundle bundleForClass:[self class]]

// 图片路径
#define kZLPhotoBrowserSrcName(file) [@"ZLPhotoBrowser.bundle" stringByAppendingPathComponent:file]
#define kZLPhotoBrowserFrameworkSrcName(file) [@"Frameworks/ZLPhotoBrowser.framework/ZLPhotoBrowser.bundle" stringByAppendingPathComponent:file]

#define kViewWidth      [[UIScreen mainScreen] bounds].size.width

#define kViewHeight     [[UIScreen mainScreen] bounds].size.height

////////ZLShowBigImgViewController
#define kItemMargin 50

///////ZLBigImageCell 不建议设置太大,太大的话会导致图片加载过慢
#define kMaxImageWidth 500

static inline void SetViewWidth (UIView *view, CGFloat width) {
    CGRect frame = view.frame;
    frame.size.width = width;
    view.frame = frame;
}

static inline CGFloat GetViewWidth (UIView *view) {
    return view.frame.size.width;
}

static inline void SetViewHeight (UIView *view, CGFloat height) {
    CGRect frame = view.frame;
    frame.size.height = height;
    view.frame = frame;
}

static inline CGFloat GetViewHeight (UIView *view) {
    return view.frame.size.height;
}

static inline NSString *  GetLocalLanguageTextValue (NSString *key) {
    return [NSBundle zlLocalizedStringForKey:key];
}

static inline UIImage * GetImageWithName (NSString *name) {
    return [UIImage imageNamed:kZLPhotoBrowserSrcName(name)]?:[UIImage imageNamed:kZLPhotoBrowserFrameworkSrcName(name)];
}

static inline CGFloat GetMatchValue (NSString *text, CGFloat fontSize, BOOL isHeightFixed, CGFloat fixedValue) {
    CGSize size;
    if (isHeightFixed) {
        size = CGSizeMake(MAXFLOAT, fixedValue);
    } else {
        size = CGSizeMake(fixedValue, MAXFLOAT);
    }

    CGSize resultSize;
    if ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 7.0) {
        //返回计算出的size
        resultSize = [text boundingRectWithSize:size options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:fontSize]} context:nil].size;
    }
    if (isHeightFixed) {
        return resultSize.width;
    } else {
        return resultSize.height;
    }
}

static inline CABasicAnimation * GetPositionAnimation (id fromValue, id toValue, CFTimeInterval duration, NSString *keyPath) {
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:keyPath];
    animation.fromValue = fromValue;
    animation.toValue   = toValue;
    animation.duration = duration;
    animation.repeatCount = 0;
    animation.autoreverses = NO;
    //以下两个设置,保证了动画结束后,layer不会回到初始位置
    animation.removedOnCompletion = NO;
    animation.fillMode = kCAFillModeForwards;
    return animation;
}

static inline CAKeyframeAnimation * GetBtnStatusChangedAnimation() {
    CAKeyframeAnimation *animate = [CAKeyframeAnimation animationWithKeyPath:@"transform"];

    animate.duration = 0.3;
    animate.removedOnCompletion = YES;
    animate.fillMode = kCAFillModeForwards;

    animate.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.7, 0.7, 1.0)],
                       [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.2, 1.2, 1.0)],
                       [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.8, 0.8, 1.0)],
                       [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)]];
    return animate;
}

#endif /* ZLDefine_h */