text:
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.vfs.newvfs;

import com.intellij.openapi.util.io.FileAttributes;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileListener;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.vfs.VirtualFileSystem;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.IOException;
import java.util.Map;

public abstract class NewVirtualFileSystem extends VirtualFileSystem implements FileSystemInterface, CachingVirtualFileSystem {
  private final Map<VirtualFileListener, VirtualFileListener> myListenerWrappers = ContainerUtil.newConcurrentMap();

  /**
   *
Implementations should convert separator chars to forward slashes and remove duplicates ones,
   * and convert paths to "absolute" form (so that they start from a root that is valid for this FS and
   * could be later extracted with {@link #extractRootPath}).

   *
   *
Implementations should not normalize paths by eliminating directory traversals or other indirections.

   *
   * @return a normalized path, or {@code null} when a path is invalid for this FS.
   */
  @ApiStatus.OverrideOnly
  protected @Nullable String normalize(@NotNull String path) {
    return path;
  }

  /**
   * IntelliJ platform calls this method with non-null value returned by {@link #normalize}, but if something went wrong
   * and an implementation can't extract a valid root path nevertheless, it should return an empty string.
   */
  @ApiStatus.OverrideOnly
  protected @NotNull abstract String extractRootPath(@NotNull String normalizedPath);

  @Nullable
  public abstract VirtualFile findFileByPathIfCached(@NotNull String path);

  @Override
  public void refreshWithoutFileWatcher(boolean asynchronous) {
    refresh(asynchronous);
  }

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

  @Override
  public boolean isSymLink(@NotNull VirtualFile file) {
    return false;
  }

  @Override
  public String resolveSymLink(@NotNull VirtualFile file) {
    return null;
  }

  @Override
  public void addVirtualFileListener(@NotNull VirtualFileListener listener) {
    VirtualFileListener wrapper = new VirtualFileFilteringListener(listener, this);
    //noinspection deprecation
    VirtualFileManager.getInstance().addVirtualFileListener(wrapper);
    myListenerWrappers.put(listener, wrapper);
  }

  @Override
  public void removeVirtualFileListener(@NotNull VirtualFileListener listener) {
    VirtualFileListener wrapper = myListenerWrappers.remove(listener);
    if (wrapper != null) {
      //noinspection deprecation
      VirtualFileManager.getInstance().removeVirtualFileListener(wrapper);
    }
  }

  public abstract int getRank();

  @NotNull
  @Override
  public abstract VirtualFile copyFile(Object requestor, @NotNull VirtualFile file, @NotNull VirtualFile newParent, @NotNull String copyName) throws IOException;

  @Override
  @NotNull
  public abstract VirtualFile createChildDirectory(Object requestor, @NotNull VirtualFile parent, @NotNull String dir) throws IOException;

  @NotNull
  @Override
  public abstract VirtualFile createChildFile(Object requestor, @NotNull VirtualFile parent, @NotNull String file) throws IOException;

  @Override
  public abstract void deleteFile(Object requestor, @NotNull VirtualFile file) throws IOException;

  @Override
  public abstract void moveFile(Object requestor, @NotNull VirtualFile file, @NotNull VirtualFile newParent) throws IOException;

  @Override
  public abstract void renameFile(Object requestor, @NotNull VirtualFile file, @NotNull String newName) throws IOException;

  public boolean markNewFilesAsDirty() {
    return false;
  }

  @NotNull
  public String getCanonicallyCasedName(@NotNull VirtualFile file) {
    return file.getName();
  }

  /**
   * Reads various file attributes in one shot (to reduce the number of native I/O calls).
   *
   * @param file file to get attributes of.
   * @return attributes of a given file, or {@code null} if the file doesn't exist.
   */
  @Nullable
  public abstract FileAttributes getAttributes(@NotNull VirtualFile file);

  /**
   * Returns {@code true} if {@code path} represents a directory with at least one child.
   * Override if your file system can answer this question more efficiently (e.g. without enumerating all children).
   */
  public boolean hasChildren(@NotNull VirtualFile file) {
    return list(file).length != 0;
  }
}


text:
[![Version](http://img.shields.io/gem/v/compass_point.svg?style=flat)](https://rubygems.org/gems/compass_point)
[![Build Status](https://github.com/infused/compass_point/actions/workflows/build.yml/badge.svg)](https://github.com/infused/compass_point/actions/workflows/build.yml)
[![Total Downloads](https://img.shields.io/gem/dt/compass_point.svg)](https://rubygems.org/gems/compass_point/)
[![License](https://img.shields.io/github/license/infused/compass_point.svg)](https://github.com/infused/compass_point)

A Ruby library for working with compass points.

![Compass Rose](https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Compass_Rose_English_North.svg/237px-Compass_Rose_English_North.svg.png)

* Project page: <http://github.com/infused/compass_point>
* API Documentation: <http://rubydoc.info/github/infused/compass_point/>
* Report bugs: <http://github.com/infused/compass_point/issues>

## Compatibility

Compass Point is tested to work with the following versions of ruby:

* MRI Ruby 2.0.x, 2.1.x, 2.2.x, 2.3.x, 2.4.x, 2.5.x, 2.7.x
* JRuby 1.7.x

## Installation

    gem install compass_point

## Basic Usage

### Azimuth

Given an string such as "NW", "SE", "Northeast by east", or "N 20° W", `azimuth` will
return the corresponding azimuth in degrees from 0 to 360:

    CompassPoint.azimuth('N') #=> 0.0
    CompassPoint.azimuth('S') #=> 180.0
    CompassPoint.azimuth('swbs') #=> 213.75
    CompassPoint.azimuth('Northeast by east') #=> 56.25
    CompassPoint.azimuth('N 20° W') #=> 340

Use `back_azimuth` to find the opposite azimuth:

    CompassPoint.azimuth('N') #=> 180.0
    CompassPoint.azimuth('S') #=> 0.0
    CompassPoint.azimuth('swbs') #=> 33.75

You can also get the minimum and maximum azimuths for any
abbreviation with `min`, `max` and `min_max`:

    CompassPoint.min('E') #=> 84.38
    CompassPoint.max('E') #=> 95.62
    CompassPoint.min('Northeast by east') #=> 50.63
    CompassPoint.max('Northeast by east') #=> 61.87
    CompassPoint.min_max('E') #=> [84.38, 95.62]
    CompassPoint.min_max('Northeast by east') #=> [50.63, 61.87]

Get the full name for an abbreviation:

    CompassPoint.name('NNW') #=> "North northwest"
    CompassPoint.name('SEbS') #=> "Southeast by south"

### Compass Quadrant Bearing

Given an azimuth, calculate the compass quadrant bearing.  For
example:

    CompassPoint.compass_quadrant_bearing(103) #=> "S 77° E"
    CompassPoint.compass_quadrant_bearing(340) #=> "N 20° W"
    CompassPoint.compass_quadrant_bearing(0) #=> "N"

## License

Copyright (c) 2015-2021 Keith Morrison <<keithm@infused.org>>

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.

redpajama_set_name: RedPajamaGithub


text:
'use strict';

//dts
import {IGlobalSumanObj} from "suman-types/dts/global";
import {IGanttData} from "../socket-cp-hash";
import {AsyncQueue} from 'async';

//polyfills
const process = require('suman-browser-polyfills/modules/process');
const global = require('suman-browser-polyfills/modules/global');

//npm
import async = require('async');
import chalk from 'chalk';

//project
const _suman: IGlobalSumanObj = global.__suman = (global.__suman || {});

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

let runQueue : AsyncQueue<Function> = null;

export const getRunQueue = function(){
  return runQueue;
};

export const makeRunQueue = function () {
  const {maxProcs} = _suman;
  return runQueue = async.queue((task,cb) => task(cb), maxProcs);
};

let transpileQueue : AsyncQueue<Function> = null;

export const getTranspileQueue = function(){
  return transpileQueue;
};

export const makeTranspileQueue = function (failedTransformObjects, runFile: Function, queuedTestFns) {

  const {sumanOpts, sumanConfig, projectRoot} = _suman;
  const waitForAllTranformsToFinish = sumanOpts.wait_for_all_transforms;

  return transpileQueue = async.queue(function (task: Function, cb: Function) {

    task(function (err: Error, file: string, shortFile: string, stdout: string, stderr: string, gd: IGanttData) {

      if (err) {
        _suman.log.error('transform error => ', err.stack || err);
        failedTransformObjects.push({err, file, shortFile, stdout, stderr});
        return;
      }

      setImmediate(cb);

      if (waitForAllTranformsToFinish) {
        queuedTestFns.push(function () {
          runFile(file, shortFile, stdout, gd);
        });
      }
      else {
        runFile(file, shortFile, stdout, gd);
      }

    });

  }, 3);

};


text:
using System;
using System.Data.Entity;
using System.Linq;

namespace Microsoft.Its.Domain.Sql
{
    public static class EventBusExtensions
    {
        /// <summary>
        /// Reports event handling errors via the specified database.
        /// </summary>
        /// <param name="bus">The bus.</param>
        /// <param name="db">The database.</param>
        /// <returns></returns>
        public static IDisposable ReportErrorsToDatabase(this IEventBus bus, Func<DbContext> db)
        {
            return bus.Errors.Subscribe(e => ReadModelUpdate.ReportFailure(e, db));
        }
    }
}


text:
#ifndef __CHESS_GAME_STATE_HEADER__
#define __CHESS_GAME_STATE_HEADER__

#include <SFML/Graphics/Rect.hpp>
#include <System/AbstractState.h>

class Texture2D;
class SimpleLabel;
class TexturedButton;
class ChessManager;

/**
 * This class represents the chess game state of the game.
 */
class ChessGameState : public AbstractState {
public:
    //--------------------------------------------------------------------------------
    // Methods
    //--------------------------------------------------------------------------------

    virtual void Initialize();
    virtual void Release();
    virtual void Draw(const sf::Time & timeDelta);
    virtual void Update(const sf::Time & timeDelta);

    //--------------------------------------------------------------------------------
    // Constructors and destructor
    //--------------------------------------------------------------------------------

    ChessGameState();
    virtual ~ChessGameState();

private:
    //--------------------------------------------------------------------------------
    // Fields
    //--------------------------------------------------------------------------------

    ChessManager * manager_;

    sf::Vector2i boardPosition_;
    std::unique_ptr<Texture2D> boardTexture_;

    std::unique_ptr<SimpleLabel> resetLabel_;
    std::unique_ptr<SimpleLabel> saveLabel_;
    std::unique_ptr<SimpleLabel> loadLabel_;
    std::unique_ptr<SimpleLabel> exitLabel_;

    std::unique_ptr<TexturedButton> resetButton_;
    std::unique_ptr<TexturedButton> saveButton_;
    std::unique_ptr<TexturedButton> loadButton_;
    std::unique_ptr<TexturedButton> exitButton_;
};

#endif


text:
package com.skcraft.plume.common.util.event;

import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;

import java.lang.reflect.Method;
import java.util.concurrent.atomic.AtomicInteger;

import static com.google.common.base.Preconditions.checkNotNull;
import static org.objectweb.asm.ClassWriter.COMPUTE_FRAMES;
import static org.objectweb.asm.ClassWriter.COMPUTE_MAXS;
import static org.objectweb.asm.Opcodes.*;

class HandlerClassFactory implements HandlerFactory {

    private final AtomicInteger index = new AtomicInteger();
    private final LocalClassLoader classLoader = new LocalClassLoader(HandlerClassFactory.class.getClassLoader());
    private final String targetPackage;
    private final LoadingCache<CacheKey, Class<?>> cache = CacheBuilder.newBuilder()
            .concurrencyLevel(1)
            .weakValues()
            .build(
                    new CacheLoader<CacheKey, Class<?>>() {
                        @Override
                        public Class<?> load(CacheKey key) {
                            return createClass(key.type, key.method, key.ignoreCancelled);
                        }
                    });

    /**
     * Creates a new class factory.
     *
     *
Different instances of this class should use different packages.

     *
     * @param targetPackage The target package
     */
    public HandlerClassFactory(String targetPackage) {
        checkNotNull(targetPackage, "targetPackage");
        this.targetPackage = targetPackage;
    }

    @Override
    public Handler createHandler(Object object, Method method, boolean ignoreCancelled) {
        synchronized (this.cache) {
            CacheKey key = new CacheKey(object.getClass(), method, ignoreCancelled);
            try {
                return (Handler) this.cache.getUnchecked(key)
                        .getConstructor(object.getClass(), Method.class, boolean.class)
                        .newInstance(object, method, ignoreCancelled);
            } catch (Exception e) {
                throw new RuntimeException("Failed to create a handler", e);
            }
        }
    }

    @SuppressWarnings("unchecked")
    private Class<? extends Handler> createClass(Class<?> type, Method method, boolean ignoreCancelled) {
        Class<?> eventClass = method.getParameterTypes()[0];
        String name = this.targetPackage + "." + eventClass.getSimpleName() + "Handler_" + type.getSimpleName() + "_" + method.getName() + this.index.incrementAndGet();
        byte[] bytes = generateClass(type, method, eventClass, ignoreCancelled, name);
        return (Class<? extends Handler>) this.classLoader.defineClass(name, bytes);
    }

    public byte[] generateClass(Class<?> objectClass, Method method, Class<?> eventClass, boolean ignoreCancelled, String className) {
        ClassWriter cw = new ClassWriter(COMPUTE_FRAMES | COMPUTE_MAXS);
        FieldVisitor fv;
        MethodVisitor mv;

        String createdInternalName = className.replace(".", "/");
        String invokedInternalName = Type.getInternalName(objectClass);
        String eventInternalName = Type.getInternalName(eventClass);

        cw.visit(Opcodes.V1_6, ACC_PUBLIC + ACC_SUPER, createdInternalName, null, "java/lang/Object", new String[] { Type.getInternalName(Handler.class) });

        {
            fv = cw.visitField(ACC_PRIVATE + ACC_FINAL, "object", "L" + invokedInternalName + ";", null, null);
            fv.visitEnd();
        }
        {
            fv = cw.visitField(ACC_PRIVATE + ACC_FINAL, "method", "Ljava/lang/reflect/Method;", null, null);
            fv.visitEnd();
        }
        {
            fv = cw.visitField(ACC_PRIVATE + ACC_FINAL, "ignoreCancelled", "Z", null, null);
            fv.visitEnd();
        }
        {
            mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(L" + invokedInternalName + ";Ljava/lang/reflect/Method;Z)V", null, null);
            mv.visitCode();
            mv.visitVarInsn(ALOAD, 0);
            mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitVarInsn(ALOAD, 1);
            mv.visitFieldInsn(PUTFIELD, createdInternalName, "object", "L" + invokedInternalName + ";");
            mv.visitVarInsn(ALOAD, 0);
            mv.visitVarInsn(ALOAD, 2);
            mv.visitFieldInsn(PUTFIELD, createdInternalName, "method", "Ljava/lang/reflect/Method;");
            mv.visitVarInsn(ALOAD, 0);
            mv.visitVarInsn(ILOAD, 3);
            mv.visitFieldInsn(PUTFIELD, createdInternalName, "ignoreCancelled", "Z");
            mv.visitInsn(RETURN);
            mv.visitMaxs(0, 0);
            mv.visitEnd();
        }
        {
            mv = cw.visitMethod(ACC_PUBLIC, "handle", "(L" + Object.class.getName().replace(".", "/") + ";)V", null, null);
            mv.visitCode();

            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, createdInternalName, "ignoreCancelled", "Z");
            Label afterCheck = new Label();
            mv.visitJumpInsn(IFEQ, afterCheck);
            mv.visitVarInsn(ALOAD, 1);
            mv.visitTypeInsn(INSTANCEOF, Cancellable.class.getName().replace(".", "/"));
            mv.visitJumpInsn(IFEQ, afterCheck);
            mv.visitVarInsn(ALOAD, 1);
            mv.visitTypeInsn(CHECKCAST, Cancellable.class.getName().replace(".", "/"));
            mv.visitMethodInsn(INVOKEINTERFACE, Cancellable.class.getName().replace(".", "/"), "isCancelled", "()Z", true);
            mv.visitJumpInsn(IFEQ, afterCheck);
            mv.visitInsn(RETURN);
            mv.visitLabel(afterCheck);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, createdInternalName, "object", "L" + invokedInternalName + ";");
            mv.visitVarInsn(ALOAD, 1);
            mv.visitTypeInsn(CHECKCAST, eventInternalName);
            mv.visitMethodInsn(INVOKEVIRTUAL, "" + invokedInternalName + "", method.getName(), "(L" + eventInternalName + ";)V", false);
            mv.visitInsn(RETURN);
            mv.visitMaxs(2, 2);
            mv.visitEnd();
        }
        {
            mv = cw.visitMethod(ACC_PUBLIC, "equals", "(Ljava/lang/Object;)Z", null, null);
            mv.visitCode();
            mv.visitVarInsn(ALOAD, 0);
            mv.visitVarInsn(ALOAD, 1);
            Label l0 = new Label();
            mv.visitJumpInsn(IF_ACMPNE, l0);
            mv.visitInsn(ICONST_1);
            mv.visitInsn(IRETURN);
            mv.visitLabel(l0);
            mv.visitVarInsn(ALOAD, 1);
            Label l1 = new Label();
            mv.visitJumpInsn(IFNULL, l1);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "getClass", "()Ljava/lang/Class;", false);
            mv.visitVarInsn(ALOAD, 1);
            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "getClass", "()Ljava/lang/Class;", false);
            Label l2 = new Label();
            mv.visitJumpInsn(IF_ACMPEQ, l2);
            mv.visitLabel(l1);
            mv.visitInsn(ICONST_0);
            mv.visitInsn(IRETURN);
            mv.visitLabel(l2);
            mv.visitVarInsn(ALOAD, 1);
            mv.visitTypeInsn(CHECKCAST, createdInternalName);
            mv.visitVarInsn(ASTORE, 2);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, createdInternalName, "method", "Ljava/lang/reflect/Method;");
            mv.visitVarInsn(ALOAD, 2);
            mv.visitFieldInsn(GETFIELD, createdInternalName, "method", "Ljava/lang/reflect/Method;");
            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/reflect/Method", "equals", "(Ljava/lang/Object;)Z", false);
            Label l3 = new Label();
            mv.visitJumpInsn(IFNE, l3);
            mv.visitInsn(ICONST_0);
            mv.visitInsn(IRETURN);
            mv.visitLabel(l3);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, createdInternalName, "object", "L" + invokedInternalName + ";");
            mv.visitVarInsn(ALOAD, 2);
            mv.visitFieldInsn(GETFIELD, createdInternalName, "object", "L" + invokedInternalName + ";");
            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "equals", "(Ljava/lang/Object;)Z", false);
            Label l4 = new Label();
            mv.visitJumpInsn(IFNE, l4);
            mv.visitInsn(ICONST_0);
            mv.visitInsn(IRETURN);
            mv.visitLabel(l4);
            mv.visitInsn(ICONST_1);
            mv.visitInsn(IRETURN);
            mv.visitMaxs(0, 0);
            mv.visitEnd();
        }
        {
            mv = cw.visitMethod(ACC_PUBLIC, "hashCode", "()I", null, null);
            mv.visitCode();
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, createdInternalName, "object", "L" + invokedInternalName + ";");
            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "hashCode", "()I", false);
            mv.visitVarInsn(ISTORE, 1);
            mv.visitIntInsn(BIPUSH, 31);
            mv.visitVarInsn(ILOAD, 1);
            mv.visitInsn(IMUL);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, createdInternalName, "method", "Ljava/lang/reflect/Method;");
            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/reflect/Method", "hashCode", "()I", false);
            mv.visitInsn(IADD);
            mv.visitVarInsn(ISTORE, 1);
            mv.visitVarInsn(ILOAD, 1);
            mv.visitInsn(IRETURN);
            mv.visitMaxs(2, 2);
            mv.visitEnd();
        }
        cw.visitEnd();

        return cw.toByteArray();
    }

    private static class LocalClassLoader extends ClassLoader {
        public LocalClassLoader(ClassLoader parent) {
            super(parent);
        }

        public Class<?> defineClass(String name, byte[] b) {
            return defineClass(name, b, 0, b.length);
        }
    }

    private static class CacheKey {
        private final Class<?> type;
        private final Method method;
        private final boolean ignoreCancelled;

        private CacheKey(Class<?> type, Method method, boolean ignoreCancelled) {
            this.type = type;
            this.method = method;
            this.ignoreCancelled = ignoreCancelled;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            CacheKey cacheKey = (CacheKey) o;

            if (this.ignoreCancelled != cacheKey.ignoreCancelled) return false;
            if (!this.method.equals(cacheKey.method)) return false;
            if (!this.type.equals(cacheKey.type)) return false;

            return true;
        }

        @Override
        public int hashCode() {
            int result = this.type.hashCode();
            result = 31 * result + this.method.hashCode();
            result = 31 * result + (this.ignoreCancelled ? 1 : 0);
            return result;
        }
    }

}


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>vexpseg</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="vexp_i.html" title="vexp_i" />
    <link rel="next" href="vexpv.html" title="vexpv" />

          vexpseg

          Prev
          Orchestra Opcodes and Operators
           Next

          vexpseg

vexpseg —
      Vectorial envelope generator

Description

      Generate exponential vectorial segments

Syntax

vexpseg  ifnout, ielements, ifn1, idur1, ifn2 [, idur2, ifn3 [...]]

Initialization

      ifnout - number of table hosting output vectorial signal

      ifn1 - starting vector

      ifn2, ifn3,etc. - vector after idurx seconds

      idur1 - duration in seconds of first segment.

      idur2, idur3, etc.  - duration in seconds of subsequent segments.

      ielements - number of elements of vectors.

Performance

      These opcodes are similar to linseg and expseg, but operate with vectorial signals instead of with scalar signals.

      Output is a vectorial control signal hosted by ifnout (that must be previously allocated), while each break-point of the envelope is actually a vector of values. All break-points must contain the same number of elements (ielements).

      All these operators are designed to be used together with other opcodes that operate with vectorial signals such as>, vcella, adsynt, adsynt2, etc.

Example

      Here is an example of the vexpseg opcode. It uses the files vexpseg.csd.

            Example 1032. Example of the vexpseg opcode.

<CsoundSynthesizer>
<CsOptions>
-odac -B441 -b441
</CsOptions>
<CsInstruments>

sr=44100
ksmps=10
nchnls=2

gilen init 32

gitable1 ftgen 0, 0, gilen, 10, 1
gitable2 ftgen 0, 0, gilen, 10, 1

gitable3 ftgen 0, 0, gilen, -7, 30, gilen, 35
gitable4 ftgen 0, 0, gilen, -7, 400, gilen, 450
gitable5 ftgen 0, 0, gilen, -7, 5000, gilen, 5500

instr 1
vcopy gitable2, gitable1, gilen
turnoff
endin

instr 2
vexpseg gitable2, 16, gitable3, 2, gitable4, 2, gitable5
endin

instr 3
kcount init 0
if kcount < 16 then
	kval table kcount, gitable2
	printk 0,kval
	kcount = kcount +1
else
turnoff
endif

endin

</CsInstruments>
<CsScore>
i1 0 1
s
i2 0 10
i3 0 1
i3 1 1
i3 1.5 1
i3 2 1
i3 2.5 1
i3 3 1
i3 3.5 1
i3 4 1
i3 4.5 1

</CsScore>
</CsoundSynthesizer>

Credits

Written by Gabriel Maldonado.

Example by Andres Cabrera.

New in Csound 5 (Previously available only on CsoundAV)

          Prev

            Up

           Next

          vexp_i

            Home

           vexpv


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">m-Banking</string>
    <string name="action_settings">Settings</string>
    <string name="hello_world">Hello world!</string>
    <string name="drawer_open">Slider Menu Opened</string>
    <string name="drawer_close">Slider Menu Closed</string>

    <!-- Nav Drawer Menu Items -->
    <string-array name="nav_drawer_items">
        <item>History of Payments</item>
        <item>Alerts</item>
        <item>Apply for Loan</item>
        <item>Peer Payment</item>
        <item>Balance Check</item>

    </string-array>

     <string-array name="nav_drawer_items2">
        <item>Send Alerts</item>
        <item>Send Offers</item>
        <item>Manage Loan</item>
        <item>Loan Information</item>
    </string-array>

    <string-array name="role">
        <item>Customers</item>
        <item>Bank-Employee</item>
    </string-array>
    <string-array name="type_loan">
        <item>Home Loan</item>
        <item>Car Loan</item>
        <item>Personal Loan</item>
        <item>Study Loan</item>
        <item>Marriage Loan</item>
    </string-array>

    <!-- Nav Drawer List Item Icons -->
    <!-- Keep them in order as the titles are in -->
    <array name="nav_drawer_icons">
        <item>@drawable/mbanking</item>
        <item>@drawable/mbanking</item>
        <item>@drawable/mbanking</item>
        <item>@drawable/mbanking</item>
        <item>@drawable/mbanking</item>
        <item>@drawable/mbanking</item>
    </array>

    <!-- Content Description -->
    <string name="desc_list_item_icon">Item Icon</string>
    <string name="title_activity_main_activity2">m-Banking</string>

</resources>


text:
package com.mcleodmoores.integration.function;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;

import com.opengamma.engine.function.config.AbstractFunctionConfigurationBean;
import com.opengamma.engine.function.config.CombiningFunctionConfigurationSource;
import com.opengamma.engine.function.config.FunctionConfiguration;
import com.opengamma.engine.function.config.FunctionConfigurationSource;
import com.opengamma.financial.analytics.CurrencyPairsDefaults;
import com.opengamma.financial.analytics.model.curve.CurveFunctions;
import com.opengamma.financial.currency.CurrencyPairs;
import com.opengamma.lambdava.functions.Function1;
import com.opengamma.util.SingletonFactoryBean;
import com.opengamma.web.spring.StandardFunctionConfiguration.CurrencyInfo;

/**
 * Constructs a function repository for Finmath functions.
 */
public class FinmathFunctionConfiguration extends AbstractFunctionConfigurationBean {
  /** The logger. */
  private static final Logger LOGGER = LoggerFactory.getLogger(FinmathFunctionConfiguration.class);
  /** The per-currency info */
  private final Map<String, CurrencyInfo> _perCurrencyInfo = new HashMap<>();

  public static FunctionConfigurationSource instance() {
    return new FinmathFunctionConfiguration().getObjectCreating();
  }

  public FinmathFunctionConfiguration() {
    setDefaultCurrencyInfo();
  }

  protected void setDefaultCurrencyInfo() {
    setCurrencyInfo("USD", usdCurrencyInfo());
  }

  protected CurrencyInfo usdCurrencyInfo() {
    return defaultCurrencyInfo("USD");
  }

  protected CurrencyInfo defaultCurrencyInfo(final String currency) {
    return new CurrencyInfo(currency);
  }

  public void setCurrencyInfo(final String currency, final CurrencyInfo info) {
    _perCurrencyInfo.put(currency, info);
  }

  public CurrencyInfo getCurrencyInfo(final String currency) {
    return _perCurrencyInfo.get(currency);
  }

  public Map<String, CurrencyInfo> getPerCurrencyInfo() {
    return _perCurrencyInfo;
  }

  protected <T> Map<String, T> getCurrencyInfo(final Function1<CurrencyInfo, T> filter) {
    final Map<String, T> result = new HashMap<>();
    for (final Map.Entry<String, CurrencyInfo> e : getPerCurrencyInfo().entrySet()) {
      final T entry = filter.execute(e.getValue());
      if (entry instanceof InitializingBean) {
        try {
          ((InitializingBean) entry).afterPropertiesSet();
        } catch (final Exception ex) {
          LOGGER.debug("Skipping {}", e.getKey());
          LOGGER.trace("Caught exception", e);
          continue;
        }
      }
      if (entry != null) {
        result.put(e.getKey(), entry);
      }
    }
    return result;
  }

  @Override
  protected void addAllConfigurations(final List<FunctionConfiguration> functionConfigs) {
    functionConfigs.add(functionConfiguration(CurrencyPairsDefaults.class, CurrencyPairs.DEFAULT_CURRENCY_PAIRS));
  }

  protected FunctionConfigurationSource getRepository(final SingletonFactoryBean<FunctionConfigurationSource> defaults) {
    try {
      defaults.afterPropertiesSet();
    } catch (final Exception e) {
      LOGGER.warn("Caught exception ", e);
      return null;
    }
    return defaults.getObject();
  }

  protected FunctionConfigurationSource curveFunctions() {
    final CurveFunctions.Defaults defaults = new CurveFunctions.Defaults();
    setCurveDefaults(defaults);
    return getRepository(defaults);
  }

  protected void setCurveDefaults(final CurveFunctions.Defaults defaults) {
    defaults.setAbsoluteTolerance(1e-9);
    defaults.setMaximumIterations(1000);
    defaults.setRelativeTolerance(1e-9);
  }

  @Override
  protected FunctionConfigurationSource createObject() {
    return CombiningFunctionConfigurationSource.of(super.createObject(), curveFunctions());
  }
}


text:
{-# LANGUAGE OverloadedStrings #-}

module Main where

import           Data.GraphViz           as GV hiding (toDot)
import           Data.Json.Util
import           Data.Json.Visualization
import           System.Environment

main :: IO ()
main = do
    as <- getArgs
    case as of
      inFilename:outFilename:_ -> do
          r <- readJson inFilename
          _ <- case r of
            Nothing -> error $ "could not read " ++ inFilename
            Just v  -> let d = (toDot . findInJson "$ref") v
                       in runGraphviz d Png outFilename
          return ()
      _ -> error "Usage: vjson <input filename> <output filename>"


text:
package org.uranoplums.typical.util.time;

import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;

/**
 * RowCalendarクラス。<br>
 *
 * @since 2015/03/27
 * @author syany
 */
public interface RowCalendar {

    public void add(int field, int amount);

    public boolean after(Object when);

    public boolean before(Object when);

    public void clear();

    public void clear(int field);

    public Object clone();

    public int compareTo(Calendar anotherCalendar);

    @Override
    public boolean equals(Object obj);

    public int get(int field);

    public int getActualMaximum(int field);

    public int getActualMinimum(int field);

    public Calendar getCalendar();

    public String getDisplayName(int field, int style, Locale locale);

    public Map<String, Integer> getDisplayNames(int field, int style, Locale locale);

    public int getFirstDayOfWeek();

    public int getGreatestMinimum(int field);

    public int getLeastMaximum(int field);

    public int getMaximum(int field);

    public int getMinimalDaysInFirstWeek();

    public int getMinimum(int field);

    public Date getTime();

    public long getTimeInMillis();

    public TimeZone getTimeZone();

    @Override
    public int hashCode();

    public boolean isLenient();

    public boolean isSet(int field);

    public void roll(int field, boolean up);

    public void roll(int field, int amount);

    public void set(int field, int value);

    public void set(int year, int month, int date);

    public void set(int year, int month, int date, int hourOfDay, int minute);

    public void set(int year, int month, int date, int hourOfDay, int minute, int second);

    public void setFirstDayOfWeek(int value);

    public void setLenient(boolean lenient);

    public void setMinimalDaysInFirstWeek(int value);

    public void setTime(Date date);

    public void setTimeInMillis(long millis);

    public void setTimeZone(TimeZone value);

    @Override
    public String toString();
}


text:
package org.jkiss.dbeaver.model.impl.jdbc;

import org.eclipse.core.runtime.IAdaptable;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBPTransactionIsolation;
import org.jkiss.dbeaver.model.exec.*;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession;
import org.jkiss.dbeaver.model.impl.AbstractExecutionContext;
import org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCSavepointImpl;
import org.jkiss.dbeaver.model.messages.ModelMessages;
import org.jkiss.dbeaver.model.qm.QMUtils;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.utils.RuntimeUtils;
import org.jkiss.utils.CommonUtils;

import java.lang.reflect.InvocationTargetException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.Savepoint;

/**
 * JDBCExecutionContext.
 * Implements transaction manager and execution context defaults.
 * Both depend on datasource implementation.
 */
public class JDBCExecutionContext extends AbstractExecutionContext<JDBCDataSource> implements DBCTransactionManager, IAdaptable {
    public static final String TYPE_MAIN = "Main";
    public static final String TYPE_METADATA = "Metadata";

    protected static final String TASK_TITLE_SET_SCHEMA = "Set active schema"; //$NON-NLS-1$

    private static final Log log = Log.getLog(JDBCExecutionContext.class);

    // Time to wait for txn level/auto-commit detection
    static final int TXN_INFO_READ_TIMEOUT = 5000;

    @NotNull
    private volatile JDBCRemoteInstance instance;
    private volatile Connection connection;
    private volatile Boolean autoCommit;
    private volatile Integer transactionIsolationLevel;
    private transient volatile boolean txnIsolationLevelReadInProgress;

    public JDBCExecutionContext(@NotNull JDBCRemoteInstance instance, String purpose) {
        super(instance.getDataSource(), purpose);
        this.instance = instance;
    }

    @Override
    public JDBCRemoteInstance getOwnerInstance() {
        return instance;
    }

    protected void setOwnerInstance(@NotNull JDBCRemoteInstance instance) {
        this.instance = instance;
    }

    @NotNull
    private Connection getConnection() throws DBCException {
        Connection dbCon = this.connection;
        if (dbCon == null) {
            throw new DBCException("Disconnected");
        }
        return dbCon;
    }

    public void connect(DBRProgressMonitor monitor) throws DBCException {
        connect(monitor, null, null, null, true);
    }

    protected void connect(@NotNull DBRProgressMonitor monitor, Boolean autoCommit, @Nullable Integer txnLevel, JDBCExecutionContext initFrom, boolean addContext) throws DBCException {
        if (connection != null && addContext) {
            log.error("Reopening not-closed connection");
            close();
        }
        boolean connectionReadOnly = dataSource.getContainer().isConnectionReadOnly();
        final JDBCRemoteInstance currentInstance = this.instance;

        DBExecUtils.startContextInitiation(dataSource.getContainer());

        Object exclusiveLock = currentInstance.getExclusiveLock().acquireExclusiveLock();
        try {
            this.connection = dataSource.openConnection(monitor, this, purpose);
            if (this.connection == null) {
                throw new DBCException("Null connection returned");
            }
            monitor.subTask("Set connection defaults");
            // Get defaults from preferences
            if (autoCommit == null) {
                autoCommit = dataSource.getContainer().isDefaultAutoCommit();
            }
            // Get default txn isolation level
            if (txnLevel == null) {
                txnLevel = dataSource.getContainer().getDefaultTransactionsIsolation();
            }

            if (txnLevel != null) {
                try {
                    this.getConnection().setTransactionIsolation(txnLevel);
                    this.transactionIsolationLevel = txnLevel;
                } catch (Throwable e) {
                    log.debug("Can't set transaction isolation level", e); //$NON-NLS-1$
                }
            }

            try {
                connection.setAutoCommit(autoCommit);
                this.autoCommit = autoCommit;
            } catch (Throwable e) {
                log.debug("Can't set auto-commit state: " + e.getMessage()); //$NON-NLS-1$
            }
            {
                // Cache auto-commit
                try {
                    this.autoCommit = connection.getAutoCommit();
                } catch (Throwable e) {
                    log.debug("Can't check auto-commit state", e); //$NON-NLS-1$
                    this.autoCommit = false;
                }
            }

            try {
                this.initContextBootstrap(monitor, autoCommit);
            } catch (DBCException e) {
                log.warn("Error while running context bootstrap", e);
            }

            if (addContext) {
                // Add self to context list
                currentInstance.addContext(this);
            }
        } finally {
            DBExecUtils.finishContextInitiation(dataSource.getContainer());
            currentInstance.getExclusiveLock().releaseExclusiveLock(exclusiveLock);
        }

        // Now initialize context state
        // Do it outside of exclusive lock to avoid dead locks
        {
            try {
                // Init (or copy) context state
                this.dataSource.initializeContextState(monitor, this, initFrom);
            } catch (DBException e) {
                log.warn("Error while initializing context state", e);
            }

            try {
                // Commit transaction. We can perform init SQL which potentially may lock some resources
                // Let's free them.
                if (!this.autoCommit) {
                    try (JDBCSession session = openSession(monitor, DBCExecutionPurpose.META, "Start transaction")) {
                        session.enableLogging(false); // Disable logging to avoid smart commit recovery activation
                        session.commit();
                    }
                }
            } catch (Throwable e) {
                log.error("Error ending transaction after context initialize", e);
            }
        }

    }

    protected void disconnect() {
        // [JDBC] Need sync here because real connection close could take some time
        // while UI may invoke callbacks to operate with connection
        synchronized (this) {
            // If we cannot determine if connection is in autocommit mode, assume that it is not
            if (connection != null && !dataSource.closeConnection(connection, purpose, !isAutoCommit(false))) {
                log.debug("Connection close timeout");
            }
            this.connection = null;
        }
        // Notify QM
        super.closeContext();
    }

    @NotNull
    public Connection getConnection(DBRProgressMonitor monitor) throws SQLException {
        if (connection == null) {
            try {
                connect(monitor);
            } catch (DBCException e) {
                if (e.getCause() instanceof SQLException) {
                    throw (SQLException) e.getCause();
                } else {
                    throw new SQLException(e);
                }
            }
        }
        return connection;
    }

    @NotNull
    @Override
    public JDBCSession openSession(@NotNull DBRProgressMonitor monitor, @NotNull DBCExecutionPurpose purpose, @NotNull String taskTitle) {
        return dataSource.createConnection(monitor, this, purpose, taskTitle);
    }

    @Override
    public void checkContextAlive(DBRProgressMonitor monitor) throws DBException {
        if (!JDBCUtils.isConnectionAlive(getDataSource(), getConnection())) {
            throw new DBCException("Connection is dead");
        }
    }

    @Override
    public boolean isConnected() {
        return connection != null;
    }

    @NotNull
    @Override
    public InvalidateResult invalidateContext(@NotNull DBRProgressMonitor monitor, boolean closeOnFailure)
        throws DBException
    {
        if (this.connection == null) {
            connect(monitor);
            return InvalidateResult.CONNECTED;
        }

        Boolean prevAutocommit = autoCommit;
        Integer txnLevel = transactionIsolationLevel;
        closeContext(false);
        // Try to connect again.
        // If connect will fail then context will remain in the list but with null connection.
        // On next invalidate it will try to reopen
        connect(monitor, prevAutocommit, txnLevel, this, false);

        return InvalidateResult.RECONNECTED;
    }

    @Override
    public void close() {
        closeContext(true);
    }

    private void closeContext(boolean removeContext) {
        // We remove context before it is actually closed.
        // Because disconnect may (potentially) hang in socket forever
        if (removeContext) {
            // Remove self from context list
            this.instance.removeContext(this);
        }

        disconnect();
    }

    //////////////////////////////////////////////////////////////
    // Transaction manager
    //////////////////////////////////////////////////////////////

    @Override
    public DBPTransactionIsolation getTransactionIsolation()
        throws DBCException {
        if (transactionIsolationLevel == null) {
            if (!txnIsolationLevelReadInProgress) {
                txnIsolationLevelReadInProgress = true;
                try {
                    if (!RuntimeUtils.runTask(monitor -> {
                        try {
                            DBExecUtils.tryExecuteRecover(monitor, getDataSource(), monitor1 -> {
                                try {
                                    transactionIsolationLevel = getConnection().getTransactionIsolation();
                                } catch (Throwable e) {
                                    transactionIsolationLevel = Connection.TRANSACTION_NONE;
                                    log.error("Error getting transaction isolation level", e);
                                }
                            });
                        } catch (DBException e) {
                            throw new InvocationTargetException(e);
                        }
                    }, "Get transaction isolation level", TXN_INFO_READ_TIMEOUT, true)) {
                        throw new DBCException("Can't determine transaction isolation - timeout");
                    }
                } finally {
                    txnIsolationLevelReadInProgress = false;
                }
            }
            if (transactionIsolationLevel == null) {
                transactionIsolationLevel = Connection.TRANSACTION_NONE;
                log.error("Cannot determine transaction isolation level due to connection hanging. Setting to NONE.");
            }
        }
        return JDBCTransactionIsolation.getByCode(transactionIsolationLevel);
    }

    @Override
    public void setTransactionIsolation(@NotNull DBRProgressMonitor monitor, @NotNull DBPTransactionIsolation transactionIsolation)
        throws DBCException {
        if (!(transactionIsolation instanceof JDBCTransactionIsolation)) {
            throw new DBCException(ModelMessages.model_jdbc_exception_invalid_transaction_isolation_parameter);
        }
        JDBCTransactionIsolation jdbcTIL = (JDBCTransactionIsolation) transactionIsolation;
        try {
            getConnection().setTransactionIsolation(jdbcTIL.getCode());
            transactionIsolationLevel = jdbcTIL.getCode();
        } catch (SQLException e) {
            throw new JDBCException(e, this);
        } finally {
            QMUtils.getDefaultHandler().handleTransactionIsolation(this, transactionIsolation);
        }

        //QMUtils.getDefaultHandler().handleTransactionIsolation(getConnection(), jdbcTIL);
    }

    @Override
    public boolean isAutoCommit()
        throws DBCException {
        if (autoCommit == null) {
            // Run in task with timeout
            if (!RuntimeUtils.runTask(monitor -> {
                try {
                    DBExecUtils.tryExecuteRecover(monitor, getDataSource(), monitor1 -> {
                        try {
                            autoCommit = getConnection().getAutoCommit();
                        } catch (Exception e) {
                            log.error("Error getting auto commit state", e);
                        }
                    });
                } catch (DBException e) {
                    throw new InvocationTargetException(e);
                }
            }, "Get auto commit state", TXN_INFO_READ_TIMEOUT)) {
                throw new DBCException("Can't determine auto-commit state - timeout");
            }
            if (autoCommit == null) {
                log.error("Cannot determine autocommit state due to connection hanging. Setting to manual commit mode.");
                autoCommit = false;
            }
        }
        return autoCommit;
    }

    private boolean isAutoCommit(boolean defaultValue) {
        try {
            return isAutoCommit();
        } catch (DBCException e) {
            log.debug("Unable to determine if connection is in autocommit mode", e);
            return defaultValue;
        }
    }

    @Override
    public void setAutoCommit(@NotNull DBRProgressMonitor monitor, boolean autoCommit)
        throws DBCException {
        monitor.subTask("Set JDBC connection auto-commit " + autoCommit);
        try {
            Connection dbCon = getConnection();
            dbCon.setAutoCommit(autoCommit);
            this.autoCommit = dbCon.getAutoCommit();
        } catch (SQLException e) {
            throw new JDBCException(e, this);
        } finally {
            QMUtils.getDefaultHandler().handleTransactionAutocommit(this, autoCommit);
        }
    }

    @Override
    public DBCSavepoint setSavepoint(@NotNull DBRProgressMonitor monitor, String name)
        throws DBCException {
        Savepoint savepoint;
        try {
            Connection dbCon = getConnection();
            if (name == null) {
                savepoint = dbCon.setSavepoint();
            } else {
                savepoint = dbCon.setSavepoint(name);
            }
        } catch (SQLException e) {
            throw new DBCException(e, this);
        }
        return new JDBCSavepointImpl(this, savepoint);
    }

    @Override
    public boolean supportsSavepoints() {
        return getDataSource().getInfo().supportsSavepoints();
    }

    @Override
    public void releaseSavepoint(@NotNull DBRProgressMonitor monitor, @NotNull DBCSavepoint savepoint)
        throws DBCException {
        try {
            Connection dbCon = getConnection();
            if (savepoint instanceof JDBCSavepointImpl) {
                dbCon.releaseSavepoint(((JDBCSavepointImpl) savepoint).getOriginal());
            } else if (savepoint instanceof Savepoint) {
                dbCon.releaseSavepoint((Savepoint) savepoint);
            } else {
                throw new SQLFeatureNotSupportedException(ModelMessages.model_jdbc_exception_bad_savepoint_object);
            }
        } catch (SQLException e) {
            throw new JDBCException(e, this);
        }
    }

    @Override
    public void commit(@NotNull DBCSession session)
        throws DBCException {
        try {
            getConnection().commit();
        } catch (SQLException e) {
            throw new JDBCException(e, this);
        } finally {
            if (session.isLoggingEnabled()) {
                QMUtils.getDefaultHandler().handleTransactionCommit(this);
            }
        }
    }

    @Override
    public void rollback(@NotNull DBCSession session, DBCSavepoint savepoint)
        throws DBCException {
        try {
            Connection dbCon = getConnection();
            if (savepoint != null) {
                if (savepoint instanceof JDBCSavepointImpl) {
                    dbCon.rollback(((JDBCSavepointImpl) savepoint).getOriginal());
                } else if (savepoint instanceof Savepoint) {
                    dbCon.rollback((Savepoint) savepoint);
                } else {
                    throw new SQLFeatureNotSupportedException(ModelMessages.model_jdbc_exception_bad_savepoint_object);
                }
            } else {
                dbCon.rollback();
            }
        } catch (SQLException e) {
            throw new JDBCException(e, this);
        } finally {
            if (session.isLoggingEnabled()) {
                QMUtils.getDefaultHandler().handleTransactionRollback(this, savepoint);
            }
        }
    }

    @Override
    public boolean isSupportsTransactions() {
        return instance.getDataSource().getInfo().supportsTransactions();
    }

    public void reconnect(DBRProgressMonitor monitor) throws DBCException {
        close();
        connect(monitor, null, null, this, true);
    }

    @Override
    public <T> T getAdapter(Class<T> adapter) {
        if (adapter == DBCTransactionManager.class) {
            return adapter.cast(this);
        }
        return null;
    }

    @Override
    public String toString() {
        if (CommonUtils.equalObjects(instance.getName(), dataSource.getName())) {
            return super.toString();
        }
        return dataSource.getName() + " - " + instance.getName() + " - " + getContextName();
    }
}


text:
package com.gemstone.gemfire.pdx.internal;

/**
 * This is a helper class that defines the size of the
 * primitive java types.
 *
 * @author agingade
 * @since 6.6
 */
public class DataSize {

  private DataSize() {
    // no instances allowed
  }

  public static final int BYTE_SIZE = 1;

  public static final int BOOLEAN_SIZE = 1;

  public static final int CHAR_SIZE = 2;

  public static final int SHORT_SIZE = 2;

  public static final int INTEGER_SIZE = 4;

  public static final int FLOAT_SIZE = 4;

  public static final int LONG_SIZE = 8;

  public static final int DOUBLE_SIZE = 8;

  public static final int DATE_SIZE = 8;
}


text:
package org.vaadin.flexcombobox.client.flexcombobox;

import com.vaadin.shared.communication.ClientRpc;

public interface FlexComboboxClientRpc extends ClientRpc {

	// TODO example API
	public void alert(String message);

}


text:
$packageName = 'dispcalgui.portable'
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$url = 'https://sourceforge.net/projects/dispcalgui/files/release/3.1.2.0/DisplayCAL-3.1.2.0-win32.zip/download'
$checksum = '6d0e1d62ee33a627183d6118ee75f913b4a1a982'
$checksumType = 'sha1'
$url64 = "$url"
$checksum64 = "$checksum"
$checksumType64 = "$checksumType"

Install-ChocolateyZipPackage -PackageName "$packageName" `
                             -Url "$url" `
                             -UnzipLocation "$toolsDir" `
                             -Url64bit "$url64" `
                             -Checksum "$checksum" `
                             -ChecksumType "$checksumType" `
                             -Checksum64 "$checksum64" `
                             -ChecksumType64 "$checksumType64"


text:
using System.Collections.Generic;
using System.IO;
using System.Text;
using LoadFileAdapter.Parsers;
using LoadFileAdapter.Builders;

namespace LoadFileAdapter.Importers
{
    /// <summary>
    /// An importer used to import data from an OPT file.
    /// </summary>
    public class OptImporter : IImporter
    {
        private DatParser parser = new DatParser(Delimiters.COMMA_DELIMITED);
        private OptBuilder builder = new OptBuilder();

        /// <summary>
        /// Gets or sets the <see cref="DatParser"/>.
        /// </summary>
        public DatParser Parser
        {
            get
            {
                return parser;
            }

            set
            {
                parser = value;
            }
        }

        /// <summary>
        /// Gets or sets the <see cref="OptBuilder"/>.
        /// </summary>
        public OptBuilder Builder
        {
            get
            {
                return builder;
            }

            set
            {
                builder = value;
            }
        }

        /// <summary>
        /// Parses data from a file and builds the data into a collection of <see cref="Document"/> objects.
        /// </summary>
        /// <param name="file">The file to import.</param>
        /// <param name="encoding">The encoding of the file.</param>
        /// <returns>Returns a <see cref="DocumentCollection"/>.</returns>
        public DocumentCollection Import(FileInfo file, Encoding encoding)
        {
            List<string[]> records = parser.Parse(file, encoding);
            List<Document> documentList = builder.Build(records);
            DocumentCollection documents = new DocumentCollection(documentList);
            return documents;
        }
    }
}


text:
class WelcomeController < ApplicationController

  def index
    @user = User.new
    @posts = Post.search(params[:search], params[:page]).take(3)
    @projects = Project.search(params[:search], params[:page]).take(3)
    @games = Game.search(params[:search], params[:page]).take(3)
  end

  def search

    search_query = params["q"] # User entered search string
    p "search array:"
    p search_array = search_query.split(" ") # Array containing individual terms of the user entered search string

    @search_query = search_query # Display what was searched

    @searched_posts = []
    @searched_projects = []
    @searched_games = []

    search_array.each do |sa_item|
      Post.all.each do |post|
        if ( post.title.downcase.include? sa_item.downcase and post.published == true)
          @searched_posts << post
        end
      end
      Project.all.each do |project|
        if project.name.downcase.include? sa_item.downcase
          @searched_projects << project
        end
      end
      Game.all.each do |game|
        if game.name.downcase.include? sa_item.downcase
          @searched_games << game
        end
      end
    end
    @searched_posts
    @searched_projects
    @searched_games
  end

  def jellyvision
    @user = User.new
    @posts = Post.search(params[:search], params[:page]).take(3)
    @projects = Project.search(params[:search], params[:page]).take(3)
  end

end


text:
<?php
namespace Cheetahmail\Campaigns\Campaigns;

class ListCustom
{

    /**
     * @var STATUS $_status
     */
    protected $_status = null;

    /**
     * @param STATUS $_status
     */
    public function __construct($_status)
    {
        $this->_status = $_status;
    }

    /**
     * @return STATUS
     */
    public function get_status()
    {
        return $this->_status;
    }

    /**
     * @param STATUS $_status
     * @return \Cheetahmail\Campaigns\Campaigns\List
     */
    public function set_status($_status)
    {
        $this->_status = $_status;
        return $this;
    }
}


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/datalabeling/v1beta1/instruction.proto

package com.google.cloud.datalabeling.v1beta1;

public final class InstructionOuterClass {
  private InstructionOuterClass() {}

  public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {}

  public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) {
    registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry);
  }

  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_datalabeling_v1beta1_Instruction_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_datalabeling_v1beta1_Instruction_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_datalabeling_v1beta1_CsvInstruction_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_datalabeling_v1beta1_CsvInstruction_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_datalabeling_v1beta1_PdfInstruction_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_datalabeling_v1beta1_PdfInstruction_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
    return descriptor;
  }

  private static com.google.protobuf.Descriptors.FileDescriptor descriptor;

  static {
    java.lang.String[] descriptorData = {
      "\n3google/cloud/datalabeling/v1beta1/inst"
          + "ruction.proto\022!google.cloud.datalabeling"
          + ".v1beta1\032\031google/api/resource.proto\032/goo"
          + "gle/cloud/datalabeling/v1beta1/dataset.p"
          + "roto\032\037google/protobuf/timestamp.proto\"\375\003"
          + "\n\013Instruction\022\014\n\004name\030\001 \001(\t\022\024\n\014display_n"
          + "ame\030\002 \001(\t\022\023\n\013description\030\003 \001(\t\022/\n\013create"
          + "_time\030\004 \001(\0132\032.google.protobuf.Timestamp\022"
          + "/\n\013update_time\030\005 \001(\0132\032.google.protobuf.T"
          + "imestamp\022>\n\tdata_type\030\006 \001(\0162+.google.clo"
          + "ud.datalabeling.v1beta1.DataType\022N\n\017csv_"
          + "instruction\030\007 \001(\01321.google.cloud.datalab"
          + "eling.v1beta1.CsvInstructionB\002\030\001\022J\n\017pdf_"
          + "instruction\030\t \001(\01321.google.cloud.datalab"
          + "eling.v1beta1.PdfInstruction\022\032\n\022blocking"
          + "_resources\030\n \003(\t:[\352AX\n\'datalabeling.goog"
          + "leapis.com/Instruction\022-projects/{projec"
          + "t}/instructions/{instruction}\"&\n\016CsvInst"
          + "ruction\022\024\n\014gcs_file_uri\030\001 \001(\t\"&\n\016PdfInst"
          + "ruction\022\024\n\014gcs_file_uri\030\001 \001(\tB\347\001\n%com.go"
          + "ogle.cloud.datalabeling.v1beta1P\001ZMgoogl"
          + "e.golang.org/genproto/googleapis/cloud/d"
          + "atalabeling/v1beta1;datalabeling\252\002!Googl"
          + "e.Cloud.DataLabeling.V1Beta1\312\002!Google\\Cl"
          + "oud\\DataLabeling\\V1beta1\352\002$Google::Cloud"
          + "::DataLabeling::V1beta1b\006proto3"
    };
    descriptor =
        com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
            descriptorData,
            new com.google.protobuf.Descriptors.FileDescriptor[] {
              com.google.api.ResourceProto.getDescriptor(),
              com.google.cloud.datalabeling.v1beta1.DatasetOuterClass.getDescriptor(),
              com.google.protobuf.TimestampProto.getDescriptor(),
            });
    internal_static_google_cloud_datalabeling_v1beta1_Instruction_descriptor =
        getDescriptor().getMessageTypes().get(0);
    internal_static_google_cloud_datalabeling_v1beta1_Instruction_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_datalabeling_v1beta1_Instruction_descriptor,
            new java.lang.String[] {
              "Name",
              "DisplayName",
              "Description",
              "CreateTime",
              "UpdateTime",
              "DataType",
              "CsvInstruction",
              "PdfInstruction",
              "BlockingResources",
            });
    internal_static_google_cloud_datalabeling_v1beta1_CsvInstruction_descriptor =
        getDescriptor().getMessageTypes().get(1);
    internal_static_google_cloud_datalabeling_v1beta1_CsvInstruction_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_datalabeling_v1beta1_CsvInstruction_descriptor,
            new java.lang.String[] {
              "GcsFileUri",
            });
    internal_static_google_cloud_datalabeling_v1beta1_PdfInstruction_descriptor =
        getDescriptor().getMessageTypes().get(2);
    internal_static_google_cloud_datalabeling_v1beta1_PdfInstruction_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_datalabeling_v1beta1_PdfInstruction_descriptor,
            new java.lang.String[] {
              "GcsFileUri",
            });
    com.google.protobuf.ExtensionRegistry registry =
        com.google.protobuf.ExtensionRegistry.newInstance();
    registry.add(com.google.api.ResourceProto.resource);
    com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor(
        descriptor, registry);
    com.google.api.ResourceProto.getDescriptor();
    com.google.cloud.datalabeling.v1beta1.DatasetOuterClass.getDescriptor();
    com.google.protobuf.TimestampProto.getDescriptor();
  }

  // @@protoc_insertion_point(outer_class_scope)
}


text:
namespace onnxruntime {
namespace contrib {

class EmbedLayerNormBase : public OpKernel {
 public:
  explicit EmbedLayerNormBase(const OpKernelInfo& op_kernel_info);

 protected:
  float epsilon() const;

 private:
  float epsilon_;
};

template <typename T>
class EmbedLayerNorm : public EmbedLayerNormBase {
 public:
  explicit EmbedLayerNorm(const OpKernelInfo& op_kernel_info);
  Status Compute(OpKernelContext* context) const override;
};
}  // namespace contrib
}  // namespace onnxruntime


text:
import { Pipeline } from "./Pipeline";

/**
 * Sub pipeline
 *
 * The "sub-pipeline"" is a pipeline which can run as part of a stage (e.g. the filter stage) in the "main" pipeline.
 * Stages can be piped onto the sub pipeline and when the pipeline run's it will hand control back to the "main"
 * pipeline once it completes its "up" process. When the next stage in the "main" pipeline resolves, this
 * "sub-pipeline" will resume with its "down" process.
 *
 * If the next stage of the main (parent) pipeline is not set before the pipeline has completed it's "up" process, the
 * pipeline will resolve the "up" process like any other and immediatly continue with its down process.
 *
 * @package j-stillery/SubPipeline
 * @author Sandhjé Bouw (sandhje@ecodes.io)
 */
class SubPipeline<T> extends Pipeline<T> {
    /**
     * Callback to trigger the next stage in the "main" pipeline
     *
     * @callback (input: T): Promise<T>
     */
    private parentNext: (input: T) => Promise<T>;

    /**
     * Parent next setter
     *
     * @param function parentNext
     * @returns void
     */
    public setParentNext(parentNext: (input: T) => Promise<T>): void {
        this.parentNext = parentNext;
    }

    /**
     * End override
     *
     * Override for the pipeline's end method. Allows to hand control back to the "main" pipeline once this "sub"
     * pipeline completes its "up" process. Once the next stage in the "main" pipeline resolves the "down" process
     * in this "sub" pipeline is executed.
     *
     * @param T input
     * @param function resolve
     * @param function reject
     */
    protected end(input: T, resolve: (value?: T | PromiseLike<T>) => void, reject: (reason: any) => void): void {
        if (typeof this.parentNext !== "function") {
            resolve(input);
        }

        // On end of the "filter" pipeline, continue with parent
        // Once parent comes back, continue back down the "filter"
        this.parentNext(input).then((output: T) => {
            resolve(output);
        }).catch((reason: any) => {
            reject(reason);
        });
    }
}

export { SubPipeline };


text:
package com.commonsware.cwac.mediarouter.app;

import android.app.Fragment;
import android.os.Bundle;
import com.commonsware.cwac.mediarouter.media.MediaRouteSelector;
import com.commonsware.cwac.mediarouter.media.MediaRouter;

/**
 * Media route discovery fragment.
 *

 * This fragment takes care of registering a callback for media route discovery
 * during the activity's {@link android.app.Activity#onStart onStart()} phase
 * and removing it during the {@link android.app.Activity#onStart onStop()} phase.
 *

 * The application must supply a route selector to specify the kinds of routes
 * to discover.  The application may also override {@link #onCreateCallback} to
 * provide the {@link MediaRouter} callback to register.
 *

 */
public class MediaRouteDiscoveryFragment extends Fragment {
  private final String ARGUMENT_SELECTOR = "selector";

  private MediaRouter mRouter;
  private MediaRouteSelector mSelector;
  private MediaRouter.Callback mCallback;

  public MediaRouteDiscoveryFragment() {
  }

  /**
   * Gets the media router instance.
   */
  public MediaRouter getMediaRouter() {
    ensureRouter();
    return mRouter;
  }

  private void ensureRouter() {
    if (mRouter == null) {
      mRouter = MediaRouter.getInstance(getActivity());
    }
  }

  /**
   * Gets the media route selector for filtering the routes to be discovered.
   *
   * @return The selector, never null.
   */
  public MediaRouteSelector getRouteSelector() {
    ensureRouteSelector();
    return mSelector;
  }

  /**
   * Sets the media route selector for filtering the routes to be discovered.
   * This method must be called before the fragment is added.
   *
   * @param selector The selector to set.
   */
  public void setRouteSelector(MediaRouteSelector selector) {
    if (selector == null) {
      throw new IllegalArgumentException("selector must not be null");
    }

    ensureRouteSelector();
    if (!mSelector.equals(selector)) {
      mSelector = selector;

      Bundle args = getArguments();
      if (args == null) {
        args = new Bundle();
      }
      args.putBundle(ARGUMENT_SELECTOR, selector.asBundle());
      setArguments(args);

      if (mCallback != null) {
        mRouter.removeCallback(mCallback);
        //noinspection ResourceType
        mRouter.addCallback(mSelector, mCallback, onPrepareCallbackFlags());
      }
    }
  }

  private void ensureRouteSelector() {
    if (mSelector == null) {
      Bundle args = getArguments();
      if (args != null) {
        mSelector = MediaRouteSelector.fromBundle(args.getBundle(ARGUMENT_SELECTOR));
      }
      if (mSelector == null) {
        mSelector = MediaRouteSelector.EMPTY;
      }
    }
  }

  /**
   * Called to create the MediaRouter.Callback callback
   * that will be registered.
   *

   * The default callback does nothing.  The application may override this method to
   * supply its own callback.
   *

   *
   * @return The new callback, or null if no callback should be registered.
   */
  public MediaRouter.Callback onCreateCallback() {
    return new MediaRouter.Callback() { };
  }

  /**
   * Called to prepare the callback flags that will be used when the
   * MediaRouter.Callback callback is registered.
   *

   * The default implementation returns {@link MediaRouter#CALLBACK_FLAG_REQUEST_DISCOVERY}.
   *

   *
   * @return The desired callback flags.
   */
  public int onPrepareCallbackFlags() {
    return MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY;
  }

  @Override
  public void onStart() {
    super.onStart();

    ensureRouteSelector();
    ensureRouter();
    mCallback = onCreateCallback();
    if (mCallback != null) {
      //noinspection ResourceType
      mRouter.addCallback(mSelector, mCallback, onPrepareCallbackFlags());
    }
  }

  @Override
  public void onStop() {
    if (mCallback != null) {
      mRouter.removeCallback(mCallback);
      mCallback = null;
    }

    super.onStop();
  }
}