text:
package gw.plugin.ij.lang.psi.impl.types;

import com.intellij.openapi.util.Pair;
import com.intellij.psi.HierarchicalMethodSignature;
import com.intellij.psi.PsiAnnotation;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiClassInitializer;
import com.intellij.psi.PsiClassType;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.PsiField;
import com.intellij.psi.PsiIdentifier;
import com.intellij.psi.PsiInvalidElementAccessException;
import com.intellij.psi.PsiJavaToken;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiModifierList;
import com.intellij.psi.PsiReference;
import com.intellij.psi.PsiReferenceList;
import com.intellij.psi.PsiSubstitutor;
import com.intellij.psi.PsiTypeParameter;
import com.intellij.psi.PsiTypeParameterList;
import com.intellij.psi.PsiTypeParameterListOwner;
import com.intellij.psi.ResolveState;
import com.intellij.psi.impl.InheritanceImplUtil;
import com.intellij.psi.impl.PsiImplUtil;
import com.intellij.psi.impl.source.tree.LeafPsiElement;
import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.util.ArrayUtil;
import com.intellij.util.IncorrectOperationException;
import gw.lang.parser.expressions.ITypeVariableDefinitionExpression;
import gw.plugin.ij.lang.parser.GosuCompositeElement;
import gw.plugin.ij.lang.psi.api.auxilary.annotation.IGosuAnnotation;
import gw.plugin.ij.lang.psi.api.statements.IGosuField;
import gw.plugin.ij.lang.psi.api.statements.typedef.IGosuExtendsClause;
import gw.plugin.ij.lang.psi.api.statements.typedef.IGosuImplementsClause;
import gw.plugin.ij.lang.psi.api.statements.typedef.IGosuMembersDeclaration;
import gw.plugin.ij.lang.psi.api.types.IGosuTypeVariable;
import gw.plugin.ij.lang.psi.api.types.IGosuTypeVariableList;
import gw.plugin.ij.lang.psi.impl.GosuElementVisitor;
import gw.plugin.ij.lang.psi.impl.GosuPsiElementImpl;
import gw.plugin.ij.lang.psi.impl.GosuPsiImplUtil;
import gw.plugin.ij.lang.psi.util.GosuClassImplUtil;
import gw.plugin.ij.lang.psi.util.GosuDocUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 */
public class GosuTypeVariableImpl extends GosuPsiElementImpl<ITypeVariableDefinitionExpression> implements IGosuTypeVariable {
  public GosuTypeVariableImpl(@NotNull GosuCompositeElement node) {
    super(node);
  }

  @Nullable
  public IGosuExtendsClause getExtendsClause() {
    return null;
  }

  @Nullable
  public IGosuImplementsClause getImplementsClause() {
    return null;
  }

  @NotNull
  public String[] getSuperClassNames() {
    final PsiReference[] types = getExtendsList().getReferences();
    List<String> names = new ArrayList<>(types.length);
    for (PsiReference type : types) {
      names.add(type.getCanonicalText());
    }
    return ArrayUtil.toStringArray(names);
  }

  @NotNull
  public PsiMethod[] findCodeMethodsByName(@NonNls String name, boolean checkBases) {
    return GosuClassImplUtil.findCodeMethodsByName(this, name, checkBases);
  }

  @NotNull
  public PsiMethod[] findCodeMethodsBySignature(PsiMethod patternMethod, boolean checkBases) {
    return GosuClassImplUtil.findCodeMethodsBySignature(this, patternMethod, checkBases);
  }

  @Nullable
  public LeafPsiElement getGosuLBrace() {
    return null;
  }

  @Nullable
  public LeafPsiElement getGosuRBrace() {
    return null;
  }

  @NotNull
  public <T extends IGosuMembersDeclaration> T addMemberDeclaration(T decl, PsiElement anchorBefore) throws IncorrectOperationException {
    throw new UnsupportedOperationException("Cannot add member declaration to GosuTypeVariable");
  }

  @NotNull
  public String toString() {
    return "Type variable";
  }

  @Nullable
  @NonNls
  public String getQualifiedName() {
    return null;
  }

  public boolean isInterface() {
    return false;
  }

  public boolean isAnonymous() {
    return false;
  }

  @Override
  public boolean isEnhancement() {
    return false;
  }

  public boolean isAnnotationType() {
    return false;
  }

  public boolean isEnum() {
    return false;
  }

  @NotNull
  public PsiReferenceList getExtendsList() {
    final GosuTypeVariableExtendsListImpl list = findChildByClass(GosuTypeVariableExtendsListImpl.class);
    assert list != null;
    return list;
  }

  @Nullable
  public PsiReferenceList getImplementsList() {
    return null;
  }

  @NotNull
  public PsiClassType[] getExtendsListTypes() {
    return getExtendsList().getReferencedTypes();
  }

  @NotNull
  public PsiClassType[] getImplementsListTypes() {
    return PsiClassType.EMPTY_ARRAY;
  }

  @Nullable
  public PsiClass getSuperClass() {
    return GosuClassImplUtil.getSuperClass(this);
  }

  @NotNull
  public PsiClass[] getInterfaces() {
    return PsiClass.EMPTY_ARRAY;
  }

  @NotNull
  public PsiClass[] getSupers() {
    return GosuClassImplUtil.getSupers(this);
  }

  @NotNull
  public PsiClassType[] getSuperTypes() {
    return GosuClassImplUtil.getSuperTypes(this);
  }

  @NotNull
  public IGosuField[] getFields() {
    return IGosuField.EMPTY_ARRAY;
  }

  @NotNull
  public PsiMethod[] getMethods() {
    return PsiMethod.EMPTY_ARRAY;
  }

  @NotNull
  public PsiMethod[] getConstructors() {
    return PsiMethod.EMPTY_ARRAY;
  }

  @NotNull
  public PsiClass[] getInnerClasses() {
    return PsiClass.EMPTY_ARRAY;
  }

  @NotNull
  public PsiClassInitializer[] getInitializers() {
    return PsiClassInitializer.EMPTY_ARRAY;
  }

  @NotNull
  public PsiField[] getAllFields() {
    return GosuClassImplUtil.getAllFields(this);
  }

  @NotNull
  public PsiMethod[] getAllMethods() {
    return GosuClassImplUtil.getAllMethods(this);
  }

  @NotNull
  public PsiClass[] getAllInnerClasses() {
    return PsiClass.EMPTY_ARRAY;
  }

  @Nullable
  public PsiField findFieldByName(@NonNls String name, boolean checkBases) {
    return GosuClassImplUtil.findFieldByName(this, name, checkBases);
  }

  @Nullable
  public PsiMethod findMethodBySignature(PsiMethod patternMethod, boolean checkBases) {
    return GosuClassImplUtil.findMethodBySignature(this, patternMethod, checkBases);
  }

  @NotNull
  public PsiMethod[] findMethodsBySignature(PsiMethod patternMethod, boolean checkBases) {
    return GosuClassImplUtil.findCodeMethodsBySignature(this, patternMethod, checkBases);
  }

  @NotNull
  public PsiMethod[] findMethodsByName(@NonNls String name, boolean checkBases) {
    return GosuClassImplUtil.findCodeMethodsByName(this, name, checkBases);
  }

  @NotNull
  public List<Pair<PsiMethod, PsiSubstitutor>> findMethodsAndTheirSubstitutorsByName(@NonNls String name, boolean checkBases) {
    return GosuClassImplUtil.findMethodsAndTheirSubstitutorsByName(this, name, checkBases);
  }

  @NotNull
  public List<Pair<PsiMethod, PsiSubstitutor>> getAllMethodsAndTheirSubstitutors() {
    return GosuClassImplUtil.getAllMethodsAndTheirSubstitutors(this);
  }

  @Nullable
  public PsiClass findInnerClassByName(@NonNls String name, boolean checkBases) {
    return null;
  }

  @Nullable
  public PsiJavaToken getLBrace() {
    return null;
  }

  @Nullable
  public PsiJavaToken getRBrace() {
    return null;
  }

  @Nullable
  public PsiIdentifier getNameIdentifier() {
    PsiIdentifier id = findElement(this, PsiIdentifier.class);
    if(id != null) {
      PsiElement firstChild = id.getFirstChild();
      if(firstChild instanceof PsiIdentifier) {
        // Always return the leaf token node; we always want to patch in just the name and not mess with upper-level tree nodes
        id = (PsiIdentifier) firstChild;
      }
    }
    return id;
  }

  @Nullable
  public PsiElement getScope() {
    return null;
  }

  public boolean isInheritor(@NotNull PsiClass baseClass, boolean checkDeep) {
    return InheritanceImplUtil.isInheritor(this, baseClass, checkDeep);
  }

  public boolean isInheritorDeep(@NotNull PsiClass baseClass, @Nullable PsiClass classToByPass) {
    return InheritanceImplUtil.isInheritorDeep(this, baseClass, classToByPass);
  }

  @Nullable
  public PsiClass getContainingClass() {
    return null;
  }

  @NotNull
  public Collection<HierarchicalMethodSignature> getVisibleSignatures() {
    return Collections.emptyList(); //todo
  }

  public PsiTypeParameterListOwner getOwner() {
    final PsiElement parent = getParent();
    if (parent == null) {
      throw new PsiInvalidElementAccessException(this);
    }
    final PsiElement parentParent = parent.getParent();
    if (parentParent != null && !(parentParent instanceof PsiTypeParameterListOwner)) {
      throw new AssertionError("CCE: " + parentParent);
    }
    return (PsiTypeParameterListOwner) parentParent;
  }

  public int getIndex() {
    final IGosuTypeVariableList list = (IGosuTypeVariableList) getParent();
    return list.getTypeParameterIndex(this);
  }

  @NotNull
  public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException {
    throw new UnsupportedOperationException("Men at work");
//    GosuPsiImplUtil.setName( name, getNameIdentifierGosu() );
//    return this;
  }

  @Nullable
  public PsiModifierList getModifierList() {
    return null;
  }

  public boolean hasModifierProperty(@NonNls @NotNull String name) {
    return false;
  }

  @Nullable
  public PsiDocComment getDocComment() {
    return GosuDocUtil.findDocCommnentNode(getNode());
  }

  public boolean isDeprecated() {
    return GosuPsiImplUtil.isDeprecatedByAnnotation(this) ||  PsiImplUtil.isDeprecatedByDocTag(this);
  }

  public boolean hasTypeParameters() {
    return false;
  }

  @Nullable
  public PsiTypeParameterList getTypeParameterList() {
    return null;
  }

  @NotNull
  public PsiTypeParameter[] getTypeParameters() {
    return PsiTypeParameter.EMPTY_ARRAY;
  }

  public String getName() {
    PsiIdentifier nameIdentifier = getNameIdentifier();
    return nameIdentifier == null ? null : nameIdentifier.getText();
  }

  public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
    return GosuClassImplUtil.processDeclarations(this, processor, state, lastParent, place);
  }

  @NotNull
  public IGosuAnnotation[] getAnnotations() {
    return IGosuAnnotation.EMPTY_ARRAY;
  }

  public PsiAnnotation findAnnotation(@NotNull @NonNls String qualifiedName) {
    return null;
  }

  @NotNull
  public PsiAnnotation addAnnotation(@NotNull @NonNls String qualifiedName) {
    throw new IncorrectOperationException();
  }

  @NotNull
  public PsiAnnotation[] getApplicableAnnotations() {
    return getAnnotations();
  }

  @Override
  public void accept(@NotNull PsiElementVisitor visitor) {
    if( visitor instanceof GosuElementVisitor) {
      ((GosuElementVisitor)visitor).visitTypeVariable(this);
    }
    else {
      visitor.visitElement( this );
    }
  }
}


text:
[source](https://commons.wikimedia.org/wiki/File:Eye_of_Horus.svg), [author](https://commons.wikimedia.org/wiki/User:Hendrike), [author](https://commons.wikimedia.org/wiki/User:Erin_Silversmith)

copyright notice:
> "Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
> This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license."

## my header picture
[source](https://commons.wikimedia.org/wiki/File:Horus_as_falcon.svg), [author](https://commons.wikimedia.org/wiki/User:Jeff_Dahl)

copyright notice:
> "I, the copyright holder of this work, hereby publish it under the following licenses:
>
> Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
>
>
> This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International, 3.0 Unported, 2.5 Generic, 2.0 Generic and 1.0 Generic license.
>
>
> You are free:
> to share & to copy, distribute and transmit the work
> to remix & to adapt the work
> Under the following conditions:
> attribution & You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
> share alike & If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
>
> You may select the license of your choice."

# Software license information
## Pymarkovchain
This software uses the python [pymarkovchain library](https://pypi.python.org/pypi/PyMarkovChain/).
It is distributed under the [Beer-Ware-License](https://github.com/TehMillhouse/PyMarkovChain/blob/master/LICENSE.txt).

## Tweepy
This software uses the python [tweepy library](http://www.tweepy.org/).
It is distributed under the [MIT License](https://github.com/tweepy/tweepy/blob/master/LICENSE).

## LanguageTool
This software uses the [LanguageTool](https://languagetool.org/).
It is distributed under the [GNU Lesser General Public License](https://www.gnu.org/licenses/old-licenses/lgpl-2.1).

## Python
The python programming language is distributed under the [Python License](https://docs.python.org/3.5/license.html).

## Java
The Java runtime binaries are distributed under the [Oracle Binary Code License Agreement for the Java SE Platform Products and JavaFX](http://www.oracle.com/technetwork/java/javase/terms/license/index.html).

# Text license information
## Tatoeba
This project uses a corpus of close to 800000 english sentences, taken from the Tatoeba project: http://downloads.tatoeba.org/exports/sentences.tar.bz2
These sentences are distributed under the [terms of use](https://tatoeba.org/eng/terms_of_use).
They are distributed under the [CC-BY license](https://creativecommons.org/licenses/by/2.0/).

The following modifications have been made to the original data:
* All non-english sentences have been removed
* Any tags that do not belong to the sentences themselves have been removed
* A few characters have been changed to similar characters that match a smaller encoding (e.g. » to ")

redpajama_set_name: RedPajamaGithub


text:
package edu.usu.sdl.openstorefront.core.api;

import edu.usu.sdl.openstorefront.core.entity.AttributeCodePk;
import edu.usu.sdl.openstorefront.core.entity.Component;
import edu.usu.sdl.openstorefront.core.model.search.AdvanceSearchResult;
import edu.usu.sdl.openstorefront.core.model.search.SearchModel;
import edu.usu.sdl.openstorefront.core.view.ArticleView;
import edu.usu.sdl.openstorefront.core.view.ComponentSearchView;
import edu.usu.sdl.openstorefront.core.view.FilterQueryParams;
import edu.usu.sdl.openstorefront.core.view.SearchQuery;
import java.util.List;

/**
 * Search AsyncService Interface
 *
 * @author dshurtleff
 */
public interface SearchService
		extends AsyncService
{

	/**
	 * Get all components and articles
	 *
	 * @return
	 */
	public List<ComponentSearchView> getAll();

	/**
	 * Performs a search
	 *
	 * @param query
	 * @param filter
	 * @return
	 */
	public List<ComponentSearchView> getSearchItems(SearchQuery query, FilterQueryParams filter);

	/**
	 * Performs the search according to search elements and then gathers all
	 * results
	 *
	 * @param searchModel
	 * @return results and any validation failures
	 */
	public AdvanceSearchResult advanceSearch(SearchModel searchModel);

	/**
	 * This is used for an architecture search
	 *
	 * @param pk
	 * @param filter
	 * @return
	 */
	public List<ComponentSearchView> architectureSearch(AttributeCodePk pk, FilterQueryParams filter);

	/**
	 * Indexes a component
	 *
	 * @param components
	 */
	public void indexComponents(List<Component> components);

	/**
	 * Indexes an article
	 *
	 * @param articles
	 */
	public void indexArticles(List<ArticleView> articles);

	/**
	 * Indexes articles and Components
	 *
	 * @param components
	 * @param articles
	 */
	public void indexArticlesAndComponents(List<ArticleView> articles, List<Component> components);

	/**
	 * Removes a search index
	 *
	 * @param id
	 */
	public void deleteById(String id);

	/**
	 * Updates all records in the index
	 */
	public void saveAll();

	/**
	 * This clears all records in the index CAUTION: deletes everything!
	 */
	public void deleteAll();

	/**
	 * This will do a complete refresh
	 */
	public void resetIndexer();

}


text:
This document is supposed to give you a short introduction to the project. \
It explains the project structure, so you can get a rough overview of the overall architecture.

Feel free to expand this document!

- [Overall Structure](https://github.com/Nukesor/pueue/blob/main/ARCHITECTURE.md#overall-structure)
- [Daemon](https://github.com/Nukesor/pueue/blob/main/ARCHITECTURE.md#daemon)
- [Request Handler](https://github.com/Nukesor/pueue/blob/main/ARCHITECTURE.md#request-handler)
- [TaskHandler](https://github.com/Nukesor/pueue/blob/main/ARCHITECTURE.md#taskhandler)
- [Shared State](https://github.com/Nukesor/pueue/blob/main/ARCHITECTURE.md#shared-state)
- [Code Style](https://github.com/Nukesor/pueue/blob/main/ARCHITECTURE.md#code-style)

## Overall Structure

This project is divided into two modules, the client (`pueue`) and the daemon (`pueued`). \
_Pueue_ also depends on [pueue-lib](https://github.com/nukesor/pueue-lib).
_Pueue-lib_ contains everything that is shared between the daemon and the client.

This includes:

- The protocol used for communicating.
- Settings, since they're parsed by both binaries.
- All data structs, namely `state`, `task` and `message`.
- Helper to interact with task's logs.

## Daemon

The daemon is composed of two main components.

1. Request handling in `daemon/network/`.
    This is the code responsible for communicating with clients.
    In `daemon/network/message_handler/` you can find neatly separated handlers for all of Pueue's subcommands.
2. The TaskHandler in `daemon/task_handler/`.
    It's responsible for everything regarding process interaction.

All information that's not sub-process specific, is stored in the `State` (`pueue-lib/state.rs`) struct. \
Both components share a reference to the State, a `Arc<Mutex<State>>`.
That way we can guarantee a single source of truth and a consistent state.

It's also important to know, that there's a `mpsc` channel. \
This channel is used to send on-demand messages from the network request handler to the the TaskHandler.
This includes stuff like "Start/Pause/Kill" sub-processes or "Reset everything".

### Request handling

The `daemon/network/socket.rs` module contains the logic for accepting client connections and receiving payloads.
The request accept and handle logic is a single async-await loop run by the main thread.

The payload is then deserialized to `Message` (`pueue-lib/message.rs`) and handled by its respective function.
All functions used for handling these messages can be found in `daemon/network/message_handler`.

Many messages can be instantly handled by simply modifying or reading the state. \
However, sometimes the TaskHandler has to be notified, if something involves modifying actual system processes (start/pause/kill tasks).
That's when the `mpsc` channel to the TaskHandler comes into play.

### TaskHandler

The TaskHandler is responsible for actually starting and managing system processes. \
It's further important to note, that it runs in its own thread.

The TaskHandler runs a never ending loop, which checks a few times each second, if

- there are new instructions in the `mpsc` channel.
- a new task can be started.
- tasks finished and can be finalized.
- delayed tasks can be enqueued (`-d` flag on `pueue add`)
- A few other things. Check the `TaskHandler::run` function in `daemon/task_handler/mod.rs`.

The TaskHandler is by far the most complex piece of code in this project, but there is also a lot of documentation.

## Shared State

Whenever you're writing some core-logic in Pueue, please make sure to understand how mutexes work.

Try to be conservative with your `state.lock()` calls, since this also blocks the request handler!
Only use the state, if you absolutely have to.

At the same time, you should also lock early enough to prevent inconsistent states.
Operations should generally be atomic. \
Anyhow, working with mutexes is usually straight-forward, but can sometimes be a little bit tricky.

## Code Style

This is a result of `tokei ./client ./daemon` on commit `fde79eb` at the 2021-07-27.

```
===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 Rust                   62         6332         4860          522          950
 |- Markdown            53          644            0          600           44
 (Total)                           6976         4860         1122          994
===============================================================================
 Total                  62         6332         4860          522          950
===============================================================================
```

### Format and Clippy

`cargo format` and `cargo clean && cargo clippy` should never return any warnings on the current stable Rust version!

PR's are automatically checked for these two and won't be accepted unless everything looks fine.

### Comments

1. All functions have to have a doc block.
2. All non-trivial structs have to have doc block.
3. Rather too many inline comments than too few.
4. Non-trivial complexity should be well documented!

In general, please add a lot of comments. It makes maintenance, collaboration and reviews MUCH easier.


text:
package org.kie.dmn.model.api;

import java.util.List;

import javax.xml.namespace.QName;

/**
 * @since DMN v1.3
 */
public interface FunctionItem extends DMNElement {

    List<InformationItem> getParameters();

    /**
     * for consistency in the modeling, use QName
     */
    QName getOutputTypeRef();

    void setOutputTypeRef(QName value);

}


text:
import { isGuid } from './validators';

describe('GUID validator', () => {
  it('returns undefined if GUID is valid', () => {
    expect(isGuid('c2bb9245-78cd-4bde-bb70-7b7649c30178')).toBeUndefined();
  });

  it('returns error message if GUID is invalid', () => {
    expect(isGuid('invalid-guid-string')).toBe('GUID is expected.');
  });
});


text:
<!DOCTYPE html>

  <link href="http://gmpg.org/xfn/11" rel="profile">
  <meta http-equiv="content-type" content="text/html; charset=utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

  <title>

      WordPress Standards · Developer Handbook

  </title>

  <link rel="stylesheet" href="/public/css/poole.css">
  <link rel="stylesheet" href="/public/css/syntax.css">
  <link rel="stylesheet" href="/public/css/hyde.css">
  <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">

  <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/public/apple-touch-icon-144-precomposed.png">
                                 <link rel="shortcut icon" href="/public/favicon.ico">

  <link rel="alternate" type="application/rss+xml" title="RSS" href="/atom.xml">

Developer Handbook

              Frontend Standards

              WordPress Standards

© 2014. All rights reserved.

WordPress Standards

Since the bulk of our code is for the WordPress platform and much of it is also reviewed by WordPress.com VIP, this is the most important platform to have consistency on.
Source link: WordPress Coding Standards
Also see our WordPress Best Practices document.

PHP Formatting:

Whitespace:

Always use TABS instead of SPACES to indent code:
This reduces code size and allows everyone to choose their preferred tab stop width.
Exception: Indenting within a line. This should always be done with SPACES so that things line up the same for everybody.

NEVER leave whitespace at the end of a line, or have whitespace on an empty line.
Your text editor should be able to display whitespace. Turn on this option to show where the whitespace is.

Use whitespace appropriately and consistently. Blocks of related code should be grouped and separated by blank lines.

The standards below differ from the official WordPress coding standards:

Whitespace should be used around ALL binary operators, but NOT after unary operators like ! or -. Thus:

if( 'bar ' . 'bacon' == 'bar bacon' && !$truth_serum ) {
  // Code
}

Whitespace should not be given inside array indices, but any expressions within should follow the above whitespace rules:

$foo = array( 'bar' => 'baz', 5 => 'five' );
$bar = $foo['bar'];  // NOT $foo[ 'bar' ];
$five = $foo[3 + 2]; // NOT $foo[3+2];

Blocks

Control blocks must be written as such:

if( $x == 'bar' ) {
  // Code
}

That is, control statement, NO SPACE, open-parenthesis, SPACE, statement, SPACE, close-parenthesis, SPACE, open-brace, NEWLINE.

NEVER EVER EVER EVER EVER use the alternate PHP control statement syntax:

if( $foo ) :
endif;
while( $condition ) :
endwhile;

This leads to code that is less consistent and harder to read. There's no reason you must write it this way for "the loop." Break the habit.

Closing braces should ALWAYS appear on their own line. (This differs from WP coding standards)

Control blocks should always be written with braces:

if( $condition ) {
  $foo = 'bar';
}

if( $x == 'bar' ) {
   $foo = 'bar';
}
elseif( $x == 'baz' ) {
  $foo = 'quux';
}
else {
  $foo = 'brains';
}

PHP: The One True Singleton

This singleton is the most robust and compact implemetation I have found. It prevents multiple instantiation explicitly. We should always use this for any singletons in the future.

class Theme_Feature {
  // Define and register singleton
  private static $instance = false;
  public static function instance() {
    if( !self::$instance )
      self::$instance = new Theme_Feature; // MUST BE UPDATED WITH CLASS NAME
    return self::$instance;
  }
  // Disallow clone() of object
  private function __clone() { }
  // CPT registration, custom taxonomy registration, actions, filters
  private function __construct() { }
}
Theme_Feature::instance();

HTML

HTML should be indented with TABS, not SPACES, much like PHP.
HTML intermingled with PHP should start at the same indentation level as the PHP.
HTML embedded in PHP should for the most part be written OUTSIDE of PHP blocks.
Short tags made up of many parts can be built in PHP.

If you need to capture long chunks of HTML into an output, use obstart() and obget_clean():

<?php ob_start(); ?>
  <p>
    This is a long piece of <span class="<?php echo esc_attr( join( ' ', $classes ) ); ?>">some text</span>
    that should be captured by <em>ob_start()</em> and <em>ob_get_clean()</em>
   </p>
<?php $markup = ob_get_clean(); ?>

HTML attribute values must ALWAYS be written with double-quotes, and always lower-case, with no spacing: attr="value"

Correct

<div class="foo bar"></div>

Incorrect

<DIV class='foo bar'></DIV>

Any PHP variables emitted into HTML must ALWAYS be escaped with one of the escaping functions: eschtml() or escattr()
Javascript variables should be set using encodejson() over escjs(). json_encode() is more type-safe and can bring over any type of variable into a Javascript representation and will quote properly when necessary:

<script>var foo = <?php echo json_encode( $foo ); ?>;</script>

Within WordPress, JavaScript variables should be provided to the page using wplocalizescript() instead of direct injection of JavaScript code as above.

Translation Strings

Unless a theme needs to be translation-ready, there's never any need to leave the e(), _(), escattre(), or other translation functions in the theme as they serve no purpose but to slow down page rendering.

URLs

WordPress includes myriad functions for building URLs, and these should always be used instead of manual URL construction.

For front-end URLs, home_url() is used to build URLs relative to the site URL.

For admin URLs, admin_url() is used to build URLs relative to the site's WP Admin.

If query strings are needed, addqueryarg() should always be used, in conjunction with the aforementioned URL functions.

If URLs are to be constructed from more than two pieces (base URL and relative path thereto), pathjoin() should be used. Note that the second parameter cannot contain a leading slash, otherwise pathjoin() will return only the second argument.

When referencing files within the theme, the following two functions should be used:

getstylesheetdirectory_uri() - for child themes or themes that won't have parent/child setup

gettemplatedirectory_uri() - only to be used in a parent/child theme setup when the parent theme is referenced

Related to the foregoing statement, bloginfo() and get_bloginfo() should never be used to reference theme directories.

Root-relative URLs should never be used as we can hardly predict what a client may do with a site once we deliver a final product to them.


text:
namespace N1 {

struct A { A(); void f(); };
struct B: public A { B(); };

A::A() { }
B::B() { }

B::A ba;
A::A a; // { dg-error "constructor" "the injected-class-name can never be found through qualified lookup" }

void A::f()
{
  A::A();			// { dg-message "::A" "c++/42415" }
}

void f()
{
  A::A a; // { dg-error "constructor" "constructor" }
} // { dg-error "" "error cascade" { target *-*-* } 23 } error cascade
}

namespace N2 {

// This is nasty: if we allowed the injected-class-name to be looked as a
//  qualified type, then the following code would be well-formed. Basically
//  the last line is defining the static member (with redundant parenthesis).
// Instead, it should be rejected as a malformed constructor declaration.

template <class T> struct A {
  template <class T2> A(T2);
  static A x;
};
template<> template <> A<char>::A<char>(char);
template<> A<int>::A<int>(A<int>::x);  // { dg-error "" "this is an invalid declaration of the constructor" }

}

// But DR 318 says that in situations where a type is syntactically
// required, lookup finds it.

struct C
{
  C();
  typedef int T;
};
struct C::C c;
C::C::T t;
struct D: C::C
{
  D(): C::C() { }
};

// And if lookup doesn't find the injected-class-name, we aren't naming the
// constructor (c++/44401).

struct E
{
  int E;
};

int E::*p = &E::E;


text:
var q = require('q');

var d = q.defer();

d.promise.then(console.log, console.log);
d.resolve('I FIRED');
d.reject('I DID NOT FIRE');


text:
import sys
import requests
import json
import apis

def square(n):
    """ Square numbers

    >>> square(2)
    4
    >>> square(3)
    8
    """
    return n**n

def dispatcher(command, arg):
    """ Does things """
    if command == "weather":
        print("Here's the weather forcast for "+arg)
        print(apis.fetch_weather(arg))
    if command == "square":
        print("The square of " + arg + " is " + str(square(int(arg))))
    elif command == "go away":
        print("It sounds like you no longer need my assistance")
        print("Very well. Goodbye!")
        return
    elif command == "bye":
        print("Goodbye! Have a good day!")
        return
    # Reprompt the user.
    prompter()

def prompter():
    """ asks for things """

    command = input("How may I help you?: [weather, square, go away, bye]")
    if command == "weather":
        city = input("Sure thing! What city?")
        dispatcher(command, city)
    if command == "square":
        num = input("I love math! What number?")
        dispatcher(command, num)
    elif command == "stocks": # TODO
        pass
    else:
        dispatcher(command, "")

def starter(cliargs):
    # TODO: Finish up command line interface
    print("DEBUG: Called with ", cliargs[1:])

    print("Summoning Jarvis")
    print("Good evening!")

    if (len(cliargs) > 1):
        command = cliargs[2]
        # TODO: Call dispatcher with args instead of prompting user.
    else:
        prompter()

if __name__ == "__main__":
    starter(sys.argv)


text:
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

package org.apache.doris.persist;

import org.apache.doris.common.io.Text;
import org.apache.doris.common.io.Writable;
import org.apache.doris.load.routineload.RoutineLoadJob.JobState;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

/*
 * Author: Chenmingyu
 * Date: Mar 14, 2019
 */

public class RoutineLoadOperation implements Writable {
    private long id;
    private JobState jobState;

    private RoutineLoadOperation() {
    }

    public RoutineLoadOperation(long id, JobState jobState) {
        this.id = id;
        this.jobState = jobState;
    }

    public long getId() {
        return id;
    }

    public JobState getJobState() {
        return jobState;
    }

    public static RoutineLoadOperation read(DataInput in) throws IOException {
        RoutineLoadOperation operation = new RoutineLoadOperation();
        operation.readFields(in);
        return operation;
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeLong(id);
        Text.writeString(out, jobState.name());
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        id = in.readLong();
        jobState = JobState.valueOf(Text.readString(in));
    }
}


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

#if !netstandard
using Internal.Runtime.CompilerServices;
#endif

namespace System.Buffers.Text
{
    public static partial class Utf8Formatter
    {
        // Rfc1123 - lowercase
        //
        //   01234567890123456789012345678
        //   -----------------------------
        //   tue, 03 jan 2017 08:08:05 gmt
        //
        private static bool TryFormatDateTimeL(DateTime value, Span<byte> buffer, out int bytesWritten)
        {
            bytesWritten = 29;
            if (buffer.Length < bytesWritten)
            {
                bytesWritten = 0;
                return false;
            }

            ref byte utf8Bytes = ref MemoryMarshal.GetReference(buffer);

            byte[] dayAbbrev = DayAbbreviationsLowercase[(int)value.DayOfWeek];
            Unsafe.Add(ref utf8Bytes, 0) = dayAbbrev[0];
            Unsafe.Add(ref utf8Bytes, 1) = dayAbbrev[1];
            Unsafe.Add(ref utf8Bytes, 2) = dayAbbrev[2];
            Unsafe.Add(ref utf8Bytes, 3) = Utf8Constants.Comma;
            Unsafe.Add(ref utf8Bytes, 4) = Utf8Constants.Space;

            FormattingHelpers.WriteDigits(value.Day, 2, ref utf8Bytes, 5);
            Unsafe.Add(ref utf8Bytes, 7) = (byte)' ';

            byte[] monthAbbrev = MonthAbbreviationsLowercase[value.Month - 1];
            Unsafe.Add(ref utf8Bytes, 8) = monthAbbrev[0];
            Unsafe.Add(ref utf8Bytes, 9) = monthAbbrev[1];
            Unsafe.Add(ref utf8Bytes, 10) = monthAbbrev[2];
            Unsafe.Add(ref utf8Bytes, 11) = Utf8Constants.Space;

            FormattingHelpers.WriteDigits(value.Year, 4, ref utf8Bytes, 12);
            Unsafe.Add(ref utf8Bytes, 16) = Utf8Constants.Space;

            FormattingHelpers.WriteDigits(value.Hour, 2, ref utf8Bytes, 17);
            Unsafe.Add(ref utf8Bytes, 19) = Utf8Constants.Colon;

            FormattingHelpers.WriteDigits(value.Minute, 2, ref utf8Bytes, 20);
            Unsafe.Add(ref utf8Bytes, 22) = Utf8Constants.Colon;

            FormattingHelpers.WriteDigits(value.Second, 2, ref utf8Bytes, 23);
            Unsafe.Add(ref utf8Bytes, 25) = Utf8Constants.Space;

            Unsafe.Add(ref utf8Bytes, 26) = GMT1Lowercase;
            Unsafe.Add(ref utf8Bytes, 27) = GMT2Lowercase;
            Unsafe.Add(ref utf8Bytes, 28) = GMT3Lowercase;

            return true;
        }
    }
}


text:
module.exports = {
  up: (queryInterface, Sequelize) =>
    queryInterface.createTable('Users', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      name: {
        type: Sequelize.STRING
      },
      username: {
        type: Sequelize.STRING,
        unique: true,
      },
      email: {
        type: Sequelize.STRING,
        unique: true,
      },
      imageUrl: {
        type: Sequelize.STRING
      },
      imageId: {
        type: Sequelize.STRING
      },
      password: {
        type: Sequelize.STRING
      },
      createdAt: {
        allowNull: false,
        type: Sequelize.DATE
      },
      updatedAt: {
        allowNull: false,
        type: Sequelize.DATE
      }
    }),

  down: queryInterface =>
    queryInterface.dropTable('Users'),
};


text:
<%= polyglot.t('serverConnectModal.intro') %>

      <form class="width100" name="serverConfigForm">

            <% // TODO: turn the error output into a template helper so
               // we don't have to keep repeating it %>
            <% if (ob.errors.name) { %>

                <% ob.errors.name.forEach(function(err) {
                     print('
' + err + '
');
                   }); %>

            <% } %>

                Name

            <div class="flexCol-8 borderRight0 custCol-border <% ob.errors.name && print('invalid') %>">
              <input name="name" type="text" id="fld_name" class="fieldItem" value="<%= ob.name %>">

            <% if (ob.errors.server_ip) { %>

                <% ob.errors.server_ip.forEach(function(err) {
                     print('
' + err + '
');
                   }); %>

            <% } %>

                <%= polyglot.t('serverConnectModal.serverIP') %>

            <div class="flexCol-8 borderRight0 custCol-border <% ob.errors.server_ip && print('invalid') %>">
              <input name="server_ip" type="text" id="fld_server" placeholder="" class="fieldItem" required="" value="<%= ob.server_ip %>">
              <div class="btn btn-txt btn-corner btn-cornerTR custCol-secondary ion-locked
                          positionAbsolute tooltip <% if(!ob.SSL){ %> hide <% } %>  js-sslOn"
                   data-tooltip="<%= polyglot.t('SSLIsOn') %>">
                <%= polyglot.t('SSLOn') %>

              <div class="btn btn-txt btn-corner btn-cornerTR custCol-secondary ion-unlocked
                          positionAbsolute tooltip <% if(ob.SSL){ %> hide <% } %>  js-sslOff"
                   data-tooltip="<%= polyglot.t('SSLIsOff') %>">
                <%= polyglot.t('SSLOff') %>

            <% if (ob.errors.username) { %>

                <% ob.errors.username.forEach(function(err) {
                  print('
' + err + '
');
                }); %>

            <% } %>

                <%= polyglot.t('serverConnectModal.username') %>

            <div class="flexCol-8 borderRight0 custCol-border <% ob.errors.username && print('invalid') %>">
              <input name="username" type="text" id="fld_username" class="fieldItem" value="<%= ob.username %>">

            <% if (ob.errors.password) { %>

                <% ob.errors.password.forEach(function(err) {
                  print('
' + err + '
');
                }); %>

            <% } %>

                <%= polyglot.t('serverConnectModal.password') %>

            <div class="flexCol-8 borderRight0 custCol-border <% ob.errors.password && print('invalid') %>">
              <input name="password" type="password" id="fld_password" class="fieldItem" value="<%= ob.password %>">

            <% if (ob.errors.rest_api_port) { %>

                <% ob.errors.rest_api_port.forEach(function(err) {
                     print('
' + err + '
');
                   }); %>

            <% } %>

                <%= polyglot.t('serverConnectModal.restApiPort') %>

            <div class="flexCol-8 borderRight0 custCol-border <% ob.errors.rest_api_port && print('invalid') %>">
              <input name="rest_api_port" type="text" id="fld_rest_port" placeholder="" class="fieldItem" value="<%= ob.rest_api_port %>">

            <% if (ob.errors.api_socket_port) { %>

                <% ob.errors.api_socket_port.forEach(function(err) {
                     print('
' + err + '
');
                   }); %>

            <% } %>

                <%= polyglot.t('serverConnectModal.websocketApiPort') %>

            <div class="flexCol-8 borderRight0 custCol-border <% ob.errors.api_socket_port && print('invalid') %>">
              <input name="api_socket_port" type="text" id="fld_api_socket_port" placeholder="" class="fieldItem" value="<%= ob.api_socket_port %>">

            <% if (ob.errors.heartbeat_socket_port) { %>

                <% ob.errors.heartbeat_socket_port.forEach(function(err) {
                     print('
' + err + '
');
                   }); %>

            <% } %>

                <%= polyglot.t('serverConnectModal.heartbeatSocketApiPort') %>

            <div class="flexCol-8 borderRight0 custCol-border <% ob.errors.heartbeat_socket_port && print('invalid') %>">
              <input name="heartbeat_socket_port" type="text" id="fld_heartbeat_socket_port" placeholder="" class="fieldItem" value="<%= ob.heartbeat_socket_port %>">

      </form>

      Cancel

      <%= polyglot.t('serverConnectModal.saveChanges') %>


text:
<?php

namespace Orchestra\Contracts\Installation;

interface Specification
{
    /**
     * Get specification id.
     */
    public function uid(): string;

    /**
     * Get specification title.
     */
    public function title(): string;

    /**
     * Get specification description.
     */
    public function description(): string;

    /**
     * Check specification requirement.
     */
    public function check(): bool;

    /**
     * Get specification error.
     *
     * @return array|string|null
     */
    public function error();

    /**
     * Is specification optional.
     */
    public function optional(): bool;
}


text:
package com.onlinelibrary.Model;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 * The persistent class for the book_category database table.
 *
 */
@Entity
@Table(name="book_category")
@NamedQuery(name="BookCategory.findAll", query="SELECT b FROM BookCategory b")
@XmlRootElement(name = "book_category")
@XmlAccessorType(XmlAccessType.FIELD)
public class BookCategory implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;

	//bi-directional many-to-one association to Book
	@ManyToOne
	@JoinColumn(name="isbn")
	private Book book;

	//bi-directional many-to-one association to Category
	@ManyToOne
	@JoinColumn(name="cat_id")
	private Category category;

	public BookCategory() {
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Book getBook() {
		return this.book;
	}

	public void setBook(Book book) {
		this.book = book;
	}

	public Category getCategory() {
		return this.category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

}


text:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../js/resources/js-test-pre.js"></script>
</head>
<body>
<script src="script-tests/xhr-response-blob.js"></script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>


text:
define(["require", "exports", "./decl"], function (require, exports, g) {
    "use strict";
    exports.__esModule = true;
    var p = g.point(10, 20);
});


text:
package org.apache.kafka.streams.processor.internals;

public class PunctuationSchedule extends Stamped<ProcessorNode> {

    final long interval;

    public PunctuationSchedule(ProcessorNode node, long interval) {
        this(node, 0L, interval);
    }

    public PunctuationSchedule(ProcessorNode node, long time, long interval) {
        super(node, time);
        this.interval = interval;
    }

    public ProcessorNode node() {
        return value;
    }

    public PunctuationSchedule next(long currTimestamp) {
        // we need to special handle the case when it is firstly triggered (i.e. the timestamp
        // is equal to the interval) by reschedule based on the currTimestamp
        if (timestamp == 0L)
            return new PunctuationSchedule(value, currTimestamp + interval, interval);
        else
            return new PunctuationSchedule(value, timestamp + interval, interval);
    }

}


text:
import {test} from './methodFuncs/CustomerMethods';
export default function ({Collections, Meteor}) {
  Meteor.methods({
    'customer.search'(key) {
      return test({Collections, Meteor},key);
    }
  });
}


text:
package org.innovateuk.ifs.invite.transactional;

import org.innovateuk.ifs.commons.security.SecuredBySpring;
import org.innovateuk.ifs.commons.service.ServiceResult;
import org.innovateuk.ifs.invite.domain.ApplicationInvite;
import org.innovateuk.ifs.invite.resource.ApplicationInviteResource;
import org.innovateuk.ifs.invite.resource.InviteOrganisationResource;
import org.innovateuk.ifs.user.resource.UserResource;
import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PreFilter;

import java.util.List;
import java.util.Optional;

public interface ApplicationInviteService {

    @PostAuthorize("hasPermission(returnObject, 'READ')")
    ServiceResult<ApplicationInvite> findOneByHash(String hash);

    @PreAuthorize("hasPermission(#inviteOrganisationResource, 'CREATE_APPLICATION_INVITES')")
    ServiceResult<Void> createApplicationInvites(final InviteOrganisationResource inviteOrganisationResource, Optional<Long> applicationId);

    @PreAuthorize("hasAuthority('system_registrar')")
    @SecuredBySpring(value = "READ_INVITE_ORGANISATION_ON_HASH",
            description = "The System Registration user can view an organisation invitation when looked up by hash",
            additionalComments = "The hash should be unguessable so the only way to successfully call this method would be to have been given the hash in the first place")
    ServiceResult<InviteOrganisationResource> getInviteOrganisationByHash(String hash);

    @PreAuthorize("hasPermission(#applicationId, 'org.innovateuk.ifs.application.resource.ApplicationResource', 'READ')")
    ServiceResult<List<InviteOrganisationResource>> getInvitesByApplication(Long applicationId);

    @PreFilter(filterTarget = "inviteResources", value = "hasPermission(filterObject, 'SAVE')")
    ServiceResult<Void> saveInvites(List<ApplicationInviteResource> inviteResources);

    @PreAuthorize("hasPermission(#inviteResource, 'SAVE')")
    ServiceResult<Void> resendInvite(ApplicationInviteResource inviteResource);

    @PreAuthorize("hasAuthority('system_registrar')")
    @SecuredBySpring(value = "READ_INVITE_ON_HASH",
            description = "The System Registration user can read an invite for a given hash",
            additionalComments = "The hash should be unguessable so the only way to successfully call this method would be to have been given the hash in the first place")
    ServiceResult<ApplicationInviteResource> getInviteByHash(String hash);

    @PreAuthorize("hasAuthority('system_registrar')")
    @SecuredBySpring(value = "CHECK_EXISTENCE_OF_INVITE_ON_HASH",
            description = "The System Registration user can check to see if there is an invite for a given hash",
            additionalComments = "The hash should be unguessable so the only way to successfully call this method would be to have been given the hash in the first place")
    ServiceResult<Boolean> checkUserExistsForInvite(String hash);

    @PreAuthorize("hasAuthority('system_registrar')")
    @SecuredBySpring(value = "GET_USER_ON_HASH",
            description = "The System Registration user can see if there is a user for a given hash",
            additionalComments = "The hash should be unguessable so the only way to successfully call this method would be to have been given the hash in the first place")
    ServiceResult<UserResource> getUserByInviteHash(String hash);

    @PreAuthorize("hasPermission(#applicationInviteId, 'org.innovateuk.ifs.invite.resource.ApplicationInviteResource', 'DELETE')")
    ServiceResult<Void> removeApplicationInvite(long applicationInviteId);

    @PostAuthorize("hasPermission(returnObject, 'READ')")
    ServiceResult<Void> updateInviteHistory(ApplicationInviteResource inviteResource);

    @PostAuthorize("hasPermission(returnObject, 'READ')")
    ServiceResult<ApplicationInvite> getById(Long id);

}


text:
package io.xkniu.github.leetcode;

import java.util.ArrayList;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;

/**
 * #637, https://leetcode.com/problems/average-of-levels-in-binary-tree/
 */
public class AverageOfLevelsInBinaryTree {

    public List<Double> averageOfLevels(TreeNode root) {
        List<Double> result = new ArrayList<>();

        Deque<TreeNode> deque = new LinkedList<>();
        deque.addLast(root);

        while (!deque.isEmpty()) {
            int count = deque.size();
            // 注意 sum 需要用 long,int 可能会溢出
            long sum = 0;

            for (int i = 0; i < count; i++) {
                TreeNode treeNode = deque.removeFirst();
                sum += treeNode.val;
                if (treeNode.left != null) {
                    deque.addLast(treeNode.left);
                }
                if (treeNode.right != null) {
                    deque.addLast(treeNode.right);
                }
            }
            result.add((double) sum / count);
        }
        return result;
    }
}


text:
import { dropdb } from 'pgtools'
import prompt from 'prompt'
import { database } from '../settings'

const { database: dbname, ...configParams } = database
prompt.start()

const property = {
  name: 'yesno',
  message: `Are you sure to reset databases ${dbname} and ${dbname}_test ?`,
  validator: /y[es]*|n[o]?/,
  warning: 'Must respond yes|y or no|n',
  default: 'no'
}

prompt.get(property, (error, {yesno}) => {
  if (error || /^n|no$/i.test(yesno)) {
    console.log('Canceled reset')
    process.exit(-1)
  }
  if (/^y|yes$/i.test(yesno)) return resetdb(configParams, dbname)
})

function resetdb (configParams, dbname) {
  dropdb(configParams, dbname)
    .then(() => console.log(`DB ${dbname} successfully dropped.`))
    .catch(error => console.error(
      `Error dropping db ${dbname}!
      ${error}`
    ))
/*  dropdb(configParams, `${dbname}_test`)
    .then(() => console.log(`DB ${dbname}_test successfully dropped.`))
    .catch(error => console.error(
      `Error dropping db ${dbname}_test!
      ${error}`
    ))
    */
}

/*
SQL equivalent:

 -- Making sure the database exists
 SELECT * from pg_database where datname = 'my_database_name';

 -- Disallow new connections
 UPDATE pg_database SET datallowconn = 'false' WHERE datname = 'my_database_name';
 ALTER DATABASE my_database_name CONNECTION LIMIT 1;

 -- Terminate existing connections
 SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'my_database_name';

 -- Drop database
 DROP DATABASE my_database_name;
 */


text:
agile
=====

Provides a command-line interface to a text-based agile storage database, which can be stored alongside the source code and version controlled with the source code.

Building
===
To build...

Installing
===
To install...

Run Examples
===
To run...


text:
<query id="getComment" action="select">
    <tables>
        <table name="comments" />
    </tables>
    <columns>
        <column name="*" />
    </columns>
    <conditions>
        <condition operation="equal" column="comment_srl" var="comment_srl" filter="number" notnull="notnull" />
    </conditions>
</query>


text:
package lb.census.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

/**
 * @author Philippe
 * @since 4-sep.-2014
 */
@Entity
@Table(name = "census_anomaly")
public class Anomaly implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GenericGenerator(name = "CUSTOM", strategy = "lb.census.utils.UUIDGenerator")
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "CUSTOM")
    private String id;
    @Column(name = "userid")
    private String userId;
    @Temporal(TemporalType.DATE)
    @Column(name = "date")
    private Date date;
    @Column(name = "description")
    private String description;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public String toString() {
        return "Anomaly[" + id + "]{" + date + ": " + getDescription() + "}";
    }
}


text:
#ifndef BH_DISPLAY_H_192088098
#define BH_DISPLAY_H_192088098

#if defined (__cplusplus)
extern "C" {
#endif

/* ===  Dependencies  === */

#include "benchfn.h"   /* BMK_benchFn_t */

/* ===  Declarations  === */

typedef struct {
    const char* name;
    BMK_benchFn_t hash;
} Bench_Entry;

void bench_largeInput(Bench_Entry const* hashDescTable, int nbHashes, int sizeLogMin, int sizeLogMax);

void bench_throughput_smallInputs(Bench_Entry const* hashDescTable, int nbHashes, size_t sizeMin, size_t sizeMax);
void bench_throughput_randomInputLength(Bench_Entry const* hashDescTable, int nbHashes, size_t sizeMin, size_t sizeMax);

void bench_latency_smallInputs(Bench_Entry const* hashDescTable, int nbHashes, size_t sizeMin, size_t sizeMax);
void bench_latency_randomInputLength(Bench_Entry const* hashDescTable, int nbHashes, size_t sizeMin, size_t sizeMax);

#if defined (__cplusplus)
}
#endif

#endif   /* BH_DISPLAY_H_192088098 */


text:
(function(){
	Ti.App.disableNetworkActivityIndicator = true; //ネットワークインジゲータを消す
	///////////
	// var v = b.createView();
	// console.log(v);

	tab_group = Ti.UI.createTabGroup();

	//一番下のベースLayer
	Ti.App.win_base = Ti.UI.createWindow({
		// backgroundImage: 'image/background.jpg',
		backgroundColor:"#F5F1E9",
		navBarHidden: true,
		tabBarHidden: true,
		fullscreen : false,
	});

	var tab = Ti.UI.createTab({ window: Ti.App.win_base });
	tab_group.addTab(tab);
	tab_group.open();

		// Ti.App.Properties.removeProperty('username');
	    // Ti.App.Properties.removeProperty('password');

	start();
	if(!Ti.App.Properties.hasProperty('username')){
		var signSelectView = require('UI/signSelect').signSelect();
		Ti.App.win_base.add(signSelectView);
		Ti.App.win_base.loginSelectView = signSelectView;
	}
	else{
		// Ti.App.Properties.removeProperty('username');
	    // Ti.App.Properties.removeProperty('password');
		// console.log(Ti.App.Properties.getString('username'));
		require('lib/vineAPI').vineLogin(Ti.App.Properties.getString('username'),Ti.App.Properties.getString('password'));
	}

	function start(){
		var dummyWindow = [];

	    //この個数は変動
	    for(var i=0;i<4;i++){
		    var w = Ti.UI.createWindow({
			    width:"100%",
			    height:Ti.UI.FILL,
			    backgroundColor:"#F5F1E9",
		    });
		    dummyWindow.push(w);
	    }

	    //スクロールビューの挿入
	    Ti.App.scrollview = Ti.UI.createScrollableView({
		    // left:"10%",
		    top:"10%",
		    width:"100%",
		    height:"80%",
		    // left:"20%",
		    views:dummyWindow,
		    horizontalBounce:false,
		    cacheSize:6,
		    // showPagingControl: true,
            // pagingControlHeight: 30,
	    });

	    Ti.App.win_base.add(Ti.App.scrollview);

	    //Button の 追加
	    createImages = function(image,size){
		    var button = Ti.UI.createButton({
			    color : "#ffffff",
			    backgroundImage : image,
			    left:size,
			    width:20,
		        height:20,
		    });
		    return button;
	    };

	    var homeButton = createImages("images/home2.png",17);
	    var listButton = createImages("images/list.png",17);
	    var cameraButton = createImages("images/videocamera.png",153);
	    var searchButton = createImages("images/search.png",285);

	    listButton.addEventListener('singletap',function(){
		    require('UI/leftList').list();
	    });

	    cameraButton.addEventListener('singletap',function(){
		    require('UI/post').postWindow();
	    });

	    //可視化用
	    var buttonBar = Ti.UI.createView({
		    width:"100%",
		    height:"10%",
		    bottom:0,
		    backgroundColor:"#00a478",
		    color:"#fff",
		    textAlign:'center'
	    });

	    //buttonBar.add(homeButton);
	    buttonBar.add(listButton);
	    buttonBar.add(cameraButton);
	    buttonBar.add(searchButton);

	    var homebuttonBar = Ti.UI.createView({
		    width:"20%",
		    height:"100%",
		    top:0,
		    left:0,
		    image:"images/home2.png",
		    bubbleParent:false
	    });

	    homebuttonBar.addEventListener('singletap',function(){
		    Ti.App.scrollview.scrollToView(0);
	    });

	    // homebuttonBar.add(homeButton);

	    //上部ラベル
	    var topLabel = Ti.UI.createLabel({//Label
		    width:"100%",
		    height:"10%",
		    top:0,
		    backgroundColor:"#00a478",
		    text:"TIMELINE",
		    font:{
			    fontWeight: "normal",
			    fontSize: 25,
			    fontFamily: 'AppleGothic'
		    },
		    color:"#d3c2ad",
		    textAlign:'center',
		    bubbleParent:false
	    });

	    topLabel.add(homebuttonBar);
	    homebuttonBar.add(homeButton);

	    homebuttonBar.addEventListener('singletap',function(e){

		    //Ti.UI.ScrollableView. scrollToView(dummyWindow = [0]);
	    });

	    topLabel.addEventListener('singletap',function(e){
	    });

	    ///////////////////////////////////////////////
	    //Labelとscrollableview
	    var topLabelNameArray = [];
	    topLabelNameArray[0]= "TIMELINE";
	    topLabelNameArray[1]= "ACTIVITY";
	    topLabelNameArray[2]= "EXPLORE";
	    topLabelNameArray[3]= "PROFILE";

	    Ti.App.scrollview.addEventListener('scroll',function(e){
		    if(e.currentPage != undefined){
			    topLabel.text = topLabelNameArray[e.currentPage];
		    }
	    });

	    ///////////////////////////////////////////////

        //
	    Ti.App.win_base.add(buttonBar);
	    Ti.App.win_base.add(topLabel);
	    // require('lib/camera').camera();
	    //これに入ったら各処理させる

	    Ti.App.addEventListener('loginComplete',function(){
	    	Ti.App.Properties.removeProperty('username');
	    	Ti.App.Properties.removeProperty('password');
	    	Ti.App.Properties.setString('username',Ti.App.email);
	    	Ti.App.Properties.setString('password',Ti.App.password);
	    	console.log(Ti.App.email);

	    	console.log(Ti.App.Properties.getString('username'));
	    	if(Ti.App.win_base.loginSelectView != undefined){
	    		// Ti.App.win_base.remove(Ti.App.win_base.loginSelectView);
	    		var animation = Ti.UI.createAnimation({
	    			delay:100,
	    			opacity:0,
	    			duration:300
	    		});
	    		Ti.App.win_base.loginSelectView.animate(animation);
	    		var cnt=0;
	    		Ti.App.win_base.loginView.animate(animation);
	    		animation.addEventListener('complete',function(){
	    			if(cnt == 0){
	    				animation = null;
	    			}
	    			if(cnt == 1){
	    				Ti.App.win_base.loginSelectView = null;
	    				Ti.App.win_base.loginView = null;
	    			}
	    			cnt++;
	    		});
	    	}
		    console.log('login');

		    // require('lib/vineAPI').vinePopularTimeLine();

		    // Ti.App.scrollview.views[0].add(require('UI/myTimeline').myTimeline());
		    //test
		    //require('UI/newLogin').newLogin();

		    // require('UI/signIn').signIn();
		    // require('UI/myProfile').myProfile();
		    // require('lib/vineAPI').myProfile();
		    // require('lib/vineAPI').vineGraphTimeLine();

		    //require('lib/vineAPI').userData();
		    //require('lib/vineAPI').vineLogin();

		    require('UI/myProfile').myProfile();
		    require('lib/vineAPI').myProfile();

		    require('lib/vineAPI').vineGraphTimeLine();
		    //require('lib/vineAPI').userData();
	    });
	}
})();


text:
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;

namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
    public class SpinnerTicks : Container
    {
        public SpinnerTicks()
        {
            Origin = Anchor.Centre;
            Anchor = Anchor.Centre;
            RelativeSizeAxes = Axes.Both;

            const int count = 18;

            for (int i = 0; i < count; i++)
            {
                Add(new Container
                {
                    Colour = Color4.Black,
                    Alpha = 0.4f,
                    EdgeEffect = new EdgeEffectParameters
                    {
                        Type = EdgeEffectType.Glow,
                        Radius = 10,
                        Colour = Color4.Gray.Opacity(0.2f),
                    },
                    RelativePositionAxes = Axes.Both,
                    Masking = true,
                    CornerRadius = 5,
                    Size = new Vector2(60, 10),
                    Origin = Anchor.Centre,
                    Position = new Vector2(
                        0.5f + (float)Math.Sin((float)i / count * 2 * MathHelper.Pi) / 2 * 0.86f,
                        0.5f + (float)Math.Cos((float)i / count * 2 * MathHelper.Pi) / 2 * 0.86f
                    ),
                    Rotation = -(float)i / count * 360 + 90,
                    Children = new[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                        }
                    }
                });
            }
        }
    }
}


text:
from topoml_util.gaussian_loss import r4_bivariate_gaussian
import numpy as np

class GaussianMixtureLoss:
    def __init__(self, num_components):
        self.num_components = num_components

    @staticmethod
    def softmax(x):
        """Compute softmax values for each sets of scores in x."""
        return np.exp(x) / np.sum(np.exp(x), axis=0)

    @staticmethod
    def epsilon():
        return 1e-16

    def geom_gaussian_mixture_loss(self, y_true, y_pred):
        # loss fn based on eq #26 of http://arxiv.org/abs/1308.0850.
        (data_points, points, features) = y_pred.shape
        geom_type_index = 6 * self.num_components  # Calculate offset from parameters times components
        render_index = geom_type_index + 8
        pi_index = 5

        predicted_components = np.reshape(y_pred[:geom_type_index], (-1, points.value, self.num_components, 6))
        pi = self.softmax(predicted_components[:, :, :, pi_index])

        true_components = np.reshape(y_true[:geom_type_index], (-1, points.value, self.num_components, 6))

        gmm = r4_bivariate_gaussian(true_components, predicted_components) * pi
        gmm_loss = np.sum(-np.log(gmm + self.epsilon()))

        # Zero out loss terms beyond N_s, the last actual stroke
        render = 1 - np.mean(y_pred[:, :, render_index:render_index + 2])  # RENDER and STOP values

        gmm_loss = gmm_loss * render

        return gmm_loss


text:
package com.cardpay.pccredit.intopieces.web;

import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.cardpay.pccredit.QZBankInterface.model.Circle;
import com.cardpay.pccredit.QZBankInterface.model.ECIF;
import com.cardpay.pccredit.QZBankInterface.service.CircleService;
import com.cardpay.pccredit.QZBankInterface.service.ECIFService;
import com.cardpay.pccredit.QZBankInterface.web.IESBForCircleForm;
import com.cardpay.pccredit.QZBankInterface.web.IESBForECIFForm;
import com.cardpay.pccredit.QZBankInterface.web.IESBForECIFReturnMap;
import com.cardpay.pccredit.customer.constant.CustomerInforConstant;
import com.cardpay.pccredit.customer.filter.VideoAccessoriesFilter;
import com.cardpay.pccredit.customer.model.CustomerInfor;
import com.cardpay.pccredit.customer.service.CustomerInforService;
import com.cardpay.pccredit.datapri.constant.DataPriConstants;
import com.cardpay.pccredit.intopieces.constant.Constant;
import com.cardpay.pccredit.intopieces.filter.CustomerApplicationProcessFilter;
import com.cardpay.pccredit.intopieces.model.CustomerApplicationInfo;
import com.cardpay.pccredit.intopieces.model.CustomerApplicationProcess;
import com.cardpay.pccredit.intopieces.model.QzApplnAttachmentList;
import com.cardpay.pccredit.intopieces.model.QzApplnJyd;
import com.cardpay.pccredit.intopieces.model.QzApplnJydBzdb;
import com.cardpay.pccredit.intopieces.model.QzApplnJydDydb;
import com.cardpay.pccredit.intopieces.model.QzApplnJydGtjkr;
import com.cardpay.pccredit.intopieces.model.QzApplnSdhjy;
import com.cardpay.pccredit.intopieces.model.VideoAccessories;
import com.cardpay.pccredit.intopieces.service.AttachmentListService;
import com.cardpay.pccredit.intopieces.service.CustomerApplicationIntopieceWaitService;
import com.cardpay.pccredit.intopieces.service.CustomerApplicationProcessService;
import com.cardpay.pccredit.intopieces.service.IntoPiecesService;
import com.cardpay.workflow.constant.ApproveOperationTypeEnum;
import com.wicresoft.jrad.base.auth.IUser;
import com.wicresoft.jrad.base.auth.JRadModule;
import com.wicresoft.jrad.base.auth.JRadOperation;
import com.wicresoft.jrad.base.constant.JRadConstants;
import com.wicresoft.jrad.base.database.model.QueryResult;
import com.wicresoft.jrad.base.web.JRadModelAndView;
import com.wicresoft.jrad.base.web.controller.BaseController;
import com.wicresoft.jrad.base.web.result.JRadPagedQueryResult;
import com.wicresoft.jrad.base.web.result.JRadReturnMap;
import com.wicresoft.jrad.base.web.security.LoginManager;
import com.wicresoft.jrad.base.web.utility.WebRequestHelper;
import com.wicresoft.jrad.modules.privilege.model.User;
import com.wicresoft.util.spring.Beans;
import com.wicresoft.util.spring.mvc.mv.AbstractModelAndView;
import com.wicresoft.util.web.RequestHelper;

@Controller
@RequestMapping("/intopieces/intopiecesshouxin/*")
@JRadModule("intopieces.intopiecesshouxin")
public class IntoPiecesShouxinControl extends BaseController {

	@Autowired
	private IntoPiecesService intoPiecesService;

	@Autowired
	private CustomerInforService customerInforService;

	@Autowired
	private CustomerInforService customerInforservice;

	@Autowired
	private CustomerApplicationIntopieceWaitService customerApplicationIntopieceWaitService;
	@Autowired
	private CustomerApplicationProcessService customerApplicationProcessService;

	@Autowired
	private ECIFService eCIFService;
	@Autowired
	private CircleService circleService;

	@Autowired
	private AttachmentListService attachmentListService;
	/**
	 * 授信岗进件页面
	 *
	 * @param filter
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "shouxin.page", method = { RequestMethod.GET })
	public AbstractModelAndView shouxin(@ModelAttribute CustomerApplicationProcessFilter filter, HttpServletRequest request) throws SQLException {
		filter.setRequest(request);
		IUser user = Beans.get(LoginManager.class).getLoggedInUser(request);
		String loginId = user.getId();
		filter.setLoginId(loginId);
		filter.setNodeName(Constant.status_shouxin);
		QueryResult<CustomerApplicationIntopieceWaitForm> result = customerApplicationIntopieceWaitService.recieveIntopieceWaitForm(filter);
		JRadPagedQueryResult<CustomerApplicationIntopieceWaitForm> pagedResult = new JRadPagedQueryResult<CustomerApplicationIntopieceWaitForm>(filter, result);

		JRadModelAndView mv = new JRadModelAndView(
				"/intopieces/intopieces_wait/intopiecesApprove_shouxin", request);
		mv.addObject(PAGED_RESULT, pagedResult);
		mv.addObject("filter", filter);
		return mv;
	}

	/**
	 * 进入授信决议单页面
	 *
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "create_form.page")
	public AbstractModelAndView createForm(HttpServletRequest request) {
		JRadModelAndView mv = new JRadModelAndView("/qzbankinterface/appIframeInfo/page8_for_approve", request);
		String customerId = RequestHelper.getStringValue(request, ID);
		String appId = RequestHelper.getStringValue(request, "appId");
		String type = RequestHelper.getStringValue(request, "type");
		String operate = RequestHelper.getStringValue(request, "operate");
		QzApplnJyd qzSdhjyd = new QzApplnJyd();
		List<QzApplnJydGtjkr> gtjkrs = new ArrayList<QzApplnJydGtjkr>();
		List<QzApplnJydBzdb> bzdbs = new ArrayList<QzApplnJydBzdb>();
		List<QzApplnJydDydb> dydbs = new ArrayList<QzApplnJydDydb>();
		if (StringUtils.isNotEmpty(customerId)) {
			qzSdhjyd = intoPiecesService.getSdhjydFormAfter(appId);
			if(qzSdhjyd!=null){
				//获取共同借款人list
				gtjkrs = intoPiecesService.getJkrList(qzSdhjyd.getId());
				//获取保证担保list
				bzdbs = intoPiecesService.getBzdbList(qzSdhjyd.getId());
				//获取抵押担保list
				dydbs = intoPiecesService.getDydbList(qzSdhjyd.getId());
			}
			mv.addObject("customerId", customerId);
			mv.addObject("appId", appId);
			mv.addObject("result", qzSdhjyd);
			mv.addObject("gtjkrs", gtjkrs);
			mv.addObject("bzdbs", bzdbs);
			mv.addObject("dydbs", dydbs);
			mv.addObject("type", type);
			mv.addObject("returnUrl",intoPiecesService.getReturnUrl(operate) );
		}
		return mv;
	}
	/**
	 * 授信决议单保存(申请后)
	 * @param customerinfoForm
	 * @param request
	 * @return
	 */

	@ResponseBody
	@RequestMapping(value = "page8insert.json")
	public JRadReturnMap insert(@ModelAttribute QzSdhjydForm qzSdhjydForm, HttpServletRequest request) {
		JRadReturnMap returnMap = new JRadReturnMap();
		if (returnMap.isSuccess()) {
			try {
				String customerId = RequestHelper.getStringValue(request, ID);
				String appId = RequestHelper.getStringValue(request, "appId");
				QzApplnJyd qzSdhjyd = qzSdhjydForm.createModel(QzApplnJyd.class);
				qzSdhjyd.setCustomerId(customerId);
				qzSdhjyd.setApplicationId(appId);
				qzSdhjyd.setCreatedTime(new Date());
				intoPiecesService.insertSdhjydFormAfter(qzSdhjyd);
				returnMap.addGlobalMessage(CREATE_SUCCESS);
			}catch (Exception e) {
				returnMap.put(JRadConstants.MESSAGE, DataPriConstants.SYS_EXCEPTION_MSG);
				returnMap.put(JRadConstants.SUCCESS, false);
				return WebRequestHelper.processException(e);
			}
		}else{
			returnMap.setSuccess(false);
			returnMap.addGlobalError(CustomerInforConstant.CREATEERROR);
		}
		return returnMap;
	}

	/**
	 * 进入审议纪要页面
	 *
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "create_syjy_form.page")
	public AbstractModelAndView createSyjyForm(HttpServletRequest request) {
		JRadModelAndView mv = new JRadModelAndView("/qzbankinterface/appIframeInfo/page10", request);
		String customerId = RequestHelper.getStringValue(request, ID);
		String appId = RequestHelper.getStringValue(request, "appId");
		String type = RequestHelper.getStringValue(request, "type");
		String operate = RequestHelper.getStringValue(request, "operate");
		if (StringUtils.isNotEmpty(customerId)) {
			QzApplnSdhjy qzSyjy = intoPiecesService.getSyjyForm(appId);
			mv.addObject("customerId", customerId);
			mv.addObject("appId", appId);
			mv.addObject("result", qzSyjy);
			mv.addObject("type", type);
			mv.addObject("operate", operate);
			mv.addObject("returnUrl", intoPiecesService.getReturnUrl(operate));
		}
		return mv;
	}
	/**
	 * 审议纪要保存
	 * @param customerinfoForm
	 * @param request
	 * @return
	 */

	@ResponseBody
	@RequestMapping(value = "syjy_save.json")
	public JRadReturnMap syjySave(@ModelAttribute QzSyjyForm qzSyjyForm, HttpServletRequest request) {
		JRadReturnMap returnMap = new JRadReturnMap();
		if (returnMap.isSuccess()) {
			try {
				String customerId = RequestHelper.getStringValue(request, ID);
				String appId = RequestHelper.getStringValue(request, "appId");
				QzApplnSdhjy QzSyjy = qzSyjyForm.createModel(QzApplnSdhjy.class);
				QzSyjy.setCustomerId(customerId);
				QzSyjy.setApplicationId(appId);
				QzSyjy.setCreatedTime(new Date());
				intoPiecesService.insertSyjyForm(QzSyjy);
				returnMap.addGlobalMessage(CREATE_SUCCESS);
			}catch (Exception e) {
				returnMap.put(JRadConstants.MESSAGE, DataPriConstants.SYS_EXCEPTION_MSG);
				returnMap.put(JRadConstants.SUCCESS, false);
				return WebRequestHelper.processException(e);
			}
		}else{
			returnMap.setSuccess(false);
			returnMap.addGlobalError(CustomerInforConstant.CREATEERROR);
		}
		return returnMap;
	}
	/**
	 * 申请件审批通过
	 * 从授信审批岗--中心负责岗
	 * @param filter
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "pass.json")
	public JRadReturnMap pass(HttpServletRequest request) throws SQLException {
		JRadReturnMap returnMap = new JRadReturnMap();
		try {
			String appId = request.getParameter("id");
			CustomerApplicationProcess process =  customerApplicationProcessService.findByAppId(appId);
			request.setAttribute("serialNumber", process.getSerialNumber());
			request.setAttribute("applicationId", process.getApplicationId());
			request.setAttribute("applicationStatus", ApproveOperationTypeEnum.APPROVE.toString());
			request.setAttribute("objection", "false");
			//查找审批金额
			Circle circle = circleService.findCircleByAppId(appId);

			request.setAttribute("examineAmount", circle.getContractAmt());
			customerApplicationIntopieceWaitService.updateCustomerApplicationProcessBySerialNumberApplicationInfo1(request);
			returnMap.addGlobalMessage(CHANGE_SUCCESS);
		} catch (Exception e) {
			returnMap.addGlobalMessage("保存失败");
			e.printStackTrace();
		}
		return returnMap;
	}

	/**
	 * 申请件退件
	 * 从授信岗--行政岗
	 * @param filter
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "returnAppln.json")
	public JRadReturnMap returnAppln(HttpServletRequest request) throws SQLException {
		JRadReturnMap returnMap = new JRadReturnMap();
		try {
			int nodeNo=0;//授信审核
			String appId = request.getParameter("appId");
			String operate = request.getParameter("operate");
			String nodeName = request.getParameter("nodeName");
			if("1".equals(nodeName)){

				intoPiecesService.checkDoNotToManager(appId,request);
			}else{
				intoPiecesService.returnAppln(appId, request,nodeName);
			}
			returnMap.addGlobalMessage(CHANGE_SUCCESS);
		} catch (Exception e) {
			returnMap.addGlobalMessage("保存失败");
			e.printStackTrace();
		}
		return returnMap;
	}

	/*
	 * 调额
	 *
	 * @param request
	 * @return
	*/
	@ResponseBody
	@RequestMapping(value = "shouxin_edu.page")
	public AbstractModelAndView edu(HttpServletRequest request) {
		JRadModelAndView mv = new JRadModelAndView("/qzbankinterface/shouxin_edu", request);

		//查找新开户
		/*List<IESBForECIFReturnMap> ls = eCIFService.findAllECIFByStatus2(com.cardpay.pccredit.QZBankInterface.constant.Constant.STATUS_CIRCLE);
		mv.addObject("ECIF_ls",ls);
		JSONArray json = new JSONArray();
		json = JSONArray.fromObject(ls);
		mv.addObject("ECIF_ls_json",json.toString());*/
		String applicationId = request.getParameter(ID);
		CustomerApplicationInfo appInfo = intoPiecesService.findCustomerApplicationInfoByApplicationId(applicationId);
		IESBForECIFReturnMap ecif = eCIFService.findEcifMapByCustomerId(appInfo.getCustomerId());
		mv.addObject("ecif",ecif);

		List<Circle> circle_ls = circleService.findCircleByClientNo(ecif.getClientNo());
		mv.addObject("circle",circle_ls.get(circle_ls.size()-1));
		return mv;
	}

	/**
	 * 调额
	 * @param customerinfoForm
	 * @param request
	 * @return
	 */

	@ResponseBody
	@RequestMapping(value = "update_edu.json")
	public JRadReturnMap update_edu(@ModelAttribute IESBForCircleForm iesbForCircleForm, HttpServletRequest request) {
		String clientNo = request.getParameter(ID);

		JRadReturnMap returnMap = new JRadReturnMap();
		if (returnMap.isSuccess()) {
			try {
				List<Circle> circle_ls = circleService.findCircleByClientNo(clientNo);
				Circle circle = circle_ls.get(circle_ls.size()-1);
				circle.setContractAmt(iesbForCircleForm.getContractAmt());

				circleService.updateCustomerInforCircle(circle);
//				returnMap.put(RECORD_ID, id);
				returnMap.addGlobalMessage(CREATE_SUCCESS);
			}catch (Exception e) {
				returnMap.put(JRadConstants.MESSAGE, DataPriConstants.SYS_EXCEPTION_MSG);
				returnMap.put(JRadConstants.SUCCESS, false);
				return WebRequestHelper.processException(e);
			}
		}else{
			returnMap.setSuccess(false);
			returnMap.addGlobalError(CustomerInforConstant.CREATEERROR);
		}
		return returnMap;
	}

	/**
	 * 申请件拒件
	 * @param filter
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "rejectAppln.json")
	public JRadReturnMap rejectAppln(HttpServletRequest request) throws SQLException {
		JRadReturnMap returnMap = new JRadReturnMap();
		try {
			String appId = request.getParameter("appId1");
			intoPiecesService.rejectAppln(appId, request);
			returnMap.addGlobalMessage(CHANGE_SUCCESS);
		} catch (Exception e) {
			returnMap.addGlobalMessage("保存失败");
			e.printStackTrace();
		}
		return returnMap;
	}

	/**
	 * 进入初审拒件记录页面
	 *
	 * @param filter
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "chushen_reject.page", method = { RequestMethod.GET })
	public AbstractModelAndView reject(@ModelAttribute CustomerApplicationProcessFilter filter, HttpServletRequest request) throws SQLException {
		filter.setRequest(request);
		IUser user = Beans.get(LoginManager.class).getLoggedInUser(request);
		String loginId = user.getId();
		filter.setLoginId(loginId);
		QueryResult<CustomerApplicationIntopieceWaitForm> result = customerApplicationIntopieceWaitService.IntopieceChushenRejectForm();
		JRadPagedQueryResult<CustomerApplicationIntopieceWaitForm> pagedResult = new JRadPagedQueryResult<CustomerApplicationIntopieceWaitForm>(filter, result);

		JRadModelAndView mv = new JRadModelAndView(
				"/intopieces/intopieces_wait/intopiecesApprove_chushen_reject", request);
		mv.addObject(PAGED_RESULT, pagedResult);
		return mv;
	}

	/**
	 * 同意初审拒件
	 * @param filter
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "inToReject.json")
	public JRadReturnMap inToreject(HttpServletRequest request) throws SQLException {
		JRadReturnMap returnMap = new JRadReturnMap();
		try {
			String appId = request.getParameter("id");
			intoPiecesService.inToReject(appId, request);
			returnMap.addGlobalMessage(CHANGE_SUCCESS);
		} catch (Exception e) {
			returnMap.addGlobalMessage("保存失败");
			e.printStackTrace();
		}
		return returnMap;
	}

	/**
	 * 不同意初审拒件
	 * @param filter
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "outToReject.json")
	public JRadReturnMap outToreject(HttpServletRequest request) throws SQLException {
		JRadReturnMap returnMap = new JRadReturnMap();
		try {
			String appId = request.getParameter("id");
			intoPiecesService.outToReject(appId, request);
			returnMap.addGlobalMessage(CHANGE_SUCCESS);
		} catch (Exception e) {
			returnMap.addGlobalMessage("保存失败");
			e.printStackTrace();
		}
		return returnMap;
	}

	/**
	 * 补充上会(添加标记,客户经理补充)
	 *
	 * @param filter
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "return_to_cu.json")
	public JRadReturnMap returnToCu(HttpServletRequest request) throws SQLException {
		JRadReturnMap returnMap = new JRadReturnMap();

		try {
			intoPiecesService.returnToCu(request);
			returnMap.addGlobalMessage(CHANGE_SUCCESS);
		} catch (Exception e) {
			returnMap.addGlobalMessage("退回失败");
			e.printStackTrace();
		}
		return returnMap;
	}

	//iframe_approve(申请后)
	@ResponseBody
	@RequestMapping(value = "iframe_approve.page")
	public AbstractModelAndView iframeApprove(HttpServletRequest request) {
		JRadModelAndView mv = new JRadModelAndView("/qzbankinterface/appIframeInfo/iframe_approve", request);
		String customerInforId = RequestHelper.getStringValue(request, ID);
		String appId = RequestHelper.getStringValue(request, "appId");
		if (StringUtils.isNotEmpty(customerInforId)) {
			CustomerInfor customerInfor = customerInforservice.findCustomerInforById(customerInforId);
			mv.addObject("customerInfor", customerInfor);
			mv.addObject("customerId", customerInfor.getId());
			mv.addObject("appId", appId);
			mv.addObject("operate", Constant.status_shouxin);
		}
		return mv;
	}
}


text:
package suadb.parse;

import suadb.query.Region;

/**
 * Created by rony on 2016-12-12.
 */
public class BetweenNaiveData implements QueryData
{
	private QueryData array;
	private Region region;

	public BetweenNaiveData(QueryData array, Region region)
	{
		this.array = array;
		this.region = region;
	}

	public QueryData array()
	{
		return array;
	}

	public Region region()
	{
		return region;
	}

	@Override
	public String toString()
	{
		return "between(" + array.toString() + ", " + region.toString() + ")";
	}
}