text:
define({
  "addTaskTip": "Dodaj vidžetu jedan ili više filtera i konfiguriši parametre za svaki od njih.",
  "enableMapFilter": "Uklonite unapred podešeni filter slojeva sa mape.",
  "newFilter": "Novi filter",
  "filterExpression": "Izraz filtera",
  "layerDefaultSymbolTip": "Koristi podrazumevani simbol sloja",
  "uploadImage": "Otpremi snimak",
  "selectLayerTip": "Izaberite sloj.",
  "setTitleTip": "Postavite naslov.",
  "noTasksTip": "Nema konfigurisanih filtera. Kliknite na \"${newFilter}\" da biste dodali novi."
});


text:
package geologger.saints.com.geologger.models;

/**
 * Created by Mizuno on 2015/04/06.
 */
public class TrajectoryStatisticalEntry {

    public static final String TID = "t_id";
    public static final String DURATION = "duration";
    public static final String DISTANCE = "distance";
    public static final String SPEED = "speed";
    public static final String TIMESTAMP = "timestamp";

    private String tid;
    private float duration;
    private float distance;
    private float speed;
    private String timestamp;

    public TrajectoryStatisticalEntry(String tid, float duration, float distance, float speed) {
        this.setTid(tid);
        this.setDuration(duration);
        this.setDistance(distance);
        this.setSpeed(speed);
    }

    public TrajectoryStatisticalEntry(String tid, float duration, float distance, float speed, String timestamp) {
        this(tid, duration, distance, speed);
        this.setTimestamp(timestamp);
    }

    public String getTid() {
        return tid;
    }

    public void setTid(String tid) {
        this.tid = tid;
    }

    public float getDuration() {
        return duration;
    }

    public void setDuration(float duration) {
        this.duration = duration;
    }

    public float getDistance() {
        return distance;
    }

    public void setDistance(float distance) {
        this.distance = distance;
    }

    public float getSpeed() {
        return speed;
    }

    public void setSpeed(float speed) {
        this.speed = speed;
    }

    public String getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.lightbend.lagom.javadsl.persistence.testkit

import akka.actor.ActorSystem
import com.lightbend.lagom.internal.persistence.testkit.PersistenceTestConfig
import com.lightbend.lagom.internal.persistence.testkit.{ AwaitPersistenceInit => InternalAwaitPersistenceInit }
import com.typesafe.config.Config

@deprecated("Internal class, not intended for direct use.", "1.5.0")
private class AwaitPersistenceInit extends InternalAwaitPersistenceInit

@deprecated("Internal interface, not intended for direct use.", "1.5.0")
trait AbstractTestUtil {
  def clusterConfig(): Config = PersistenceTestConfig.ClusterConfig

  def awaitPersistenceInit(system: ActorSystem): Unit = InternalAwaitPersistenceInit.awaitPersistenceInit(system)
}


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

<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="(C) Copyright 2005" />
<meta name="DC.rights.owner" content="(C) Copyright 2005" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta content="task" name="DC.Type" />
<meta name="DC.Title" content="Obtaining system information by using the API" />
<meta name="abstract" content="The getSysinfo method produces the same information as the sysinfo command." />
<meta name="description" content="The getSysinfo method produces the same information as the sysinfo command." />
<meta content="Network Server, sysinfo method, system information, obtaining" name="DC.subject" />
<meta content="Network Server, sysinfo method, system information, obtaining" name="keywords" />
<meta scheme="URI" name="DC.Relation" content="tadminconfigsysteminformation.html" />
<meta scheme="URI" name="DC.Relation" content="tadminconfig815768.html" />
<meta scheme="URI" name="DC.Relation" content="tadminappsruntimeinfo.html" />
<meta scheme="URI" name="DC.Relation" content="tadminconfig815822.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="tadminconfig815853" name="DC.Identifier" />
<meta content="en-us" name="DC.Language" />
<link href="commonltr.css" type="text/css" rel="stylesheet" />
<title>Obtaining system information by using the API</title>

Obtaining system information by using the API

The <samp class="codeph">getSysinfo</samp> method produces the same information
as the <samp class="codeph">sysinfo</samp> command.

The signature for this method is

String getSysinfo();

For example:

NetworkServerControl serverControl = new NetworkServerControl();
String myinfo = serverControl.getSysinfo();

The <samp class="codeph">getSysinfo</samp> method returns information about the Network
Server that is running on the current machine on the default port number
(1527).

Obtaining Network Server runtime information

Use the runtimeinfo command or the getRuntimeInfo method to get memory usage and current session information about the Network Server, including user, database, and prepared statement information.

Obtaining Network Server properties by using the getCurrentProperties method

The getCurrentProperties method is a Java method that you can use to obtain information about the Network Server.

Parent topic: Obtaining system information

Related tasks

Obtaining system information by using the command line


text:
package com.teamtreehouse.mememaker.ui.fragments;

import android.app.AlertDialog;
import android.app.Fragment;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.GridView;

import com.teamtreehouse.mememaker.R;
import com.teamtreehouse.mememaker.adapters.GridViewAdapter;
import com.teamtreehouse.mememaker.models.ImageGridItem;
import com.teamtreehouse.mememaker.ui.activities.CreateMemeActivity;
import com.teamtreehouse.mememaker.ui.activities.MemeSettingsActivity;
import com.teamtreehouse.mememaker.utils.FileUtilities;

import java.io.File;
import java.util.ArrayList;

public class ImageGridFragment extends Fragment {

    private GridView mGridView;
    private GridViewAdapter mGridAdapter;
    public static int RESULT_LOAD_IMAGE = 1000;

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_image_grid, container, false);
        mGridView = (GridView) rootView.findViewById(R.id.gridView);
        mGridAdapter = new GridViewAdapter(this.getActivity(), R.layout.view_grid, extractFiles());
        mGridView.setAdapter(mGridAdapter);
        mGridView.setOnItemClickListener(mOnItemClickListener);
        mGridView.setOnItemLongClickListener(mOnItemLongClickListener);
        this.setHasOptionsMenu(true);
        return rootView;
    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.image_list, menu);
        super.onCreateOptionsMenu(menu, inflater);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if(item.getItemId() == R.id.import_action) {
            Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
            startActivityForResult(intent, RESULT_LOAD_IMAGE);
        } else {
            if (item.getItemId() == R.id.settings_action) {
                Intent intent = new Intent(this.getActivity(), MemeSettingsActivity.class);
                startActivity(intent);
            }
        }

        return super.onOptionsItemSelected(item);
    }

    private ArrayList extractFiles() {
        final ArrayList imageItems = new ArrayList();
        File [] filteredFiles = FileUtilities.listFiles(this.getActivity());
        for(File filteredFile : filteredFiles) {
            Bitmap bitmap = BitmapFactory.decodeFile(filteredFile.getAbsolutePath());
            ImageGridItem item = new ImageGridItem(bitmap, filteredFile.getName(), filteredFile.getAbsolutePath());
            imageItems.add(item);
        }
        return imageItems;
    }

    private void resetGridAdapter() {
        mGridAdapter = new GridViewAdapter(this.getActivity(), R.layout.view_grid, extractFiles());
        mGridView.setAdapter(mGridAdapter);
    }

    protected AdapterView.OnItemClickListener mOnItemClickListener = new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            ImageGridItem imageGridItem = (ImageGridItem) adapterView.getAdapter().getItem(i);
            Intent intent = new Intent(ImageGridFragment.this.getActivity(), CreateMemeActivity.class);
            intent.putExtra(CreateMemeActivity.EXTRA_IMAGE_FILE_PATH, imageGridItem.getFullPath());
            Log.d("FILE:", imageGridItem.getFullPath());
            ImageGridFragment.this.getActivity().startActivity(intent);
        }
    };

    protected AdapterView.OnItemLongClickListener mOnItemLongClickListener = new AdapterView.OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
            final ImageGridItem imageGridItem = (ImageGridItem) adapterView.getAdapter().getItem(i);

            AlertDialog.Builder builder = new AlertDialog.Builder(ImageGridFragment.this.getActivity());
            builder.setTitle(R.string.dialog_confirm)
                    .setMessage(R.string.dialog_message_delete_file)
                    .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                            File fileToDelete = new File(imageGridItem.getFullPath());
                            boolean deleted = fileToDelete.delete();
                            if (deleted) {
                                ImageGridFragment.this.resetGridAdapter();
                            }
                        }
                    })
                    .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {

                        }
                    });
            builder.create().show();
            return true;
        }
    };
}


text:
cd $1/game_resources
mkdir -p ../assets
rm -f ../assets/resources.zip
zip -r -0 ../assets/resources.zip * -x "*/*.svn/*"


text:
import {SuperMap} from '../../SuperMap';
import {Collection} from './Collection';
import './LineString';

/**
 * @class SuperMap.Geometry.MultiLineString
 * @classdesc 几何对象多线类。
 * @category BaseTypes Geometry
 * @extends {SuperMap.Geometry.Collection}
 * @param {Array.<SuperMap.Geometry.LineString>} components - LineString 数组。
 * @example
 * var multi = new SuperMap.Geometry.MultiLineString([
 *      new SuperMap.Geometry.LineString([
 *          new SuperMap.Geometry.Point(1, 0),
 *          new SuperMap.Geometry.Point(0, 1)
 *      ])
 *  ]);
 */
export class MultiLineString extends Collection {

    constructor(components) {
        super(components);
        /**
         * @member {Array.<string>} [SuperMap.Geometry.MultiLineString.prototype.componentTypes=["SuperMap.Geometry.LineString"]]
         * @description components 存储的的几何对象所支持的几何类型数组。
         * @readonly
         */
        this.componentTypes = ["SuperMap.Geometry.LineString"];
        this.CLASS_NAME = "SuperMap.Geometry.MultiLineString";
        this.geometryType = "MultiLineString";
    }

}

SuperMap.Geometry.MultiLineString = MultiLineString;


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package eu.socialsensor.topicdetection;

import java.io.*;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author gpetkos
 */
public class MainConfiguration extends BasicConfiguration{

    public Properties getConfig(){
        if(config==null){
            ClassLoader loader=ClassLoader.getSystemClassLoader ();
            InputStream in = null;
            in = loader.getResourceAsStream ("main_parameters.properties");
            if (in != null)
            {
                config = new Properties ();
                try {
                    config.load (in); // Can throw IOException
                } catch (IOException ex) {
                    Logger.getLogger(MainConfiguration.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        return config;
    }

}


text:
use crate::callbacks::*;
use crate::types;

use super::auto::{AsAny, HasInner, Abstract};
use super::member::{Member, MemberBase, MemberInner};

has_reacted!(Visibility(types::Visibility): Member);

impl<II: HasVisibilityInner, T: HasInner<I = II> + Abstract + 'static> HasVisibilityInner for T {
    fn on_visibility_set(&mut self, member: &mut MemberBase, value: types::Visibility) -> bool {
        self.inner_mut().on_visibility_set(member, value)
    }
}


text:
<?php
/**
 * FileField configuration
 *
 * @author Virgil-Adrian Teaca - virgil@giulianaeassociati.com
 * @version 3.0
 */

return array(
    'path'        => base_path('files/:class_slug/:attribute/:unique_id-:file_name'),
    'defaultPath' => base_path('files/default.png')
);


text:
import datetime
import functools
import json

from django import http
from django.conf import settings
from django.core.exceptions import PermissionDenied

import olympia.core.logger

from . import models as context

task_log = olympia.core.logger.getLogger('z.task')

def login_required(f=None, redirect=True):
    """
    Like Django's login_required, but with to= instead of next=.

    If redirect=False then we return 401 instead of redirecting to the
    login page.  That's nice for ajax views.
    """

    def decorator(func):
        @functools.wraps(func)
        def wrapper(request, *args, **kw):
            # Prevent circular ref in accounts.utils
            from olympia.accounts.utils import redirect_for_login

            if request.user.is_authenticated:
                return func(request, *args, **kw)
            else:
                if redirect:
                    return redirect_for_login(request)
                else:
                    return http.HttpResponse(status=401)

        return wrapper

    if f:
        return decorator(f)
    else:
        return decorator

def post_required(f):
    @functools.wraps(f)
    def wrapper(request, *args, **kw):
        if request.method != 'POST':
            return http.HttpResponseNotAllowed(['POST'])
        else:
            return f(request, *args, **kw)

    return wrapper

def permission_required(permission):
    def decorator(f):
        @functools.wraps(f)
        @login_required
        def wrapper(request, *args, **kw):
            from olympia.access import acl

            if acl.action_allowed(request, permission):
                return f(request, *args, **kw)
            else:
                raise PermissionDenied

        return wrapper

    return decorator

def json_response(response, has_trans=False, status_code=200):
    """
    Return a response as JSON. If you are just wrapping a view,
    then use the json_view decorator.
    """
    # to avoid circular imports with users.models
    from .utils import AMOJSONEncoder

    if has_trans:
        response = json.dumps(response, cls=AMOJSONEncoder)
    else:
        response = json.dumps(response)
    return http.HttpResponse(
        response, content_type='application/json', status=status_code
    )

def json_view(f=None, has_trans=False, status_code=200):
    def decorator(func):
        @functools.wraps(func)
        def wrapper(*args, **kw):
            response = func(*args, **kw)
            if isinstance(response, http.HttpResponse):
                return response
            else:
                return json_response(
                    response, has_trans=has_trans, status_code=status_code
                )

        return wrapper

    if f:
        return decorator(f)
    else:
        return decorator

json_view.error = lambda s: http.HttpResponseBadRequest(
    json.dumps(s), content_type='application/json'
)

def use_primary_db(f):
    @functools.wraps(f)
    def wrapper(*args, **kw):
        with context.use_primary_db():
            return f(*args, **kw)

    return wrapper

def set_modified_on(f):
    """
    Will update the modified timestamp on the objects provided through
    the `set_modified_on` keyword argument, a short time after the wrapped
    function exits successfully (returns a truthy value).

    If that function returns a dict, it will also use that dict as additional
    keyword arguments to update on the provided objects.
    """
    from olympia.amo.tasks import set_modified_on_object

    @functools.wraps(f)
    def wrapper(*args, **kw):
        obj_info = kw.pop('set_modified_on', None)
        # obj_info is a tuple in the form of (app_label, model_name, pk)
        result = f(*args, **kw)
        if obj_info and result:
            # If the function returned a dict, pass that dict down as
            # kwargs to the set_modified_on_object task. Useful to set
            # things like icon hashes.
            kwargs_from_result = result if isinstance(result, dict) else {}
            task_log.info(
                'Delaying setting modified on object: %s, %s'
                % (obj_info[0], obj_info[1])
            )
            # Execute set_modified_on_object in NFS_LAG_DELAY seconds. This
            # allows us to make sure any changes have been written to disk
            # before changing modification date and/or image hashes stored
            # on objects - otherwise we could end up caching an old version
            # of an image on CDNs/clients for a very long time.
            set_modified_on_object.apply_async(
                args=obj_info,
                kwargs=kwargs_from_result,
                eta=(
                    datetime.datetime.now()
                    + datetime.timedelta(seconds=settings.NFS_LAG_DELAY)
                ),
            )
        return result

    return wrapper

def allow_cross_site_request(f):
    """Allow other sites to access this resource, see
    https://developer.mozilla.org/en/HTTP_access_control."""

    @functools.wraps(f)
    def wrapper(request, *args, **kw):
        response = f(request, *args, **kw)
        """If Access-Control-Allow-Credentials isn't set, the browser won't
        return data required cookies to see.  This is a good thing, let's keep
        it that way."""
        response['Access-Control-Allow-Origin'] = '*'
        response['Access-Control-Allow-Methods'] = 'GET'
        return response

    return wrapper

def allow_mine(f):
    @functools.wraps(f)
    def wrapper(request, user_id, *args, **kw):
        """
        If the author is `mine` then show the current user's collection
        (or something).
        """
        # Prevent circular ref in accounts.utils
        from olympia.accounts.utils import redirect_for_login

        if user_id == 'mine':
            if not request.user.is_authenticated:
                return redirect_for_login(request)
            user_id = request.user.id
        return f(request, user_id, *args, **kw)

    return wrapper


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
J. Linn. Soc. , Bot. 27: 115 (1890)

#### Original name
Thelephora abietina Pers., 1801

### Remarks
null


text:
require 'test_helper'

class HelpRequestTest < ActiveSupport::TestCase
  should validate_presence_of(:title)
  should validate_presence_of(:description)
  should validate_presence_of(:author)
  should validate_presence_of(:state)
  should belong_to(:author)
  should have_and_belong_to_many(:rescuers)

  test 'active should display valid only active requests' do
    2.times { FactoryBot.create(:help_request, state: 'active') }
    3.times { FactoryBot.create(:help_request, state: 'completed') }
    assert_equal 2, HelpRequest.active.count
  end
end


text:
import React from 'react'
import chai, {expect} from 'chai'
import sinon from 'sinon'
import sinonChai from 'sinon-chai'
import CurrencyInput from '../src/index'
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-dom/test-utils';
import setup from './setup'

chai.use(sinonChai);

describe('react-currency-input', function(){

    before('setup dom', function(){
        setup(); // setup the jsdom
    });

    describe('default arguments', function(){

        before('render and locate element', function() {
            this.renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput />
            );

            this.inputComponent = ReactTestUtils.findRenderedDOMComponentWithTag(
                this.renderedComponent,
                'input'
            );
        });

        it('<CurrencyInput> should have masked value of "0.00"', function() {
            expect(this.renderedComponent.getMaskedValue()).to.equal('0.00')
        });

        it('<input> should be of type "text"', function() {
            expect(this.inputComponent.getAttribute('type')).to.equal('text')
        });

        it('does not auto-focus by default', function() {
            expect(this.renderedComponent.props.autoFocus).to.be.false
        });
    });

    describe('custom arguments', function(){

        before('render and locate element', function() {
            this.renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput
                  decimalSeparator=","
                  thousandSeparator="."
                  precision="3"
                  value="123456789"
                  inputType="tel"
                  id="currencyInput"
                  autoFocus={true} />
            );

            this.inputComponent = ReactTestUtils.findRenderedDOMComponentWithTag(
                this.renderedComponent,
                'input'
            );
        });

        it('<CurrencyInput> should have masked value of "123.456,789"', function() {
            expect(this.renderedComponent.getMaskedValue()).to.equal('123.456.789,000')
        });

        it('<input> should be of type "tel"', function() {
            expect(this.inputComponent.getAttribute('type')).to.equal('tel')
        });

        it('should be auto focused', function() {
          var focusedElement = document.activeElement;
          expect(focusedElement.getAttribute('id')).to.equal("currencyInput");
        });
    });

    describe('properly convert number value props into display values', function(){

        it('adds decimals to whole numbers to match precision', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput precision="2" value={123456789} />
            );
            expect (renderedComponent.getMaskedValue()).to.equal('123,456,789.00')
        });

        it('Does not change value when precision matches', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput precision="2" value={1234567.89} />
            );
            expect (renderedComponent.getMaskedValue()).to.equal('1,234,567.89')
        });

        it('Rounds down properly when an number with extra decimals is passed in', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput precision="2" value={1234567.89123} />
            );
            expect (renderedComponent.getMaskedValue()).to.equal('1,234,567.89')
        });

        it('Rounds up properly when an number with extra decimals is passed in', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput precision="2" value={1234567.89999} />
            );
            expect (renderedComponent.getMaskedValue()).to.equal('1,234,567.90')
        });

        it('Rounds up the whole number when an number with extra decimals is passed in', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput precision="0" value={1234567.89999} />
            );
            expect (renderedComponent.getMaskedValue()).to.equal('1,234,568')
        });

        it('it handles initial value as the integer 0,', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput value={0} />
            );
            expect (renderedComponent.getMaskedValue()).to.equal('0.00')
        });

        it('it handles initial value as the float 0.00,', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput value={0.00} />
            );
            expect (renderedComponent.getMaskedValue()).to.equal('0.00')
        });

    });

    describe('properly convert string value props into display values', function(){

        it('adds decimals to whole numbers to match precision', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput precision="2" value="6300" />
            );
            expect (renderedComponent.getMaskedValue()).to.equal('6,300.00')
        });

        it('Does not change value when precision matches', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput precision="2" value="1234567.89" />
            );
            expect (renderedComponent.getMaskedValue()).to.equal('1,234,567.89')
        });

        it('Rounds down properly when an number with extra decimals is passed in', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput precision="2" value="1234567.89123" />
            );
            expect (renderedComponent.getMaskedValue()).to.equal('1,234,567.89')
        });

        it('Rounds up properly when an number with extra decimals is passed in', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput precision="2" value="1234567.89999" />
            );
            expect (renderedComponent.getMaskedValue()).to.equal('1,234,567.90')
        });

        it('Rounds up the whole number when an number with extra decimals is passed in', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput precision="0" value="1234567.89999" />
            );
            expect (renderedComponent.getMaskedValue()).to.equal('1,234,568')
        });

        it('Handles strings with separators', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput value="1,000.01" />
            );
            expect (renderedComponent.getMaskedValue()).to.equal('1,000.01')
        });

        it('Handles strings with prefixes', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput value="$10.01" prefix="$" />
            );
            expect (renderedComponent.getMaskedValue()).to.equal('$10.01')
        });

        it('Handles strings with suffixes', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput value="10.01 kr" suffix=" kr" />
            );
            expect (renderedComponent.getMaskedValue()).to.equal('10.01 kr')
        });

        it('Handles strings with custom separators', function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput value="123.456.789,12" decimalSeparator="," thousandSeparator="."/>
            );
            expect (renderedComponent.getMaskedValue()).to.equal('123.456.789,12')
        });

        it("Handles 1,234,567.89 format", function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput value="1,234,567.89" decimalSeparator="." thousandSeparator=","/>
            );
            expect (renderedComponent.getMaskedValue()).to.equal('1,234,567.89')
        });

        it("Handles 1 234 567.89 format", function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput value="1,234,567.89" decimalSeparator="." thousandSeparator=" "/>
            );
            expect (renderedComponent.getMaskedValue()).to.equal('1 234 567.89')
        });

        it("Handles 1 234 567,89 format", function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput value="1 234 567,89" decimalSeparator="," thousandSeparator=" "/>
            );
            expect (renderedComponent.getMaskedValue()).to.equal('1 234 567,89')
        });

        it("Handles 1,234,567·89 format", function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput value="1,234,567·89" decimalSeparator="·" thousandSeparator=","/>
            );
            expect (renderedComponent.getMaskedValue()).to.equal('1,234,567·89')
        });

        it("Handles 1.234.567,89 format", function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput value="1.234.567,89" decimalSeparator="," thousandSeparator="."/>
            );
            expect (renderedComponent.getMaskedValue()).to.equal('1.234.567,89')
        });

        it("Handles 1˙234˙567,89 format", function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput value="1˙234˙567,89" decimalSeparator="," thousandSeparator="˙"/>
            );
            expect (renderedComponent.getMaskedValue()).to.equal('1˙234˙567,89')
        });

        it("Handles 1'234'567.89 format", function() {
            var renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput value="1'234'567.89" decimalSeparator="." thousandSeparator="'"/>
            );
            expect (renderedComponent.getMaskedValue()).to.equal("1'234'567.89")
        });

    });

    describe('change events', function(){

        before('render and locate element', function() {
            this.handleChange = sinon.spy();

            this.renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput onChange={this.handleChange} value="0"/>
            );

            this.inputComponent = ReactTestUtils.findRenderedDOMComponentWithTag(
                this.renderedComponent,
                'input'
            );
        });

        it('should call onChange', function() {
            this.inputComponent.value=123456789;
            ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.handleChange).to.have.been.calledWith("1,234,567.89", 1234567.89);
        });

        it('should change the masked value', function() {
            this.inputComponent.value=123456789;
            ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal("1,234,567.89");
        });

        it('should change the component value', function() {
            this.inputComponent.value=123456789;
            ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.inputComponent.value).to.equal("1,234,567.89");
        });

    });

    describe('negative numbers', function() {

        before('render and locate element', function() {
            this.renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput onChange={this.handleChange} value="0" allowNegative={true}/>
            );

            this.inputComponent = ReactTestUtils.findRenderedDOMComponentWithTag(
                this.renderedComponent,
                'input'
            );
        });

        beforeEach('reset value to 0', function() {
            this.inputComponent.value = "0";
            ReactTestUtils.Simulate.change(this.inputComponent);
        });

        it('should render 0 without negative sign', function() {
            expect(this.renderedComponent.getMaskedValue()).to.equal('0.00');
            this.inputComponent.value = "-0"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('0.00');
        });

        it('should render number with no or even number of "-" as positive', function() {
            expect(this.renderedComponent.getMaskedValue()).to.equal('0.00');
            this.inputComponent.value = "123456"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('1,234.56');
            this.inputComponent.value = "--123456"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('1,234.56');
            this.inputComponent.value = "123--456"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('1,234.56');
            this.inputComponent.value = "123456--"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('1,234.56');
            this.inputComponent.value = "--123--456--"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('1,234.56');
            this.inputComponent.value = "123456----"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('1,234.56');
        });

        it('should render number with odd number of "-" as negative', function() {
            expect(this.renderedComponent.getMaskedValue()).to.equal('0.00');
            this.inputComponent.value = "-123456"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('-1,234.56');
            this.inputComponent.value = "123-456"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('-1,234.56');
            this.inputComponent.value = "123456-"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('-1,234.56');
            this.inputComponent.value = "-123-456-"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('-1,234.56');
        });

        it('should correctly change between negative and positive numbers', function() {
            expect(this.renderedComponent.getMaskedValue()).to.equal('0.00');
            this.inputComponent.value = "123456"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('1,234.56');
            this.inputComponent.value = "1,234.56-"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('-1,234.56');
            this.inputComponent.value = "-1,234.56-"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('1,234.56');
            this.inputComponent.value = "1-,234.56"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('-1,234.56');
            this.inputComponent.value = "-1,234.-56"; ReactTestUtils.Simulate.change(this.inputComponent);
            expect(this.renderedComponent.getMaskedValue()).to.equal('1,234.56');
        });

    });

    describe('currency prefix', function() {

        before('render and locate element', function () {
            this.renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput onChange={this.handleChange} value="0" prefix="$"/>
            );

            this.inputComponent = ReactTestUtils.findRenderedDOMComponentWithTag(
                this.renderedComponent,
                'input'
            );
        });

        it('should render the prefix', function() {
            expect(this.renderedComponent.getMaskedValue()).to.equal('$0.00');
        });

    });

    describe('currency suffix', function() {

        before('render and locate element', function () {
            this.renderedComponent = ReactTestUtils.renderIntoDocument(
                <CurrencyInput onChange={this.handleChange} value="0" suffix=" kr"/>
            );

            this.inputComponent = ReactTestUtils.findRenderedDOMComponentWithTag(
                this.renderedComponent,
                'input'
            );
        });

        it('should render the suffix', function() {
            expect(this.renderedComponent.getMaskedValue()).to.equal('0.00 kr');
        });

    });

    describe('input selection', function() {
        let defaultProps = {
            allowNegative: true,
            handleChange: () => {},
            value: '0',
            prefix: '$',
            suffix: ' s'
        };
        let divElem;
        let renderComponent = function(props = {}) {
            divElem = document.createElement('div');
            document.body.appendChild(divElem);

            const componentProps = Object.assign({}, defaultProps, props);

            const renderedComponent = ReactDOM.render(
                <CurrencyInput {...componentProps} />,
                divElem
            );
            const inputComponent = ReactTestUtils.findRenderedDOMComponentWithTag(
                renderedComponent,
                'input'
            );

            inputComponent.value = "0";
            ReactTestUtils.Simulate.change(inputComponent);

            return { renderedComponent, inputComponent };
        };

        after('clean up dom', function() {
            document.body.removeChild(divElem);
        });

        it('sanity - renders "$0.00 s"', function() {
            const { renderedComponent } = renderComponent();
            expect(renderedComponent.getMaskedValue()).to.equal('$0.00 s');
        });

        it('should consider precision absence', function() {
            const { inputComponent } = renderComponent({ precision: 0 });

            expect(inputComponent.selectionStart).to.equal(2);
            expect(inputComponent.selectionEnd).to.equal(2);
        });

        xit('should highlight number on focus', function() {
            const { inputComponent } = renderComponent();
            ReactTestUtils.Simulate.focus(inputComponent);
            expect(inputComponent.selectionStart).to.equal(1);
            expect(inputComponent.selectionEnd).to.equal(5);
        });

        xit('should consider the negative sign when highlighting', function() {
            const { inputComponent } = renderComponent();

            inputComponent.value = '-4.35';
            ReactTestUtils.Simulate.change(inputComponent);

            ReactTestUtils.Simulate.focus(inputComponent);
            expect(inputComponent.selectionStart).to.equal(2);
            expect(inputComponent.selectionEnd).to.equal(6);
        });

        xit('should adjust start/end by 1 when entering a number', function() {
            const { inputComponent } = renderComponent();

            inputComponent.value = '134';
            ReactTestUtils.Simulate.change(inputComponent);
            ReactTestUtils.Simulate.focus(inputComponent);

            inputComponent.setSelectionRange(1, 1);
            inputComponent.value = '1234';
            ReactTestUtils.Simulate.change(inputComponent);

            expect(inputComponent.selectionStart).to.equal(2);
            expect(inputComponent.selectionEnd).to.equal(2);
        });

    });

});


text:
<!DOCTYPE html>

		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>News - Summary Extraction</title>
		<link rel="stylesheet" href="css/bootstrap.css">
		<link rel="stylesheet" href="css/news.css">

		Zenefits' Leader Is Rattling an Industry, So Why Is He Stressed Out? - ...

		www.nytimes.com

			Parker Conrad's start-up, Zenefits, is thought to be one of the fastest-growing companies in recent Silicon Valley history, and his investors and ...

		Venture Capitalist Sounds Alarm on Startup Investing

		online.wsj.com

			Silicon Valley may have taken on more risk than it can handle, according to prominent venture capitalist Bill Gurley, who cited potential cracks in ...

		Why India's Mars mission is so cheap - and thrilling

		www.bbc.co.uk

			India's Mangalyaan satellite is staggeringly cheap by Western standards - but it hopes to address some of the biggest questions on Mars, writes the ...

		Peter Thiel, technology entrepreneur and investor. AMA • /r/IAmA

		www.reddit.com

			**My short bio:** Hi, I'm Peter Thiel, co-founder of PayPal and Palantir, first investor in Facebook, venture capitalist at Founders Fund, and...

		A Watch Guy's Thoughts On The Apple Watch After Seeing It In The Metal ...

		www.hodinkee.com

			I'm not even sure we can call it a watch. Okay, it goes on the wrist, and it happens to tell the time, but that's about where the similarities ...

		Health Insurance Marketplace, Affordable Care Act

		www.healthcare.gov

			Learn how the health care law affects you at Healthcare.gov. The official site of the Health Insurance Marketplace. See your health insurance choices.

		Coke reaps rewards after putting names on cans and bottles - Telegraph

		www.telegraph.co.uk

			Sales of Coke climb significantly after Coca-Cola start putting people's names on cans and bottles

		The Secret Goldman Sachs Tapes

		www.bloombergview.com

			The public doesn't seem to understand just how dysfunctional our financial regulatory system is, Michael Lewis writes. That may change today with a ...

		Shellshock: All you need to know about the Bash Bug vulnerability

		www.symantec.com

			Web servers at risk as new vulnerability potentially affects most versions of Linux and Unix, as well as Mac OS X.

		Dreamforce '14 - Register for a Free Expo+ pass and we'll donate a meal to ...

		www.salesforce.com

			Dreamforce '14 - Register for a Free Expo+ pass and we'll donate a meal to the hungry

		On 'Dark Talent', MOOCs, Universities, and Startups: An Interview with the ...

		a16z.com

			We're bringing together a great group of computer science professors from around the U.S. for talks and discussion as part of our second annual ...

		Apple Is More Like a Band than a Company

		blogs.hbr.org

			It makes stuff it loves – and doesn't care what you think.

		America's Promise

		www.americaspromise.org

			President Obama Becomes The 7th President to Sign Summit Declaration

		Demystifying Venture Capital Economics, Part 2 - Wealthfront ...

		blog.wealthfront.com

			Just because a company operates at a loss today doesn't mean it can't be profitable in the future. Those unfamiliar with venture capital economics ...

		HOW NOT TO BE A SHITTY ADVISOR

		medium.com

			There are numerous ways we give each other advice in the technology company ecosystem. There are formal relationships li…

		OpenGov: The Startup Analyzing $50B in Spending | Andreessen Horowitz

		a16z.com

			"A billion here, a billion there, and pretty soon you're talking real money!" — attributed to Fmr. Sen. Everett Dirksen

		Why India's Mars mission is so cheap - and thrilling

		www.bbc.com

			India's Mangalyaan satellite is staggeringly cheap by Western standards - but it hopes to address some of the biggest questions on Mars, writes the ...

		How One Silicon Valley Exec Landed Her First Fortune 500 Board Seat | ...

		a16z.com

			Gerri Elliott

		Emma Watson Nude Photo Threat Was a Prank Aimed at 4Chan

		mashable.com

			The website that threatened to release nude photographs of Emma Watson turned out to be a viral marketing campaign.

		Lecture 1 - How to Start a Startup

		www.youtube.com

			Sam Altman and Dustin Moskovitz start off the How to Start a Startup Course. Sam's topic is "Ideas, Products, Teams and Execution, Part I" and ...

		Global Ebola Response Coalition | The UN family's and partners' response ...

		www.ebolacrisisresponse.org

			The Ebola epidemic in West Africa requires a coordinated, system wide response by the UN and its partners facilitated by the Global Ebola Response ...

		Europe shows negative interest rates not absurd – and might work - FT.com

		www.ft.com

			Imagine borrowing money – but paying back less than the original sum. Absurd? Welcome to the new world of continental European financial markets. ...

		Not sure what to bring to the NY Climate Summit? Just ask Denmark.

		www.greenpeace.org

			Climate change is back on the global political agenda. On September 23rd, world leaders from government, finance, business and civil society will ...

		Salesforce and Omnicom Ink Marketing Cloud, CRM Deal | Digital - ...

		adage.com

			You've read all of your free items this month.

		Connect Apps, Products and Spaces with Journey Builder for Apps - YouTube

		www.youtube.com

		Livestream

		www.exacttarget.com

		How Philosophy Makes You a Better Leader

		blogs.hbr.org

			An exercise to help you understand your behavior.

		Why Cisco Showered Three Men With Billions - Business Insider

		www.businessinsider.com

			There are three legendary engineers at Cisco known as "the heart, soul and brains" of the company: Mario Mazzola, Prem Jain and Luca Cafiero.

		Report: iPhone 6 Plus Activations Are a Fraction of Those for iPhone 6

		mashable.com

			The adoption rate for the iPhone 6 Plus is 0.2%, compared with 1.5% for the iPhone 6.

		Entrepreneurs anonymous

		www.economist.com

			SEVEN years ago Joe Jones (not his real name) left his job with a big NASDAQ-listed company to strike out on his own. He was sick of corporate life ...


text:
'use strict';

const common = require('../common');
if (!common.hasCrypto)
  common.skip('missing crypto');
const assert = require('assert');
const h2 = require('http2');

// Http2ServerResponse.flushHeaders

let serverResponse;

const server = h2.createServer();
server.listen(0, common.mustCall(function() {
  const port = server.address().port;
  server.once('request', common.mustCall(function(request, response) {
    response.flushHeaders();
    response.flushHeaders(); // Idempotent
    common.expectsError(() => {
      response.writeHead(400, { 'foo-bar': 'abc123' });
    }, {
      code: 'ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND'
    });

    response.on('finish', common.mustCall(function() {
      server.close();
    }));
    serverResponse = response;
  }));

  const url = `http://localhost:${port}`;
  const client = h2.connect(url, common.mustCall(function() {
    const headers = {
      ':path': '/',
      ':method': 'GET',
      ':scheme': 'http',
      ':authority': `localhost:${port}`
    };
    const request = client.request(headers);
    request.on('response', common.mustCall(function(headers, flags) {
      assert.strictEqual(headers['foo-bar'], undefined);
      assert.strictEqual(headers[':status'], 200);
      serverResponse.end();
    }, 1));
    request.on('end', common.mustCall(function() {
      client.destroy();
    }));
    request.end();
    request.resume();
  }));
}));


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

	<!-- ActiveMQ -->

	<!-- embedded ActiveMQ Broker -->
	<!--
	<amq:broker useJmx="false" persistent="false">
		<amq:transportConnectors>
			<amq:transportConnector uri="tcp://localhost:61616" />
		</amq:transportConnectors>
	</amq:broker>

	-->

	<amq:queue id="notificationQueue" physicalName="backtype.storm.contrib.example.queue" />

	<amq:topic id="notificationTopic" physicalName="backtype.storm.contrib.example.topic" />

	<amq:connectionFactory id="jmsConnectionFactory"
		brokerURL="tcp://52.201.251.165:61616" />

<!--
	<bean id="queueTemplate" class="org.springframework.jms.core.JmsTemplate">
		<property name="connectionFactory">
			<ref bean="jmsConnectionFactory" />
		</property>
		<property name="pubSubDomain" value="false" />
	</bean>
	-->

</beans>


text:
package cgta.oscala
package util

import scala.collection.mutable.ListBuffer
import scala.annotation.tailrec
import scala.util.control.NonFatal

//////////////////////////////////////////////////////////////
// Copyright (c) 2014 Ben Jackman
// All Rights Reserved
// please contact ben@jackman.biz
// for licensing inquiries
// Created by bjackman @ 6/17/14 11:24 AM
//////////////////////////////////////////////////////////////

object StackTracer {

  def trace(e: Throwable): List[String] = {
    val lb = new ListBuffer[Either[String, StackTraceElement]]
    @tailrec
    def loop(e: Throwable) {
      val msg = try {e.getMessage} catch {case NonFatal(_) => "UNABLE TO DISPLAY EXCEPTION MESSAGE"}
      val name = e.getClass.getName
      lb += Left(name + ": " + msg)
      lb ++= e.getStackTrace.map(Right(_))
      val cause = e.getCause
      if (cause != null) loop(cause)
    }
    loop(e)
    trace(lb.toList)
  }

  def trace(t: Seq[Either[String, StackTraceElement]]): List[String] = {
    val lb = new ListBuffer[String]
    var first = true
    t.foreach {
      case Left(msg) =>
        lb += (if (first) "Exception " else "Caused by: ") + msg
        first = false
      case Right(ste) =>
        lb += "  at " + ste.toString
    }
    lb.toList
  }

}


text:
require 'test_helper'

class LinksReportWorkerTest < ActiveSupport::TestCase

  test '#perform checks links and updates the report with the results' do
    links_report = create(:links_report, links: %w(good_link bad_link))

    stub_request(:get, 'good_link').to_return(status: 200)
    stub_request(:get, 'bad_link').to_return(status: 404)

    LinksReportWorker.new.perform(links_report.id)

    assert links_report.reload.completed?
    assert_equal ['bad_link'], links_report.broken_links
  end
end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Russula lepida var. sapinea Zvára

### Remarks
null


text:
<?php

use Praxigento_Bonus_Config as Config;
use Praxigento_Bonus_Model_Own_Payout as Payout;

/**
 * User: Alex Gusev <alex@flancer64.com>
 */
class Praxigento_Bonus_Block_Adminhtml_Own_Sales_Bonus_Grid_Payout_Grid
    extends Mage_Adminhtml_Block_Widget_Grid {
    const AS_CUST_ID = 'customer_inc';

    public function __construct() {
        parent::__construct();
        $this->setId('prxgt_bonus_grid_payout');
        $this->setDefaultSort(Payout::ATTR_ID);
        $this->setDefaultDir('DESC');
        //        $this->setSaveParametersInSession(true);
    }

    protected function _prepareCollection() {
        /** @var  $collection Praxigento_Bonus_Resource_Own_Payout_Collection */
        $collection = Mage::getResourceModel(Config::CFG_MODEL . '/own_payout_collection');
        /* JOIN customer_entity */
        $tbl = array( 'cust' => 'customer/entity' );
        $cond = 'main_table.' . Payout::ATTR_CUSTOMER_ID . '=cust.entity_id';
        $cols = array( self::AS_CUST_ID => Nmmlm_Core_Config::ATTR_CUST_MLM_ID );
        $collection->join($tbl, $cond, $cols);
        /* prepare collection */
        $sql = $collection->getSelectSql(true);
        $this->setCollection($collection);
        parent::_prepareCollection();
        return $this;
    }

    protected function _prepareColumns() {
        $helper = Mage::helper(Config::CFG_HELPER);
        $currency = (string)Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE);

        $this->addColumn(Payout::ATTR_ID, array(
            'header' => $helper->__('#'),
            'filter' => false,
            'index'  => Payout::ATTR_ID
        ));

        $this->addColumn(Payout::ATTR_DATE_CREATED, array(
            'header' => $helper->__('Created at'),
            'filter' => false,
            'index'  => Payout::ATTR_DATE_CREATED,
            'type'   => 'datetime'
        ));

        $this->addColumn(self::AS_CUST_ID, array(
            'header' => $helper->__('Customer #'),
            'filter' => false,
            'index'  => self::AS_CUST_ID
        ));

        $this->addColumn(Payout::ATTR_AMOUNT, array(
            'header'        => $helper->__('Amount'),
            'index'         => Payout::ATTR_AMOUNT,
            'type'          => 'currency',
            'filter'        => false,
            'currency_code' => $currency
        ));

        $this->addColumn(Payout::ATTR_DESC, array(
            'header' => $helper->__('Description'),
            'filter' => false,
            'index'  => Payout::ATTR_DESC
        ));

        $this->addColumn(Payout::ATTR_REFERENCE, array(
            'header' => $helper->__('eWallet Ref.'),
            'filter' => false,
            'index'  => Payout::ATTR_REFERENCE
        ));

        $this->addColumn(Payout::ATTR_DATE_PAID, array(
            'header' => $helper->__('Paid at'),
            'filter' => false,
            'index'  => Payout::ATTR_DATE_PAID,
            'type'   => 'datetime'
        ));

        return parent::_prepareColumns();
    }

}


text:
<?php
namespace App\Entity;

use Doctrine\ORM\EntityRepository;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Doctrine\ORM\NoResultException;

/**
 * Class UserRepository
 * @package App\Entity
 */
class UserRepository extends EntityRepository implements UserProviderInterface
{

    /**
     * Loads the user for the given username.
     * @param string $username
     * @return mixed
     * @throws \Symfony\Component\Security\Core\Exception\UsernameNotFoundException
     */
    public function loadUserByUsername($username)
    {
        $q = $this
          ->createQueryBuilder('u')
          ->where('u.username = :username')
          ->setParameter('username', $username)
          ->getQuery()
        ;
        try {
            $user = $q->getSingleResult();
        } catch (NoResultException $e) {
            throw new UsernameNotFoundException(sprintf('Impossible de trouver un utilisateur avec l\'identifiant "%s".', $username));
        }
        return $user;
    }

    /**
     * Loads the user for the given username.
     * @param UserInterface $user
     * @return bool
     */
    public function equals(UserInterface $user)
    {
        return $this->username === $user->getUsername();
    }

    /**
     * Refreshes the user for the account interface.
     * @param UserInterface $user
     * @return null|object
     * @throws \Symfony\Component\Security\Core\Exception\UnsupportedUserException
     */
    public function refreshUser(UserInterface $user)
    {
        $class = get_class($user);
        if (!$this->supportsClass($class)) {
            throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $class));
        }
        return $this->find($user->getId());
    }

    /**
     * Whether this provider supports the given user class
     * @param string $class
     * @return bool
     */
    public function supportsClass($class)
    {
        return $this->getEntityName() === $class || is_subclass_of($class, $this->getEntityName());
    }
}


text:
import csv
from collections import OrderedDict, Callable
from io import StringIO, BytesIO

import six
from django.http import StreamingHttpResponse

__all__ = ("formats", )

class FormatsException(Exception):
    pass

class Formats(OrderedDict):

    def add(self, format):
        parent = self

        def decorator(func):
            if isinstance(func, Callable):
                parent.update({format: func})
            else:
                raise FormatsException("func is not a function.")

        return decorator

formats = Formats()

# Taken from http://docs.python.org/library/csv.html#csv-examples
class UnicodeWriter(object):
    """
    A CSV writer which will write rows to CSV file "f",
    which is encoded in the given encoding.
    """

    def __init__(self, dialect=csv.excel_tab, encoding="utf-8", **kwds):
        # Redirect output to a queue
        self.queue = BytesIO() if six.PY2 else StringIO()
        self.writer = csv.writer(self.queue, dialect=dialect, **kwds)

    def _encode(self, item):
        if six.PY2:
            encoded = unicode(item).encode('utf-8')
        else:
            encoded = str(item)

        return encoded

    def writerow(self, row):
        self.writer.writerow([self._encode(s) for s in row])

    def get_values(self):
        # Fetch UTF-8 output from the queue ...
        ret = self.queue.getvalue()
        # empty queue
        self.queue.truncate(0)
        if six.PY2:
            return ret.lstrip(b'\0')
        return ret.encode('utf-8').lstrip(b'\0')

    def writerows(self, rows):
        for row in rows:
            self.writerow(row)

def base_export(labels, results, dialect=csv.excel_tab):
    w = UnicodeWriter(dialect=dialect)
    count = 0
    w.writerow(labels)
    for row in results:
        count += 1
        w.writerow(row)

        if count % 200 == 0:
            yield w.get_values()

    yield w.get_values()

def make_attachment(response, ext):
    response['Content-Disposition'] = 'attachment; filename=export.%s' % ext
    return response

@formats.add("csv")
def csv_format(labels, results):
    content_type = "text/csv"
    return make_attachment(StreamingHttpResponse(base_export(labels, results, dialect=csv.excel), content_type=content_type), "csv")

@formats.add("ods")
def ods_format(labels, results):
    content_type = "application/vnd.oasis.opendocument.spreadsheet"
    return make_attachment(StreamingHttpResponse(base_export(labels, results, dialect=csv.excel), content_type=content_type), "ods")

@formats.add("xls")
def xls_format(labels, results):
    content_type = "application/vnd.ms-excel"
    return make_attachment(StreamingHttpResponse(base_export(labels, results, dialect=csv.excel), content_type=content_type), "xls")


text:
using System;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;

namespace Noside.Wyvern.Common
{
    public class GlassHelper
    {
	    public static bool ExtendGlassFrame(Window window) {
		    return ExtendGlassFrame(window, new Thickness(-1));
	    }

        public static bool ExtendGlassFrame(Window window, Thickness margin)
        {
            IntPtr hwnd = new WindowInteropHelper(window).Handle;
            if (hwnd == IntPtr.Zero)
                throw new InvalidOperationException("The Window must be shown before extending glass.");

            if (NativeMethods.DwmApi.DwmIsCompositionEnabled())
            {
                var windowHelper = new WindowInteropHelper(window);

                var accent = new NativeMethods.Structs.AccentPolicy();
                var accentStructSize = Marshal.SizeOf(accent);
                accent.AccentState = NativeMethods.AccentState.ACCENT_ENABLE_BLURBEHIND;

                var accentPtr = Marshal.AllocHGlobal(accentStructSize);
                Marshal.StructureToPtr(accent, accentPtr, false);

                var data = new NativeMethods.Structs.WindowCompositionAttributeData();
                data.Attribute = NativeMethods.WindowCompositionAttribute.WCA_ACCENT_POLICY;
                data.SizeOfData = accentStructSize;
                data.Data = accentPtr;

                NativeMethods.User32.SetWindowCompositionAttribute(windowHelper.Handle, ref data);

                Marshal.FreeHGlobal(accentPtr);
                return true;
            }

            // Set the background to transparent from both the WPF and Win32 perspectives
            window.Background = Brushes.Transparent;
            HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;

            NativeMethods.Structs.MARGINS margins = new NativeMethods.Structs.MARGINS(margin);
            NativeMethods.DwmApi.DwmExtendFrameIntoClientArea(hwnd, ref margins);
            return true;
        }
    }
}


text:
package com.javarush.task.task07.task0727;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

/*
Меняем функциональность

Задача: Программа вводит строки, пока пользователь не введёт пустую строку (нажав enter).
Потом она конвертирует строки в верхний регистр (Мама превращается в МАМА) и выводит их на экран.

Новая задача: Программа вводит строки, пока пользователь не введёт пустую строку (нажав enter).
Потом программа строит новый список. Если в строке чётное число букв, строка удваивается, если нечётное – утраивается.
Программа выводит содержимое нового списка на экран.

Пример ввода:
Кот
Коты
Я

Пример вывода:
Кот Кот Кот
Коты Коты
Я Я Я
*/

public class Solution {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        ArrayList<String> list = new ArrayList<String>();
        while (true) {
            String s = reader.readLine();
            if (s.isEmpty()) break;
            list.add(s);
        }

//        ArrayList<String> listUpperCase = new ArrayList<String>();
//        for (int i = 0; i < list.size(); i++) {
//            String s = list.get(i);
//            listUpperCase.add(s.toUpperCase());
//        }
//
//        for (int i = 0; i < listUpperCase.size(); i++) {
//            System.out.println(listUpperCase.get(i));
//        }

        ArrayList<String> list2 = new ArrayList<String>();
        for (String s : list) {
            if (s.length() % 2 == 0)
                list2.add(s + " " + s);
            else
                list2.add(s + " " + s + " " + s);
        }

        for (int i = 0; i < list2.size(); i++) {
            System.out.println(list2.get(i));
        }
    }
}


text:
package test;

import static test.Bar1.f;

class Bar {
    public static final void f() {}
}

class Bar1 {
    public static final void f(int i) {}
}
public class Foo {
    {
        Bar.<caret>f();
    }
}


text:
package com.twu.tools;

import com.twu.tools.ReadFromTxtFile;
import org.junit.Test;

/**
 * Created by ayiannak on 09/03/2015.
 */
public class ReadFromTxtFileTest {
    //=new ReadFromTxtFile("/Users/ayiannak/Documents/workspace/twu-biblioteca-AlikiYiannakou/Books");
    //right file
    ReadFromTxtFile testRead2;
    //wrong file

   // @Test(expected=java.io.FileNotFoundException.class)
    //public void testConstructor(){
      //  ReadFromTxtFile testRead1=new ReadFromTxtFile("/Users/ayiannak/Documents/workspace/twu-biblioteca-AlikiYiannakou/BooksWrong");

   // }

}


text:
using System;

namespace Contrive.Common
{
    public interface ICryptoConfigurationProvider
    {
        Type EncryptionAlgorithm { get; }

        byte[] EncryptionKey { get; }

        Type HashAlgorithm { get; }

        byte[] HmacKey { get; }
    }
}


text:
package com.fyp.widerst.cron;

import static com.fyp.widerst.WiderstObjectifyService.ofy;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

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

import com.fyp.widerst.entity.DataPiece;
import com.fyp.widerst.entity.DataWhole;
import com.fyp.widerst.util.GcmHelper;
import com.googlecode.objectify.Key;

@SuppressWarnings("serial")
public class CronJobServlet extends HttpServlet {

    private static final Logger logger = Logger.getLogger(GcmHelper.class.getSimpleName());

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        try {

        List<DataWhole> wholes = ofy().load().type(DataWhole.class).list();

        for (DataWhole dataWhole : wholes) {
            //TODO: Add time check
            /* Only check those that have enough pieces */
            if (dataWhole.getDataPieceKeyList().size() > 0
                    && (dataWhole.getDataPieceKeyList().size() == dataWhole.getNumOfPieces())) {
                Map<Key<DataPiece>, DataPiece> pieces = ofy().load().keys(dataWhole.getDataPieceKeyList());
                for (DataPiece dataPiece : pieces.values()) {
                    if (dataPiece.getBlobKey() == null || dataPiece.getBlobKey().equals("")) {
                        logger.log(Level.INFO, "Sending request for Piece " + dataPiece.getKey());
                        GcmHelper.sendPieceRequest(dataPiece, dataWhole);
                    }
                }
            }
        }

        resp.setStatus(HttpServletResponse.SC_OK);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}


text:
using System;
using System.Linq.Expressions;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using TableDependency.SqlClient.Test.Models;
using TableDependency.SqlClient.Where;

namespace TableDependency.SqlClient.Test
{
    [TestClass]
    public class WhereUnitTestToLower
    {
        [TestMethod]
        public void ToLower1()
        {
            // Arrange
            Expression<Func<Product, bool>> expression = p => p.Code.ToLower() == "123";

            // Act
            var where = new SqlTableDependencyFilter<Product>(expression).Translate();

            // Assert
            Assert.AreEqual("(LOWER([Code]) = '123')", where);
        }
    }
}


text:
using Common::JsonValue;
using namespace CryptoNote;

namespace CryptoNote {
std::ostream& operator<<(std::ostream& out, const JsonOutputStreamSerializer& enumerator) {
  out << enumerator.root;
  return out;
}
}

namespace {

template <typename T>
void insertOrPush(JsonValue& js, Common::StringView name, const T& value) {
  if (js.isArray()) {
    js.pushBack(JsonValue(value));
  } else {
    js.insert(std::string(name), JsonValue(value));
  }
}

}

JsonOutputStreamSerializer::JsonOutputStreamSerializer() : root(JsonValue::OBJECT) {
  chain.push_back(&root);
}

JsonOutputStreamSerializer::~JsonOutputStreamSerializer() {
}

ISerializer::SerializerType JsonOutputStreamSerializer::type() const {
  return ISerializer::OUTPUT;
}

bool JsonOutputStreamSerializer::beginObject(Common::StringView name) {
  JsonValue& parent = *chain.back();
  JsonValue obj(JsonValue::OBJECT);

  if (parent.isObject()) {
    chain.push_back(&parent.insert(std::string(name), obj));
  } else {
    chain.push_back(&parent.pushBack(obj));
  }

  return true;
}

void JsonOutputStreamSerializer::endObject() {
  assert(!chain.empty());
  chain.pop_back();
}

bool JsonOutputStreamSerializer::beginArray(size_t& size, Common::StringView name) {
  JsonValue val(JsonValue::ARRAY);
  JsonValue& res = chain.back()->insert(std::string(name), val);
  chain.push_back(&res);
  return true;
}

void JsonOutputStreamSerializer::endArray() {
  assert(!chain.empty());
  chain.pop_back();
}

bool JsonOutputStreamSerializer::operator()(uint64_t& value, Common::StringView name) {
  int64_t v = static_cast<int64_t>(value);
  return operator()(v, name);
}

bool JsonOutputStreamSerializer::operator()(uint16_t& value, Common::StringView name) {
  uint64_t v = static_cast<uint64_t>(value);
  return operator()(v, name);
}

bool JsonOutputStreamSerializer::operator()(int16_t& value, Common::StringView name) {
  int64_t v = static_cast<int64_t>(value);
  return operator()(v, name);
}

bool JsonOutputStreamSerializer::operator()(uint32_t& value, Common::StringView name) {
  uint64_t v = static_cast<uint64_t>(value);
  return operator()(v, name);
}

bool JsonOutputStreamSerializer::operator()(int32_t& value, Common::StringView name) {
  int64_t v = static_cast<int64_t>(value);
  return operator()(v, name);
}

bool JsonOutputStreamSerializer::operator()(int64_t& value, Common::StringView name) {
  insertOrPush(*chain.back(), name, value);
  return true;
}

bool JsonOutputStreamSerializer::operator()(double& value, Common::StringView name) {
  insertOrPush(*chain.back(), name, value);
  return true;
}

bool JsonOutputStreamSerializer::operator()(std::string& value, Common::StringView name) {
  insertOrPush(*chain.back(), name, value);
  return true;
}

bool JsonOutputStreamSerializer::operator()(uint8_t& value, Common::StringView name) {
  insertOrPush(*chain.back(), name, static_cast<int64_t>(value));
  return true;
}

bool JsonOutputStreamSerializer::operator()(bool& value, Common::StringView name) {
  insertOrPush(*chain.back(), name, value);
  return true;
}

bool JsonOutputStreamSerializer::binary(void* value, size_t size, Common::StringView name) {
  std::string hex = Common::toHex(value, size);
  return (*this)(hex, name);
}

bool JsonOutputStreamSerializer::binary(std::string& value, Common::StringView name) {
  return binary(const_cast<char*>(value.data()), value.size(), name);
}


text:
'use strict';

var lab = exports.lab = require('lab').script();
var chai = require('chai');
var expect = chai.expect;
chai.use(require('sinon-chai'));
var sinon = require('sinon');
var aliasGen = require(__dirname + '/../lib/profiles/alias-generator');

lab.experiment('Alias Generator', { timeout: 5000}, function () {
    var sandbox;
    var senecaStub;
    var aliasGenerator;

    lab.beforeEach(function (done) {
        sandbox = sinon.sandbox.create();
        senecaStub = {
            act: sandbox.stub(),
            make: sandbox.stub()
        };
        aliasGenerator = aliasGen.bind(senecaStub);
        done();
    });

    lab.afterEach(function (done) {
        sandbox.restore();
        done();
    });

    lab.test('should create a nick with the next available number if it does not exist and the nick is not taken', function (done) {
        // ARRANGE
        var userWithNoNick = {
            firstName: 'Foo'
        };
        var profileWithNoAlias = {};
        var userEntityMock = {
            list$: sandbox.stub()
        };
        var firstNameCounterEntityMock = {
            list$: sandbox.stub(),
            save$: sandbox.stub()
        };
        senecaStub.make.withArgs('cd_first_name_counter').returns(firstNameCounterEntityMock);
        firstNameCounterEntityMock.list$.callsFake(function (query, cb) {
            expect(query).to.deep.equal({
                firstName: userWithNoNick.firstName.toLowerCase()
            });
            cb(null, [{
                id: 'abc',
                firstName: 'foo',
                userCount: 5
            }]);
        });
        firstNameCounterEntityMock.save$.callsFake(function (ent, cb) {
            cb(null, ent);
        });
        senecaStub.make.withArgs('sys/user').returns(userEntityMock);
        userEntityMock.list$.callsFake(function (query, cb) {
            expect(query).to.deep.equal({
                nick: 'Foo6'
            });
            cb(null, []);
        });

        aliasGenerator(userWithNoNick, profileWithNoAlias, function () {
            expect(userWithNoNick.nick).to.equal('Foo6');
            expect(profileWithNoAlias.alias).to.equal('Foo6');
            expect(firstNameCounterEntityMock.save$).to.have.been.calledOnce;
            expect(firstNameCounterEntityMock.save$).to.have.been.calledWith({
                id: 'abc',
                firstName: 'foo',
                userCount: 6
            });
            done();
        });
    });

    lab.test('should keep incrementing the number for nick until it finds an unused nick', function (done) {
        // ARRANGE
        var userWithNoNick = {
            firstName: 'Foo'
        };
        var profileWithNoAlias = {};
        var userEntityMock = {
            list$: sandbox.stub()
        };
        var firstNameCounterEntityMock = {
            list$: sandbox.stub(),
            save$: sandbox.stub()
        };
        senecaStub.make.withArgs('cd_first_name_counter').returns(firstNameCounterEntityMock);
        firstNameCounterEntityMock.list$.callsFake(function (query, done) {
            expect(query).to.deep.equal({
                firstName: userWithNoNick.firstName.toLowerCase()
            });
            done(null, [{
                id: 'abc',
                firstName: 'foo',
                userCount: 5
            }]);
        });
        firstNameCounterEntityMock.save$.callsFake(function (ent, cb) {
            cb(null, ent);
        });
        senecaStub.make.withArgs('sys/user').returns(userEntityMock);
        userEntityMock.list$.callsFake(function (query, done) {
            if (query.nick === 'Foo6') {
                done(null, [{
                    nick: 'Foo6'
                }]);
            } else if (query.nick === 'Foo7') {
                done(null, [{
                    nick: 'Foo7'
                }]);
            } else {
                done(null, []);
            }
        });

        aliasGenerator(userWithNoNick, profileWithNoAlias, function () {
            expect(userWithNoNick.nick).to.equal('Foo8');
            expect(profileWithNoAlias.alias).to.equal('Foo8');
            expect(firstNameCounterEntityMock.save$).to.have.been.calledOnce;
            expect(firstNameCounterEntityMock.save$).to.have.been.calledWith({
                id: 'abc',
                firstName: 'foo',
                userCount: 8
            });
            done();
        });
    });

    lab.test('should create a new row in cd_first_name_counter if it doesnt exist yet', function (done) {
        // ARRANGE
        var userWithNoNick = {
            firstName: 'Foo'
        };
        var profileWithNoAlias = {};
        var userEntityMock = {
            list$: sandbox.stub()
        };
        var firstNameCounterEntityMock = {
            list$: sandbox.stub(),
            save$: sandbox.stub()
        };
        senecaStub.make.withArgs('cd_first_name_counter').returns(firstNameCounterEntityMock);
        firstNameCounterEntityMock.list$.callsFake(function (query, done) {
            expect(query).to.deep.equal({
                firstName: userWithNoNick.firstName.toLowerCase()
            });
            done(null, []);
        });
        firstNameCounterEntityMock.save$.callsFake(function (ent, cb) {
            cb(null, ent);
        });
        senecaStub.make.withArgs('sys/user').returns(userEntityMock);
        userEntityMock.list$.callsFake(function (query, done) {
            expect(query).to.deep.equal({
                nick: 'Foo1'
            });
            done(null, []);
        });

        aliasGenerator(userWithNoNick, profileWithNoAlias, function () {
            expect(userWithNoNick.nick).to.equal('Foo1');
            expect(profileWithNoAlias.alias).to.equal('Foo1');
            expect(firstNameCounterEntityMock.save$).to.have.been.calledOnce;
            expect(firstNameCounterEntityMock.save$).to.have.been.calledWith({
                firstName: 'foo',
                userCount: 1
            });
            done();
        });
    });

    lab.test('should do nothing if nick is provided', function (done) {
        // ARRANGE
        var userMock = {
            firstName: 'Foo',
            nick: 'Foo1'
        };
        var profileMock = {
            alias: 'Foo1'
        };

        aliasGenerator(userMock, profileMock, function () {
            // Check userMock.nick & profileMock.alias have not been mutated
            expect(userMock.nick).to.equal('Foo1');
            expect(profileMock.alias).to.equal('Foo1');
            done();
        });
    });

    lab.test('should call callback with error if listing count for first name fails', function (done) {
        // ARRANGE
        var userWithNoNick = {
            firstName: 'Foo'
        };
        var firstNameCounterEntityMock = {
            list$: sandbox.stub()
        };
        senecaStub.make.withArgs('cd_first_name_counter').returns(firstNameCounterEntityMock);
        firstNameCounterEntityMock.list$.callsFake(function (query, cb) {
            cb('Could not connect');
        });

        aliasGenerator(userWithNoNick, {}, function (err) {
            expect(err).to.equal('Could not connect');
            done();
        });
    });

    lab.test('should call callback with error if saving count for first name fails', function (done) {
        // ARRANGE
        var userWithNoNick = {
            firstName: 'Foo'
        };
        var userEntityMock = {
            list$: sandbox.stub()
        };
        var firstNameCounterEntityMock = {
            list$: sandbox.stub(),
            save$: sandbox.stub()
        };
        senecaStub.make.withArgs('cd_first_name_counter').returns(firstNameCounterEntityMock);
        firstNameCounterEntityMock.list$.callsFake(function (query, cb) {
            cb(null, [{
                id: 'abc',
                firstName: 'foo',
                userCount: 5
            }]);
        });
        firstNameCounterEntityMock.save$.callsFake(function (ent, cb) {
            cb('Could not connect');
        });
        senecaStub.make.withArgs('sys/user').returns(userEntityMock);
        userEntityMock.list$.callsFake(function (query, cb) {
            cb(null, []);
        });

        aliasGenerator(userWithNoNick, {}, function (err) {
            expect(err).to.equal('Could not connect');
            done();
        });
    });

    lab.test('should call callback with error if listing users by nick fails', function (done) {
        // ARRANGE
        var userWithNoNick = {
            firstName: 'Foo'
        };
        var userEntityMock = {
            list$: sandbox.stub()
        };
        var firstNameCounterEntityMock = {
            list$: sandbox.stub(),
            save$: sandbox.stub()
        };
        senecaStub.make.withArgs('cd_first_name_counter').returns(firstNameCounterEntityMock);
        firstNameCounterEntityMock.list$.callsFake(function (query, cb) {
            cb(null, [{
                id: 'abc',
                firstName: 'foo',
                userCount: 5
            }]);
        });
        senecaStub.make.withArgs('sys/user').returns(userEntityMock);
        userEntityMock.list$.callsFake(function (query, cb) {
            cb('Could not connect');
        });

        aliasGenerator(userWithNoNick, {}, function (err) {
            expect(err).to.equal('Could not connect');
            done();
        });
    });
});


text:
namespace SQLite3
{
  ref class Database;

  public ref class Statement sealed
  {
  public:
    Statement(Database^ database, Platform::String^ sql);
    virtual ~Statement();

    int Step();

    int ColumnCount();
    int ColumnType(int index);
    Platform::String^ ColumnName(int index);

    Platform::String^ ColumnText(int index);
    int ColumnInt(int index);
    double ColumnDouble(int index);

    int BindText(int index, Platform::String^ val);
    int BindInt(int index, int val);
    int BindDouble(int index, double val);
    int BindNull(int index);

  private:
    sqlite3_stmt* statement;
  };
}


text:
import React from 'react';
import { storiesOf } from '@storybook/react';
import { boolean, number, select, text } from '@storybook/addon-knobs';
import { withOutline, withPhpdocManifest } from './storybook.decorators';
import { PhpdocMethodSignature } from '@codex/phpdoc';

let fqsenList = [
    'Codex\\Codex::get()',
    'Codex\\CodexServiceProvider::register()',
    'Codex\\Projects\\Project::url()',
];

storiesOf('phpdoc', module)
    .addDecorator(withPhpdocManifest)
    .addDecorator(withOutline)
    .addParameters({})
    .add('PhpdocMethodSignature', () => {
        return <PhpdocMethodSignature
            fqsen={select('fqsen', fqsenList, fqsenList[ 0 ])}
            noClick={boolean('noClick', false)}
            inline={boolean('inline', false)}
            link={boolean('link', false)}
            size={number('size', 14)}
            returnCharacter={text('returnCharacter', '=>')}
            hide={{
                inherited       : boolean('inherited', false),
                deprecated      : boolean('deprecated', false),
                modifiers       : boolean('modifiers', false),
                arguments       : boolean('arguments', false),
                argumentTypes   : boolean('argumentTypes', false),
                argumentDefaults: boolean('argumentDefaults', false),
                returns         : boolean('returns', false),
                namespace       : boolean('namespace', false),
                typeTooltip     : boolean('typeTooltip', false),
                typeTooltipClick: boolean('typeTooltipClick', false),
            }}
        />;
    });


text:
const XRegExp = require('xregexp');

class SummonerUtil {
	static normalizeSummonerName(name) {
		return name.toLowerCase().replace(/ /g, '');
	}

	/**
	 * Checks the given string for invalid characters.
	 * @return null if the name is valid, otherwise an Array with all the matched characters */
	static validateSummonerNameInputCharacters(name) {
		//  https://developer.riotgames.com/getting-started.html
		// translation of the suggested regex ^[0-9\p{L} ]+$ into JS neccessary
		// because JS does not support unicode shortcuts ( \p{L} )
		// UPDATE: now using xregexp, which seems to work fine

		let invalidMatches = name.match(new XRegExp('[^0-9\\p{L} _\\.]+', 'g'))
		if (invalidMatches) {
			invalidMatches = invalidMatches
				.map(matchesString => matchesString.split(''))
				.reduce((result, singleMatchArray) => result.concat(singleMatchArray), []);
		}
		return invalidMatches;
	}

	static validateSummonerNameInputLength(name) {
		return name.length <= 16;
	}
}

module.exports = SummonerUtil;


text:
@interface PRDatabase ()

@property (nonatomic, strong) FMDatabaseQueue *dbQueue;

@end

@implementation PRDatabase

#pragma mark - Initialize

+ (instancetype)sharedDatabase
{
    static PRDatabase *database = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        database = [[PRDatabase alloc] init];
    });
    return database;
}

- (void)prepareDatabase
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        NSFileManager *fm = [NSFileManager defaultManager];
        if (![fm fileExistsAtPath:[self dbPath]]) {
            NSURL *prototypeDBURL = [[NSBundle mainBundle] URLForResource:@"plainreader" withExtension:@"db"];
            NSError *error = nil;
            [fm copyItemAtURL:prototypeDBURL toURL:[NSURL fileURLWithPath:[self dbPath]] error:&error];
            if (error) {
                DDLogError(@"%@", error);
            }
        }

        _dbQueue = [FMDatabaseQueue databaseQueueWithPath:[self dbPath]];
    });
}

- (NSString *)dbPath
{
    static NSString *dbPath = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        NSString *docPath = [UIApplication cw_documentsPath];
        dbPath = [docPath stringByAppendingPathComponent:@"plainreader.db"];
    });
    return dbPath;
}

#pragma mark - Public

- (PRArticle *)articleForId:(NSNumber *)articleId
{
    __block PRArticle *article = nil;
    [self.dbQueue inDatabase:^(FMDatabase *db) {
        FMResultSet *s = [db executeQuery:@"SELECT * FROM article WHERE id = ?", articleId];
        while ([s next]) {
            article = [s toArticle];
        }
    }];
    return article;
}

- (void)storeArticle:(PRArticle *)article
{
    if ([article.title length] == 0) {
        return;
    }

    [self.dbQueue inDatabase:^(FMDatabase *db) {
        NSUInteger totalCount = [db intForQuery:@"SELECT COUNT (id) FROM article WHERE id = ?", article.articleId];
        if (totalCount > 0) {
            [PRLongSQLGenerator generateSQLForUpdatingArticle:article completion:^(NSString *sql, NSArray *arguments) {
                BOOL result = [db executeUpdate:sql withArgumentsInArray:arguments];
                if (!result) {
                    DDLogError(@"%d : %@", [db lastErrorCode], [db lastErrorMessage]);
                }
            }];
        }
        else {
            [PRLongSQLGenerator generateSQLForInsertingArticle:article completion:^(NSString *sql, NSArray *arguments) {
                BOOL result = [db executeUpdate:sql withArgumentsInArray:arguments];
                if (!result) {
                    DDLogError(@"%d : %@", [db lastErrorCode], [db lastErrorMessage]);
                }
            }];
        }
    }];
}

- (void)updateReadField:(PRArticle *)article
{
    [self.dbQueue inDatabase:^(FMDatabase *db) {
        [db executeUpdate:@"UPDATE article SET is_read = ? WHERE id = ?", article.read, article.articleId];
    }];
}

- (NSArray *)realtimesWithLastArticle:(PRArticle *)lastArticle limit:(NSUInteger)limit
{
    NSString *sql = nil;
    if (lastArticle) {
        sql = [NSString stringWithFormat:@"SELECT id, title, pubtime, cmt_count, thumb, is_read, cache_status FROM article WHERE id < %@ AND (pubtime IS NOT NULL OR pubtime != '') ORDER BY id DESC LIMIT %@", lastArticle.articleId, [@(limit) stringValue]];
    }
    else {
        sql = [NSString stringWithFormat:@"SELECT id, title, pubtime, cmt_count, thumb, is_read, cache_status FROM article WHERE (pubtime IS NOT NULL OR pubtime != '') ORDER BY id DESC LIMIT %@", [@(limit) stringValue]];
    }

    NSMutableArray *results = [[NSMutableArray alloc] init];
    [self.dbQueue inDatabase:^(FMDatabase *db) {
        FMResultSet *s = [db executeQuery:sql];
        while ([s next]) {
            PRArticle *article = [s toRealtimeArticle];
            [results addObject:article];
        }
    }];
    return results;
}

- (void)clearTopComments
{
    [self.dbQueue inDatabase:^(FMDatabase *db) {
        BOOL result = [db executeUpdate:@"DELETE FROM top_comment"];
        if (!result) {
            DDLogError(@"%d : %@", [db lastErrorCode], [db lastErrorMessage]);
        }
    }];
}

- (void)storeTopComment:(PRTopComment *)topComment
{
    [self.dbQueue inDatabase:^(FMDatabase *db) {
        NSUInteger totalCount = [db intForQuery:@"SELECT COUNT (id) FROM top_comment WHERE hash = ?", topComment.hashValue];
        if (totalCount == 0) {
            BOOL result = [db executeUpdate:@"INSERT INTO top_comment (id, hash, content, location, article_id) VALUES (NULL, ?, ?, ?, ?)", topComment.hashValue, topComment.content, topComment.from, [topComment.article articleId]];
            if (!result) {
                DDLogError(@"%d : %@", [db lastErrorCode], [db lastErrorMessage]);
            }
        }
    }];
}

- (NSArray *)topCommentsWithLastTopComment:(PRTopComment *)topComment limit:(NSUInteger)limit
{
    NSMutableArray *results = [[NSMutableArray alloc] init];
    [self.dbQueue inDatabase:^(FMDatabase *db) {
        FMResultSet *s = [db executeQuery:@"SELECT * FROM top_comment WHERE id > ? ORDER BY id ASC LIMIT ?", topComment ? topComment.topCommentId : @(0), @(limit)];
        while ([s next]) {
            PRTopComment *comment = [s toTopComment];

            NSString *articleTitle = [db stringForQuery:@"SELECT title FROM article WHERE id = ?", [comment.article articleId]];
            if (!articleTitle) {
                continue;
            }
            [comment.article setTitle:articleTitle];
            [results addObject:comment];
        }
    }];
    return results;
}

- (void)clearWeekly
{
    [self.dbQueue inDatabase:^(FMDatabase *db) {
        BOOL result = [db executeUpdate:@"DELETE FROM weekly"];
        if (!result) {
            DDLogError(@"%d : %@", [db lastErrorCode], [db lastErrorMessage]);
        }
    }];
}

- (void)storeArticle:(PRArticle *)article weeklyType:(PRWeeklyType)type
{
    if ([article.title length] == 0) {
        return;
    }

    [self storeArticle:article];

    [self.dbQueue inDatabase:^(FMDatabase *db) {
        BOOL result = [db executeUpdate:@"INSERT INTO weekly (article_id, type) VALUES(?, ?)", [article articleId], @(type)];
        if (!result) {
            DDLogError(@"%d : %@", [db lastErrorCode], [db lastErrorMessage]);
        }
    }];
}

- (NSArray *)weekly
{
    NSMutableArray *results = [[NSMutableArray alloc] init];
    NSMutableArray *hots = [[NSMutableArray alloc] init];
    NSMutableArray *recommends = [[NSMutableArray alloc] init];

    [self.dbQueue inDatabase:^(FMDatabase *db) {
        FMResultSet *s = [db executeQuery:@"SELECT * FROM weekly WHERE type = ? ORDER BY article_id DESC", @(PRWeeklyTypeHot)];
        while ([s next]) {
            NSNumber *articleId = [s numberForColumnName:@"article_id"];

            FMResultSet *ss = [db executeQuery:@"SELECT id, title, pubtime, cmt_count, thumb, is_read, cache_status FROM article WHERE id = ?", articleId];
            while ([ss next]) {
                PRArticle *article = [ss toRealtimeArticle];
                [hots addObject:article];
            }
        }

        s = [db executeQuery:@"SELECT * FROM weekly WHERE type = ? ORDER BY article_id DESC", @(PRWeeklyTypeRecommend)];
        while ([s next]) {
            NSNumber *articleId = [s numberForColumnName:@"article_id"];

            FMResultSet *ss = [db executeQuery:@"SELECT id, title, pubtime, cmt_count, thumb, is_read, cache_status FROM article WHERE id = ?", articleId];
            while ([ss next]) {
                PRArticle *article = [ss toRealtimeArticle];
                [recommends addObject:article];
            }
        }

        [results addObjectsFromArray:@[hots, recommends]];
    }];

    return results;
}

- (void)clearExpiredArticles:(void (^) (void))completion
{
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        [self.dbQueue inDatabase:^(FMDatabase *db) {
            NSDate *sevenDaysAgo = [NSDate dateWithTimeIntervalSinceNow:-(60 * 60 * 24 * 7)];
            NSTimeInterval interval = [sevenDaysAgo timeIntervalSince1970];
            BOOL result = [db executeUpdate:
                           @"DELETE FROM article WHERE pubtime <= Datetime(?, 'unixepoch', 'localtime') "
                           "AND id NOT IN (SELECT article_id FROM weekly) "
                           "AND id NOT IN (SELECT article_id FROM starred) "
                           "AND id NOT IN (SELECT article_id FROM top_comment)", @(interval)];
            if (!result) {
                DDLogError(@"%d : %@", [db lastErrorCode], [db lastErrorMessage]);
            }
        }];

        dispatch_sync(dispatch_get_main_queue(), ^{
            if (completion) {
                completion();
            }
        });
    });
}

- (void)starArticle:(PRArticle *)article
{
    [self.dbQueue inDatabase:^(FMDatabase *db) {
        BOOL result = [db executeUpdate:@"INSERT OR REPLACE INTO starred (article_id, time) VALUES (?, ?)", article.articleId, @((int)[[NSDate date] timeIntervalSince1970])];
        if (!result) {
            DDLogError(@"%d : %@", [db lastErrorCode], [db lastErrorMessage]);
        }

        [[PRStarredCache sharedCache] starArticle:article];
    }];
}

- (void)unstarArticle:(PRArticle *)article
{
    [self.dbQueue inDatabase:^(FMDatabase *db) {
        BOOL result = [db executeUpdate:@"DELETE FROM starred WHERE article_id = ?", article.articleId];
        if (!result) {
            DDLogError(@"%d : %@", [db lastErrorCode], [db lastErrorMessage]);
        }

        [[PRStarredCache sharedCache] unstarArticle:article];
    }];
}

- (NSArray *)starredArticles
{
    NSMutableArray *results = [[NSMutableArray alloc] init];
    [self.dbQueue inDatabase:^(FMDatabase *db) {
        FMResultSet *s = [db executeQuery:@"SELECT * FROM article, starred WHERE article.id = starred.article_id ORDER BY starred.time DESC"];
        while ([s next]) {
            PRArticle *article = [s toRealtimeArticle];
            [results addObject:article];
        }
    }];
    return results;
}

- (BOOL)isArticleStarred:(PRArticle *)article
{
    __block BOOL isStarred = NO;
    [self.dbQueue inDatabase:^(FMDatabase *db) {
        NSUInteger totalCount = [db intForQuery:@"SELECT COUNT (article_id) FROM starred WHERE article_id = ?", article.articleId];
        isStarred = totalCount > 0;
    }];
    return isStarred;
}

- (NSArray *)starredArticleIds
{
    NSMutableArray *results = [[NSMutableArray alloc] init];
    [self.dbQueue inDatabase:^(FMDatabase *db) {
        FMResultSet *s = [db executeQuery:@"SELECT article_id FROM starred"];
        while ([s next]) {
            NSNumber *aid = [s numberForColumnName:@"article_id"];
            [results addObject:aid];
        }
    }];
    return results;
}

@end


text:
//namespace System.Collections
//{
//    /// <summary>
//    /// ModifiedValue
//    /// </summary>
//    internal class ModifiedValue
//    {
//        private object _animatedValue;
//        private object _baseValue;
//        private object _coercedValue;
//        private object _expressionValue;

//        /// <summary>
//        /// Gets or sets the animated value.
//        /// </summary>
//        /// <value>The animated value.</value>
//        internal object AnimatedValue
//        {
//            get { return _animatedValue; }
//            set { _animatedValue = value; }
//        }

//        /// <summary>
//        /// Gets or sets the base value.
//        /// </summary>
//        /// <value>The base value.</value>
//        internal object BaseValue
//        {
//            get { return _baseValue; }
//            set { _baseValue = value; }
//        }

//        /// <summary>
//        /// Gets or sets the coerced value.
//        /// </summary>
//        /// <value>The coerced value.</value>
//        internal object CoercedValue
//        {
//            get { return _coercedValue; }
//            set { _coercedValue = value; }
//        }

//        /// <summary>
//        /// Gets or sets the expression value.
//        /// </summary>
//        /// <value>The expression value.</value>
//        internal object ExpressionValue
//        {
//            get { return _expressionValue; }
//            set { _expressionValue = value; }
//        }
//    }
//}


text:
package org.zalando.nakadi.validation;

public class ValidationError {
    private final String message;

    public ValidationError(final String message) {
        this.message = message;
    }

    public String getMessage() {
        return message;
    }
}


text:
package http

import (
	"net/http"

	"go-common/app/service/main/share/conf"
	"go-common/app/service/main/share/service"
	"go-common/library/log"
	bm "go-common/library/net/http/blademaster"
	"go-common/library/net/http/blademaster/middleware/verify"
)

var (
	svr       *service.Service
	verifySvc *verify.Verify
)

// Init init http router.
func Init(c *conf.Config, s *service.Service) {
	svr = s
	verifySvc = verify.New(c.Verify)
	engine := bm.DefaultServer(c.BM)
	route(engine)
	if err := engine.Start(); err != nil {
		log.Error("engine.Start error(%v)", err)
		panic(err)
	}
}

func route(e *bm.Engine) {
	e.Ping(ping)
	e.Register(register)
	group := e.Group("/x/internal/share")
	{
		group.POST("/add", verifySvc.Verify, add)
		group.GET("/stat", verifySvc.Verify, stat)
		group.GET("/stats", verifySvc.Verify, stats)
	}
}

func ping(c *bm.Context) {
	if err := svr.Ping(); err != nil {
		log.Error("share-service ping error(%v)", err)
		c.AbortWithStatus(http.StatusServiceUnavailable)
	}
}

func register(c *bm.Context) {
	c.JSON(nil, nil)
}