text:
package gov.nasa.worldwind.layers;

import com.jogamp.opengl.util.texture.*;
import gov.nasa.worldwind.avlist.AVKey;
import gov.nasa.worldwind.exception.WWRuntimeException;
import gov.nasa.worldwind.geom.Vec4;
import gov.nasa.worldwind.render.*;
import gov.nasa.worldwind.util.*;

import javax.media.opengl.*;
import java.awt.*;
import java.io.*;

/**
 * Renders a crosshair icon in the viewport center or at a specified location.
 *
 * @author Patrick Murris
 * @version $Id: CrosshairLayer.java 1171 2013-02-11 21:45:02Z dcollins $
 */
public class CrosshairLayer extends AbstractLayer
{
    private String iconFilePath = "images/32x32-crosshair-simple.png"; // TODO: make configurable
    private double toViewportScale = 1d; // TODO: make configurable
    private double iconScale = 1d;
    private String resizeBehavior = AVKey.RESIZE_SHRINK_ONLY;
    private int iconWidth;
    private int iconHeight;
    private Vec4 locationCenter = null;

    // Draw it as ordered with an eye distance of 0 so that it shows up in front of most other things.
    private OrderedIcon orderedImage = new OrderedIcon();

    private class OrderedIcon implements OrderedRenderable
    {
        public double getDistanceFromEye()
        {
            return 0;
        }

        public void pick(DrawContext dc, Point pickPoint)
        {
            // Not implemented
        }

        public void render(DrawContext dc)
        {
            CrosshairLayer.this.draw(dc);
        }
    }

    public CrosshairLayer()
    {
        this.setOpacity(0.8); // TODO: make configurable
    }

    public CrosshairLayer(String iconFilePath)
    {
        this.setIconFilePath(iconFilePath);
        this.setOpacity(0.8); // TODO: make configurable
    }

    /**
     * Returns the layer's current icon file path.
     *
     * @return the icon file path
     */
    public String getIconFilePath()
    {
        return iconFilePath;
    }

    /**
     * Sets the crosshair icon's image location. The layer first searches for this location in the current Java
     * classpath. If not found then the specified path is assumed to refer to the local file system. found there then
     * the
     *
     * @param iconFilePath the path to the icon's image file
     */
    public void setIconFilePath(String iconFilePath)
    {
        if (iconFilePath == null)
        {
            String message = Logging.getMessage("nullValue.IconFilePath");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }
        this.iconFilePath = iconFilePath;
    }

    /**
     * Returns the layer's compass-to-viewport scale factor.
     *
     * @return the crosshair-to-viewport scale factor
     */
    public double getToViewportScale()
    {
        return toViewportScale;
    }

    /**
     * Sets the scale factor applied to the viewport size to determine the displayed size of the crosshair icon. This
     * scale factor is used only when the layer's resize behavior is AVKey.RESIZE_STRETCH or AVKey.RESIZE_SHRINK_ONLY.
     * The icon's width is adjusted to occupy the proportion of the viewport's width indicated by this factor. The
     * icon's height is adjusted to maintain the crosshair image's native aspect ratio.
     *
     * @param toViewportScale the compass to viewport scale factor
     */
    public void setToViewportScale(double toViewportScale)
    {
        this.toViewportScale = toViewportScale;
    }

    /**
     * Returns the icon scale factor. See {@link #setIconScale(double)} for a description of the scale factor.
     *
     * @return the current icon scale
     */
    public double getIconScale()
    {
        return iconScale;
    }

    /**
     * Sets the scale factor defining the displayed size of the crosshair icon relative to the icon's width and height
     * in its image file. Values greater than 1 magify the image, values less than one minify it. If the layer's resize
     * behavior is other than AVKey.RESIZE_KEEP_FIXED_SIZE, the icon's displayed sized is further affected by the value
     * specified by {@link #setToViewportScale(double)} and the current viewport size.
     *
     * @param iconScale the icon scale factor
     */
    public void setIconScale(double iconScale)
    {
        this.iconScale = iconScale;
    }

    /**
     * Returns the crosshair icon's resize behavior.
     *
     * @return the icon's resize behavior
     */
    public String getResizeBehavior()
    {
        return resizeBehavior;
    }

    /**
     * Sets the behavior the layer uses to size the crosshair icon when the viewport size changes, typically when the
     * World Wind window is resized. If the value is AVKey.RESIZE_KEEP_FIXED_SIZE, the icon size is kept to the size
     * specified in its image file scaled by the layer's current icon scale. If the value is AVKey.RESIZE_STRETCH, the
     * icon is resized to have a constant size relative to the current viewport size. If the viewport shrinks the icon
     * size decreases; if it expands then the icon file enlarges. The relative size is determined by the current
     * crosshair-to-viewport scale and by the icon's image file size scaled by the current icon scale. If the value is
     * AVKey.RESIZE_SHRINK_ONLY (the default), icon sizing behaves as for AVKey.RESIZE_STRETCH but the icon will not
     * grow larger than the size specified in its image file scaled by the current icon scale.
     *
     * @param resizeBehavior the desired resize behavior
     */
    public void setResizeBehavior(String resizeBehavior)
    {
        this.resizeBehavior = resizeBehavior;
    }

    /**
     * Get the crosshair location inside the viewport. If this location is null, the crosshair is drawn in the viewport
     * center.
     *
     * @return the crosshair location inside the viewport.
     */
    public Vec4 getLocationCenter()
    {
        return locationCenter;
    }

    /**
     * Set the crosshair location inside the viewport. If this location is null, the crosshair will be drawn in the
     * viewport center.
     *
     * @param locationCenter the crosshair location inside the viewport.
     */
    public void setLocationCenter(Vec4 locationCenter)
    {
        this.locationCenter = locationCenter;
    }

    protected void doRender(DrawContext dc)
    {
        dc.addOrderedRenderable(this.orderedImage);
    }

    private void draw(DrawContext dc)
    {
        if (this.getIconFilePath() == null)
            return;

        GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.

        boolean attribsPushed = false;
        boolean modelviewPushed = false;
        boolean projectionPushed = false;

        try
        {
            gl.glPushAttrib(GL2.GL_DEPTH_BUFFER_BIT
                | GL2.GL_COLOR_BUFFER_BIT
                | GL2.GL_ENABLE_BIT
                | GL2.GL_TRANSFORM_BIT
                | GL2.GL_VIEWPORT_BIT
                | GL2.GL_CURRENT_BIT);
            attribsPushed = true;

            Texture iconTexture = dc.getTextureCache().getTexture(this.getIconFilePath());
            if (iconTexture == null)
            {
                this.initializeTexture(dc);
                iconTexture = dc.getTextureCache().getTexture(this.getIconFilePath());
                if (iconTexture == null)
                {
                    // TODO: log warning
                    return;
                }
            }

            gl.glEnable(GL.GL_TEXTURE_2D);
            iconTexture.bind(gl);

            gl.glColor4d(1d, 1d, 1d, this.getOpacity());
            gl.glEnable(GL.GL_BLEND);
            gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
            gl.glDisable(GL.GL_DEPTH_TEST);

            double width = this.getScaledIconWidth();
            double height = this.getScaledIconHeight();

            // Load a parallel projection with xy dimensions (viewportWidth, viewportHeight)
            // into the GL projection matrix.
            java.awt.Rectangle viewport = dc.getView().getViewport();
            gl.glMatrixMode(GL2.GL_PROJECTION);
            gl.glPushMatrix();
            projectionPushed = true;
            gl.glLoadIdentity();
            double maxwh = width > height ? width : height;
            gl.glOrtho(0d, viewport.width, 0d, viewport.height, -0.6 * maxwh, 0.6 * maxwh);

            gl.glMatrixMode(GL2.GL_MODELVIEW);
            gl.glPushMatrix();
            modelviewPushed = true;
            gl.glLoadIdentity();

            double scale = this.computeScale(viewport);
            Vec4 locationSW = this.computeLocation(viewport, scale);

            gl.glTranslated((int) locationSW.x, (int) locationSW.y, (int) locationSW.z);
            gl.glScaled(scale, scale, 1);

            TextureCoords texCoords = iconTexture.getImageTexCoords();
            gl.glScaled(width, height, 1d);
            dc.drawUnitQuad(texCoords);
        }
        finally
        {
            gl.glBindTexture(GL.GL_TEXTURE_2D, 0);

            if (projectionPushed)
            {
                gl.glMatrixMode(GL2.GL_PROJECTION);
                gl.glPopMatrix();
            }
            if (modelviewPushed)
            {
                gl.glMatrixMode(GL2.GL_MODELVIEW);
                gl.glPopMatrix();
            }
            if (attribsPushed)
                gl.glPopAttrib();
        }
    }

    private double computeScale(Rectangle viewport)
    {
        if (this.resizeBehavior.equals(AVKey.RESIZE_SHRINK_ONLY))
        {
            return Math.min(1d, (this.toViewportScale) * viewport.width / this.getScaledIconWidth());
        }
        else if (this.resizeBehavior.equals(AVKey.RESIZE_STRETCH))
        {
            return (this.toViewportScale) * viewport.width / this.getScaledIconWidth();
        }
        else if (this.resizeBehavior.equals(AVKey.RESIZE_KEEP_FIXED_SIZE))
        {
            return 1d;
        }
        else
        {
            return 1d;
        }
    }

    private double getScaledIconWidth()
    {
        return this.iconWidth * this.iconScale;
    }

    private double getScaledIconHeight()
    {
        return this.iconHeight * this.iconScale;
    }

    private Vec4 computeLocation(Rectangle viewport, double scale)
    {
        double width = this.getScaledIconWidth();
        double height = this.getScaledIconHeight();

        double scaledWidth = scale * width;
        double scaledHeight = scale * height;

        double x;
        double y;

        if (this.locationCenter != null)
        {
            x = this.locationCenter.x - scaledWidth / 2;
            y = this.locationCenter.y - scaledHeight / 2;
        }
        else // viewport center
        {
            x = viewport.getWidth() / 2 - scaledWidth / 2;
            y = viewport.getHeight() / 2 - scaledHeight / 2;
        }

        return new Vec4(x, y, 0);
    }

    private void initializeTexture(DrawContext dc)
    {
        Texture iconTexture = dc.getTextureCache().getTexture(this.getIconFilePath());
        if (iconTexture != null)
            return;

        GL gl = dc.getGL();

        try
        {
            InputStream iconStream = this.getClass().getResourceAsStream("/" + this.getIconFilePath());
            if (iconStream == null)
            {
                File iconFile = new File(this.getIconFilePath());
                if (iconFile.exists())
                {
                    iconStream = new FileInputStream(iconFile);
                }
            }

            TextureData textureData = OGLUtil.newTextureData(gl.getGLProfile(), iconStream, false);
            iconTexture = TextureIO.newTexture(textureData);
            iconTexture.bind(gl);
            this.iconWidth = iconTexture.getWidth();
            this.iconHeight = iconTexture.getHeight();
            dc.getTextureCache().put(this.getIconFilePath(), iconTexture);
        }
        catch (IOException e)
        {
            String msg = Logging.getMessage("layers.IOExceptionDuringInitialization");
            Logging.logger().severe(msg);
            throw new WWRuntimeException(msg, e);
        }

        gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);//_MIPMAP_LINEAR);
        gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
        gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE);
        gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE);
        // Enable texture anisotropy
        int[] maxAnisotropy = new int[1];
        gl.glGetIntegerv(GL.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, maxAnisotropy, 0);
        gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAnisotropy[0]);
    }

    @Override
    public String toString()
    {
        return Logging.getMessage("layers.CrosshairLayer.Name");
    }
}


text:
require_relative './test'

class Vonage::NumbersTest < Vonage::Test
  def numbers
    Vonage::Numbers.new(config)
  end

  def test_list_method
    uri = 'https://rest.nexmo.com/account/numbers'

    params = {size: 25, pattern: '33'}

    stub_request(:get, uri).with(query: params.merge(api_key_and_secret)).to_return(numbers_response)

    response = numbers.list(params)

    response.each{|resp| assert_kind_of Vonage::Numbers::ListResponse, resp }
  end

  def test_list_method_without_args
    uri = 'https://rest.nexmo.com/account/numbers'

    stub_request(:get, uri).with(query: api_key_and_secret).to_return(numbers_response)

    response = numbers.list

    response.each{|resp| assert_kind_of Vonage::Numbers::ListResponse, resp }
  end

  def test_search_method
    uri = 'https://rest.nexmo.com/number/search'

    params = {size: 25, country: country}

    stub_request(:get, uri).with(query: params.merge(api_key_and_secret)).to_return(response)

    assert_kind_of Vonage::Numbers::ListResponse, numbers.search(params)
  end

  def test_buy_method
    uri = 'https://rest.nexmo.com/number/buy'

    params = {country: country, msisdn: msisdn}

    stub_request(:post, uri).with(headers: headers, body: params.merge(api_key_and_secret)).to_return(response)

    assert_kind_of Vonage::Numbers::Response, numbers.buy(params)
  end

  def test_cancel_method
    uri = 'https://rest.nexmo.com/number/cancel'

    params = {country: country, msisdn: msisdn}

    stub_request(:post, uri).with(headers: headers, body: params.merge(api_key_and_secret)).to_return(response)

    assert_kind_of Vonage::Numbers::Response, numbers.cancel(params)
  end

  def test_update_method
    uri = 'https://rest.nexmo.com/number/update'

    mo_http_url = 'https://example.com/callback'

    params = {'country' => country, 'msisdn' => msisdn, 'moHttpUrl' => mo_http_url}

    stub_request(:post, uri).with(headers: headers, body: params.merge(api_key_and_secret)).to_return(response)

    assert_kind_of Vonage::Numbers::Response, numbers.update(country: country, msisdn: msisdn, mo_http_url: mo_http_url)
  end
end

redpajama_set_name: RedPajamaGithub


text:
package com.eaw1805.battles.field.generation.calculators;

import com.eaw1805.battles.field.generation.BasePathGenerator;
import com.eaw1805.battles.field.generation.MajorRiverGenerator;
import com.eaw1805.battles.field.generation.MinorRiverGenerator;
import com.eaw1805.battles.field.generation.NonTraversingMinorRiverGenerator;
import com.eaw1805.battles.field.utils.MathUtils;
import com.eaw1805.data.model.battles.field.FieldBattleMap;
import com.eaw1805.data.model.battles.field.FieldBattleSector;

import java.util.List;
import java.util.Set;

/**
 * This is a helper class that adds rivers to a field battle map. It
 * conceptually separates the map into 4 quarters, and creates rivers from a
 * quarter to its opposite. Rivers only start from and end to the vertical borders of
 * of the map (from 1 to 3 or from 4 to 2).
 * <pre>
 * +++++++++
 * + 1 | 4 +
 * +-------+
 * + 2 | 3 +
 * +++++++++
 * </pre>
 *
 * @author fragkakis
 */
public class RiverCalculator {

    /**
     * Adds a non-traversing minor river (a 1-width river that horizontally traverses the 2/3 of the map).
     *
     * @param fbMap the field battle map
     */
    public void addNonTraversingMinorRiver(FieldBattleMap fbMap) {

        int entryQuarter = MathUtils.generateRandomIntInRange(1, 2);
        int exitQuarter = findMirrorQuarter(entryQuarter);

        FieldBattleSector entrySector = null;
        FieldBattleSector exitSector = null;

        if (MathUtils.generateRandomIntInRange(0, 1) == 1) {
            entrySector = findSectorInQuarter(fbMap, entryQuarter);
            exitSector = findBorderSectorInQuarter(fbMap, exitQuarter);
        } else {
            entrySector = findBorderSectorInQuarter(fbMap, entryQuarter);
            exitSector = findSectorInQuarter(fbMap, exitQuarter);
        }

        BasePathGenerator nonTraveringRiverGenerator = new NonTraversingMinorRiverGenerator(fbMap);
        List<FieldBattleSector> path = nonTraveringRiverGenerator.generate(entrySector, exitSector);

        for (FieldBattleSector sector : path) {
            sector.setMinorRiver(true);
        }

    }

    /**
     * Adds a minor river (1-width) that traverses horizontally the map.
     *
     * @param fbMap the field battle map
     */
    public void addMinorRiver(FieldBattleMap fbMap) {

        int entryQuarter = MathUtils.generateRandomIntInRange(1, 2);
        int exitQuarter = findMirrorQuarter(entryQuarter);

        FieldBattleSector entrySector = findBorderSectorInQuarter(fbMap, entryQuarter);
        FieldBattleSector exitSector = findBorderSectorInQuarter(fbMap, exitQuarter);

        BasePathGenerator riverGenerator = new MinorRiverGenerator(fbMap);
        List<FieldBattleSector> path = riverGenerator.generate(entrySector, exitSector);

        for (FieldBattleSector sector : path) {
            sector.setMinorRiver(true);
        }

    }

    /**
     * Adds a major river (2-3 width) that traverses horizontally the map.
     *
     * @param fbMap the field battle map
     */
    public void addMajorRiver(FieldBattleMap fbMap) {

        int entryQuarter = MathUtils.generateRandomIntInRange(1, 2);
        int exitQuarter = findMirrorQuarter(entryQuarter);

        FieldBattleSector entrySector = findBorderSectorInQuarter(fbMap, entryQuarter);
        FieldBattleSector exitSector = findBorderSectorInQuarter(fbMap, exitQuarter);

        MajorRiverGenerator majorRiverGenerator = new MajorRiverGenerator(fbMap);
        Set<FieldBattleSector> majorRiverSectors = majorRiverGenerator.generate(entrySector, exitSector);

        for (FieldBattleSector sector : majorRiverSectors) {
            sector.setMajorRiver(true);
        }

    }

    private FieldBattleSector findBorderSectorInQuarter(FieldBattleMap fbMap, int quarter) {
        switch (quarter) {
            case 1:
                return fbMap.getFieldBattleSector(0, MathUtils.generateRandomIntInRange(fbMap.getSizeY() / 2, fbMap.getSizeY() - 1 - 5));
            case 2:
                return fbMap.getFieldBattleSector(0, MathUtils.generateRandomIntInRange(5, fbMap.getSizeY() / 2 - 1));
            case 3:
                return fbMap.getFieldBattleSector(fbMap.getSizeX() - 1, MathUtils.generateRandomIntInRange(5, fbMap.getSizeY() / 2 - 1));
            default:
                // case 4
                return fbMap.getFieldBattleSector(fbMap.getSizeX() - 1, MathUtils.generateRandomIntInRange(fbMap.getSizeY() / 2, fbMap.getSizeY() - 1 - 5));
        }
    }

    /**
     * This method returns a sector in the first 1/3 of a quarter
     *
     * @param fbMap
     * @param quarter
     * @return
     */
    private FieldBattleSector findSectorInQuarter(FieldBattleMap fbMap, int quarter) {
        switch (quarter) {
            case 1:
                return fbMap.getFieldBattleSector(fbMap.getSizeX() / 3, MathUtils.generateRandomIntInRange(fbMap.getSizeY() / 2, fbMap.getSizeY() - 1 - 10));
            case 2:
                return fbMap.getFieldBattleSector(fbMap.getSizeX() / 3, MathUtils.generateRandomIntInRange(10, fbMap.getSizeY() / 2 - 1));
            case 3:
                return fbMap.getFieldBattleSector(fbMap.getSizeX() * 2 / 3 - 1, MathUtils.generateRandomIntInRange(10, fbMap.getSizeY() / 2 - 1));
            default:
                // case 4
                return fbMap.getFieldBattleSector(fbMap.getSizeX() * 2 / 3 - 1, MathUtils.generateRandomIntInRange(fbMap.getSizeY() / 2, fbMap.getSizeY() - 1 - 10));
        }
    }

    private int findMirrorQuarter(int entryQuarter) {
        switch (entryQuarter) {
            case 1:
                return 3;
            case 2:
                return 4;
            case 3:
                return 1;
            default:
                // case 4
                return 2;
        }
    }

}


text:
module MagicEffects where

import qualified Data.MultiSet as MultiSet
import Control.Monad (mzero, msum, mplus, guard, when)
import Control.Monad.State (modify, get, state)
import System.Random.Shuffle (shuffleM)
import System.Random (mkStdGen)
import GameState
import Mana
import Card

initGameState :: Int -> [Card] -> GameState
initGameState seed deck =
  let gs = GameState (initGame deck) (mkStdGen seed) []
  in head (runEffect gs (shuffleLibrary >> draw 7))

nextStates :: GameState -> [GameState]
nextStates gs@(GameState game _ _) = runEffect gs $
  msum (map playCard (MultiSet.distinctElems (hand game)))
  `mplus`
  msum (map activatePermanent (MultiSet.distinctElems (battlefield game)))

activatePermanent :: Permanent -> Effect
activatePermanent permanent =
  let abilities = cardActivatedAbilities (permanentCard permanent)
  in msum (map (activateAbility permanent) abilities)

activateAbility :: Permanent -> ActivatedAbility -> Effect
activateAbility permanent (ActivatedAbility cost effect) = do
  cost permanent
  effect

stormWin :: Int -> Effect
stormWin n = do
  stormCount <- fmap storm get
  guard $ stormCount >= n
  winGame

winGame :: Effect
winGame = modify (\g->g { isWin = True })

draw :: Int -> Effect
draw n = do
  lib <- fmap library get
  guard $ length lib >= n
  modify $ \g->g {
    library = drop n (library g),
    hand = MultiSet.union
             (MultiSet.fromList (take n (library g)))
             (hand g) }

discardHand :: Effect
discardHand = modify $ \g->g {
  hand = MultiSet.empty,
  graveyard = MultiSet.toList (hand g) ++ graveyard g }

shuffleGraveyardHandIntoLibrary :: Effect
shuffleGraveyardHandIntoLibrary = do
  modify $ \g->g {
    hand = MultiSet.empty,
    graveyard = [],
    library = MultiSet.toList (hand g) ++ graveyard g ++ library g }
  draw 7

-- TODO: This immediately resolves the stack rather than allowing that to be
-- a separate step. This will have to be changed if we want to allow for the
-- stacking of instant abilities which will be necessary for Lion's Eye
-- Diamond.
playCard :: Card -> Effect
playCard card = do
  if isType Land card
  then do hasPlayedLand <- fmap playedLand get
          guard $ not hasPlayedLand
          modify $ \g->g {
            hand = MultiSet.delete card (hand g),
            playedLand = True
            }
          putIntoPlay card
  else do payCost (cardCost card)
          modify $ \g->g {
            hand = MultiSet.delete card (hand g),
            stack = card : stack g,
            storm = storm g + 1 }
          resolveStack

-- TODO: This will fail to call the effect of a permanent. That's bad but
-- should they be called? Should they even have effects? Perhaps there should
-- just be different constructors for cards that are spells or permanents?
resolveStack :: Effect
resolveStack = do
  topOfStack <- popTheStack
  if isPermanentCard topOfStack
  then putIntoPlay topOfStack
  else do cardEffect topOfStack
          putInGraveyard topOfStack
  where popTheStack :: EffectM Card
        popTheStack = state $ \g->
          let (top:restOfStack) = stack g
          in (top, g { stack = restOfStack })

putInGraveyard :: Card -> Effect
putInGraveyard card = modify (\g->g { graveyard = card : graveyard g })

-- TODO This does not include the ability for a card to determine that it comes
-- into play tapped. It also should call any list of enters battlefield
-- effects that currently are not suported.
putIntoPlay :: Card -> Effect
putIntoPlay card = do
  let perm = Permanent card False []
  modify (\g->g { battlefield = MultiSet.insert perm (battlefield g) })

putIntoHand :: Card -> Effect
putIntoHand card = modify $ \g -> g { hand = MultiSet.insert card (hand g) }

payCost :: Mana -> Effect
payCost manaCost = do
  game <- get
  let currentMana = manaPool game
  case payMana manaCost currentMana of
    Just newPool -> modify (\g->g { manaPool = newPool })
    Nothing -> mzero

addToManaPool :: String -> Effect
addToManaPool manaStr = modify $ \g->g {
  manaPool = addMana (readMana manaStr) (manaPool g) }

tap :: Permanent -> Effect
tap permanent = do
  guard $ not (permanentTapped permanent)
  let newPerm = permanent { permanentTapped = True }
  modify $ \g->g {
    battlefield =
      MultiSet.insert newPerm
        (MultiSet.delete permanent (battlefield g)) }

sacrifice :: Permanent -> Effect
sacrifice permanent = modify $ \g->g {
  battlefield = MultiSet.delete permanent (battlefield g),
  graveyard = permanentCard permanent : graveyard g }

tapSacrifice :: Permanent -> Effect
tapSacrifice permanent = do
  guard $ not (permanentTapped permanent)
  sacrifice permanent

shuffleLibrary :: Effect
shuffleLibrary = do
  oldLibrary <- fmap library get
  newLibrary <- shuffleM oldLibrary
  modify (\g->g { library = newLibrary })

-- TODO does not actually remove. use state for this.
search :: (Game -> [a]) -> (a -> Bool) -> EffectM a
search zone matching = do
  choices <- fmap zone get
  msum (map return (filter matching choices))

threshold :: Effect -> Effect
threshold effect = do
  gy <- fmap graveyard get
  when (length gy >= 7) effect

metalCraft :: Effect -> Effect
metalCraft effect = do
  permanents <- fmap battlefield get
  let num =
        MultiSet.size
          (MultiSet.filter (\p->isType Artifact (permanentCard p))
                           permanents)
  guard $ num >= 3
  effect


text:
/*
 *  Project:        WhaTBI? (What's The Big Idea?)
 *  Filename:       Metadata.cs
 *  Description:    Classes describing type metadata
 */

using System;
using System.Collections;
using System.ComponentModel;
using System.Reflection;
using System.Text;

namespace Pdbartlett.Whatbi
{
    namespace Custom
    {
        public interface IGetTypeInfo
        {
            ITypeInfo GetTypeInfo();
        }
    }

    public interface ITypeInfo
    {
        string Name { get; }
        bool IsCollection { get; }

        IPropertyInfo[] GetProperties();
        IPropertyInfo GetProperty(string propName);
        object ConvertTo(object o, ITypeInfo dest);
    }

    public interface IPropertyInfo
    {
        string Name { get; }
        string DisplayName { get; }
        ITypeInfo TypeInfo { get; }

        object GetValue(object o);
    }

    public class TypeToTypeInfoAdapter : ITypeInfo
    {
        private Type m_clrType;
        private PropertyDescriptorCollection m_props;

        public TypeToTypeInfoAdapter(Type clrType)
        {
            if (clrType == null)
                throw new ArgumentNullException();

            m_clrType = clrType;
        }

        public Type ClrType { get { return m_clrType; } }

        public string Name { get { return m_clrType.Name; } }

        public bool IsCollection { get { return m_clrType.GetInterface("ICollection") != null; } }

        public virtual IPropertyInfo[] GetProperties()
        {
            if (m_props == null)
                m_props = TypeDescriptor.GetProperties(m_clrType);

            PropDescToPropInfoAdapter[] pi = new PropDescToPropInfoAdapter[m_props.Count];

            int i = 0;
            foreach(PropertyDescriptor pd in m_props)
                pi[i++] = new PropDescToPropInfoAdapter(pd);

            return pi;
        }

        public virtual IPropertyInfo GetProperty(string propName)
        {
            if (m_props == null)
                m_props = TypeDescriptor.GetProperties(m_clrType);

            PropertyDescriptor pd = m_props[propName];
            return pd == null ? null : new PropDescToPropInfoAdapter(pd);
        }

        public virtual object ConvertTo(object o, ITypeInfo dest)
        {
            // TODO - update to use component model

            TypeToTypeInfoAdapter clrDest = dest as TypeToTypeInfoAdapter;
            if (clrDest == null)
                return null;

            IConvertible src = o as IConvertible;
            if (src == null)
                return null;

            return src.ToType(clrDest.m_clrType, null);
        }
    }

    public class ObjectToTypeInfoAdapter : ITypeInfo
    {
        private object m_obj;
        private PropertyDescriptorCollection m_props;

        public ObjectToTypeInfoAdapter(object obj)
        {
            if (obj == null)
                throw new ArgumentNullException();

            m_obj = obj;
        }

        public object Object { get { return m_obj; } }

        public string Name { get { return TypeDescriptor.GetClassName(m_obj); } }

        public bool IsCollection { get { return m_obj is ICollection; } }

        public virtual IPropertyInfo[] GetProperties()
        {
            if (m_props == null)
                m_props = TypeDescriptor.GetProperties(m_obj, false);

            PropDescToPropInfoAdapter[] pi = new PropDescToPropInfoAdapter[m_props.Count];

            int i = 0;
            foreach(PropertyDescriptor pd in m_props)
                pi[i++] = new PropDescToPropInfoAdapter(pd);

            return pi;
        }

        public virtual IPropertyInfo GetProperty(string propName)
        {
            if (m_props == null)
                m_props = TypeDescriptor.GetProperties(m_obj, false);

            PropertyDescriptor pd = m_props[propName];
            return pd == null ? null : new PropDescToPropInfoAdapter(pd);
        }

        public virtual object ConvertTo(object o, ITypeInfo dest)
        {
            TypeToTypeInfoAdapter adaptThis = new TypeToTypeInfoAdapter(this.GetType());
            return adaptThis.ConvertTo(o, dest);
        }
    }

    public class PropDescToPropInfoAdapter : IPropertyInfo
    {
        private PropertyDescriptor m_propDesc;

        public PropDescToPropInfoAdapter(PropertyDescriptor propDesc)
        {
            if (propDesc == null)
                throw new ArgumentNullException();

            m_propDesc = propDesc;
        }

        public string Name { get { return m_propDesc.Name; } }

        public string DisplayName
        {
            get
            {
                // Has type descriptor provided something different to name
                string dispName = m_propDesc.DisplayName;
                string name = Name;
                if (dispName != name)
                    return dispName;

                // Otherwise, just "tidy" the name

                int c = name.Length;
                if (c == 0)
                    return "";

                StringBuilder sb = new StringBuilder(2 * name.Length);
                sb.Append(Char.ToUpper(name[0]));
                for (int i = 1; i < c; ++i)
                {
                    char ch = name[i];
                    if (Char.IsUpper(ch))
                        sb.Append(' ');

                    sb.Append(ch);
                }

                return sb.ToString();
            }
        }

        public ITypeInfo TypeInfo
        {
            get
            {
                return new TypeToTypeInfoAdapter(m_propDesc.PropertyType);
            }
        }

        public override string ToString()
        {
            return DisplayName;
        }

        public object GetValue(object o)
        {
            return m_propDesc.GetValue(o);
        }
    }

    public abstract class DynamicObjectHelper : ICustomTypeDescriptor
    {
        private PropertyDescriptorCollection m_props;

        public void RebuildProperties()
        {
            BuildProps();
        }

        protected virtual void BuildProps()
        {
            IPropertyInfo[] pis = InternalGetProperties();
            if (pis != null)
            {
                m_props = new PropertyDescriptorCollection(null);
                foreach (IPropertyInfo pi in pis)
                    m_props.Add(new PropInfoToPropDescAdapter(GetType(), pi));

                return;
            }

            m_props = InternalGetPropDescColl();
        }

        protected virtual IPropertyInfo[] InternalGetProperties()
        {
            return null;
        }

        protected virtual PropertyDescriptorCollection InternalGetPropDescColl()
        {
            return TypeDescriptor.GetProperties(this, true);
        }

        public virtual string GetClassName()
        {
            return TypeDescriptor.GetClassName(this, true);
        }

        public AttributeCollection GetAttributes()
        {
            return TypeDescriptor.GetAttributes(this, true);
        }

        public string GetComponentName()
        {
            return TypeDescriptor.GetComponentName(this, true);
        }

        public TypeConverter GetConverter()
        {
            return TypeDescriptor.GetConverter(this, true);
        }

        public EventDescriptor GetDefaultEvent()
        {
            return TypeDescriptor.GetDefaultEvent(this, true);
        }

        public PropertyDescriptor GetDefaultProperty()
        {
            return TypeDescriptor.GetDefaultProperty(this, true);
        }

        public object GetEditor(Type t)
        {
            return TypeDescriptor.GetEditor(this, t, true);
        }

        public EventDescriptorCollection GetEvents()
        {
            return TypeDescriptor.GetEvents(this, true);
        }

        public EventDescriptorCollection GetEvents(Attribute[] attrs)
        {
            return TypeDescriptor.GetEvents(this, attrs, true);
        }

        public PropertyDescriptorCollection GetProperties()
        {
            if (m_props == null)
                BuildProps();

            return m_props;
        }

        public PropertyDescriptorCollection GetProperties(Attribute[] attrs)
        {
            if (m_props == null)
                BuildProps();

            return m_props; // need to filter for .NET v2
        }

        public object GetPropertyOwner(PropertyDescriptor prop)
        {
            return this;
        }
    }

    public class PropInfoToPropDescAdapter : PropertyDescriptor
    {
        private IPropertyInfo   m_pi;
        private Type            m_clrComponentType;
        private Type            m_clrPropertyType;

        public PropInfoToPropDescAdapter(Type clrType, IPropertyInfo pi) : base(pi.Name, null)
        {
            m_pi = pi;
            m_clrComponentType = clrType;
            m_clrPropertyType = GetClrTypeFromTypeInfo(pi.TypeInfo);
        }

        private static Type GetClrTypeFromTypeInfo(ITypeInfo ti)
        {
            TypeToTypeInfoAdapter ttia = ti as TypeToTypeInfoAdapter;
            if (ttia != null)
                return ttia.ClrType;

            ObjectToTypeInfoAdapter otia = ti as ObjectToTypeInfoAdapter;
            if (otia != null)
                return otia.Object.GetType();

            throw new ArgumentException();
        }

        public override Type ComponentType  { get { return m_clrComponentType; } }
        public override bool IsReadOnly     { get { return true; } }
        public override Type PropertyType   { get { return m_clrPropertyType; } }

        public override object GetValue(object o)
        {
            return m_pi.GetValue(o);
        }

        public override void SetValue(object o, object value)
        {
            throw new NotImplementedException();
        }

        public override bool CanResetValue(object o)
        {
            return false;
        }

        public override void ResetValue(object o)
        {
            throw new NotImplementedException();
        }

        public override bool ShouldSerializeValue(object o)
        {
            return false;
        }
    }

    public delegate object ObjectValueGetter(IPropertyInfo sender, object obj);

    public class DynamicPropertyInfo : IPropertyInfo
    {
        private string              m_name;
        private ITypeInfo           m_ti;
        private ObjectValueGetter   m_getter;

        public DynamicPropertyInfo(string name, ITypeInfo ti, ObjectValueGetter getter)
        {
            m_name      = name;
            m_ti        = ti;
            m_getter    = getter;
        }

        public string Name { get { return m_name; } }
        public string DisplayName { get { return m_name; } }
        public ITypeInfo TypeInfo { get { return m_ti; } }

        public object GetValue(object o)
        {
            return m_getter(this, o);
        }
    }
}


text:
type CacheObject = {
  [key: string]: string
}

const DASH = /-([a-z])/g
const MS = /^Ms/g
const cache: CacheObject = {}

function toUpper(match: string) {
  return match[1].toUpperCase()
}

export default function camelCaseProperty(property: string) {
  if (cache.hasOwnProperty(property)) {
    return cache[property]
  }

  const camelProp = property.replace(DASH, toUpper).replace(MS, 'ms')
  cache[property] = camelProp

  return camelProp
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>PRONOS-FOOT.com | Site de Pronostics de Football 100% Gratuit avec Prix a Gagner</title>
  <meta name="description" content="Site de Pronostics de Football 100% Gratuit.
Inscription Simple et Rapide.
Collectez des Points en Trouvant les Résultats des Matchs de L'EURO 2016.
Devenez le Champion de Pronos-Foot.com et Gagnez un iPhone 6.">
  <meta property="og:title" content="PRONOS-FOOT.com | Site de Pronostics de Football 100% Gratuit avec Prix a Gagner">
  <meta property="og:description" content="Site de Pronostics de Football 100% Gratuit.
Inscription Simple et Rapide.
Collectez des Points en Trouvant les Résultats des Matchs de L'EURO 2016.
Devenez le Champion de Pronos-Foot.com et Gagnez un iPhone 6.">
  <meta property="og:image" content="https://daks2k3a4ib2z.cloudfront.net/570cdf23fb4e011d1cf72234/5719de9f6324c106760c3392_facebook-og.jpg">
  <meta name="twitter:card" content="summary">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="generator" content="Webflow">
  <link rel="stylesheet" type="text/css" href="css/normalize.css">
  <link rel="stylesheet" type="text/css" href="css/webflow.css">
  <link rel="stylesheet" type="text/css" href="css/pronos-football.webflow.css">

  <link rel="shortcut icon" type="image/x-icon" href="images/pronos-foot-logo-small.png">
  <link rel="apple-touch-icon" href="images/pronos-foot-logo-large.png">

Se Connecter avec Facebook

      Comment JouerPrix à GagnerRèglesCalendrier des Matchs

PRONOS-FOOT.com

Site de Pronostics de Football 100% Gratuit

1

Inscription Simple et Rapide

2

Collectez des Points en Trouvant les Résultats des Matchs de L'EURO 2016

3

Devenez le Champion de Pronos-Foot.com et Gagnez un iPhone 6

Inscrivez-vous Maintenant !

Se Connecter avec Facebook

Gagnez un iPhone 6

Devenez le Champion de Pronos-Foot.com et Gagnez un iPhone 6.

Collectez le Maximum de Points en :

1

Trouvant le Vainqueur des Matchs:

1 Victoire de l'equipe à domicile   |  N Match nul  |  2 Victoire de l'equipe à l'exterieur

2

Trouvant le Score des Matchs

Nous vous Souhaitons de Bons Pronostics sur Pronos-Foot.com et Bonne Chance !

Règles

Le but est de pronostiquer le vainqueur et le score des rencontres de cette compétition. Le score dont on tient compte est celui après le temps réglementaire (prolongations incluses). Dans le cas d'un match à élimination directe et si une séance de but est nécessaire alors le résultat même de la séance de tirs au but n'est pas pris en compte.

Quelques exemples de pronostics sur le match de football France-Suisse :

Vous pensez que la France va gagner 3-0 au bout de 90 minutes : vous pronostiquez 3-0 pour la France

Vous pensez que les équipes seront à 1-1 au bout de 90 minutes mais que la France va gagner 3-1 après prolongations : vous pronostiquez 3-1 pour la France

Vous pensez que les équipes seront à 1-1 au bout de 90 minutes, 2-2 au bout de 120 minutes et que la France va gagner la séance de tirs au but par 5 tirs au but à 4 : vous pronostiquez 2-2 et spécifiez la France comme vainqueur de la rencontre

Le nombre de points que vos pronostics vous rapportent dépendent :

Du stade de la compétition auquel appartient le match (match de poule, quart de finale...)

De l'exactitude de votre pronostic :

bon vainqueur

bon vainqueur avec le score exact

TOUR

ELIMINATION

DIRECTE

BON VAINQUEUR

(MAIS MAUVAIS SCORE)

BON VAINQUEUR

ET BON SCORE

Groupes (A,B,C,D,E,F)

Non

10pts

30pts

1/8 Finale

Oui

20pts

60pts

1/4 Finale

Oui

30pts

90pts

1/2 Finale

Oui

40pts

120pts

Finale

Oui

60pts

250pts

EURO 2016 Calendrier

FRANCE

Groupe A | Vendredi 10 Juin, 21:00

ROUMANIE

ALBANIE

Groupe A | Samedi 11 Juin, 15:00

SUISSE

GALLES

Groupe B | Samedi 11 Juin, 18:00

SLOVAQUIE

ANGLETERRE

Groupe B | Samedi 11 Juin, 21:00

RUSSIE

TURQUIE

Groupe D | Dimanche 12 Juin, 15:00

CROATIE

POLOGNE

Groupe C | Dimanche 12 Juin, 18:00

IRLANDE DU NORD

ALLEMAGNE

Groupe C | Dimanche 12 Juin, 21:00

UKRAINE

ESPAGNE

Groupe D | Lundi 13 Juin, 15:00

REP. TCHEQUE

IRLANDE

Groupe E | Lundi 13 Juin, 18:00

SUEDE

BELGIQUE

Groupe E | Lundi 13 Juin, 21:00

ITALIE

AUTRICHE

Groupe F | Mardi 14 juin, 18:00

HONGRIE

PORTUGAL

Groupe F | Mardi 14 juin, 21:00

ISLANDE

RUSSIE

Groupe B | Mercredi 15 Juin, 15:00

SLOVAQUIE

ROUMANIE

Groupe A | Mercredi 15 Juin, 18:00

SUISSE

FRANCE

Groupe A | Mercredi 15 Juin, 21:00

ALBANIE

ANGLETERRE

Groupe B | Jeudi 16 Juin, 15:00

GALLES

UKRAINE

Groupe C | Jeudi 16 Juin, 18:00

IRLANDE DU NORD

ALLEMAGNE

Groupe C | Jeudi 16 Juin, 21:00

POLOGNE

ITALIE

Groupe E | Vendredi 17 juin, 15:00

SUEDE

REP. TCHEQUE

Groupe D | Vendredi 17 Juin, 18:00

CROATIE

ESPAGNE

Groupe D | Vendredi 17 Juin, 21:00

TURQUIE

BELGIQUE

Groupe E | Samedi 18 Juin, 15:00

IRLANDE

ISLANDE

Groupe F | Samedi 18 Juin, 18:00

HONGRIE

PORTUGAL

Groupe F | Samedi 18 Juin, 21:00

AUTRICHE

ROUMANIE

Groupe A | Dimanche 19 juin, 21:00

ALBANIE

SUISSE

Groupe A | Dimanche 19 Juin, 21:00

FRANCE

RUSSIE

Groupe B | Lundi 20 Juin, 21:00

GALLES

SLOVAQUIE

Groupe B | Lundi 20 Juin, 21:00

ANGLETERRE

UKRAINE

Groupe C | Mardi 21 Juin, 18:00

POLOGNE

IRLANDE DU NORD

Groupe C | Mardi 21 Juin, 18:00

ALLEMAGNE

REP. TCHEQUE

Groupe D | Mardi 21 Juin, 21:00

TURQUIE

CROATIE

Groupe D | Mardi 21 Juin, 21:00

ESPAGNE

ISLANDE

Groupe E | Mercredi 22 juin, 18:00

AUTRICHE

HONGRIE

Groupe E | Mercredi 22 juin, 18:00

PORTUGAL

ITALIE

Groupe F | Mercredi 22 juin, 21:00

IRLANDE

SUEDE

Groupe F | Mercredi 22 juin, 21:00

BELGIQUE

© 2016 PRONOS-FOOT.COM Tous droits réservés.

Site de Pronostics de Football 100% Gratuit

INSCRIVEZ-VOUS MAINTENANT !

Se Connecter avec Facebook

PRONOS-FOOT.COM

le service est édité par la société :

 Ecashcontent Limited

 Unit 1109, 11/F Dominion CTR

 43-59 Queen's RD East Wanchai

 HONG KONG


text:
看雪论坛Android版本,侵删。

# Thanks To:

Android-Universal-Image-Loader

android-async-http

material-dialogs

butterknife

EventBus

jsoup

gson


text:
layout: frontpage
header:
  image_fullwidth: Header_Main.jpg
widget1:
  title: "Passion"
  url: 'http://mxj5897.github.io/feeling-responsive/blog/'
  image: passion.jpg
  text: 'Personal Portfolio'
widget2:
  title: "About Me"
  url: 'http://mxj5897.github.io/feeling-responsive/info/'
  image: pexels-photo.jpg
  text: 'I am a third year ME/BS, Mechanical Engineering student at Rochester Institute of Technology (RIT). To learn more about me, click below'
widget3:
  title: "Contact Me"
  url: 'https://mxj5897.github.io/feeling-responsive/contact/'
  image: smartphone-friends-internet-connection.jpg
  text: 'Interested? Please get in touch.'
#
# Use the call for action to show a button on the frontpage
#
# To make internal links, just use a permalink like this
# url: /getting-started/
#
# To style the button in different colors, use no value
# to use the main color or success, alert or secondary.
# To change colors see sass/_01_settings_colors.scss
#
callforaction:
  url: /resume/
  text: Resume ›
  style: alert
permalink: /index.html
#
# This is a nasty hack to make the navigation highlight
# this page as active in the topbar navigation
#
homepage: true
---


text:
package com.dgwave.car.common;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.plugin.MojoExecutionException;
import org.codehaus.plexus.util.IOUtil;

/**
 * Static utilities to be used for Ceylon repos.
 *
 * @author Akber Choudhry
 */
public final class CeylonUtil {

    /**
     * Path separator.
     */
    public static final char PATH_SEPARATOR = '/';

    /**
     * Group separator.
     */
    public static final char GROUP_SEPARATOR = '.';

    /**
     * Artifact separator.
     */
    public static final char ARTIFACT_SEPARATOR = '-';

    /**
     * Initial StringBuilder size.
     */
    public static final int STRING_BUILDER_SIZE = 128;

    /**
     * Initial size of the buffer used to calculate checksums.
     */
    private static final int CHECKSUM_BUFFER_SIZE = 65536 * 2;

    /**
     * Regular buffer size.
     */
    private static final int BUFFER_SIZE = 4096;

    /**
     * Number of ways in which a Ceylon Java dependencies can be represented.
     */
    public static final int NUM_CEYLON_JAVA_DEP_TYPES = 4;

    /**
     * ceylon.repo.
     */
    public static final String CEYLON_REPO = "ceylon.repo";

    /**
     * Hidden constructor.
     */
    private CeylonUtil() {

    }

    /**
     * Replaces '.' with '/' to derive module path.
     * @param dotSep The dot-separated name to process
     * @return String The path with '.' replaced by '/'
     */
    public static String formatAsDirectory(final String dotSep) {
        if (dotSep == null || "".equals(dotSep)) {
            return "";
        }
        return dotSep.replace(GROUP_SEPARATOR, PATH_SEPARATOR);
    }

    public static String ceylonSystemFullPath(org.eclipse.aether.artifact.Artifact artifact, String type) {
        // TODO map to .ceylon/config mapping
        return systemRepo() + File.separator
            + ceylonRepoPath(artifact.getGroupId(), artifact.getArtifactId(),
                artifact.getVersion(), artifact.getClassifier(), type);
    }

    public static String systemRepo() {
        return System.getProperty("ceylon.repo", System.getProperty("user.home")
            + File.separator + ".ceylon" + File.separator + "repo");
    }

    public static String ceylonSystemFullPath(Artifact artifact, String type) {

        // TODO map to .ceylon/config mapping
        return systemRepo()

            + File.separator

            + ceylonRepoPath(artifact.getGroupId(), artifact.getArtifactId(),
            artifact.getVersion(), artifact.getClassifier(), type);
    }

    /**
     * Determines the relative path of a module atifact within a Ceylon repo.
     *
     * @param groupId Maven group id
     * @param artifactId Maven artifact id
     * @param version Version
     * @param classifier Sources, javadoc etc.
     * @param extension The extension or packaging of the artifact
     * @return String The computed path
     */
    public static String ceylonRepoPath(final String groupId, final String artifactId, final String version,
            final String classifier, final String extension) {

        StringBuilder path = new StringBuilder(STRING_BUILDER_SIZE);

        path.append(formatAsDirectory(groupId)).append(PATH_SEPARATOR);
        path.append(artifactId).append(PATH_SEPARATOR);
        path.append(version).append(PATH_SEPARATOR);
        path.append(ceylonModuleName(groupId, artifactId, version, classifier, extension));

        return path.toString();
    }

    /**
     * Comes up with a Ceylon module name based on Maven coordinates.
     *
     * @param groupId Maven group id
     * @param artifactId Maven artifact id
     * @param version Version
     * @param classifier Sources, javadoc etc.
     * @param extension The extension or packaging of the artifact
     * @return String The module name
     */
    public static String ceylonModuleName(final String groupId, final String artifactId, final String version,
            final String classifier, final String extension) {

        if (version == null || "".equals(version) || version.contains("-")) {
         // TODO fix the '-' based on the new Herd rules
            throw new IllegalArgumentException(" Null, empty, or '-' is not allowed in version");
        }

        StringBuilder name = new StringBuilder(STRING_BUILDER_SIZE);

        name.append(ceylonModuleBaseName(groupId, artifactId))
            .append(ARTIFACT_SEPARATOR).append(version);

        if (extension != null) {
            name.append(GROUP_SEPARATOR).append(extension);
        } else {
            name.append(GROUP_SEPARATOR).append("car");
        }

        return name.toString();
    }

    /**
     * Determines the Ceylon module name (without extension).
     *
     * @param groupId Maven group id
     * @param artifactId Maven artifact id
     * @return String The module base name
     */
    public static String ceylonModuleBaseName(final String groupId, final String artifactId) {
        if (groupId == null || artifactId == null || "".equals(artifactId) || artifactId.contains(".")) {
            throw new IllegalArgumentException(" Null or empty, or '.' is not allowed in artifactId");
        }
        return groupId + GROUP_SEPARATOR +  artifactId;
    }

    /**
     * Calculates the SHA1 checksum for a file using a crude method.
     *
     * @param installedFile  The installed artifact for which the checksum is being computed
     * @return String The SHA1 checksum
     * @throws MojoExecutionException In case of IO error or checksum calculation error
     */
    public static String calculateChecksum(final File installedFile) throws MojoExecutionException {
        int bufsize = CHECKSUM_BUFFER_SIZE;
        byte[] buffer = new byte[bufsize];
        FileInputStream fis = null;
        BufferedInputStream bis = null;
        String checksum = null;

        try {
            MessageDigest sha1 = MessageDigest.getInstance("SHA-1");

            fis = new FileInputStream(installedFile);
            sha1.reset();
            int size = fis.read(buffer, 0, bufsize);
            while (size >= 0) {
                sha1.update(buffer, 0, size);
                size = fis.read(buffer, 0, bufsize);
            }
            checksum = String.format("%040x", new BigInteger(1, sha1.digest()));
        } catch (Exception e) {
            throw new MojoExecutionException("Failed to calculate digest checksum for " + installedFile, e);
        } finally {
            IOUtil.close(bis);
            IOUtil.close(fis);
        }

        if (checksum != null) {
            return checksum;
        } else {
            throw new MojoExecutionException("Failed to calculate digest checksum for " + installedFile);
        }
    }

    /**
     * Extracts a single file from a zip archive.
     * @param in Input zip stream
     * @param outdir Output directory
     * @param name File name
     * @throws IOException In case of IO error
     */
    public static void extractFile(final ZipInputStream in, final File outdir, final String name) throws IOException {
        byte[] buffer = new byte[BUFFER_SIZE];
        BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(new File(outdir, name)));
        int count = -1;
        while ((count = in.read(buffer)) != -1) {
            out.write(buffer, 0, count);
        }
        out.close();
    }

    /**
     * Creates directories from an existing file to an additional path.
     * @param outdir Existing directory
     * @param path Additional path
     */
    public static void mkdirs(final File outdir, final String path) {
        File d = new File(outdir, path);
        if (!d.exists()) {
            d.mkdirs();
        }
    }

    /**
     * Returns the directory part of path string.
     * @param path Input path
     * @return String The directory part of the path
     */
    public static String dirpart(final String path) {
        int s = path.lastIndexOf(File.separatorChar);
        if (s != -1) {
            return path.substring(0, s);
        } else {
            return null;
        }
    }

    /***
     * Extract zipfile to outdir with complete directory structure.
     *
     * @param zipfile Input .zip file
     * @param outdir Output directory
     */
    public static void extract(final File zipfile, final File outdir) {
        try {
            ZipInputStream zin = new ZipInputStream(new FileInputStream(zipfile));
            ZipEntry entry;
            String name, dir;
            while ((entry = zin.getNextEntry()) != null) {
                name = entry.getName();
                if (entry.isDirectory()) {
                    mkdirs(outdir, name);
                    continue;
                }

                dir = dirpart(name);
                if (dir != null) {
                    mkdirs(outdir, dir);
                }

                extractFile(zin, outdir, name);
            }
            zin.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static Artifact toArtifact(String name, String version) {
        int d = name.lastIndexOf('.');
        String g = null, a = null;
        if (d == -1) {
            g = name; a = name;
        } else {
            g = name.substring(0, d); a = name.substring(d + 1);
        }
        return new DefaultArtifact(g, a, version, null, null, null, null);
    }
}


text:
<?php

return [
    /*
    |--------------------------------------------------------------------------
    | translations path
    |--------------------------------------------------------------------------
    */

    'langPath' => '/resources/lang',

    /*
    |--------------------------------------------------------------------------
    | Output file
    |--------------------------------------------------------------------------
    |
    | The javascript path where I will place the generated file.
    | Note: the path will be prepended to point to the App directory.
    |
    */

    'jsFile' => '/src/lang/vue-i18n-locales.generated.js'
];


text:
namespace oak {

	struct PrefabComponent {
		static const TypeInfo typeInfo;
		size_t id;
	};

	void pup(Puper& puper, PrefabComponent& data, const ObjInfo& info);

}


text:
<resources>
    <string name="app_name">SunmiDesign</string>
</resources>


text:
"use strict";
require('source-map-support').install({
    handleUncaughtExceptions: false
});
var chai_1 = require('chai');
var path = require('path');
var workload_href_meta_1 = require('../lib/models/workload-href-meta');
describe('WorkloadHrefMeta', function () {
    it('should parse working protocol', function () {
        var result = workload_href_meta_1.default.parse('working://module-name/lives/here:class-name');
        chai_1.assert.isNotNull(result);
        chai_1.assert.equal(result.modulePath, path.resolve('module-name/lives/here'));
        chai_1.assert.equal(result.className, 'class-name');
    });
    it('should parse a npm installed module', function () {
        var result = workload_href_meta_1.default.parse('some-package:className');
        chai_1.assert.isNotNull(result);
        chai_1.assert.equal(result.modulePath, 'some-package');
        chai_1.assert.equal(result.className, 'className');
    });
    it('should parse a node-workhorse module', function () {
        var result = workload_href_meta_1.default.parse(':ConsoleLogger');
        chai_1.assert.isNotNull(result);
        chai_1.assert.equal(result.modulePath, path.resolve(__dirname, '../../dist/index'));
        chai_1.assert.equal(result.className, 'ConsoleLogger');
    });
});
//# sourceMappingURL=workload-href-meta-spec.js.map


text:
<?php
namespace LazyRecord\Model;

class MetadataCollection  extends \LazyRecord\Model\MetadataCollectionBase {

}


text:
package net.krazyweb.starmodmanager.view;

import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import net.krazyweb.jfx.controls.ProgressIndicatorBar;

public class LoaderView {

	private Stage stage;

	private ProgressIndicatorBar bar;
	private Text text;

	public void build() {

		bar = new ProgressIndicatorBar();
		bar.setSize(250.0, 56.0);

		text = new Text("Loading");
		text.setId("progress-text");

		VBox box = new VBox();
		box.getChildren().addAll(
			text,
			bar
		);
		box.setAlignment(Pos.CENTER);
		box.setSpacing(34);

		Scene scene = new Scene(box, 450, 300);
		scene.getStylesheets().add(LoaderView.class.getClassLoader().getResource("theme_base.css").toString());
		scene.getStylesheets().add(LoaderView.class.getClassLoader().getResource("theme_green.css").toString());

		stage = new Stage();
		stage.setScene(scene);
		stage.setTitle("Loading");
		stage.centerOnScreen();
		stage.show();

	}

	public void close() {
		stage.close();
	}

	public ProgressIndicatorBar getProgressBar() {
		return bar;
	}

	public Text getText() {
		return text;
	}

}


text:
using System;
using System.Collections.Generic;

namespace OliveTree.Transitions.Curves
{
    public class Spring : AnimationCurve
    {
        public int Tension { get; set; } = 40;
        public int Friction { get; set; } = 7;

        public IEnumerable<double> Steps(int stepsPerSecond)
        {
            //Port of http://facebook.github.io/rebound/
            const double restVelocityThreshold = .001,
                distanceFromRestThreshold = .001,
                startValue = 0,    //we're building up an easing curve from 0-1ish, not end values
                endValue = 1.0;

            double stepTime = 1.0 / stepsPerSecond,
                halfStep = stepTime / 2.0;

            //Maps Origami parameters to this algorithm
            double tension = (Tension - 30.0) * 3.62 + 194.0,
                friction = (Friction - 8.0) * 3.0 + 25.0;
            double position = startValue,
                velocity = 0,
                seedPosition = 0;

            yield return startValue;
            do
            {
                var aVel = velocity;
                var aAcc = tension * (endValue - seedPosition) - friction * velocity;

                double bVel = velocity + aAcc * halfStep,
                    bAcc = tension * (endValue - (position + aVel * halfStep)) - friction * bVel;

                double cVel = velocity + bAcc * halfStep,
                    cAcc = tension * (endValue - (position + bVel * halfStep)) - friction * cVel;

                seedPosition = position + cVel * stepTime;
                double dVel = velocity + cAcc * stepTime,
                    dAcc = tension * (endValue - seedPosition) - friction * dVel;

                double dxdt = 1.0 / 6.0 * (aVel + 2.0 * (bVel + cVel) + dVel),
                    dvdt = 1.0 / 6.0 * (aAcc + 2.0 * (bAcc + cAcc) + dAcc);

                position += dxdt * stepTime;
                velocity += dvdt * stepTime;

                yield return position;
            } while (!(Math.Abs(velocity) < restVelocityThreshold) ||
                    (!(Math.Abs(endValue - position) <= distanceFromRestThreshold) && Math.Abs(tension) > .00001));
            yield return endValue;
        }
    }
}


text:
/*
 * Error handler
 * @req [Object] the request
 * @next [function] an optional callback
 */
module.exports  = function(req, next) {
  var self      = this
    , Error     = require("../../Error")

  return function(error) {
    if (req._isAborted){
      return
    }

    next.call(self
    , new Error.OriskamiConnectionError({
      "message"   : "An error occurred with the connection to Oriskami"
    , "detail"    : error })
    , null)
  }
}


text:
#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "D748EE8EF80EE59DF749191A74C0A51E"
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;

namespace CryptoNote {

    /// <summary>
    /// MainWindow
    /// </summary>
    public partial class MainWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {

        #line 6 "..\..\MainWindow.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.Button CoderButton;

        #line default
        #line hidden

        #line 7 "..\..\MainWindow.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.TextBox OutputText;

        #line default
        #line hidden

        #line 8 "..\..\MainWindow.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.TextBlock OpenFile;

        #line default
        #line hidden

        #line 9 "..\..\MainWindow.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.Button CoderButton_Copy;

        #line default
        #line hidden

        #line 10 "..\..\MainWindow.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.Button CoderButton_Copy1;

        #line default
        #line hidden

        #line 11 "..\..\MainWindow.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.TextBox key1;

        #line default
        #line hidden

        #line 12 "..\..\MainWindow.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.TextBox IntegetText;

        #line default
        #line hidden

        #line 15 "..\..\MainWindow.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.Button deadsec;

        #line default
        #line hidden

        #line 16 "..\..\MainWindow.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.Button deadsecDECSTKOV;

        #line default
        #line hidden

        #line 17 "..\..\MainWindow.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.Button CoderButton_Copy2;

        #line default
        #line hidden

        #line 18 "..\..\MainWindow.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.Button CoderButton_Copy3;

        #line default
        #line hidden

        private bool _contentLoaded;

        /// <summary>
        /// InitializeComponent
        /// </summary>
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
        public void InitializeComponent() {
            if (_contentLoaded) {
                return;
            }
            _contentLoaded = true;
            System.Uri resourceLocater = new System.Uri("/CryptoNote;component/mainwindow.xaml", System.UriKind.Relative);

            #line 1 "..\..\MainWindow.xaml"
            System.Windows.Application.LoadComponent(this, resourceLocater);

            #line default
            #line hidden
        }

        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
            switch (connectionId)
            {
            case 1:
            this.CoderButton = ((System.Windows.Controls.Button)(target));

            #line 6 "..\..\MainWindow.xaml"
            this.CoderButton.Click += new System.Windows.RoutedEventHandler(this.CoderButton_Click);

            #line default
            #line hidden
            return;
            case 2:
            this.OutputText = ((System.Windows.Controls.TextBox)(target));
            return;
            case 3:
            this.OpenFile = ((System.Windows.Controls.TextBlock)(target));
            return;
            case 4:
            this.CoderButton_Copy = ((System.Windows.Controls.Button)(target));

            #line 9 "..\..\MainWindow.xaml"
            this.CoderButton_Copy.Click += new System.Windows.RoutedEventHandler(this.CoderButton_Copy_Click);

            #line default
            #line hidden
            return;
            case 5:
            this.CoderButton_Copy1 = ((System.Windows.Controls.Button)(target));

            #line 10 "..\..\MainWindow.xaml"
            this.CoderButton_Copy1.Click += new System.Windows.RoutedEventHandler(this.CoderButton_Copy1_Click);

            #line default
            #line hidden
            return;
            case 6:
            this.key1 = ((System.Windows.Controls.TextBox)(target));
            return;
            case 7:
            this.IntegetText = ((System.Windows.Controls.TextBox)(target));
            return;
            case 8:
            this.deadsec = ((System.Windows.Controls.Button)(target));

            #line 15 "..\..\MainWindow.xaml"
            this.deadsec.Click += new System.Windows.RoutedEventHandler(this.deadsec_Click);

            #line default
            #line hidden
            return;
            case 9:
            this.deadsecDECSTKOV = ((System.Windows.Controls.Button)(target));

            #line 16 "..\..\MainWindow.xaml"
            this.deadsecDECSTKOV.Click += new System.Windows.RoutedEventHandler(this.deadsecDECSTKOV_Click);

            #line default
            #line hidden
            return;
            case 10:
            this.CoderButton_Copy2 = ((System.Windows.Controls.Button)(target));

            #line 17 "..\..\MainWindow.xaml"
            this.CoderButton_Copy2.Click += new System.Windows.RoutedEventHandler(this.CoderButton_Copy2_Click);

            #line default
            #line hidden
            return;
            case 11:
            this.CoderButton_Copy3 = ((System.Windows.Controls.Button)(target));

            #line 18 "..\..\MainWindow.xaml"
            this.CoderButton_Copy3.Click += new System.Windows.RoutedEventHandler(this.CoderButton_Copy3_Click);

            #line default
            #line hidden
            return;
            }
            this._contentLoaded = true;
        }
    }
}


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package harsha.api.solutions.em;

import harsha.api.EntityManager;
import harsha.api.solutions.vh.ValidationHandlerS3;

/**
 *
 * @author harshasraja
 */
public class EntityManagerS3 extends EntityManager{

    public EntityManagerS3() {
        super();
        setValidationHandler(new ValidationHandlerS3(this));
    }

}


text:
doctests:
	stack test jwt:doctests

clean:
	stack clean

.PHONY: clean doctests


text:
layout: post
title: Everything biology, now in Web of Science
categories:
- Library News and Events
- Research Online
tags:
- biosis
status: publish
type: post
published: true
meta:
  _edit_last: '16'
---
NU researchers already know about Web of Knowledge, the mega-database from the Institute for Scientific Information that's linked to the Journal Citation Reports.  Often used for broad searching and citation tracking, Web of Knowledge through the NU Libraries now goes much deeper with the addition of BIOSIS Previews, the premier journal article database in biology.

The NU Libraries have always offered BIOSIS; in fact, it was the very first online service that we ever licensed on the web, back in the palmy 1990's when home was a haven from library research, and every other database had to be searched on a CD-ROM network on the first floor of Snell Library.

Now we are shifting BIOSIS from the Ovid platform to Web of Knowledge.  With this change, you can search BIOSIS with numerous other journal citation databases across and beyond the sciences.  BIOSIS adds more international coverage to Web of Science, and it includes patents.  We hope this will be a real boon for interdisciplinary research.  Search "extraterrestrial life" and find scholarship from astronomy journals, journals in meteorology, astrobiology, medical sociology, and philosophy all in the same results set.   Indexing goes back to 1969.  Try BIOSIS and experience these expanded search results for yourself!


text:
package com.cerner.beadledom.guice.dynamicbindings;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import javax.inject.Qualifier;

/**
 * Test annotation.
 *
 * @author John Leacox
 */
@Qualifier
@Target({ FIELD, PARAMETER, METHOD })
@Retention(RUNTIME)
public @interface TestQualifier {
}


text:
<!DOCTYPE html>

        <meta charset="UTF-8">
        <title>Lesson 2</title>


text:
package javax.swing.colorchooser;

import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.text.ParseException;
import static java.util.Locale.ENGLISH;
import javax.swing.JFormattedTextField;
import javax.swing.JFormattedTextField.AbstractFormatter;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.DocumentFilter;

final class ValueFormatter extends AbstractFormatter implements FocusListener, Runnable {

    static void init(int length, boolean hex, JFormattedTextField text) {
        ValueFormatter formatter = new ValueFormatter(length, hex);
        text.setColumns(length);
        text.setFormatterFactory(new DefaultFormatterFactory(formatter));
        text.setHorizontalAlignment(SwingConstants.RIGHT);
        text.setMinimumSize(text.getPreferredSize());
        text.addFocusListener(formatter);
    }

    private final DocumentFilter filter = new DocumentFilter() {
        @Override
        public void remove(FilterBypass fb, int offset, int length) throws BadLocationException {
            if (isValid(fb.getDocument().getLength() - length)) {
                fb.remove(offset, length);
            }
        }

        @Override
        public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet set) throws BadLocationException {
            if (isValid(fb.getDocument().getLength() + text.length() - length) && isValid(text)) {
                fb.replace(offset, length, text.toUpperCase(ENGLISH), set);
            }
        }

        @Override
        public void insertString(FilterBypass fb, int offset, String text, AttributeSet set) throws BadLocationException {
            if (isValid(fb.getDocument().getLength() + text.length()) && isValid(text)) {
                fb.insertString(offset, text.toUpperCase(ENGLISH), set);
            }
        }
    };

    private final int length;
    private final int radix;

    private JFormattedTextField text;

    ValueFormatter(int length, boolean hex) {
        this.length = length;
        this.radix = hex ? 16 : 10;
    }

    @Override
    public Object stringToValue(String text) throws ParseException {
        try {
            return Integer.valueOf(text, this.radix);
        }
        catch (NumberFormatException nfe) {
            ParseException pe = new ParseException("illegal format", 0);
            pe.initCause(nfe);
            throw pe;
        }
    }

    @Override
    public String valueToString(Object object) throws ParseException {
        if (object instanceof Integer) {
            if (this.radix == 10) {
                return object.toString();
            }
            int value = (Integer) object;
            int index = this.length;
            char[] array = new char[index];
            while (0 < index--) {
                array[index] = Character.forDigit(value & 0x0F, this.radix);
                value >>= 4;
            }
            return new String(array).toUpperCase(ENGLISH);
        }
        throw new ParseException("illegal object", 0);
    }

    @Override
    protected DocumentFilter getDocumentFilter() {
        return this.filter;
    }

    public void focusGained(FocusEvent event) {
        Object source = event.getSource();
        if (source instanceof JFormattedTextField) {
            this.text = (JFormattedTextField) source;
            SwingUtilities.invokeLater(this);
        }
    }

    public void focusLost(FocusEvent event) {
    }

    public void run() {
        if (this.text != null) {
            this.text.selectAll();
        }
    }

    private boolean isValid(int length) {
        return (0 <= length) && (length <= this.length);
    }

    private boolean isValid(String text) {
        int length = text.length();
        for (int i = 0; i < length; i++) {
            char ch = text.charAt(i);
            if (Character.digit(ch, this.radix) < 0) {
                return false;
            }
        }
        return true;
    }
}


text:
Once you've run `bin/setup_heroku`, you should have 'cantino/huginn' as a remote in git.  (Check with `git remote -v`.)  Now, you can update your Heroku installation with the following commands:

```sh
git fetch origin
git merge origin/master
git push -f heroku master # note: this will wipe out any code changes that only exist on Heroku!
```


text:
package com.uber.hoodie.common.table.log.block;

import com.google.common.collect.Maps;
import com.uber.hoodie.common.model.HoodieLogFile;
import com.uber.hoodie.common.table.log.HoodieMergedLogRecordScanner;
import com.uber.hoodie.exception.HoodieException;
import com.uber.hoodie.exception.HoodieIOException;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.IOException;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nonnull;
import org.apache.hadoop.fs.FSDataInputStream;

/**
 * Abstract class defining a block in HoodieLogFile
 */
public abstract class HoodieLogBlock {

  /**
   * The current version of the log block. Anytime the logBlock format changes this version needs to
   * be bumped and corresponding changes need to be made to {@link HoodieLogBlockVersion} TODO :
   * Change this to a class, something like HoodieLogBlockVersionV1/V2 and implement/override
   * operations there
   */
  public static int version = 1;
  // Header for each log block
  private final Map<HeaderMetadataType, String> logBlockHeader;
  // Footer for each log block
  private final Map<HeaderMetadataType, String> logBlockFooter;
  // Location of a log block on disk
  private final Optional<HoodieLogBlockContentLocation> blockContentLocation;
  // data for a specific block
  private Optional<byte[]> content;
  // TODO : change this to just InputStream so this works for any FileSystem
  // create handlers to return specific type of inputstream based on FS
  // input stream corresponding to the log file where this logBlock belongs
  protected FSDataInputStream inputStream;
  // Toggle flag, whether to read blocks lazily (I/O intensive) or not (Memory intensive)
  protected boolean readBlockLazily;

  public HoodieLogBlock(@Nonnull Map<HeaderMetadataType, String> logBlockHeader,
      @Nonnull Map<HeaderMetadataType, String> logBlockFooter,
      @Nonnull Optional<HoodieLogBlockContentLocation> blockContentLocation,
      @Nonnull Optional<byte[]> content,
      FSDataInputStream inputStream,
      boolean readBlockLazily) {
    this.logBlockHeader = logBlockHeader;
    this.logBlockFooter = logBlockFooter;
    this.blockContentLocation = blockContentLocation;
    this.content = content;
    this.inputStream = inputStream;
    this.readBlockLazily = readBlockLazily;
  }

  // Return the bytes representation of the data belonging to a LogBlock
  public byte[] getContentBytes() throws IOException {
    throw new HoodieException("No implementation was provided");
  }

  public byte[] getMagic() {
    throw new HoodieException("No implementation was provided");
  }

  public HoodieLogBlockType getBlockType() {
    throw new HoodieException("No implementation was provided");
  }

  public long getLogBlockLength() {
    throw new HoodieException("No implementation was provided");
  }

  public Optional<HoodieLogBlockContentLocation> getBlockContentLocation() {
    return this.blockContentLocation;
  }

  public Map<HeaderMetadataType, String> getLogBlockHeader() {
    return logBlockHeader;
  }

  public Map<HeaderMetadataType, String> getLogBlockFooter() {
    return logBlockFooter;
  }

  public Optional<byte[]> getContent() {
    return content;
  }

  /**
   * Type of the log block WARNING: This enum is serialized as the ordinal. Only add new enums at
   * the end.
   */
  public enum HoodieLogBlockType {
    COMMAND_BLOCK,
    DELETE_BLOCK,
    CORRUPT_BLOCK,
    AVRO_DATA_BLOCK
  }

  /**
   * Log Metadata headers abstraction for a HoodieLogBlock WARNING : This enum is serialized as the
   * ordinal. Only add new enums at the end.
   */
  public enum HeaderMetadataType {
    INSTANT_TIME,
    TARGET_INSTANT_TIME,
    SCHEMA,
    COMMAND_BLOCK_TYPE
  }

  /**
   * Log Metadata footers abstraction for a HoodieLogBlock WARNING : This enum is serialized as the
   * ordinal. Only add new enums at the end.
   */
  public enum FooterMetadataType {
  }

  /**
   * This class is used to store the Location of the Content of a Log Block. It's used when a client
   * chooses for a IO intensive CompactedScanner, the location helps to lazily read contents from
   * the log file
   */
  public static final class HoodieLogBlockContentLocation {

    // The logFile that contains this block
    private final HoodieLogFile logFile;
    // The filePosition in the logFile for the contents of this block
    private final long contentPositionInLogFile;
    // The number of bytes / size of the contents of this block
    private final long blockSize;
    // The final position where the complete block ends
    private final long blockEndPos;

    HoodieLogBlockContentLocation(HoodieLogFile logFile, long contentPositionInLogFile,
        long blockSize, long blockEndPos) {
      this.logFile = logFile;
      this.contentPositionInLogFile = contentPositionInLogFile;
      this.blockSize = blockSize;
      this.blockEndPos = blockEndPos;
    }

    public HoodieLogFile getLogFile() {
      return logFile;
    }

    public long getContentPositionInLogFile() {
      return contentPositionInLogFile;
    }

    public long getBlockSize() {
      return blockSize;
    }

    public long getBlockEndPos() {
      return blockEndPos;
    }
  }

  /**
   * Convert log metadata to bytes 1. Write size of metadata 2. Write enum ordinal 3. Write actual
   * bytes
   */
  public static byte[] getLogMetadataBytes(Map<HeaderMetadataType, String> metadata)
      throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutputStream output = new DataOutputStream(baos);
    output.writeInt(metadata.size());
    for (Map.Entry<HeaderMetadataType, String> entry : metadata.entrySet()) {
      output.writeInt(entry.getKey().ordinal());
      byte[] bytes = entry.getValue().getBytes();
      output.writeInt(bytes.length);
      output.write(bytes);
    }
    return baos.toByteArray();
  }

  /**
   * Convert bytes to LogMetadata, follow the same order as
   * {@link HoodieLogBlock#getLogMetadataBytes}
   */
  public static Map<HeaderMetadataType, String> getLogMetadata(DataInputStream dis)
      throws IOException {

    Map<HeaderMetadataType, String> metadata = Maps.newHashMap();
    // 1. Read the metadata written out
    int metadataCount = dis.readInt();
    try {
      while (metadataCount > 0) {
        int metadataEntryIndex = dis.readInt();
        int metadataEntrySize = dis.readInt();
        byte[] metadataEntry = new byte[metadataEntrySize];
        dis.readFully(metadataEntry, 0, metadataEntrySize);
        metadata.put(HeaderMetadataType.values()[metadataEntryIndex], new String(metadataEntry));
        metadataCount--;
      }
      return metadata;
    } catch (EOFException eof) {
      throw new IOException("Could not read metadata fields ", eof);
    }
  }

  /**
   * Read or Skip block content of a log block in the log file. Depends on lazy reading enabled in
   * {@link HoodieMergedLogRecordScanner}
   */
  public static byte[] readOrSkipContent(FSDataInputStream inputStream,
      Integer contentLength, boolean readBlockLazily) throws IOException {
    byte[] content = null;
    if (!readBlockLazily) {
      // Read the contents in memory
      content = new byte[contentLength];
      inputStream.readFully(content, 0, contentLength);
    } else {
      // Seek to the end of the content block
      inputStream.seek(inputStream.getPos() + contentLength);
    }
    return content;
  }

  /**
   * When lazyReading of blocks is turned on, inflate the content of a log block from disk
   */
  protected void inflate() throws IOException {

    try {
      content = Optional.of(new byte[(int) this.getBlockContentLocation().get().getBlockSize()]);
      inputStream.seek(this.getBlockContentLocation().get().getContentPositionInLogFile());
      inputStream.readFully(content.get(), 0, content.get().length);
      inputStream.seek(this.getBlockContentLocation().get().getBlockEndPos());
    } catch (IOException e) {
      try {
        // TODO : fs.open() and return inputstream again, need to pass FS configuration
        // because the inputstream might close/timeout for large number of log blocks to be merged
        inflate();
      } catch (IOException io) {
        throw new HoodieIOException("unable to lazily read log block from disk", io);
      }
    }
  }

  /**
   * After the content bytes is converted into the required DataStructure by a logBlock, deflate the
   * content to release byte [] and relieve memory pressure when GC kicks in. NOTE: This still
   * leaves the heap fragmented
   */
  protected void deflate() {
    content = Optional.empty();
  }

}


text:
package com.amazonaws.services.cognitoidentity.model;

import com.amazonaws.AmazonServiceException;

/**
 * Thrown when a user is not authorized to access the requested resource.
 */
public class NotAuthorizedException extends AmazonServiceException {
    private static final long serialVersionUID = 1L;

    /**
     * Constructs a new NotAuthorizedException with the specified error message.
     *
     * @param message
     *        Describes the error encountered.
     */
    public NotAuthorizedException(String message) {
        super(message);
    }

}


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

        <title>Fabric8-analytics charts for repository ${repository}</title>
        <meta name="Author" content="Pavel Tisnovsky" />
        <meta name="Generator" content="Vim" />
        <meta http-equiv="Content-type"  content="text/html; charset=utf-8"/>
	<link href="bootstrap.min.css" rel="stylesheet" type="text/css" />

	<link href="dashboard.css" rel="stylesheet" type="text/css" />

                            Fabric8-analytics charts for repository ${repository}

Code coverage

Cyclomatic complexity

Maintainability index

Dead code

Common errors

Author: Pavel Tisnovsky <ptisnovs@redhat.com>

Generated on: ${generated_on}


text:
/* jshint unused: vars */

export default function() {
    return function(scope, element, attrs) {
        if (attrs.awToolTip) {
            return;
        }

        element.tooltip();
    };
}


text:
Ti=Technical Steering Committee ("{Def.TSC.sec}")

1.sec=Composition

1.1.sec=Startup Period: During the first six (6) months after project launch, the {_TSC} voting members shall consist of one (1) appointed representative from each Premier Member and each Top Level Project Maintainer, provided that no company (including related companies or affiliates under common control) shall have more than three (3) votes on the {_TSC}.

1.2.sec=Steady State: After the Startup Period, there shall be a nomination and election period for electing Contributors or Maintainers to the {_TSC}. The {_TSC} voting members shall consist of eleven (11) elected Contributors or Maintainers chosen by the Active Contributors. An Active Contributor is defined as any Contributor who has had a contribution accepted into the codebase during the prior twelve (12) months. The {_TSC} shall approve the process and timing for nominations and elections held on an annual basis.

1.=[G/Z/ol-i/s2]

2.0.sec={_TSC} projects generally will involve Maintainers and Contributors:

2.1.sec=Contributors: anyone in the technical community that contributes code, documentation or other technical artifacts to the {_HLP} codebase.

2.2.sec=Maintainers: Contributors who have the ability to commit code and contributions to a project's main branch on an {_HLP} project. A Contributor may become a Maintainer by a majority approval of the existing Maintainers.

2.=[G/Z/ol-i/s2]

3.0.sec=Participation in {_HLP} through becoming a Contributor and/or Maintainer is open to anyone. The {_TSC} may:

3.1.sec=establish work flows and procedures for the submission, approval and closure or archiving of projects,

3.2.sec=establish criteria and processes for the promotion of Contributors to Maintainer status, and

3.3.sec=amend, adjust and refine the roles of Contributors and Maintainers listed in Section 4.b., create new roles and publicly document responsibilities and expectations for such roles, as it sees fit.

3.=[G/Z/ol-i/s3]

4.sec=The {_TSC} shall elect a {_TSC} Chair, who will also serve as a voting member of the {_Governing_Board}, and is expected to act as a liaison between the {_Governing_Board} and technical leadership of {_HLP}.

=[G/Z/ol-a/s4]

5.0.sec=Responsibilities: The {_TSC} is responsible for:

5.1.sec=coordinating the technical direction of {_HLP};

5.2.sec=approving project proposals (including, but not limited to, incubation, deprecation and changes to a project's charter or scope) in accordance with a project lifecycle document to be developed, approved and maintained by the {_TSC};

5.3.sec=designating Top Level Projects;

5.4.sec=creating sub-committees or working groups to focus on cross-project technical issues or opportunities;

5.5.sec=communicating with external and industry organizations concerning Project technical matters;

5.6.sec=appointing representatives to work with other open source or standards communities;

5.7.sec=establishing community norms, workflows or policies for releases;

5.8.sec=discussing, seeking consensus, and where necessary, voting on technical matters relating to the code base that affect multiple projects; and

5.9.sec=establishing election processes for Maintainers or other leadership roles in the technical community that are not within the scope of any single project.

5.=[G/Z/ol-a/s9]

=[G/Z/ol-a/s5]


text:
/**
 * @file filesystem_test.cpp
 * @author Chase Geigle
 */

#include "test/filesystem_test.h"
#include "util/filesystem.h"

namespace meta
{
namespace testing
{

namespace
{
void num_lines_normal()
{
    {
        std::string data = "this is a test\ntwo lines\n";
        std::ofstream file{"filesystem-temp.txt", std::ios::binary};
        file.write(data.c_str(), data.length());
    }
    ASSERT_EQUAL(filesystem::num_lines("filesystem-temp.txt"), uint64_t{2});
}

void num_lines_notrailing()
{
    {
        std::string data = "this is a test\ntwo lines but no last newline";
        std::ofstream file{"filesystem-temp.txt", std::ios::binary};
        file.write(data.c_str(), data.length());
    }
    ASSERT_EQUAL(filesystem::num_lines("filesystem-temp.txt"), uint64_t{2});
}
}

int filesystem_tests()
{
    int failed = 0;
    filesystem::delete_file("filessytem-temp.txt");
    failed += testing::run_test("num-lines-normal", num_lines_normal);
    filesystem::delete_file("filessytem-temp.txt");
    failed += testing::run_test("num-lines-notrailing", num_lines_notrailing);
    filesystem::delete_file("filessytem-temp.txt");
    return failed;
}
}
}


text:
// This file is automatically generated.

package adila.db;

/*
 * LG Stylus2 4G
 *
 * DEVICE: ph2
 * MODEL: LG-K535
 */
final class ph2_lg2dk535 {
    public static final String DATA = "LG|Stylus2 4G|";
}