/*
 *
 * Copyright (c) 2006-2020, Speedment, Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); You may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.speedment.common.codegen.model.modifier;

import com.speedment.common.codegen.model.Enum;
import com.speedment.common.codegen.model.modifier.Keyword.Private;
import com.speedment.common.codegen.model.modifier.Keyword.Protected;
import com.speedment.common.codegen.model.modifier.Keyword.Public;
import com.speedment.common.codegen.model.modifier.Keyword.Static;
import com.speedment.common.codegen.model.trait.HasModifiers;

/**
 * Composed trait of all the {@link HasModifiers modifiers} that can be added to
 * an {@link Enum}.
 *
 * @param <T>  the extending type
 *
 * @author Emil Forslund
 * @since  2.0
 */
public interface EnumModifier<T extends EnumModifier<T>>
extends Public<T>, Protected<T>, Private<T>, Static<T> {}

{'repo_name': 'speedment/speedment', 'stars': '1844', 'repo_language': 'Java', 'file_name': 'MainAppTest.java', 'mime_type': 'text/x-java', 'hash': -1878325064161105169, 'source_dataset': 'data'}


/**
 * Owl QWeb Expression Parser
 *
 * Owl needs in various contexts to be able to understand the structure of a
 * string representing a javascript expression.  The usual goal is to be able
 * to rewrite some variables.  For example, if a template has
 *
 *  ```xml
 *  <t t-if="computeSomething({val: state.val})">...</t>
 * ```
 *
 * this needs to be translated in something like this:
 *
 * ```js
 *   if (context["computeSomething"]({val: context["state"].val})) { ... }
 * ```
 *
 * This file contains the implementation of an extremely naive tokenizer/parser
 * and evaluator for javascript expressions.  The supported grammar is basically
 * only expressive enough to understand the shape of objects, of arrays, and
 * various operators.
 */

//------------------------------------------------------------------------------
// Misc types, constants and helpers
//------------------------------------------------------------------------------

const RESERVED_WORDS = "true,false,NaN,null,undefined,debugger,console,window,in,instanceof,new,function,return,this,eval,void,Math,RegExp,Array,Object,Date".split(
  ","
);

const WORD_REPLACEMENT = {
  and: "&&",
  or: "||",
  gt: ">",
  gte: ">=",
  lt: "<",
  lte: "<=",
};

export interface QWebVar {
  id: string; // foo
  expr: string; // scope.foo (local variables => only foo)
  value?: string; // 1 + 3
  hasBody?: boolean;
}

//------------------------------------------------------------------------------
// Tokenizer
//------------------------------------------------------------------------------
type TKind =
  | "LEFT_BRACE"
  | "RIGHT_BRACE"
  | "LEFT_BRACKET"
  | "RIGHT_BRACKET"
  | "LEFT_PAREN"
  | "RIGHT_PAREN"
  | "COMMA"
  | "VALUE"
  | "SYMBOL"
  | "OPERATOR"
  | "COLON";

interface Token {
  type: TKind;
  value: string;
  originalValue?: string;
  size?: number;
  varName?: string;
}

const STATIC_TOKEN_MAP: { [key: string]: TKind } = {
  "{": "LEFT_BRACE",
  "}": "RIGHT_BRACE",
  "[": "LEFT_BRACKET",
  "]": "RIGHT_BRACKET",
  ":": "COLON",
  ",": "COMMA",
  "(": "LEFT_PAREN",
  ")": "RIGHT_PAREN",
};

// note that the space after typeof is relevant. It makes sure that the formatted
// expression has a space after typeof
const OPERATORS = "...,.,===,==,+,!==,!=,!,||,&&,>=,>,<=,<,?,-,*,/,%,typeof ,=>,=,;,in ".split(",");

type Tokenizer = (expr: string) => Token | false;

let tokenizeString: Tokenizer = function (expr) {
  let s = expr[0];
  let start = s;
  if (s !== "'" && s !== '"') {
    return false;
  }
  let i = 1;
  let cur;
  while (expr[i] && expr[i] !== start) {
    cur = expr[i];
    s += cur;
    if (cur === "\\") {
      i++;
      cur = expr[i];
      if (!cur) {
        throw new Error("Invalid expression");
      }
      s += cur;
    }
    i++;
  }
  if (expr[i] !== start) {
    throw new Error("Invalid expression");
  }
  s += start;
  return { type: "VALUE", value: s };
};

let tokenizeNumber: Tokenizer = function (expr) {
  let s = expr[0];
  if (s && s.match(/[0-9]/)) {
    let i = 1;
    while (expr[i] && expr[i].match(/[0-9]|\./)) {
      s += expr[i];
      i++;
    }
    return { type: "VALUE", value: s };
  } else {
    return false;
  }
};

let tokenizeSymbol: Tokenizer = function (expr) {
  let s = expr[0];
  if (s && s.match(/[a-zA-Z_\$]/)) {
    let i = 1;
    while (expr[i] && expr[i].match(/\w/)) {
      s += expr[i];
      i++;
    }
    if (s in WORD_REPLACEMENT) {
      return { type: "OPERATOR", value: WORD_REPLACEMENT[s], size: s.length };
    }
    return { type: "SYMBOL", value: s };
  } else {
    return false;
  }
};

const tokenizeStatic: Tokenizer = function (expr) {
  const char = expr[0];
  if (char && char in STATIC_TOKEN_MAP) {
    return { type: STATIC_TOKEN_MAP[char], value: char };
  }
  return false;
};

const tokenizeOperator: Tokenizer = function (expr) {
  for (let op of OPERATORS) {
    if (expr.startsWith(op)) {
      return { type: "OPERATOR", value: op };
    }
  }
  return false;
};

const TOKENIZERS = [
  tokenizeString,
  tokenizeNumber,
  tokenizeOperator,
  tokenizeSymbol,
  tokenizeStatic,
];

/**
 * Convert a javascript expression (as a string) into a list of tokens. For
 * example: `tokenize("1 + b")` will return:
 * ```js
 *  [
 *   {type: "VALUE", value: "1"},
 *   {type: "OPERATOR", value: "+"},
 *   {type: "SYMBOL", value: "b"}
 * ]
 * ```
 */
export function tokenize(expr: string): Token[] {
  const result: Token[] = [];
  let token: boolean | Token = true;

  while (token) {
    expr = expr.trim();
    if (expr) {
      for (let tokenizer of TOKENIZERS) {
        token = tokenizer(expr);
        if (token) {
          result.push(token);
          expr = expr.slice(token.size || token.value.length);
          break;
        }
      }
    } else {
      token = false;
    }
  }
  if (expr.length) {
    throw new Error(`Tokenizer error: could not tokenize "${expr}"`);
  }
  return result;
}

//------------------------------------------------------------------------------
// Expression "evaluator"
//------------------------------------------------------------------------------

/**
 * This is the main function exported by this file. This is the code that will
 * process an expression (given as a string) and returns another expression with
 * proper lookups in the context.
 *
 * Usually, this kind of code would be very simple to do if we had an AST (so,
 * if we had a javascript parser), since then, we would only need to find the
 * variables and replace them.  However, a parser is more complicated, and there
 * are no standard builtin parser API.
 *
 * Since this method is applied to simple javasript expressions, and the work to
 * be done is actually quite simple, we actually can get away with not using a
 * parser, which helps with the code size.
 *
 * Here is the heuristic used by this method to determine if a token is a
 * variable:
 * - by default, all symbols are considered a variable
 * - unless the previous token is a dot (in that case, this is a property: `a.b`)
 * - or if the previous token is a left brace or a comma, and the next token is
 *   a colon (in that case, this is an object key: `{a: b}`)
 *
 * Some specific code is also required to support arrow functions. If we detect
 * the arrow operator, then we add the current (or some previous tokens) token to
 * the list of variables so it does not get replaced by a lookup in the context
 */
export function compileExprToArray(expr: string, scope: { [key: string]: QWebVar }): Token[] {
  scope = Object.create(scope);
  const tokens = tokenize(expr);
  for (let i = 0; i < tokens.length; i++) {
    let token = tokens[i];
    let prevToken = tokens[i - 1];
    let nextToken = tokens[i + 1];
    let isVar = token.type === "SYMBOL" && !RESERVED_WORDS.includes(token.value);
    if (token.type === "SYMBOL" && !RESERVED_WORDS.includes(token.value)) {
      if (prevToken) {
        if (prevToken.type === "OPERATOR" && prevToken.value === ".") {
          isVar = false;
        } else if (prevToken.type === "LEFT_BRACE" || prevToken.type === "COMMA") {
          if (nextToken && nextToken.type === "COLON") {
            isVar = false;
          }
        }
      }
    }
    if (nextToken && nextToken.type === "OPERATOR" && nextToken.value === "=>") {
      if (token.type === "RIGHT_PAREN") {
        let j = i - 1;
        while (j > 0 && tokens[j].type !== "LEFT_PAREN") {
          if (tokens[j].type === "SYMBOL" && tokens[j].originalValue) {
            tokens[j].value = tokens[j].originalValue!;
            scope[tokens[j].value] = { id: tokens[j].value, expr: tokens[j].value };
          }
          j--;
        }
      } else {
        scope[token.value] = { id: token.value, expr: token.value };
      }
    }

    if (isVar) {
      token.varName = token.value;
      if (token.value in scope && "id" in scope[token.value]) {
        token.value = scope[token.value].expr!;
      } else {
        token.originalValue = token.value;
        token.value = `scope['${token.value}']`;
      }
    }
  }
  return tokens;
}

export function compileExpr(expr: string, scope: { [key: string]: QWebVar }): string {
  return compileExprToArray(expr, scope)
    .map((t) => t.value)
    .join("");
}

{'repo_name': 'odoo/owl', 'stars': '175', 'repo_language': 'JavaScript', 'file_name': 'store.md', 'mime_type': 'text/plain', 'hash': 2890441331675982209, 'source_dataset': 'data'}


/* $Id: sph_whirlpool.h 216 2010-06-08 09:46:57Z tp $ */
/**
 * WHIRLPOOL interface.
 *
 * WHIRLPOOL knows three variants, dubbed "WHIRLPOOL-0" (original
 * version, published in 2000, studied by NESSIE), "WHIRLPOOL-1"
 * (first revision, 2001, with a new S-box) and "WHIRLPOOL" (current
 * version, 2003, with a new diffusion matrix, also described as "plain
 * WHIRLPOOL"). All three variants are implemented here.
 *
 * The original WHIRLPOOL (i.e. WHIRLPOOL-0) was published in: P. S. L.
 * M. Barreto, V. Rijmen, "The Whirlpool Hashing Function", First open
 * NESSIE Workshop, Leuven, Belgium, November 13--14, 2000.
 *
 * The current WHIRLPOOL specification and a reference implementation
 * can be found on the WHIRLPOOL web page:
 * http://paginas.terra.com.br/informatica/paulobarreto/WhirlpoolPage.html
 *
 * ==========================(LICENSE BEGIN)============================
 *
 * Copyright (c) 2007-2010  Projet RNRT SAPHIR
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 * ===========================(LICENSE END)=============================
 *
 * @file     sph_whirlpool.h
 * @author   Thomas Pornin <thomas.pornin@cryptolog.com>
 */

#ifndef SPH_WHIRLPOOL_H__
#define SPH_WHIRLPOOL_H__

#include <stddef.h>
#include "sph_types.h"

#ifdef __cplusplus
extern "C"{
#endif

#if SPH_64

/**
 * Output size (in bits) for WHIRLPOOL.
 */
#define SPH_SIZE_whirlpool   512

/**
 * Output size (in bits) for WHIRLPOOL-0.
 */
#define SPH_SIZE_whirlpool0   512

/**
 * Output size (in bits) for WHIRLPOOL-1.
 */
#define SPH_SIZE_whirlpool1   512

/**
 * This structure is a context for WHIRLPOOL computations: it contains the
 * intermediate values and some data from the last entered block. Once
 * a WHIRLPOOL computation has been performed, the context can be reused for
 * another computation.
 *
 * The contents of this structure are private. A running WHIRLPOOL computation
 * can be cloned by copying the context (e.g. with a simple
 * memcpy()).
 */
typedef struct {
#ifndef DOXYGEN_IGNORE
	unsigned char buf[64];    /* first field, for alignment */
	sph_u64 state[8];
#if SPH_64
	sph_u64 count;
#else
	sph_u32 count_high, count_low;
#endif
#endif
} sph_whirlpool_context;

/**
 * Initialize a WHIRLPOOL context. This process performs no memory allocation.
 *
 * @param cc   the WHIRLPOOL context (pointer to a
 *             sph_whirlpool_context)
 */
void sph_whirlpool_init(void *cc);

/**
 * Process some data bytes. It is acceptable that len is zero
 * (in which case this function does nothing). This function applies the
 * plain WHIRLPOOL algorithm.
 *
 * @param cc     the WHIRLPOOL context
 * @param data   the input data
 * @param len    the input data length (in bytes)
 */
void sph_whirlpool(void *cc, const void *data, size_t len);

/**
 * Terminate the current WHIRLPOOL computation and output the result into the
 * provided buffer. The destination buffer must be wide enough to
 * accomodate the result (64 bytes). The context is automatically
 * reinitialized.
 *
 * @param cc    the WHIRLPOOL context
 * @param dst   the destination buffer
 */
void sph_whirlpool_close(void *cc, void *dst);

/**
 * WHIRLPOOL-0 uses the same structure than plain WHIRLPOOL.
 */
typedef sph_whirlpool_context sph_whirlpool0_context;

#ifdef DOXYGEN_IGNORE
/**
 * Initialize a WHIRLPOOL-0 context. This function is identical to
 * sph_whirlpool_init().
 *
 * @param cc   the WHIRLPOOL context (pointer to a
 *             sph_whirlpool0_context)
 */
void sph_whirlpool0_init(void *cc);
#endif

#ifndef DOXYGEN_IGNORE
#define sph_whirlpool0_init   sph_whirlpool_init
#endif

/**
 * Process some data bytes. It is acceptable that len is zero
 * (in which case this function does nothing). This function applies the
 * WHIRLPOOL-0 algorithm.
 *
 * @param cc     the WHIRLPOOL context
 * @param data   the input data
 * @param len    the input data length (in bytes)
 */
void sph_whirlpool0(void *cc, const void *data, size_t len);

/**
 * Terminate the current WHIRLPOOL-0 computation and output the result into the
 * provided buffer. The destination buffer must be wide enough to
 * accomodate the result (64 bytes). The context is automatically
 * reinitialized.
 *
 * @param cc    the WHIRLPOOL-0 context
 * @param dst   the destination buffer
 */
void sph_whirlpool0_close(void *cc, void *dst);

/**
 * WHIRLPOOL-1 uses the same structure than plain WHIRLPOOL.
 */
typedef sph_whirlpool_context sph_whirlpool1_context;

#ifdef DOXYGEN_IGNORE
/**
 * Initialize a WHIRLPOOL-1 context. This function is identical to
 * sph_whirlpool_init().
 *
 * @param cc   the WHIRLPOOL context (pointer to a
 *             sph_whirlpool1_context)
 */
void sph_whirlpool1_init(void *cc);
#endif

#ifndef DOXYGEN_IGNORE
#define sph_whirlpool1_init   sph_whirlpool_init
#endif

/**
 * Process some data bytes. It is acceptable that len is zero
 * (in which case this function does nothing). This function applies the
 * WHIRLPOOL-1 algorithm.
 *
 * @param cc     the WHIRLPOOL context
 * @param data   the input data
 * @param len    the input data length (in bytes)
 */
void sph_whirlpool1(void *cc, const void *data, size_t len);

/**
 * Terminate the current WHIRLPOOL-1 computation and output the result into the
 * provided buffer. The destination buffer must be wide enough to
 * accomodate the result (64 bytes). The context is automatically
 * reinitialized.
 *
 * @param cc    the WHIRLPOOL-1 context
 * @param dst   the destination buffer
 */
void sph_whirlpool1_close(void *cc, void *dst);

#endif

#endif

#ifdef __cplusplus
}
#endif

{'repo_name': 'RavenProject/Ravencoin', 'stars': '616', 'repo_language': 'C', 'file_name': 'staticbuild.md', 'mime_type': 'text/plain', 'hash': 4779966747124189647, 'source_dataset': 'data'}


Tech
    name = "GRO_CYBORG"
    description = "GRO_CYBORG_DESC"
    short_description = "POPULATION_SHORT_DESC"
    category = "GROWTH_CATEGORY"
    researchcost = 250 * [[TECH_COST_MULTIPLIER]]
    researchturns = 10
    tags = [ "PEDIA_GROWTH_CATEGORY" ]
    prerequisites = "GRO_NANO_CYBERNET"
    effectsgroups = [
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                Planet environment = [ Hostile ]
            ]
            priority = [[TARGET_POPULATION_BEFORE_SCALING_PRIORITY]]
            effects = SetTargetPopulation value = Value + 2 * Target.HabitableSize  accountinglabel = "GRO_CYBORG"

        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
            ]
            stackinggroup = "CYBORG_TROOPS_STACK"
            priority = [[VERY_EARLY_PRIORITY]]
            effects = SetMaxTroops value = Value + Target.Population * [[TROOPS_PER_POP]] accountinglabel = "GRO_CYBORG"
    ]
    graphic = "icons/tech/cyborgs.png"

#include "/scripting/common/base_prod.macros"

#include "/scripting/common/priorities.macros"

{'repo_name': 'freeorion/freeorion', 'stars': '429', 'repo_language': 'C++', 'file_name': 'ArithmeticRules.cpp', 'mime_type': 'text/x-c++', 'hash': 6846797687935905920, 'source_dataset': 'data'}


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>BlinkIdOverlayView (LibBlinkID API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.microblink.fragment.overlay.blinkid

Interface BlinkIdOverlayView

All Known Implementing Classes:

DocumentOverlayView, DocumentVerificationOverlayView, ReticleOverlayView

public interface BlinkIdOverlayView

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method and Description

void
cleanup()

Clean up your resources here.

void
createLayout(android.app.Activity activity,
            RecognizerRunnerView parentView)

Inflate your custom layout here and add it to the parent view

TorchController
createTorchController(RecognizerRunnerView recognizerRunnerView)

Return properly set-up torch controller or null if torch is handled by the activity.

RetryDialogStrings
getDocumentNotSupportedDialogStrings()

RetryDialogStrings
getRecognitionTimeoutDialogStrings()

RetryDialogStrings
getSidesNotMatchingDialogStrings()

void
onCardDetectionUpdate(DetectionStatus detectionStatus)

Called on any update to card detection process.

void
onDocumentClassified()

Called when document is successfully classified and recognition starts.

void
onErrorDialogShown()

Called when error dialog is shown.

void
onFirstSideScanStarted()

Called when scanning of the first side starts.

void
onGlare(boolean hasGlare)

Called on glare detection update.

void
onMovingCloserToBarcodeRequired()

Called when user should be instructed to move closer to barcode.

long
onScanSuccess()

Called when both sides are scanned.

void
onSecondSideScanStarted()

Called when scanning of the second side starts.

void
setRecognizerSupportsClassification(boolean isClassificationSupported)

If true, this means that recognizer supports classification and BlinkIdOverlayView.onDocumentClassified()
 will be called when the document is classified.

void
setShowBackSideBarcodeInstructions(boolean shouldShow)

Set whether to show additional instructions when scanning back side of the document instructing
 user to scan the barcode.

Method Detail

createLayout

void createLayout(@NonNull
                  android.app.Activity activity,
                  @NonNull
                  RecognizerRunnerView parentView)

Inflate your custom layout here and add it to the parent view

Parameters:

activity - current activity

parentView - root view to be used as inflation parent

createTorchController

@NonNull
TorchController createTorchController(@NonNull
                                               RecognizerRunnerView recognizerRunnerView)

Return properly set-up torch controller or null if torch is handled by the activity.

Parameters:

recognizerRunnerView - required for torch controller setup

Returns:

torch controller

onFirstSideScanStarted

void onFirstSideScanStarted()

Called when scanning of the first side starts.

onSecondSideScanStarted

void onSecondSideScanStarted()

Called when scanning of the second side starts.

onMovingCloserToBarcodeRequired

void onMovingCloserToBarcodeRequired()

Called when user should be instructed to move closer to barcode.

setRecognizerSupportsClassification

void setRecognizerSupportsClassification(boolean isClassificationSupported)

If true, this means that recognizer supports classification and BlinkIdOverlayView.onDocumentClassified()
 will be called when the document is classified.

Parameters:

isClassificationSupported - true if classification is supported

onDocumentClassified

void onDocumentClassified()

Called when document is successfully classified and recognition starts.

onCardDetectionUpdate

void onCardDetectionUpdate(@NonNull
                           DetectionStatus detectionStatus)

Called on any update to card detection process.

onScanSuccess

long onScanSuccess()

Called when both sides are scanned.
 If you wish to animate success state, return delay in milliseconds and overlay controller will
 wait before reporting that scanning is done.

Returns:

delay in milliseconds

onErrorDialogShown

void onErrorDialogShown()

Called when error dialog is shown. Make sure to stop animations here.

onGlare

void onGlare(boolean hasGlare)

Called on glare detection update.

Parameters:

hasGlare - true if glare detected

getDocumentNotSupportedDialogStrings

@NonNull
RetryDialogStrings getDocumentNotSupportedDialogStrings()

Returns:

strings to be used for error dialog shown when document is not supported

getRecognitionTimeoutDialogStrings

@NonNull
RetryDialogStrings getRecognitionTimeoutDialogStrings()

Returns:

strings to be used for error dialog shown when second document side can't be recognized

getSidesNotMatchingDialogStrings

@NonNull
RetryDialogStrings getSidesNotMatchingDialogStrings()

Returns:

strings to be used for error dialog shown when data from the second document side
 doesn't match the data from the first side

setShowBackSideBarcodeInstructions

void setShowBackSideBarcodeInstructions(boolean shouldShow)

Set whether to show additional instructions when scanning back side of the document instructing
 user to scan the barcode.

Parameters:

shouldShow - true if barcode instructions should be shown

cleanup

void cleanup()

Clean up your resources here.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

{'repo_name': 'BlinkID/blinkid-android', 'stars': '237', 'repo_language': 'Java', 'file_name': 'size_report.sh', 'mime_type': 'text/x-shellscript', 'hash': 8401506586464898757, 'source_dataset': 'data'}


/**
 * AutoComplete Sample
 */
import { AutoComplete } from '../../src/auto-complete/index';

let socialMedia: { [key: string]: Object }[] = [
    { class: 'sf-icon-facebook', country: 'Facebook' }, { class: 'sf-icon-twitter', country: 'Twitter ' },
    { class: 'sf-icon-whatsapp', country: 'WhatsApp' }, { class: 'sf-icon-tumblr', country: 'Tumblr' },
    { class: 'sf-icon-google-plus', country: 'Google plus' }, { class: 'sf-icon-skype-01', country: 'Skype' },
    { class: 'sf-icon-vimeo', country: 'Vimeo' }, { class: 'sf-icon-instagram', country: 'Instagram' },
    { class: 'sf-icon-youtube1', country: 'YouTube' }, { class: 'sf-icon-reddit', country: 'Reddit' }
];

let listObj: AutoComplete = new AutoComplete({
    dataSource: socialMedia,
    fields: { value: 'country', iconCss: 'class' },
    width: '250px',
    placeholder: 'Select an icon',
    index: -1,
    popupHeight: '200px',
    popupWidth: '250px',
});
listObj.appendTo('#list');

{'repo_name': 'syncfusion/ej2-javascript-ui-controls', 'stars': '233', 'repo_language': 'TypeScript', 'file_name': 'combo-box.html', 'mime_type': 'text/html', 'hash': 2241832950293809088, 'source_dataset': 'data'}


package com.github.czyzby.lml.parser.impl.tag.actor;

import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.github.czyzby.lml.parser.LmlParser;
import com.github.czyzby.lml.parser.tag.LmlActorBuilder;
import com.github.czyzby.lml.parser.tag.LmlTag;

/** Handles {@link Button} actor. Allows its children tags to use cell attributes. Mapped to "button".
 *
 * @author MJ */
public class ButtonLmlTag extends TableLmlTag {
    public ButtonLmlTag(final LmlParser parser, final LmlTag parentTag, final StringBuilder rawTagData) {
        super(parser, parentTag, rawTagData);
    }

    @Override
    protected Actor getNewInstanceOfActor(final LmlActorBuilder builder) {
        return new Button(getSkin(builder), builder.getStyleName());
    }
}

{'repo_name': 'czyzby/gdx-lml', 'stars': '146', 'repo_language': 'Java', 'file_name': 'lml-vis1_8.dtd', 'mime_type': 'text/plain', 'hash': 2921092800546437034, 'source_dataset': 'data'}


.. _rfc-34:

================================================================================
RFC 34: License Policy Enforcement
================================================================================

Authors: Frank Warmerdam

Contact: warmerdam@pobox.com

Status: Development

Summary
-------

This document proposes the addition of a new mechanisms so that
applications and end users can define a license policy, and so that GDAL
can help avoid license conflicts between proprietary and reciprocally
licensed applications and format drivers.

Definitions
-----------

Reciprocal FOSS License: A open source software license, such as the
GPL, that requires all other software components linked into the same
executable and distributed beyond the creator to also be offered under
open source terms.

Non-Reciprocal FOSS License: A open source software license, such as
MIT/X, BSD or LGPL, that does not place any requirements on other linked
components in the same executable at distribution time.

Proprietary License: Software provided under terms that do not adhere to
the requirements of the open source definition, such as libraries from
Oracle (OCI), Lizardtech (MrSID) and Erdas (ECW). While often offered
for zero cost, these components are incompatible with reciprocal FOSS
licenses and may place a variety of other restrictions on the
distributor or end user.

Rationale
---------

GDAL/OGR is distributed under the Non-Reciprocal MIT/X open source
license which facilitates it's use by proprietary and open source
applications, and facilitates the inclusion of proprietary format
drivers along side the open source format drivers. However, it is still
a license violation to distribute reciprocally licensed applications
(like QGIS and GRASS) which use GDAL with proprietary licensed drivers
(such as the MrSID, ECW or Oracle drivers). Likewise, it is a license
violation to distribute proprietary applications with reciprocally
licensed drivers such as the GDAL GRASS driver, or the PDF driver.

This RFC, and the improvements it promotes are intended to facilitate
users, applications and drivers setting and following license policies
to avoid unintentional license violations. One area this can be
particularly helpful is broad software distributions like
`OSGeo4W <http://osgeo4w.osgeo.org>`__.

Approach
--------

The general approach proposed is that drivers will declare their license
category, and applications or end users will declare a policy for what
sorts of drivers may be used in combination with them. The
GDALDriverManager and OGRDriverRegistrar classes will apply this
information to avoid unintentional license violations.

Drivers
-------

Drivers will declare one of these three driver specific licensing
policies via the "LICENSE_POLICY" (DMD_LICENSE_POLICY) metadata item on
the driver:

-  "RECIPROCAL": the driver is available under a reciprocal FOSS license
   such as the GPL, and should not be mixed with proprietary drivers or
   applications.
-  "NONRECIPROCAL": the driver is available under a non-reciprocal FOSS
   license such as MIT/X, or LGPL. This is the default if no licensing
   policy is declared and is the natural policy of drivers provided as
   part of GDAL without outside dependencies.
-  "PROPRIETARY": the driver, usually due to use of proprietary
   libraries, has some licensing restrictions which make it ineligible
   for distribution with reciprocally licensed software. This would
   include MrSID, ECW, and Oracle related drivers.

Application License Policy
--------------------------

Applications are encouraged to set one of the following licensing
policies reflective of the applications nature. The policy should be set
as the value of the GDAL_APPLICATION_LICENSE_POLICY configuration
variable, typically via a call to GDALSetConfigOption() *before* the
call to GDALAllRegister() or OGRRegisterAll().

-  "RECIPROCAL": the application is licensed under a reciprocal license
   such as the GPL, and no proprietary drivers should be loaded.
-  "PROPRIETARY": the application has some licensing restrictions which
   make it ineligible for distribution with reciprocally licensed
   software. Care will be taken to avoid loading reciprocally licensed
   drivers, such as the GRASS and PDF drivers.
-  "DEFAULT": the application does not apply any licensing restrictions.
   This is typical of non-GPL open source applications such as
   MapServer, and will be the default policy if nothing is declared.

User License Policy
-------------------

The restrictions on mixing proprietary and reciprocally licensed
software generally applies at the point of distribution. In particular,
it is not intended to prevent the end user from assembling a variety of
components for their own use as they see fit, for their own use. To that
end it is important to provide a mechanism for the end user to
deliberately override the restrictions on mixing reciprocally licensed,
and proprietary components. This is accomplished via the
GDAL_LICENSE_POLICY configuration variable which might typically be set
via the environment or via the --config commandline switch to most GDAL
applications. It may have the following values:

-  "USE_ALL": do not discard any drivers based on licensing
   restrictions.
-  "PREFER_PROPRIETARY": If there is a conflict between proprietary and
   reciprocally licensed drivers, use the proprietary ones.
-  "PREFER_RECIPROCAL": If there is a conflict between proprietary and
   reciprocally licensed drivers, use the reciprocally licensed ones.

In addition to setting this via config variables, there will also be a
configure / nmake.opt declaration to alter the default
GDAL_LICENSE_POLICY. Thus a local build could be configured to USE_ALL
at build time instead of having to set environment variables or
commandline switches. This would not be suitable for software that will
be redistributed.

Policy Logic
------------

1. If the user selected a GDAL_LICENSE_POLICY of "USE_ALL" then no
   drivers are unloaded on the basis of licensing.
2. If the user selected a GDAL_LICENSE_POLICY of "PREFER_PROPRIETARY" or
   "PREFER_RECIPROCAL" then ignore the GDAL_APPLICATION_LICENSE_POLICY.
3. if the application select a GDAL_APPLICATION_LICENSE_POLICY of
   "PROPRIETARY" or "RECIPROCAL" then use that.
4. In the absence of a user or application level policy, default to a
   policy of "PREFER_PROPRIETARY".

The policy will be applied in the GDALDriverManager::AutoSkipDrivers()
method and in the newly introduced OGRSFDriverManager::AutoSkipDrivers()
method. The AutoSkipDrivers() method is already used to unload drivers
based on GDAL_SKIP (and soon OGR_SKIP) and is generally called after the
preliminary registration of drivers.

Strict Link Level Compliance
----------------------------

The GPL, the leading reciprocal license, talks about distribution of GPL
applications with proprietary code linked in. In a literal sense we may
still have running processes with mixed code linked in. Instead of
addressing the problem at the point of linking we are disabling use of
incompatible components at runtime. There is some small risk that this
may be considered not to be compliant with the requirements of the GPL
license in a literal sense, though it is clear we are making every
reasonable effort to enforce it in a practical sense.

In the situation of standalone software packages being distributed with
GDAL, it may still be best for those preparing the package to completely
omit any components incompatible with the license of the applications.
This RFC is primarily intended to support complex mixed-component
distributions such as OSGeo4W.

Drivers Affected
----------------

I believe the following drivers should be marked as "PROPRIETARY":

-  ECW
-  JP2ECW
-  MRSID
-  JP2MRSID
-  MG4Lidar
-  GEORASTER
-  JP2KAK
-  JPIPKAK
-  ArcObjects
-  OCI
-  FileGDB
-  FME
-  ArcSDE (raster and vector)

I believe the following drivers should be marked as "RECIPROCAL":

-  grass (raster and vector)
-  EPSILON
-  MySQL (depending on active license terms!)
-  PDF

Unresolved:

-  The OGR SOSI driver should probably be marked as proprietary
   currently as it relies on linking with binary objects with unknown
   licencing terms, even if apparently the ultimate goal seems to open
   source them.
-  I'm a bit confused by :ref:`raster.msg`.
   Seems that it relies on third party stuff with both proprietary and
   GPL code.
-  I am unsure about the ODBC based drivers. I suppose PGEO and
   MSSQLSPATIAL drivers ought to be marked proprietary too? Might it
   depend on the actual license terms of the odbc library?

Please let me know of other drivers needing marking.

SWIG Bindings
-------------

Some (all?) swig bindings automatically call GDALAllRegister() and/or
OGRRegisterAll() at the point the bindings are loaded making it hard to
set the application level GDAL_LICENSE_POLICY in a script before the
registration takes place. To address that I believe we should expose the
AutoSkipDrivers() methods via SWIG so that scripts can set the policy
and then "clean" the drivers based on the policy in force.

Test Suite
----------

How to test?

Documentation
-------------

How to document?

Implementation
--------------

Frank Warmerdam will do the core implementation in trunk. Driver
maintainers may need to update the metadata for particular drivers.

{'repo_name': 'OSGeo/gdal', 'stars': '1923', 'repo_language': 'C++', 'file_name': 'README.TXT', 'mime_type': 'text/plain', 'hash': -2288637227851033626, 'source_dataset': 'data'}


{'repo_name': 'ritaswc/wechat_app_template', 'stars': '185', 'repo_language': 'JavaScript', 'file_name': 'bson.js', 'mime_type': 'text/plain', 'hash': 3092191811072332960, 'source_dataset': 'data'}


#!/bin/bash

function die() {
  echo "$@" 1>&2
  exit 1
}

GOOS=${GOOS:-$(go env GOOS)}
GOARCH=${GOARCH:-$(go env GOARCH)}

case "${GOOS}_${GOARCH}" in
  linux_amd64) CC=clang ;;
  linux_arm64) CC=aarch64-linux-gnu-gcc ;;
  linux_arm)   CC=arm-linux-gnueabihf-gcc ;;
  darwin_amd64) CC=o64-clang ;;
  *) die "No cross-compiler set for ${GOOS}_${GOARCH}" ;;
esac

exec ${CC} "$@"

{'repo_name': 'influxdata/flux', 'stars': '391', 'repo_language': 'Go', 'file_name': 'repl.go', 'mime_type': 'text/plain', 'hash': 2272097663443285853, 'source_dataset': 'data'}


#include helpers.inc;
#include reporting_helpers.inc;
#include string_helpers.inc;
// **************************************************************************************
function alert(http, path, vxml, details) {
		var ri = new TReportItem();
    ri.LoadFromFile(vxml);
    ri.affects = path;
    ri.alertPath = "Scripts/" + vxml;
    ri.details = details;
    ri.setHttpInfo(http);
    AddReportItem(ri);
}
// **************************************************************************************
function test_Horde_RCE(dir, path){
	if (!path.endsWith('/')) path = path + '/';

	var http = new THTTPJob();
	http.url = dir.url;
	http.uri = path + '/docs/CHANGES';
	http.verb = 'GET';

	http.execute();

	if (!http.wasError && http.responseStatus == 200){
		var m = /\nv([\d\.]+)\n/.exec(http.response.body);
		if (m && m[1]) {
			var versionStr = m[1].replace(".", "").replace(".", "").replace(".", "").replace(".", "").replace(".", "")
			var version = parseInt(versionStr);
			var vulnerable = false;

			if (versionStr) {
				// version 3.1.x
				if (versionStr.startsWith("3")) {
					if (version < 320) {
						vulnerable = true;
					}
				}

				else
				// version 5.1.x
				if (versionStr.startsWith("5")) {
					if (version < 510) {
						vulnerable = true;
					}
				}

				//trace(version);
				if (vulnerable) {
					//trace('vuln');
					vxml = "Horde_Remote_Code_Execution.xml";
					details = "Current Horde version [bold][dark]" + m[1] + "[/dark][/bold]."
					alert(http, path, vxml, details);
				}
			}
		}
	}
}
var dir = getCurrentDirectory();
var alreadyReportedWebApplication = getGlobalValue("detectedAppHorde");
if (!alreadyReportedWebApplication)
{
    setGlobalValue("detectedAppHorde", 1, true);
    KBase("Horde web application", "Horde web application was detected in directory [dark][bold]" + dir.fullPath + "[/bold][/dark].");
}
test_Horde_RCE(dir, dir.fullPath);

{'repo_name': 'fnmsd/awvs_script_decode', 'stars': '227', 'repo_language': 'SourcePawn', 'file_name': '11-Malware.script', 'mime_type': 'text/x-c', 'hash': -1375481471435575276, 'source_dataset': 'data'}


;; test_exceptions.nu
;;  tests for Nu exception handling.
;;
;;  Copyright (c) 2007 Tim Burks, Radtastical Inc.

(class TestExceptions is NuTestCase

     (if (eq (uname) "Darwin") ;; broken for iOS simulator-only
         (- (id) testRangeException is
            (set name nil)
            (set before nil)
            (set after nil)
            (set z nil)
            (try
                (set before "this should always be set")
                ((NSArray array) objectAtIndex:1)
                (set after "this should never be set")
                (catch (exception) (set name (exception name)))
                (finally (set z 99)))
            (assert_equal "this should always be set" before)
            (assert_equal nil after)
            (assert_equal "NSRangeException" name)
            (assert_equal 99 z)))

     (if (eq (uname) "Darwin") ;; broken for iOS simulator-only
         (- (id) testUserRaisedException is
            (set name nil)
            (set before nil)
            (set after nil)
            (set z nil)
            (try
                (set before "this should always be set")
                (((NSException alloc) initWithName:"UserException" reason:"" userInfo:nil) raise)
                (set after "this should never be set")
                (catch (exception) (set name (exception name)))
                (finally (set z 99)))
            (assert_equal "this should always be set" before)
            (assert_equal nil after)
            (assert_equal "UserException" name)
            (assert_equal 99 z)))

     (- (id) testUserThrownException is
        (set name nil)
        (set before nil)
        (set after nil)
        (set z nil)
        (try
            (set before "this should always be set")
            (throw ((NSException alloc) initWithName:"UserException" reason:"" userInfo:nil))
            (set after "this should never be set")
            (catch (exception) (set name (exception name)))
            (finally (set z 99)))
        (assert_equal "this should always be set" before)
        (assert_equal nil after)
        (assert_equal "UserException" name)
        (assert_equal 99 z))

     (- (id) testUserThrownObject is
        (set object nil)
        (set before nil)
        (set after nil)
        (set z nil)
        (try
            (set before "this should always be set")
            (throw 99)
            (catch (thrown) (set object thrown))
            (finally (set z 99)))
        (assert_equal "this should always be set" before)
        (assert_equal nil after)
        (assert_equal 99 object)
        (assert_equal 99 z))

     (- (id) testAssertThrown is
        (assert_throws "UserException"
             (do () (throw ((NSException alloc) initWithName:"UserException" reason:"" userInfo:nil))))))

{'repo_name': 'programming-nu/nu', 'stars': '2065', 'repo_language': 'Objective-C', 'file_name': 'generate.nu', 'mime_type': 'text/plain', 'hash': 8737111982928818602, 'source_dataset': 'data'}