text:
<?php

namespace Spatie\Fractal\Test;

use Illuminate\Http\JsonResponse;

class ResponseTest extends TestCase
{
    /** @var \Spatie\Fractal\Fractal */
    protected $fractal;

    public function setUp($defaultSerializer = '', $defaultPaginator = ''): void
    {
        parent::setUp();

        $this->fractal = fractal()
            ->collection(['item', 'item2'])
            ->transformWith(function ($item) {
                return ['item' => $item.'-transformed'];
            });
    }

    /** @test */
    public function it_can_return_a_json_response()
    {
        $response = $this->fractal->respond();

        $this->assertInstanceOf(JsonResponse::class, $response);
        $this->assertEquals('{"data":[{"item":"item-transformed"},{"item":"item2-transformed"}]}', json_encode($response->getData()));
        $this->assertEquals(200, $response->status());
    }

    /** @test */
    public function it_uses_the_given_response_code()
    {
        $response = $this->fractal->respond(404);

        $this->assertEquals(404, $response->status());
    }

    /** @test */
    public function it_uses_the_given_headers()
    {
        $response = $this->fractal
            ->respond(404, [
                'test' => 'test-value',
                'test2' => 'test2-value',
            ]);

        $headers = $response->headers->all();

        $this->assertEquals(['test-value'], $headers['test']);
        $this->assertEquals(['test2-value'], $headers['test2']);
    }

    /** @test */
    public function it_uses_the_given_encoding_options()
    {
        $response = $this->fractal->respond(200, [], JSON_PRETTY_PRINT);
        $this->assertTrue($response->hasEncodingOption(JSON_PRETTY_PRINT));
    }

    /** @test */
    public function it_accepts_a_status_code_in_the_given_closure()
    {
        $response = $this->fractal
            ->respond(function (JsonResponse $response) {
                $response->setStatusCode(404);
            });

        $this->assertEquals(404, $response->status());
    }

    /** @test */
    public function it_accepts_a_headers_in_the_given_closure()
    {
        $response = $this->fractal
            ->respond(function (JsonResponse $response) {
                $response->header('test', 'test-value');
                $response->withHeaders(['test2' => 'test2-value']);
            });

        $this->assertEquals(['test-value'], $response->headers->all()['test']);
        $this->assertEquals(['test2-value'], $response->headers->all()['test2']);
    }

    /** @test */
    public function it_accepts_encoding_options_in_the_given_closure()
    {
        $response = $this->fractal
            ->respond(function (JsonResponse $response) {
                $response->setEncodingOptions(JSON_PRETTY_PRINT);
            });

        $this->assertTrue($response->hasEncodingOption(JSON_PRETTY_PRINT));
    }

    /** @test */
    public function it_accept_a_response_code_and_a_callback()
    {
        $response = $this->fractal
            ->respond(404, function (JsonResponse $response) {
                $response->header('test', 'test-value');
            });

        $this->assertEquals(404, $response->status());
        $this->assertEquals(['test-value'], $response->headers->all()['test']);
    }

    /** @test */
    public function it_accepts_a_response_code_and_headers_and_a_callback()
    {
        $response = $this->fractal->respond(404, ['test' => 'test-value'], function (JsonResponse $response) {
            $response->setEncodingOptions(JSON_PRETTY_PRINT);
        });

        $this->assertEquals(404, $response->status());

        $this->assertEquals(['test-value'], $response->headers->all()['test']);
        $this->assertTrue($response->hasEncodingOption(JSON_PRETTY_PRINT));
    }

    /** @test */
    public function all_allowed_methods_in_the_callback_are_chainable()
    {
        $response = $this->fractal
            ->respond(function (JsonResponse $response) {
                $response
                    ->header('test', 'test-value')
                    ->setStatusCode(404)
                    ->withHeaders([
                        'test3' => 'test3-value',
                        'test4' => 'test4-value',
                    ])
                    ->header('test2', 'test2-value')
                    ->setEncodingOptions(JSON_PRETTY_PRINT);
            });

        $this->assertEquals(404, $response->status());

        $this->assertTrue($response->hasEncodingOption(JSON_PRETTY_PRINT));
    }

    /** @test */
    public function the_status_code_set_in_the_closure_will_be_used_event_when_passing_a_status_code_to_the_respond_method()
    {
        $response = $this->fractal->respond(200, function (JsonResponse $response) {
            $response->setStatusCode(300);
        });

        $this->assertEquals(300, $response->getStatusCode());
    }

    /** @test */
    public function the_encoding_options_set_in_the_closure_will_be_used_when_passing_encoding_options_to_the_respond_method()
    {
        $response = $this->fractal->respond(200, function (JsonResponse $response) {
            $response->setEncodingOptions(JSON_UNESCAPED_SLASHES);
        }, JSON_PRETTY_PRINT);

        $this->assertTrue($response->hasEncodingOption(JSON_UNESCAPED_SLASHES));
        $this->assertFalse($response->hasEncodingOption(JSON_PRETTY_PRINT));
    }
}


text:
<?php

declare(strict_types=1);

namespace EngineWorks\ProgressStatus;

use InvalidArgumentException;
use SplObserver;

/** @psalm-suppress PropertyNotSetInConstructor psalm does not recognize that Progress is setting $observers */
class ProgressByRatio extends Progress
{
    /** @var float */
    private $ratio;

    /** @var int */
    private $precision;

    /**
     * ProgressByRatio constructor.
     *
     * @param Status|null $status
     * @param iterable<SplObserver> $observers
     * @param float $ratio
     * @param int $precision
     */
    public function __construct(
        Status $status = null,
        iterable $observers = [],
        float $ratio = 0.01,
        int $precision = 2
    ) {
        parent::__construct($status, $observers);
        if ($precision < 0) {
            throw new InvalidArgumentException('Precision must be an positive integer');
        }
        $this->precision = $precision;
        $this->ratio = max(round($ratio, $this->precision), 10 ** (-$this->precision));
    }

    /** @noinspection PhpMissingParentCallCommonInspection */
    public function shouldNotifyChange(Status $current, Status $newStatus): bool
    {
        $current = (int) ceil(round($current->getRatio(), $this->precision) / $this->ratio);
        $new = (int) ceil(round($newStatus->getRatio(), $this->precision) / $this->ratio);
        return ($current !== $new);
    }

    public function getRatio(): float
    {
        return $this->ratio;
    }

    public function getPrecision(): int
    {
        return $this->precision;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.guxuede.gm.gdx.system;

import com.badlogic.ashley.core.EntitySystem;
import com.badlogic.ashley.core.Family;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import com.guxuede.gm.gdx.ResourceManager;
import com.guxuede.gm.gdx.TempObjects;
import com.guxuede.gm.gdx.component.*;

public class AmbianceLightSystem extends EntitySystem {

    private static final Family family = Family.all(AmbianceLightComponent.class).get();
    private SpriteBatch batch;
    private FrameBuffer frameBuffer;
    private TextureRegion lightBufferRegion;

    private Color ambianceColor;

    private TextureRegion lightRegion;

    private Array<Light> lights = new Array<Light>();

    public AmbianceLightSystem(int priority){
        this.priority= priority;
        Texture lightTex = ResourceManager.getTexture("data/light");
        lightRegion = new TextureRegion(lightTex);
        ambianceColor = new Color(0.3f, 0.38f, 0.6f, 1);
        createLight(0,0);
        createLight(100,100);
        resize(Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
    }

    @Override
    public void update(float deltaTime) {
        frameBuffer.begin();
        batch.enableBlending();
        batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE);
        Gdx.gl.glClearColor(ambianceColor.r, ambianceColor.g, ambianceColor.b, ambianceColor.a);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        batch.begin();
        drawEntryLight();
        batch.end();
        frameBuffer.end();
        batch.setBlendFunction(GL20.GL_DST_COLOR, GL20.GL_ZERO);
        batch.setColor(Color.WHITE);
        batch.begin();
        batch.draw(lightBufferRegion, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        batch.end();
        batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    }

    public void drawEntryLight(){
        final Vector2 tVector2 = TempObjects.temp1Vector2;
        for(Light actor : lights){
            batch.setColor(actor.color);
            tVector2.set(actor.x,actor.y);
            float visualRadius = actor.height;
            batch.draw(lightRegion ,tVector2.x-visualRadius/2, Gdx.graphics.getHeight()-tVector2.y-visualRadius/2, visualRadius, visualRadius);
        }
    }

    private void resize(int width, int height) {
        // Fakedlight system (alpha blending)
        // if frameBuffer was created before, dispose, we recreate a new one
        if (frameBuffer != null){
            frameBuffer.dispose();
        }
        if (batch != null) {
            batch.dispose();
        }
        batch = new SpriteBatch();
        frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, false);
        frameBuffer.getColorBufferTexture().setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
        lightBufferRegion = new TextureRegion(frameBuffer.getColorBufferTexture(), 0, 0, width, height);

        lightBufferRegion.flip(false, true);
    }

    private void createLight(float x, float y) {
        lights.add(new Light(x, y));
    }

    private static class Light {
        public float x = 0;
        public float y = 0;
        public float width = 16;
        public float height = 16;
        public float rotation;
        public Color color = new Color(0.9f, 0.4f, 0f, 1f);

        public Light (float x, float y) {
            this.x = x;
            this.y = y;
            width = height = MathUtils.random(100, 300);
            color.set(MathUtils.random(), MathUtils.random(), MathUtils.random(), 1);
            rotation = MathUtils.random(360);
        }
    }

}


text:
package com.helger.commons.collection.iterate;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.fail;

import java.util.NoSuchElementException;

import org.junit.Test;

/**
 * Test class for class {@link EmptyEnumeration}.
 *
 * @author Philip Helger
 */
public final class EmptyEnumerationTest
{
  @Test
  public void testAll ()
  {
    final EmptyEnumeration <String> es = new EmptyEnumeration <> ();
    assertFalse (es.hasMoreElements ());
    try
    {
      es.nextElement ();
      fail ();
    }
    catch (final NoSuchElementException ex)
    {}
    assertNotEquals (es, null);
    assertNotEquals (es, "any");
  }
}


text:
package com.demigodsrpg.aspect.bloodlust;

import com.demigodsrpg.ability.Ability;
import com.demigodsrpg.aspect.Aspect;
import com.demigodsrpg.aspect.Groups;
import com.demigodsrpg.util.ItemUtil;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

import java.util.Arrays;

public class BloodlustAspectHero implements Aspect {
    @Override
    public Aspect.Group getGroup() {
        return Groups.BLOODLUST_ASPECT;
    }

    @Override
    public ItemStack getItem() {
        return ItemUtil.create(Material.GOLDEN_CHESTPLATE, getName(), Arrays.asList(getInfo()), null);
    }

    @Override
    public int getId() {
        return 16;
    }

    @Override
    public String[] getInfo() {
        return new String[]{"Heroic power over bloodlust."};
    }

    @Override
    public Aspect.Tier getTier() {
        return Aspect.Tier.HERO;
    }

    @Override
    public String getName() {
        return "Bloodline";
    }

    @Ability(name = "Blessings of Battle", info = "Can only die while being attacked.", type = Ability.Type.PASSIVE,
            placeholder = true)
    public void cheatDeathAbility() {
        // Do nothing, handled directly in the ability listener to save time
    }
}


text:
package org.apache.camel.wsdl_first;

import java.util.Set;

import javax.xml.namespace.QName;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.soap.SOAPHandler;
import javax.xml.ws.handler.soap.SOAPMessageContext;

public class JaxwsTestHandler implements SOAPHandler<SOAPMessageContext> {

    private int faultCount;
    private int messageCount;
    private int getHeadersCount;

    public int getGetHeadersCount() {
        return getHeadersCount;
    }

    public Set<QName> getHeaders() {
        getHeadersCount++;
        return null;
    }

    public void close(MessageContext messagecontext) {

    }

    public boolean handleFault(SOAPMessageContext messagecontext) {
        faultCount++;
        return true;
    }

    public boolean handleMessage(SOAPMessageContext messagecontext) {
        messageCount++;
        return true;
    }

    public void reset() {
        faultCount = 0;
        messageCount = 0;
        getHeadersCount = 0;
    }

    public int getFaultCount() {
        return faultCount;
    }

    public int getMessageCount() {
        return messageCount;
    }

    public String toString() {
        return "faultCount=" + faultCount + ", messageCount="
            + messageCount + ", getHeadersCount=" + getHeadersCount;
    }

}


text:
package club.cookbean.sparrow.test.standalone;

import club.cookbean.sparrow.builder.*;
import club.cookbean.sparrow.cache.Cache;
import club.cookbean.sparrow.cache.CacheManager;
import club.cookbean.sparrow.exception.BulkCacheWritingException;
import club.cookbean.sparrow.redis.Cacheable;
import club.cookbean.sparrow.test.db.MockDB;
import club.cookbean.sparrow.writer.CacheWriter;
import org.junit.BeforeClass;
import org.junit.Test;
import redis.clients.jedis.HostAndPort;

import java.util.Map;
import java.util.concurrent.TimeUnit;

/**
 * Created by Bennett Dong

 * Date : 2017/8/3

 * Mail: dongshujin.beans@gmail.com

 * Desc:
 */
public class RedisWriteBehindBatchCacheTest {

    private static MockDB mockDB = MockDB.getDB();

    private static CacheManager cacheManager;
    private static Cache standaloneCache;

    @BeforeClass
    public static void beforeClass() {
        // cache writer
        final CacheWriter cacheWriter = new CacheWriter() {
            final String TAG = "[CacheWriter]";

            @Override
            public void write(String key, Cacheable value) throws Exception {
                System.out.println(TAG+"["+Thread.currentThread().getName()+"] write");
                MockDB.DataHolder dataHolder = new MockDB.DataHolder(key, value.getValue());
                mockDB.add(dataHolder);
            }

            @Override
            public void writeAll(Iterable<? extends Map.Entry<String, Cacheable>> entries) throws BulkCacheWritingException, Exception {
                System.out.println(TAG+"["+Thread.currentThread().getName()+"] writeAll");
                for (Map.Entry<String, Cacheable> entry : entries) {
                    mockDB.add(new MockDB.DataHolder(entry.getKey(), entry.getValue().getValue()));
                }
            }

            @Override
            public void delete(String key) throws Exception {
                // todo
            }

            @Override
            public void deleteAll(Iterable<String> keys) throws BulkCacheWritingException, Exception {
                // todo
            }
        };

        // cache manager
        cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
                .using(PooledExecutionServiceConfigurationBuilder.newPooledExecutionServiceConfigurationBuilder()
                        .defaultPool("DefaultPool", 5, 10)
                        .build())
                .build();
        cacheManager.init();

        // standalone redis node
        HostAndPort localNode = new HostAndPort("127.0.0.1", 7000);
        standaloneCache = cacheManager.createCache("StandaloneCache",
                CacheConfigurationBuilder.newCacheConfigurationBuilder(
                        RedisResourceBuilder.newRedisResourceBuilder().standalone(localNode, false),
                        RedisConnectorBuilder.newRedisConnectorBuilder().standalone()
                                .name("test")
                                .prefix("prefix")
                                .pool(20, 10, 5, 1000))
                        .withCacheWriter(cacheWriter)
                        .withWriteBehind(WriteBehindConfigurationBuilder.newBatchedWriteBehindConfiguration(10, TimeUnit.MILLISECONDS, 2).build())
        );
    }

    @Test
    public void testGetAndSet() {
        String key = "write-behind-unbatch";
        String value = standaloneCache.get(key);
        System.out.println("value="+value);

        Cacheable cacheValue = new Cacheable() {
            @Override
            public long getExpireTime() {
                return 10000;
            }

            @Override
            public long getCreationTime() {
                return System.currentTimeMillis();
            }

            @Override
            public String getValue() {
                return "{\"name\":\"Bennet\"}";
            }

            @Override
            public String getKey() {
                return null;
            }
        };
        standaloneCache.set(key, cacheValue);

        value = standaloneCache.get(key);
        System.out.println("value="+value);

        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    @Test
    public void testSetBatchAndGet() {
        String key = "write-behind-unbatch";
        String value = standaloneCache.get(key);
        System.out.println("value="+value);

        for (int i=0; i<10; i++) {
            final int finalI = i;
            Cacheable cacheValue = new Cacheable() {
                @Override
                public long getExpireTime() {
                    return 10000;
                }

                @Override
                public long getCreationTime() {
                    return System.currentTimeMillis();
                }

                @Override
                public String getValue() {
                    return "{\"name\":\"Bennet\", \"index\": "+ finalI +"}";
                }

                @Override
                public String getKey() {
                    return null;
                }
            };
            standaloneCache.setWithWriter(key+"-"+i, cacheValue);
        }

        for (int i=0; i<15; i++) {
            value = standaloneCache.get(key+"-"+i);
            System.out.println("value=" + value);
        }

        try {
            Thread.sleep(20000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}


text:
'use strict';

/**
 * Module dependencies.
 */
var should = require('should'),
  mongoose = require('mongoose'),
  User = mongoose.model('User'),
  Drink = mongoose.model('Drink');

/**
 * Globals
 */
var user, drink, drink_id;

drink = {

  drinkName: 'Drink',
  drinkStyle: 'Pale Ale',
  drinkAbV: 5,
  color: 'yellow',
  glass: 'pint',
  drinkImageURL: 'http://swamphead.com/wp-content/uploads/2016/03/pint_Icon_Yellow.png',
  origin: 'Swamp Head Brewery',
  price12: 6,
  price16: 6,
  price32: 10,
  price64: 14,
  onMenu: false,
  menuNumber: 0,
  menuIndex: 0,
  tastingRoomOnly: false

};

/**
 * Unit tests
 */
describe('Drink Model Unit Tests:', function (done) {

  this.timeout(10000);

  /*beforeEach(function (done) {
    user = new User({
      firstName: 'Full',
      lastName: 'Name',
      displayName: 'Full Name',
      email: 'test@test.com',
      username: 'username',
      password: 'M3@n.jsI$Aw3$0m3'
    }); */

  describe('Saving drinks to the database', function(done){

    this.timeout(10000);

    it('Should save to the database if the drink is provided', function(done){
      new Drink({
        drinkName: drink.drinkName,
        drinkStyle: drink.drinkStyle,
        drinkAbV: drink.drinkABV,
        color: drink.color,
        glass: drink.glass,
        drinkImageURL: drink.drinkImageURL,
        origin: drink.origin,
        price12: drink.price12,
        price16: drink.price16,
        price32: drink.price32,
        price64: drink.price64,
        onMenu: drink.onMenu,
        menuNumber: drink.menuNumber,
        menuIndex: drink.menuIndex,
        tastingRoomOnly: drink.tastingRoomOnly

      }).save(function(err, drink){
        should.not.exist(err);
        drink_id = drink._id;
        done();
      });
    });

    it('Should not save to the db if drinkName is not provided', function(done){
      new Drink({
        drinkStyle: drink.drinkStyle,
        drinkAbV: drink.drinkABV,
        color: drink.color,
        glass: drink.glass,
        drinkImageURL: drink.drinkImageURL,
        onMenu: drink.onMenu,
        menuNumber: drink.menuNumber,
        menuIndex: drink.menuIndex,
        tastingRoomOnly: drink.tastingRoomOnly
      }).save(function(err){
        should.exist(err);
        done();
      });
    });

/*
    user.save(function () {
      drink = new Drink({
        title: 'Drink Title',
        content: 'Drink Content',
        user: user
      });

      drink = new Drink(drink_);

      drink.save(function(err, r){
        should
      })

      done();
    });
  });

  describe('Method Save', function () {
    it('should be able to save without problems', function (done) {
      this.timeout(10000);
      return drink.save(function (err) {
        should.not.exist(err);
        done();
      });
    });

    it('should be able to show an error when try to save without title', function (done) {
      drink.title = '';

      return drink.save(function (err) {
        should.exist(err);
        done();
      });
    });
  });

  afterEach(function (done) {
    Drink.remove().exec(function () {
      User.remove().exec(done);
    }); */
    afterEach(function(done){
      if(drink_id) {
        Drink.remove({ _id: drink_id }).exec(function(){
          drink_id = null;
          done();
        });
      } else {
        done();
      }
    });

  });
});


text:
package org.drip.xva.trajectory;

/*
 * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 */

/*!
 * Copyright (C) 2017 Lakshmi Krishnamurthy
 *
 *  This file is part of DRIP, a free-software/open-source library for buy/side financial/trading model
 *  	libraries targeting analysts and developers
 *  	https://lakshmidrip.github.io/DRIP/
 *
 *  DRIP is composed of four main libraries:
 *
 *  - DRIP Fixed Income - https://lakshmidrip.github.io/DRIP-Fixed-Income/
 *  - DRIP Asset Allocation - https://lakshmidrip.github.io/DRIP-Asset-Allocation/
 *  - DRIP Numerical Optimizer - https://lakshmidrip.github.io/DRIP-Numerical-Optimizer/
 *  - DRIP Statistical Learning - https://lakshmidrip.github.io/DRIP-Statistical-Learning/
 *
 *  - DRIP Fixed Income: Library for Instrument/Trading Conventions, Treasury Futures/Options,
 *  	Funding/Forward/Overnight Curves, Multi-Curve Construction/Valuation, Collateral Valuation and XVA
 *  	Metric Generation, Calibration and Hedge Attributions, Statistical Curve Construction, Bond RV
 *  	Metrics, Stochastic Evolution and Option Pricing, Interest Rate Dynamics and Option Pricing, LMM
 *  	Extensions/Calibrations/Greeks, Algorithmic Differentiation, and Asset Backed Models and Analytics.
 *
 *  - DRIP Asset Allocation: Library for model libraries for MPT framework, Black Litterman Strategy
 *  	Incorporator, Holdings Constraint, and Transaction Costs.
 *
 *  - DRIP Numerical Optimizer: Library for Numerical Optimization and Spline Functionality.
 *
 *  - DRIP Statistical Learning: Library for Statistical Evaluation and Machine Learning.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *   	you may not use this file except in compliance with the License.
 *
 *  You may obtain a copy of the License at
 *  	http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  	distributed under the License is distributed on an "AS IS" BASIS,
 *  	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 *  See the License for the specific language governing permissions and
 *  	limitations under the License.
 */

/**
 * CollateralGroupPath accumulates the Vertex Realizations of the Sequence in a Single Path Projection Run
 *  along the Granularity of a Collateral Group. The References are:
 *
 *  - Burgard, C., and M. Kjaer (2014): PDE Representations of Derivatives with Bilateral Counter-party Risk
 *  	and Funding Costs, Journal of Credit Risk, 7 (3) 1-19.
 *
 *  - Burgard, C., and M. Kjaer (2014): In the Balance, Risk, 24 (11) 72-75.
 *
 *  - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90.
 *
 *  - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the
 *  	Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing,
 *  	Singapore.
 *
 *  - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk
 *  	21 (2) 97-102.
 *
 * @author Lakshmi Krishnamurthy
 */

public class CollateralGroupPath {
	private org.drip.xva.trajectory.CollateralGroupEdge[] _aCGE = null;

	/**
	 * CollateralGroupPath Constructor
	 *
	 * @param aCGE The Array of Netting Group Trajectory Edges
	 *
	 * @throws java.lang.Exception Thrown if the Inputs are Invalid
	 */

	public CollateralGroupPath (
		final org.drip.xva.trajectory.CollateralGroupEdge[] aCGE)
		throws java.lang.Exception
	{
		if (null == (_aCGE = aCGE))
			throw new java.lang.Exception ("CollateralGroupPath Constructor => Invalid Inputs");

		int iNumEdge = _aCGE.length;

		if (1 >= iNumEdge)
			throw new java.lang.Exception ("CollateralGroupPath Constructor => Invalid Inputs");

		for (int i = 0; i < iNumEdge; ++i) {
			if (null == _aCGE[i])
				throw new java.lang.Exception ("CollateralGroupPath Constructor => Invalid Inputs");

			if (0 != i && _aCGE[i - 1].tail().vertex().julian() != _aCGE[i].head().vertex().julian())
				throw new java.lang.Exception ("CollateralGroupPath Constructor => Invalid Inputs");
		}
	}

	/**
	 * Retrieve the Array of Netting Group Trajectory Edges
	 *
	 * @return The Array of Netting Group Trajectory Edges
	 */

	public org.drip.xva.trajectory.CollateralGroupEdge[] edges()
	{
		return _aCGE;
	}

	/**
	 * Retrieve the Path-wise Credit Adjustment
	 *
	 * @return The Path-wise Credit Adjustment
	 */

	public double credit()
	{
		double dblCredit = 0.;

		for (org.drip.xva.trajectory.CollateralGroupEdge cge : _aCGE)
			dblCredit += cge.credit();

		return dblCredit;
	}

	/**
	 * Retrieve the Path-wise Debt Adjustment
	 *
	 * @return The Path-wise Debt Adjustment
	 */

	public double debt()
	{
		double dblDebt = 0.;

		for (org.drip.xva.trajectory.CollateralGroupEdge cge : _aCGE)
			dblDebt += cge.debt();

		return dblDebt;
	}

	/**
	 * Retrieve the Path-wise Funding Adjustment
	 *
	 * @return The Path-wise Funding Adjustment
	 */

	public double funding()
	{
		double dblFunding = 0.;

		for (org.drip.xva.trajectory.CollateralGroupEdge cge : _aCGE)
			dblFunding += cge.funding();

		return dblFunding;
	}

	/**
	 * Retrieve the Path-wise Total Adjustment
	 *
	 * @return The Path-wise Total Adjustment
	 */

	public double total()
	{
		double dblTotal = 0.;

		for (org.drip.xva.trajectory.CollateralGroupEdge cge : _aCGE)
			dblTotal += cge.total();

		return dblTotal;
	}

	/**
	 * Retrieve the Array of Collateralized Exposures
	 *
	 * @return The Array of Collateralized Exposures
	 */

	public double[] collateralizedExposure()
	{
		int iNumEdge = _aCGE.length;
		double[] adblCollateralizedExposure = new double[iNumEdge];

		for (int i = 0; i < iNumEdge; ++i)
			adblCollateralizedExposure[i] = _aCGE[i].tail().exposure().collateralized();

		return adblCollateralizedExposure;
	}

	/**
	 * Retrieve the Array of Uncollateralized Exposures
	 *
	 * @return The Array of Uncollateralized Exposures
	 */

	public double[] uncollateralizedExposure()
	{
		int iNumEdge = _aCGE.length;
		double[] adblUncollateralizedExposure = new double[iNumEdge];

		for (int i = 0; i < iNumEdge; ++i)
			adblUncollateralizedExposure[i] = _aCGE[i].tail().exposure().uncollateralized();

		return adblUncollateralizedExposure;
	}

	/**
	 * Retrieve the Array of Collateralized Exposure PVs
	 *
	 * @return The Array of Collateralized Exposure PVs
	 */

	public double[] collateralizedExposurePV()
	{
		int iNumEdge = _aCGE.length;
		double[] adblCollateralizedExposurePV = new double[iNumEdge];

		for (int i = 0; i < iNumEdge; ++i) {
			org.drip.xva.trajectory.CollateralGroupVertex cgvTail =_aCGE[i].tail();

			adblCollateralizedExposurePV[i] = cgvTail.exposure().collateralized() /
				cgvTail.numeraire().csa();
		}

		return adblCollateralizedExposurePV;
	}

	/**
	 * Retrieve the Array of Uncollateralized Exposure PVs
	 *
	 * @return The Array of Uncollateralized Exposure PVs
	 */

	public double[] uncollateralizedExposurePV()
	{
		int iNumEdge = _aCGE.length;
		double[] adblUncollateralizedExposurePV = new double[iNumEdge];

		for (int i = 0; i < iNumEdge; ++i) {
			org.drip.xva.trajectory.CollateralGroupVertex cgvTail =_aCGE[i].tail();

			adblUncollateralizedExposurePV[i] = cgvTail.exposure().uncollateralized() /
				cgvTail.numeraire().csa();
		}

		return adblUncollateralizedExposurePV;
	}

	/**
	 * Retrieve the Array of Collateral Balances
	 *
	 * @return The Array of Collateral Balances
	 */

	public double[] collateralBalance()
	{
		int iNumEdge = _aCGE.length;
		double[] adblCollateralizedBalance = new double[iNumEdge];

		for (int i = 0; i < iNumEdge; ++i)
			adblCollateralizedBalance[i] = _aCGE[i].tail().exposure().collateralBalance();

		return adblCollateralizedBalance;
	}

	/**
	 * Retrieve the Array of Edge Adjustments
	 *
	 * @return The Array of Edge Adjustments
	 */

	public org.drip.xva.trajectory.CollateralGroupEdgeAdjustment[] edgeAdjustments()
	{
		int iNumEdge = _aCGE.length;
		org.drip.xva.trajectory.CollateralGroupEdgeAdjustment[] aCGEA = new
			org.drip.xva.trajectory.CollateralGroupEdgeAdjustment[iNumEdge];

		for (int i = 0; i < iNumEdge; ++i)
			aCGEA[i] = _aCGE[i].generate();

		return aCGEA;
	}

	/**
	 * Construct the Group Trajectory Path Adjustment Instance
	 *
	 * @return The Group Trajectory Path Adjustment Instance
	 */

	public org.drip.xva.trajectory.CollateralGroupPathAdjustment adjustment()
	{
		int iNumEdge = _aCGE.length;
		double[] adblCollateralizedExposure = new double[iNumEdge];
		double[] adblUncollateralizedExposure = new double[iNumEdge];
		double[] adblCollateralizedExposurePV = new double[iNumEdge];
		double[] adblUncollateralizedExposurePV = new double[iNumEdge];
		org.drip.analytics.date.JulianDate[] adtVertex = new org.drip.analytics.date.JulianDate[iNumEdge];

		for (int i = 0; i < iNumEdge; ++i) {
			org.drip.xva.trajectory.CollateralGroupVertex cgvTail =_aCGE[i].tail();

			adtVertex[i] = cgvTail.vertex();

			double dblTailCSANumeraire = cgvTail.numeraire().csa();

			org.drip.xva.trajectory.CollateralGroupVertexExposure cgve = cgvTail.exposure();

			adblUncollateralizedExposure[i] = cgve.uncollateralized();

			adblCollateralizedExposurePV[i] = (adblCollateralizedExposure[i] = cgve.collateralized()) /
				dblTailCSANumeraire;

			adblUncollateralizedExposurePV[i] = (adblUncollateralizedExposure[i] = cgve.collateralized()) /
				dblTailCSANumeraire;
		}

		try {
			return new org.drip.xva.trajectory.CollateralGroupPathAdjustment (
				adtVertex,
				adblCollateralizedExposure,
				adblUncollateralizedExposure,
				adblCollateralizedExposurePV,
				adblUncollateralizedExposurePV
			);
		} catch (java.lang.Exception e) {
			e.printStackTrace();
		}

		return null;
	}
}


text:
/*
* @Author: Mike Reich
* @Date:   2016-02-13 08:59:44
* @Last Modified 2016-02-14
*/

'use strict';

import Module from '../src/'

import TestApp from '@nxus/core/lib/test/support/TestApp';

describe("Module", () => {
  var module, app;

  beforeEach(() => {
    app = new TestApp();
    module = new Module(app);
  });

  describe("Load", () => {
    it("should not be null", () => Module.should.not.be.null)

    it("should be instantiated", () => {
      module = new Module(app);
      module.should.not.be.null;
    });
  });

  describe('Init', () => {
    it("should register providers", () => {
     return app.emit('load').then(() => {
        app.get.calledWith('metrics').should.be.true;
        app.get().respond.calledWith('metric').should.be.true;
      });
    })
  })
})


text:
module Formulaic
  module Inputs
    class BooleanInput < Input
      def fill
        if value
          check(input(model_name, field))
        else
          uncheck(input(model_name, field))
        end
      end
    end
  end
end


text:
<template>
  <ui-page page-title="Data Grid">
    <ui-content ui-scroll ui-padding>
      <ui-container>

Functional datagrid with resizeable, sortable columns

Examples

            <ui-page css.bind="{height: '600px'}">
              <ui-datagrid
                data-source.bind="countries"
                ui-scroll
                checkable
                counter
                selected.bind="mySelected"
              >
                <ui-column data-id="name" locked="start" label="Country" sortable>
                  <template>
                    <ui-flag round code="${$record.iso2}"></ui-flag>
                    ${$record.name}
                  </template>
                </ui-column>
                <ui-column data-id="iso2" sortable width="70px">Code2</ui-column>
                <ui-column data-id="iso3" sortable width="70px">Code3</ui-column>
                <ui-column data-id="continent" resizeable sortable>Continent</ui-column>
                <ui-column data-id="capital" resizeable sortable>Capital</ui-column>
                <ui-column data-id="fullname" resizeable sortable width="400px" max-width="600px"
                  >Fullname</ui-column
                >
                <ui-column locked="end" width="80px" no-padding align="center">
                  <template>
                    <ui-button
                      type="outline"
                      ui-theme="info"
                      icon="mdi mdi-information"
                      size="sm"
                      click.trigger="notif($record)"
                      ui-tooltip="Country Info"
                    ></ui-button>
                  </template>
                </ui-column>
              </ui-datagrid>
              <ui-sidebar position="end" width="180px">
                <ui-content ui-scroll>
                  <template repeat.for="record of mySelected" class="ui-ellipsis">
                    <ui-flag
                      round
                      code="${record.iso2}"
                      size="lg"
                      ui-margin="xs"
                      ui-tooltip="value.bind:record.name; position.bind:'top'"
                    ></ui-flag>
                  </template>
                </ui-content>
              </ui-sidebar>
            </ui-page>

Using the Datagrid

        <x-code-block lang="html" page="app.html" code.bind="datagridHtml"></x-code-block>

Properties

        <x-blockquote>Attributes marked with value none do not require a value</x-blockquote>
        <x-code-table code-template.bind="datagirdAttrs"></x-code-table>
      </ui-container>
    </ui-content>
  </ui-page>
</template>


text:
typedef enum {
	Nano_SIZE_NORMAL = 0,
	Nano_SIZE_HUGE = 1
} NanoSize;

#define Nano_EFFECT_PREF			@"Transition effect"
typedef enum {
	Nano_EFFECT_SLIDE = 0,
	Nano_EFFECT_WIPE,
	Nano_EFFECT_FADE
} NanoEffectType;

#define GrowlNanoVeryLowBackgroundColor	@"Nano-Priority-VeryLow-Color"
#define GrowlNanoModerateBackgroundColor	@"Nano-Priority-Moderate-Color"
#define GrowlNanoNormalBackgroundColor	@"Nano-Priority-Normal-Color"
#define GrowlNanoHighBackgroundColor		@"Nano-Priority-High-Color"
#define GrowlNanoEmergencyBackgroundColor	@"Nano-Priority-Emergency-Color"

#define GrowlNanoVeryLowTextColor			@"Nano-Priority-VeryLow-Text-Color"
#define GrowlNanoModerateTextColor		@"Nano-Priority-Moderate-Text-Color"
#define GrowlNanoNormalTextColor			@"Nano-Priority-Normal-Text-Color"
#define GrowlNanoHighTextColor			@"Nano-Priority-High-Text-Color"
#define GrowlNanoEmergencyTextColor		@"Nano-Priority-Emergency-Text-Color"

@interface GrowlNanoPrefs : NSPreferencePane {
	IBOutlet NSSlider *slider_opacity;
}

- (CGFloat) duration;
- (void) setDuration:(CGFloat)value;
- (unsigned) effect;
- (void) setEffect:(unsigned)newEffect;
- (CGFloat) opacity;
- (void) setOpacity:(CGFloat)value;
- (int) size;
- (void) setSize:(int)value;
- (int) screen;
- (void) setScreen:(int)value;

- (NSColor *) textColorVeryLow;
- (void) setTextColorVeryLow:(NSColor *)value;
- (NSColor *) textColorModerate;
- (void) setTextColorModerate:(NSColor *)value;
- (NSColor *) textColorNormal;
- (void) setTextColorNormal:(NSColor *)value;
- (NSColor *) textColorHigh;
- (void) setTextColorHigh:(NSColor *)value;
- (NSColor *) textColorEmergency;
- (void) setTextColorEmergency:(NSColor *)value;

- (NSColor *) backgroundColorVeryLow;
- (void) setBackgroundColorVeryLow:(NSColor *)value;
- (NSColor *) backgroundColorModerate;
- (void) setBackgroundColorModerate:(NSColor *)value;
- (NSColor *) backgroundColorNormal;
- (void) setBackgroundColorNormal:(NSColor *)value;
- (NSColor *) backgroundColorHigh;
- (void) setBackgroundColorHigh:(NSColor *)value;
- (NSColor *) backgroundColorEmergency;
- (void) setBackgroundColorEmergency:(NSColor *)value;

@end


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.gkehub.v1alpha.model;

/**
 * Deployment state for Hierarchy Controller
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the GKE Hub API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class ConfigManagementHierarchyControllerDeploymentState extends com.google.api.client.json.GenericJson {

  /**
   * The deployment state for Hierarchy Controller extension (e.g. v0.7.0-hc.1)
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String extension;

  /**
   * The deployment state for open source HNC (e.g. v0.7.0-hc.0)
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String hnc;

  /**
   * The deployment state for Hierarchy Controller extension (e.g. v0.7.0-hc.1)
   * @return value or {@code null} for none
   */
  public java.lang.String getExtension() {
    return extension;
  }

  /**
   * The deployment state for Hierarchy Controller extension (e.g. v0.7.0-hc.1)
   * @param extension extension or {@code null} for none
   */
  public ConfigManagementHierarchyControllerDeploymentState setExtension(java.lang.String extension) {
    this.extension = extension;
    return this;
  }

  /**
   * The deployment state for open source HNC (e.g. v0.7.0-hc.0)
   * @return value or {@code null} for none
   */
  public java.lang.String getHnc() {
    return hnc;
  }

  /**
   * The deployment state for open source HNC (e.g. v0.7.0-hc.0)
   * @param hnc hnc or {@code null} for none
   */
  public ConfigManagementHierarchyControllerDeploymentState setHnc(java.lang.String hnc) {
    this.hnc = hnc;
    return this;
  }

  @Override
  public ConfigManagementHierarchyControllerDeploymentState set(String fieldName, Object value) {
    return (ConfigManagementHierarchyControllerDeploymentState) super.set(fieldName, value);
  }

  @Override
  public ConfigManagementHierarchyControllerDeploymentState clone() {
    return (ConfigManagementHierarchyControllerDeploymentState) super.clone();
  }

}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Metrosideros apocynifolia Salisb.

### Remarks
null


text:
Go to:

- [data](https://github.com/tdeboissiere/DeepLearningImplementations/tree/master/Colorful/src/data) for the data processing scripts
- [utils](https://github.com/tdeboissiere/DeepLearningImplementations/tree/master/Colorful/src/utils) for the various scripting utilities used throughout
- [model](https://github.com/tdeboissiere/DeepLearningImplementations/tree/master/Colorful/src/model) for training/evaluating scripts
- [app](https://github.com/tdeboissiere/DeepLearningImplementations/tree/master/Colorful/src/app) for the webcam app


text:
using System;
using System.Reflection;

namespace HighIronRanch.Core.Services
{
	public interface ILogger
	{
		void Debug(string context, string message);
		void Debug(string context, string fmt, params object[] vars);
		void Debug(string context, Exception exception, string fmt, params object[] vars);

		void Information(string context, string message);
		void Information(string context, string fmt, params object[] vars);
		void Information(string context, Exception exception, string fmt, params object[] vars);

		void Warning(string context, string message);
		void Warning(string context, string fmt, params object[] vars);
		void Warning(string context, Exception exception, string fmt, params object[] vars);

		void Error(string context, string message);
		void Error(string context, string fmt, params object[] vars);
		void Error(string context, Exception exception, string fmt, params object[] vars);

		void TraceApi(string context, string componentName, string method, TimeSpan timespan);
		void TraceApi(string context, string componentName, string method, TimeSpan timespan, string properties);
		void TraceApi(string context, string componentName, string method, TimeSpan timespan, string fmt, params object[] vars);
		void TraceApi(string context, MethodBase methodBase, TimeSpan timespan, string message);
		void TraceApi(string context, MethodBase methodBase, TimeSpan timespan, string fmt, params object[] vars);
	}
}


text:
/**
 * Rn.java
 *
 * Author  : Christopher K. Allen
 * Since   : Jul 22, 2015
 */
package xal.tools.math.rn;

import xal.tools.data.DataAdaptor;
import xal.tools.math.BaseVector;

/**
 * Represents a vector of real numbers with arbitrary length.
 *
 * @author Christopher K. Allen
 * @since  Jul 22, 2015
 */
public class Rn extends BaseVector<Rn> {

    /*
     * Global Constants
     */

    /** Serialization version number */
    private static final long serialVersionUID = 1L;

    /*
     * Initialization
     */

    /**
     * Zero matrix constructor for Rn.  A new vector is created
     * with the given dimension and all zero elements.
     *
     * @param intSize   vector size
     *
     * @since  Jul 22, 2015   by Christopher K. Allen
     */
    public Rn(int intSize) {
        super(intSize);
    }

    /**
     * Initializing constructor for Rn.  The
     * element values are loaded from the given data source.
     *
     * @param intSize   size of the vector
     *
     * @param daSource  data source contains initial values for elements
     *
     * @since  Jul 22, 2015   by Christopher K. Allen
     */
    public Rn(int intSize, DataAdaptor daSource) {
        super(intSize, daSource);
    }

    /**
     *

     * Initializing constructor for bases class Rn.
     * Sets the entire vector to the values given in the Java primitive type
     * double array. The argument itself remains unchanged.
     *

     *

     * The dimensions of the new vector will be the length of the given Java double array.
     *

     *

     *
NOTE

     * · The given array is set to the internal vector representation.
     * Thus the given array should not be referenced afterwards!
     *

     *

     * · This action is done for performance.  If the given array is
     * intended for further manipulation then a clone should be offered to this
     * constructor.
     *

     *
     * @param arrMatrix   Java primitive array containing new vector values
     *
     * @since  Jul 22, 2015   by Christopher K. Allen
     */
    public Rn(double[] arrVals) {
        super(arrVals);
    }

    /**
     *

     *  Parsing Constructor - creates an instance of the child class and initialize it
     *  according to a token string of element values.
     *

     *

     *  The token string argument is assumed to be one-dimensional and delimited
     *  by any of the characters <tt>" ,()[]{}"</tt>  Repeated, contiguous delimiters
     *  are parsed together.  This conditions allows a variety of parseable string
     *  representations. For example,
     *

     *

     *      { 1, 2, 3, 4 }
     *

     *

     *  and
     *

     *

     *      [1 2 3 4]
     *

     *

     *  would parse to the same real vector (1.0, 2.0, 3.0, 4.0).
     *

     *
     *  @param  intSize     the matrix size of this object
     *  @param  strTokens   token vector of getSize() numeric values
     *
     *  @exception  IllegalArgumentException    wrong number of token strings
     *  @exception  NumberFormatException       bad number format, unparseable
     *
     * @since  Jul 22, 2015   by Christopher K. Allen
     */
    public Rn(int intSize, String strTokens) throws IllegalArgumentException, NumberFormatException {
        super(intSize, strTokens);
    }

    /**
     * Copy constructor.  Creates a deep copy of the given argument.
     *
     * @param   vecTemplate vector to be cloned
     *
     *  @since  Jul 22, 2015   by Christopher K. Allen
     */
    public Rn(Rn vecTemplate) throws UnsupportedOperationException {
        super(vecTemplate);
    }

    /*
     * Abstract Implementations
     */

    /**
     *
     * @see xal.tools.math.BaseVector#clone()
     *
     * @since  Jul 22, 2015   by Christopher K. Allen
     */
    @Override
    public Rn clone() {
        return new Rn(this);
    }

    /**
     * Returns a new, zero element, instance of Rn which has the
     * same size as this object.  That is, the returned object is in
     * the same equivalence class of vectors as this one.
     *
     * @see xal.tools.math.BaseVector#newInstance()
     *
     * @since  Jul 22, 2015   by Christopher K. Allen
     */
    @Override
    protected Rn newInstance(int intSize) {
        return new Rn(intSize);
    }

    /**
     *
     * @see xal.tools.math.BaseVector#newInstance(double[])
     *
     * @since  Jul 24, 2015   by Christopher K. Allen
     */
    @Override
    protected Rn newInstance(double[] arrVecInt) {
        return new Rn(arrVecInt);
    }

}


text:
title: >
  koszek.com: Goals, technical reading hints, OSX tool for better productivity, programming advice and some YouTube videos
---

Hello,

A while ago you subscribed to my mailing list. Maybe you liked one of the
articles I've written on [my website](http://www.koszek.com)?  For 2017 I
plan to give you regular monthly updates to keep myself accountable. That's
right--one e-mail a month. That's all. But you don't have this limit. You
can e-mail me more times, with questions and suggestions, and the most
important: your criticism.

This January I wrote four articles and I believe you may find them
interesting:

- [That's why you haven't accomplished enough in 2016](http://www.koszek.com/blog/2017/01/02/thats-why-you-havent-accomplished-enough-in-2016/)
  has my ideas on goal settings and shows two books which helped me a lot
  with productivity. To write my blog, for example, I'm trying to build a
  habit of writing every day.

- [Reading 101 for software engineers](http://www.koszek.com/blog/2017/01/17/reading-for-software-engineers/)
  gives you hints on how to filter good technical content. I don't like new
  books on software engineering, and I argue you should mostly focus on
  long-lasting topics that don't change much.

- [The best OSX file manager](http://www.koszek.com/blog/2017/01/18/the-best-osx-file-manager/)
  will be useful only if you have an Apple Mac computer. It talks about
  muCommander--the tool which increased my productivity.

- [Why you should start programming on UNIX](http://www.koszek.com/blog/2017/01/28/why-you-should-start-programming-on-unix/)
  explains why I believe that using UNIX (building block of OSX and Linux)
  to start programming and I argue other domains of programming are harder
  to get into.

I'd like to encourage you to subscribe to [my YouTube
channel](https://www.youtube.com/user/wkoszek) I just started. It will be
about software and technical topics. The most relevant videos so far are:
[Building an Open Source iOS app, part 1](https://www.youtube.com/watch?v=zY6YDXyF6ks&t=726s) and
[Building an Open Source iOS app, part 2](https://www.youtube.com/watch?v=gE49zGSFcio&t=46s).
This is one, very long talk, I know. I went over time. But the feedback was positive, and I
made new professional connections.

Let me know what you think and feel free to re-connect and let me know what
you're up to.

Take care and see you in a month.

	Wojciech Koszek
	http://www.koszek.com
	wojciech@koszek.com

You got this e-mail because you subscribed to the mailing list on
[my website](http://www.koszek.com). If you don't want to receive e-mail
from me, click
[unsubscribe](mailto:wojciech@koszek.com?subject=Unsubscribe from koszek.com mailing list)
and I'll remove you from my mailing list.


text:
package ac.simons.biking2.bikingpictures.rss;

import java.time.ZonedDateTime;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

/**
 * @author Michael J. Simons, 2014-02-17
 */
@XmlAccessorType(XmlAccessType.FIELD)
public final class Item {

    private String title;

    private String link;

    private String description;

    @XmlJavaTypeAdapter(RSSDateTimeAdapter.class)
    private ZonedDateTime pubDate;

    private Guid guid;

    @XmlElement(namespace = "http://search.yahoo.com/mrss/")
    private Thumbnail thumbnail;

    @XmlElement(namespace = "http://search.yahoo.com/mrss/")
    private List<Content> content;

    public String getTitle() {
        return title;
    }

    public void setTitle(final String title) {
        this.title = title;
    }

    public String getLink() {
        return link;
    }

    public void setLink(final String link) {
        this.link = link;
    }

    public String getDescription() {
        return description;
    }

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

    public ZonedDateTime getPubDate() {
        return pubDate;
    }

    public void setPubDate(final ZonedDateTime pubDate) {
        this.pubDate = pubDate;
    }

    public Guid getGuid() {
        return guid;
    }

    public void setGuid(final Guid guid) {
        this.guid = guid;
    }

    public Thumbnail getThumbnail() {
        return thumbnail;
    }

    public void setThumbnail(final Thumbnail thumbnail) {
        this.thumbnail = thumbnail;
    }

    public List<Content> getContent() {
        return content;
    }

    public void setContent(final List<Content> content) {
        this.content = content;
    }
}


text:
package org.openfact.representations.idm.search;

import java.util.ArrayList;
import java.util.List;

public class SearchResultsRepresentation<T> {

    private List<T> items = new ArrayList<>();
    private int totalSize;

    /**
     * @return the beans
     */
    public List<T> getItems() {
        return items;
    }

    /**
     * @param beans
     *            the beans to set
     */
    public void setItems(List<T> items) {
        this.items = items;
    }

    /**
     * @return the totalSize
     */
    public int getTotalSize() {
        return totalSize;
    }

    /**
     * @param totalSize
     *            the totalSize to set
     */
    public void setTotalSize(int totalSize) {
        this.totalSize = totalSize;
    }

}


text:
#import <Foundation/Foundation.h>
#import "LMNotification.h"
#import "LMConfiguration.h"

@protocol LMNotificationCenterDelegage <NSObject>

@optional
- (void) didOpenNotification:(LMNotification*)notification;
- (void) didCloseNotification:(LMNotification*)notification;

@end

@interface LMNotificationCenter : NSObject

@property (nonatomic, weak) id<LMNotificationCenterDelegage> delegage;
@property (nonatomic, strong) LMConfiguration *configuration;

+ (LMNotificationCenter*) defaultCenter;

- (void) postNotification:(LMNotification*)notification;
- (void) removeNotification:(LMNotification*)notification;
- (void) removeAllNotifications;

@end


text:
/**************************************************************************
 * Extra Chrome specific features and new APIs which need to be mixed in.
 *
 * The contents of this file is appending to lib.d.ts *before* processing.
 */
interface Element {
  remove(): void; // FF and Chrome specific.

  // Shadow DOM
  createShadowRoot(): ShadowRoot;

  webkitCreateShadowRoot(): ShadowRoot;

  getDestinationInsertionPoints(): NodeList;
  shadowRoot: ShadowRoot;
  webkitShadowRoot: ShadowRoot;
}

// Shadow DOM
interface ShadowRoot extends DocumentFragment {
  getElementById(elementId: string ): HTMLElement;
  getElementsByClassName(className: string): NodeList;
  getElementsByTagName(tagName: string): NodeList;
  getElementsByTagNameNS(namespace: string, localName: string): NodeList;
  getSelection(): Selection;
  elementFromPoint(x: number, y: number): Element;

  activeElement: Element;
  host: Element;
  olderShadowRoot: ShadowRoot;
  innerHTML: string;
  styleSheets: StyleSheetList;
}

// HTML Templates
interface HTMLTemplate extends HTMLElement {
  content: HTMLElement;
}

// HTML Template and custom element related.
interface HTMLContentElement extends HTMLElement {
  select: string;
  getDistributedNodes(): NodeList;
}

interface HTMLDialogElement extends HTMLElement {
  open: boolean;
  returnValue: string;
  show(anchor?: Element): void;
  show(anchor?: MouseEvent): void;
  showModal(anchor?: Element): void;
  showModal(anchor?: MouseEvent): void;
  close(returnValue?: string): void;
}

interface Document {
  createElement(tagName: "template"): HTMLTemplate;
  registerElement(tagName:string, props:any): any;
}

interface Window {
  CustomEvent: CustomEvent;
}

interface CustomEventOptions {
  type?: string;
  canBubble?: boolean;
  cancelable?: boolean;
  detail?: any;
}

interface KeyboardEvent {
  keyIdentifier: string;
}

interface Event {
  path: Node[]; // <- obsolete. Removed from later the Shadow DOM spec.
  deepPath: Node[];
  encapsulated: boolean;
}


text:
package server

import (
	"context"

	pb "go-common/app/service/main/spy/api"
	"go-common/app/service/main/spy/model"
	service "go-common/app/service/main/spy/service"
	"go-common/library/net/rpc/warden"
)

// New Spy warden rpc server
func New(c *warden.ServerConfig, svr *service.Service) *warden.Server {
	ws := warden.NewServer(c)
	pb.RegisterSpyServer(ws.Server(), &server{svr})
	_, err := ws.Start()
	if err != nil {
		panic(err)
	}
	return ws
}

type server struct {
	svr *service.Service
}

var _ pb.SpyServer = &server{}

// Ping check dao health.
func (s *server) Ping(ctx context.Context, req *pb.PingReq) (*pb.PingReply, error) {
	return &pb.PingReply{}, nil
}

// StatByID spy stat by id or mid.
func (s *server) StatByID(ctx context.Context, req *pb.StatByIDReq) (*pb.StatByIDReply, error) {
	statistics, err := s.svr.StatByID(ctx, req.Mid, req.Id)
	if err != nil {
		return nil, err
	}
	reply := new(pb.StatByIDReply)
	reply.DeepCopyFromStatistics(statistics)
	return reply, nil
}

// StatByIDGroupEvent spy stat by id or mid.
func (s *server) StatByIDGroupEvent(ctx context.Context, req *pb.StatByIDGroupEventReq) (*pb.StatByIDGroupEventReply, error) {
	statistics, err := s.svr.StatByIDGroupEvent(ctx, req.Mid, req.Id)
	if err != nil {
		return nil, err
	}
	reply := new(pb.StatByIDGroupEventReply)
	reply.DeepCopyFromStatistics(statistics)
	return reply, nil
}

// PurgeUser purge  user info
func (s *server) PurgeUser(ctx context.Context, req *pb.PurgeUserReq) (*pb.PurgeUserReply, error) {
	return &pb.PurgeUserReply{}, s.svr.PurgeUser(ctx, req.Mid, req.Action)
}

// HandleEvent handle spy-event.
func (s *server) HandleEvent(ctx context.Context, req *pb.HandleEventReq) (*pb.HandleEventReply, error) {
	eventMsg := new(model.EventMessage)
	req.DeepCopyAsIntoEventMessage(eventMsg)
	return &pb.HandleEventReply{}, s.svr.HandleEvent(ctx, eventMsg)
}

// UserInfo get UserInfo by mid , from cache or db or generate.
func (s *server) UserInfo(ctx context.Context, req *pb.UserInfoReq) (*pb.UserInfoReply, error) {
	ui, err := s.svr.UserInfo(ctx, req.Mid, req.Ip)
	if err != nil {
		return nil, err
	}
	reply := new(pb.UserInfoReply)
	reply.DeepCopyFromUserInfo(ui)
	return reply, nil
}

// UserInfoAsyn get UserInfo by mid , from cache or db or asyn generate.
func (s *server) UserInfoAsyn(ctx context.Context, req *pb.UserInfoAsynReq) (*pb.UserInfoAsynReply, error) {
	ui, err := s.svr.UserInfoAsyn(ctx, req.Mid)
	if err != nil {
		return nil, err
	}
	reply := new(pb.UserInfoAsynReply)
	reply.DeepCopyFromUserInfo(ui)
	return reply, nil
}

// ReBuildPortrait reBuild user info.
func (s *server) ReBuildPortrait(ctx context.Context, req *pb.ReBuildPortraitReq) (*pb.ReBuildPortraitReply, error) {
	return &pb.ReBuildPortraitReply{}, s.svr.ReBuildPortrait(ctx, req.Mid, req.Reason)
}

// UpdateUserScore update user score
func (s *server) UpdateUserScore(ctx context.Context, req *pb.UpdateUserScoreReq) (*pb.UpdateUserScoreReply, error) {
	return &pb.UpdateUserScoreReply{}, s.svr.UpdateUserScore(ctx, req.Mid, req.Ip, req.Effect)
}

// RefreshBaseScore refresh base score.
func (s *server) RefreshBaseScore(ctx context.Context, req *pb.RefreshBaseScoreReq) (*pb.RefreshBaseScoreReply, error) {
	argReset := new(model.ArgReset)
	req.DeepCopyAsIntoArgReset(argReset)
	return &pb.RefreshBaseScoreReply{}, s.svr.RefreshBaseScore(ctx, argReset)
}

// UpdateBaseScore update base score.
func (s *server) UpdateBaseScore(ctx context.Context, req *pb.UpdateBaseScoreReq) (*pb.UpdateBaseScoreReply, error) {
	argReset := new(model.ArgReset)
	req.DeepCopyAsIntoArgReset(argReset)
	return &pb.UpdateBaseScoreReply{}, s.svr.UpdateBaseScore(ctx, argReset)
}

// UpdateEventScore update event score.
func (s *server) UpdateEventScore(ctx context.Context, req *pb.UpdateEventScoreReq) (*pb.UpdateEventScoreReply, error) {
	argReset := new(model.ArgReset)
	req.DeepCopyAsIntoArgReset(argReset)
	return &pb.UpdateEventScoreReply{}, s.svr.UpdateEventScore(ctx, argReset)
}

// ClearReliveTimes clear times.
func (s *server) ClearReliveTimes(ctx context.Context, req *pb.ClearReliveTimesReq) (*pb.ClearReliveTimesReply, error) {
	argReset := new(model.ArgReset)
	req.DeepCopyAsIntoArgReset(argReset)
	return &pb.ClearReliveTimesReply{}, s.svr.ClearReliveTimes(ctx, argReset)
}

// Info get user info by mid.
func (s *server) Info(ctx context.Context, req *pb.InfoReq) (*pb.InfoReply, error) {
	ui, err := s.svr.Info(ctx, req.Mid)
	if err != nil {
		return nil, err
	}
	reply := new(pb.InfoReply)
	reply.DeepCopyFromUserInfo(ui)
	return reply, nil
}


text:
{% extends "collaboration.html" %}
{% block css %}
<link rel="stylesheet" href="/static/css/mintchoc/jquery-ui.css" type="text/css">
{% endblock css %}
{% block javascript %}

{% endblock javascript %}

{% block content %}

This contributor will be removed from Initiative. Are you sure?

Inbox

{% if system_message %}
{{ system_message }}
{% endif %}
<form id="process_offer_form" name="process_offer_form" method="post" action="/manager/inbox/">
<input name="offer_id" id="offer_id" type="hidden" value="">
<input name="cmd" id="cmd" type="hidden" value="">
{% csrf_token %}

Initiative	Service	Provider	Date	Action

{% for offer in offer_list %}

		{{ offer.initiative__short_desc|truncatechars:15 }}
		{{ offer.service__short_desc }}
		{{ offer.profile__first_name }} {{ offer.profile__last_name }}
		{{ offer.create_date|date:"M d, Y"  }}
		Accept | Reject

{% endfor %}

</form>

        {% if offer_list.has_previous %}
            previous
        {% endif %}

            Page {{ offer_list.number }} of {{ offer_list.paginator.num_pages }}.

        {% if offer_list.has_next %}
            next
        {% endif %}

{% endblock content %}


text:
if Rails.env.production?
  ZeroPush.auth_token = '<%= @production_token %>'
else
  ZeroPush.auth_token = '<%= @development_token %>'
end


text:
namespace ui {

class DesktopPlatformScreen {
 public:
  virtual ~DesktopPlatformScreen() { }

  virtual gfx::Point GetCursorScreenPoint() = 0;
};

}  // namespace ui

#endif  // OZONE_PLATFORM_PLATFORM_SCREEN_H_


text:
/* DOES THIS HELP AUTOSIZING? */
.saved {
	width: 430px !important;
	font-family: Verdana;
	position: relative;
}

.saved textarea {
	overflow: auto !important;
}

.saved .dojoDndItem,
.saved .dojoDndItem .dojoDndItemOver {
	padding: 0px !important;
}

.saved .savedTitle {
	display: inline-block;
	font-size: 15px;
	font-weight: bolder;
	top: -10px !important;
	position: relative;
}

/* DRAG SOURCE */
.saved .dragSource table
{
    border: 0 !important;
	border-collapse: collapse !important;
	float: left;
    margin-top: 0px !important;
    padding-top: 0px !important;
    height: auto !important;
}

.saved .dragSource
{
	width: 39;
	-moz-background-clip:border;
	-moz-background-inline-policy:continuous;
	-moz-background-origin:padding;
	border-radius:8pt;
	background:#FFFFFF none repeat scroll 0 0;
	border:3px solid #CCCCCC;
	cursor:default;
	padding:1em 0.5em;
	min-height: 200px !important;
	height: auto !important;

	/* NEEDED SO THAT SCROLLBAR WILL SHOW */
	display: block !important;
	width: 403px !important; */
	width: 3;
}

/* QUERY NAME */
.saved .nameInput .dijitTextBox {
	width: 255px !important;
}

/* BUTTON */
/* NB: THIS IS NEEDED FOR THE BUTTON CSS BELOW TO WORK! */
.saved table textarea {
	font-family: Verdana;
}

/* MISC */
.saved .dragSource .dijitReset.dijitValidationContainer {
    display: none !important;
}

.saved .dragSource .dijitReset.dijitInline.dijitSelectLabel.dijitValidationTextBoxLabel  {
    width: 80px !important;
}

.saved .dragSource .ordinal .dijitReset.dijitInline.dijitSelectLabel.dijitValidationTextBoxLabel  {
    width: 30px !important;
}

/* BORDER AROUND ALL ITEMS */
.saved .dragSource .actionSelect,
.saved .dragSource .fieldSelect,
.saved .dragSource .operatorSelect,
.saved .dragSource .valueInput
 {
    border: 1px grey solid;
    min-height: 20px !important;
	font-size: 14px !important;
}

/* ROW BACKGROUND */
.saved .dragSource .dojoDndItemAnchor {
    background-color: white;
}

/* NO PADDING AROUND DND ITEMS */
.saved .dojoDndItem,
.saved .dojoDndItem .dojoDndItemOver {
	padding: 0px !important;
}

.saved .invalid
{
	border: 2px solid #F00 !important;
}

/* TOGGLE */
.saved .toggleTitle {
    font-family: Arial;
	text-align: left !important;
	font-weight: 800 !important;

    color: #444 !important;

    font-size: 16px !important;
	padding-top: 6px !important;
}
.saved .toggleTitle.open {
	background-image: url(../../../plugins/apps/images/toggle-minus-11.png);
	text-indent: 20px;
	background-position: 0.2em 0.6em;
	background-repeat: no-repeat;
}
.saved .toggleTitle.closed {
	background-image: url(../../../plugins/apps/images/toggle-plus-11.png);
	text-indent: 20px;
	background-position: 0.2em 0.6em;
	background-repeat: no-repeat;
	height: 22px;
	overflow: hidden !important;
}

.saved .savedSelect
{
	position: absolute;
	top: 3px;
	left: 140px;
	font-size: 16px;
	font-weight: 900;
	color: black;
	width: 278px !important;
	text-align: center !important;
	text-indent: 2px !important;
}
.saved .savedSelect .dijitArrowButton {
	width: 16px !important;
}

.saved .dragSource .queryRow .deleteButton {
	display: none !important;
	visibility: hidden !important;
	width: 20px !important;
}

.saved .dragSource .queryRow {
	width: 380px !important;
}

.saved .savedInputContainer {
	min-height: 60px;
	overflow: hidden;
}

.saved .dijitContentPane {
	overflow: hidden;
}


text:
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F3xx_HAL_CRC_EX_H
#define __STM32F3xx_HAL_CRC_EX_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32f3xx_hal_def.h"

/** @addtogroup STM32F3xx_HAL_Driver
  * @{
  */

/** @addtogroup CRCEx
  * @{
  */

/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/** @defgroup CRCEx_Exported_Constants CRC Extended Exported Constants
  * @{
  */

/** @defgroup CRCEx_Input_Data_Inversion CRC Extended Input Data Inversion Modes
  * @{
  */
#define CRC_INPUTDATA_INVERSION_NONE              ((uint32_t)0x00000000)
#define CRC_INPUTDATA_INVERSION_BYTE              ((uint32_t)CRC_CR_REV_IN_0)
#define CRC_INPUTDATA_INVERSION_HALFWORD          ((uint32_t)CRC_CR_REV_IN_1)
#define CRC_INPUTDATA_INVERSION_WORD              ((uint32_t)CRC_CR_REV_IN)

#define IS_CRC_INPUTDATA_INVERSION_MODE(MODE)     (((MODE) == CRC_INPUTDATA_INVERSION_NONE) || \
                                                   ((MODE) == CRC_INPUTDATA_INVERSION_BYTE) || \
                                                   ((MODE) == CRC_INPUTDATA_INVERSION_HALFWORD) || \
                                                   ((MODE) == CRC_INPUTDATA_INVERSION_WORD))
/**
  * @}
  */

/** @defgroup CRCEx_Output_Data_Inversion CRC Extended Output Data Inversion Modes
  * @{
  */
#define CRC_OUTPUTDATA_INVERSION_DISABLED         ((uint32_t)0x00000000)
#define CRC_OUTPUTDATA_INVERSION_ENABLED          ((uint32_t)CRC_CR_REV_OUT)

#define IS_CRC_OUTPUTDATA_INVERSION_MODE(MODE)    (((MODE) == CRC_OUTPUTDATA_INVERSION_DISABLED) || \
                                                   ((MODE) == CRC_OUTPUTDATA_INVERSION_ENABLED))
/**
  * @}
  */

/**
  * @}
  */

/* Exported macro ------------------------------------------------------------*/

/** @defgroup CRCEx_Exported_Macros CRC Extended Exported Macros
  * @{
  */

/**
  * @brief  Set CRC output reversal
  * @param  __HANDLE__    : CRC handle
  * @retval None.
  */
#define  __HAL_CRC_OUTPUTREVERSAL_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_REV_OUT)

/**
  * @brief  Unset CRC output reversal
  * @param  __HANDLE__    : CRC handle
  * @retval None.
  */
#define __HAL_CRC_OUTPUTREVERSAL_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(CRC_CR_REV_OUT))

/**
  * @brief  Set CRC non-default polynomial
  * @param  __HANDLE__    : CRC handle
  * @param  __POLYNOMIAL__: 7, 8, 16 or 32-bit polynomial
  * @retval None.
  */
#define __HAL_CRC_POLYNOMIAL_CONFIG(__HANDLE__, __POLYNOMIAL__) ((__HANDLE__)->Instance->POL = (__POLYNOMIAL__))

/**
  * @}
  */

/* Exported functions --------------------------------------------------------*/
/** @addtogroup CRCEx_Exported_Functions CRC Extended Exported Functions
  * @{
  */

/** @addtogroup CRCEx_Exported_Functions_Group1 Extended Initialization and de-initialization functions
  * @brief    Extended Initialization and Configuration functions.
  * @{
  */
/* Initialization and de-initialization functions  ****************************/
HAL_StatusTypeDef HAL_CRCEx_Polynomial_Set(CRC_HandleTypeDef *hcrc, uint32_t Pol, uint32_t PolyLength);
HAL_StatusTypeDef HAL_CRCEx_Input_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t InputReverseMode);
HAL_StatusTypeDef HAL_CRCEx_Output_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t OutputReverseMode);
/**
  * @}
  */

/* Peripheral Control functions ***********************************************/
/* Peripheral State and Error functions ***************************************/

/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

#ifdef __cplusplus
}
#endif

#endif /* __STM32F3xx_HAL_CRC_EX_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/


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

<title>SmtpResponseReader (Apache Ant API)</title>
<meta name="date" content="2015-06-29">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.apache.tools.mail

Class SmtpResponseReader

java.lang.Object

org.apache.tools.mail.SmtpResponseReader

public class SmtpResponseReader
extends java.lang.Object

A wrapper around the raw input from the SMTP server that assembles
 multi line responses into a single String.

The same rules used here would apply to FTP and other Telnet
 based protocols as well.

Field Summary

Fields

Modifier and Type
Field and Description

protected java.io.BufferedReader
reader

Constructor Summary

Constructors

Constructor and Description

SmtpResponseReader(java.io.InputStream in)

Wrap this input stream.

Method Summary

Methods

Modifier and Type
Method and Description

void
close()

Closes the underlying stream.

java.lang.String
getResponse()

Read until the server indicates that the response is complete.

protected boolean
hasMoreLines(java.lang.String line)

Should we expect more input?

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

reader

protected java.io.BufferedReader reader

Constructor Detail

SmtpResponseReader

public SmtpResponseReader(java.io.InputStream in)

Wrap this input stream.

Parameters:

in - the stream to wrap.

Method Detail

getResponse

public java.lang.String getResponse()
                             throws java.io.IOException

Read until the server indicates that the response is complete.

Returns:

Responsecode (3 digits) + Blank + Text from all
         response line concatenated (with blanks replacing the \r\n
         sequences).

Throws:

java.io.IOException - on error.

close

public void close()
           throws java.io.IOException

Closes the underlying stream.

Throws:

java.io.IOException - on error.

hasMoreLines

protected boolean hasMoreLines(java.lang.String line)

Should we expect more input?

Parameters:

line - the line to check.

Returns:

true if there are more lines to check.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
/*
 * This software is licensed under the Apache License, Version 2.0
 * (the "License") agreement; you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * Package to facilitate tracking request correlation ids for micro-services
 * @author D. Ashmore
 *
 */
package org.force66.correlate;


text:
package org.wso2.developerstudio.eclipse.updater.handler;

import org.eclipse.ui.IStartup;
import org.wso2.developerstudio.eclipse.logging.core.IDeveloperStudioLog;
import org.wso2.developerstudio.eclipse.logging.core.Logger;
import org.wso2.developerstudio.eclipse.updater.UpdaterPlugin;

public class StartupUpdateHandler implements IStartup {

	protected static IDeveloperStudioLog log = Logger.getLog(UpdaterPlugin.PLUGIN_ID);

	@Override
	public void earlyStartup() {
		// check if user has set startup updates
		// Read updater preferences
		// Let updater wait a minute till workspace preferences are initialized
		UpdaterRootJob updaterRootJob = new UpdaterRootJob("Running Developer Studio updater Tool");
		updaterRootJob.schedule();
	}
}


text:
class Solution {
    public List<Integer> findAnagrams(String haystack, String needle) {
        Map<Character, Integer> lettersToFind = buildLettersToFind(needle.toCharArray(), 0, needle.length());

        List<Integer> indexes = new ArrayList<>();
        int windowLeft = 0;
        int windowRight = needle.length()-1;

        while (windowRight < haystack.length()) {
            if (isMatch(haystack, lettersToFind, windowLeft, windowRight)) {
                indexes.add(windowLeft);
            }

            windowLeft++;
            windowRight++;
        }

        return indexes;
    }

    private Map<Character, Integer> buildLettersToFind(char[] str, int start, int end) {
        Map<Character, Integer> lettersToFind = new HashMap<>();

        for (int i = start; i < end; i++) {
            lettersToFind.merge(str[i], 1, Integer::sum);
        }

        return lettersToFind;
    }

    private boolean isMatch(
        String haystack,
        Map<Character, Integer> lettersToFind,
        int leftCursor,
        int rightCursor
    ) {
        Map<Character, Integer> currentLetters = buildLettersToFind(haystack.toCharArray(), leftCursor, rightCursor+1);

        return currentLetters.equals(lettersToFind);
    }
}


text:
require 'test_helper'
require 'warden'

class TestController < ActionController::TestCase

  setup do
    @routes = Rails.application.routes
    @controller.env['warden'] = @request.env['warden'] = Warden::Proxy.new(@request.env, self.class.manager)
  end

  def log_in!(user = nil)
    user ||= User.first
    proxy.set_user user
  end

  def self.manager
    @manager ||= Warden::Manager.new(self,
      {
        default_strategies: :password,
        failure_app: SessionsController.action(:failed)
      })
  end

  def teardown
    Warden.test_reset!
  end

  def proxy
    @controller.env['warden']
  end

end


text:
#import "UICollectionViewCell.h"

@class NSString, UILabel, UIView;

@interface SKUIPageDividerCollectionViewCell : UICollectionViewCell
{
    UILabel *_dividerLabel;
    UIView *_leftLine;
    UIView *_rightLine;
}

- (void).cxx_destruct;
- (void)setBackgroundColor:(id)arg1;
- (void)layoutSubviews;
- (void)applyLayoutAttributes:(id)arg1;
@property(copy, nonatomic) NSString *dividerTitle;
- (void)setColoringWithColorScheme:(id)arg1;
- (id)initWithFrame:(struct CGRect)arg1;

@end


text:
//  ------------------------------------------------------------------------------------
//  Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this
//  file except in compliance with the License. You may obtain a copy of the License at
//  http://www.apache.org/licenses/LICENSE-2.0
//
//  THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
//  EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
//  CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR
//  NON-INFRINGEMENT.
//
//  See the Apache Version 2.0 License for specific language governing permissions and
//  limitations under the License.
//  ------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;
using Amqp;
using Amqp.Framing;
using Amqp.Types;

namespace Test.Amqp
{
    public enum TestPoint
    {
        None = 0,

        SaslHeader,
        SaslInit,
        SaslMechamisms,

        Header,
        Open,
        Begin,
        Attach,
        Flow,
        Transfer,
        Disposition,
        Detach,
        End,
        Close,
    }

    public enum TestOutcome
    {
        Continue,
        Stop,
    }

    public delegate TestOutcome TestFunc(Stream stream, ushort channel, List fields);

    public class TestListener
    {
        readonly IPEndPoint ip;
        readonly Dictionary<TestPoint, TestFunc> testPoints;
        Socket socket;
        SocketAsyncEventArgs args;

        public TestListener(IPEndPoint ip)
        {
            this.ip = ip;
            this.testPoints = new Dictionary<TestPoint, TestFunc>();
        }

        public static void FRM(Stream stream, ulong code, byte type, ushort channel, params object[] value)
        {
            List list = new List();
            if (value != null) list.AddRange(value);
            ByteBuffer buffer = new ByteBuffer(256, true);
            buffer.Append(4);
            AmqpBitConverter.WriteUByte(buffer, 2);
            AmqpBitConverter.WriteUByte(buffer, type);
            AmqpBitConverter.WriteUShort(buffer, channel);
            Encoder.WriteObject(buffer, new DescribedValue(code, list));
            AmqpBitConverter.WriteInt(buffer.Buffer, 0, buffer.Length);
            stream.Write(buffer.Buffer, buffer.Offset, buffer.Length);
        }

        public void Open()
        {
            this.args = new SocketAsyncEventArgs();
            this.args.Completed += this.OnAccept;

            this.socket = new Socket(this.ip.AddressFamily, SocketType.Stream, ProtocolType.Tcp) { NoDelay = true };
            this.socket.Bind(this.ip);
            this.socket.Listen(20);
            this.Accept();
        }

        public void Close()
        {
            Socket s = this.socket;
            this.socket = null;
            if (s != null) s.Dispose();
            if (this.args != null) this.args.Dispose();
        }

        public void RegisterTarget(TestPoint point, TestFunc func)
        {
            this.testPoints[point] = func;
        }

        public void ResetTargets()
        {
            this.testPoints.Clear();
        }

        static void Read(Stream stream, byte[] buffer, int offset, int count)
        {
            while (count > 0)
            {
                int bytes = stream.Read(buffer, offset, count);
                if (bytes == 0)
                {
                    throw new ObjectDisposedException("socket");
                }

                offset += bytes;
                count -= bytes;
            }
        }

        void Accept()
        {
            Socket s = this.socket;
            while (s != null)
            {
                try
                {
                    if (this.socket.AcceptAsync(this.args))
                    {
                        break;
                    }

                    this.args.UserToken = "sync";
                    this.OnAccept(s, this.args);
                }
                catch { }

                s = this.socket;
            }
        }

        void OnAccept(object sender, SocketAsyncEventArgs args)
        {
            if (args.SocketError == SocketError.Success)
            {
                Socket s = args.AcceptSocket;
                s.NoDelay = true;
                Fx.StartThread(() => this.Pump(new NetworkStream(s, true)));
            }

            bool sync = args.UserToken != null;
            args.UserToken = null;
            args.AcceptSocket = null;
            if (!sync)
            {
                this.Accept();
            }
        }

        TestOutcome HandleTestPoint(TestPoint point, Stream stream, ushort channel, List fields)
        {
            TestFunc func;
            if (this.testPoints.TryGetValue(point, out func))
            {
                return func(stream, channel, fields);
            }

            return TestOutcome.Continue;
        }

        void OnHeader(Stream stream, byte[] buffer)
        {
            if (buffer[5] == 3)
            {
                if (this.HandleTestPoint(TestPoint.SaslHeader, stream, 0, null) == TestOutcome.Continue)
                {
                    stream.Write(buffer, 0, buffer.Length);
                }
                if (this.HandleTestPoint(TestPoint.SaslMechamisms, stream, 0, null) == TestOutcome.Continue)
                {
                    FRM(stream, 0x40UL, 1, 0, new Symbol[] { "PLAIN", "EXTERNAL", "ANONYMOUS" });
                }
            }
            else
            {
                if (this.HandleTestPoint(TestPoint.Header, stream, 0, null) == TestOutcome.Continue)
                {
                    stream.Write(buffer, 0, buffer.Length);
                }
            }
        }

        bool OnFrame(Stream stream, ByteBuffer buffer)
        {
            buffer.Complete(1);
            byte type = AmqpBitConverter.ReadUByte(buffer);
            ushort channel = AmqpBitConverter.ReadUShort(buffer);
            buffer.Complete(1);
            ulong code = Encoder.ReadULong(buffer, Encoder.ReadFormatCode(buffer));
            List fields = Encoder.ReadList(buffer, Encoder.ReadFormatCode(buffer));
            switch (code)
            {
                case 0x41ul:  // sasl-init
                    if (this.HandleTestPoint(TestPoint.SaslInit, stream, channel, fields) == TestOutcome.Continue)
                    {
                        FRM(stream, 0x44ul, 1, 0, (byte)0);
                    }
                    return false;

                case 0x10ul:  // open
                    if (this.HandleTestPoint(TestPoint.Open, stream, channel, fields) == TestOutcome.Continue)
                    {
                        FRM(stream, 0x10UL, 0, 0, "TestListener");
                    }
                    break;

                case 0x11ul:  // begin
                    if (this.HandleTestPoint(TestPoint.Begin, stream, channel, fields) == TestOutcome.Continue)
                    {
                        FRM(stream, 0x11UL, 0, channel, channel, 0u, 100u, 100u, 8u);
                    }
                    break;

                case 0x12ul:  // attach
                    if (this.HandleTestPoint(TestPoint.Attach, stream, channel, fields) == TestOutcome.Continue)
                    {
                        bool role = !(bool)fields[2];
                        FRM(stream, 0x12UL, 0, channel, fields[0], fields[1], role, fields[3], fields[4], new Source(), new Target());
                        if (role)
                        {
                            FRM(stream, 0x13UL, 0, channel, 0u, 100u, 0u, 100u, fields[1], 0u, 1000u);
                        }
                    }
                    break;

                case 0x13ul:  // flow
                    if (this.HandleTestPoint(TestPoint.Flow, stream, channel, fields) == TestOutcome.Continue)
                    {
                    }
                    break;

                case 0x14ul:  // transfer
                    if (this.HandleTestPoint(TestPoint.Transfer, stream, channel, fields) == TestOutcome.Continue)
                    {
                        FRM(stream, 0x15UL, 0, channel, true, fields[1], null, true, new Accepted());
                    }
                    break;

                case 0x15ul:  // disposition
                    if (this.HandleTestPoint(TestPoint.Disposition, stream, channel, fields) == TestOutcome.Continue)
                    {
                    }
                    break;

                case 0x16ul:  // dettach
                    if (this.HandleTestPoint(TestPoint.Detach, stream, channel, fields) == TestOutcome.Continue)
                    {
                        FRM(stream, 0x16UL, 0, channel, fields[0], true);
                    }
                    break;

                case 0x17ul:  // end
                    if (this.HandleTestPoint(TestPoint.End, stream, channel, fields) == TestOutcome.Continue)
                    {
                        FRM(stream, 0x17UL, 0, channel);
                    }
                    break;

                case 0x18ul:  // close
                    if (this.HandleTestPoint(TestPoint.Close, stream, channel, fields) == TestOutcome.Continue)
                    {
                        FRM(stream, 0x18UL, 0, channel);
                    }
                    return false;

                default:
                    break;
            }

            return true;
        }

        void Pump(Stream stream)
        {
            try
            {
                while (true)
                {
                    byte[] buffer = new byte[8];
                    Read(stream, buffer, 0, 8);
                    OnHeader(stream, buffer);

                    while (true)
                    {
                        Read(stream, buffer, 0, 4);
                        int len = AmqpBitConverter.ReadInt(buffer, 0);
                        byte[] frame = new byte[len - 4];
                        Read(stream, frame, 0, frame.Length);
                        if (!OnFrame(stream, new ByteBuffer(frame, 0, frame.Length, frame.Length))) break;
                    }
                }
            }
            catch
            {
                stream.Dispose();
            }
        }
    }
}


text:
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using System.Web.UI;

namespace NNUG.WebSite.Core.MvcHelper
{
    public static class WebSiteExtensions
    {
        public static void RenderBootstrapGridLayout<T>(this HtmlHelper html, List<T> items, int itemsPerRow, string partialViewName)
        {
            var writer = new HtmlTextWriter(html.ViewContext.Writer);
            int row = 0;
            while (row * itemsPerRow < items.Count)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "row");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                foreach (T item in items.Skip(row*itemsPerRow).Take(itemsPerRow))
                {
                    html.RenderPartial(partialViewName, item);
                }
                writer.RenderEndTag();
                row++;
            }
        }
    }
}


text:
package org.apache.lucene.facet.taxonomy.directory;

import org.apache.lucene.document.FieldSelector;
import org.apache.lucene.document.FieldSelectorResult;

/**
 * @lucene.experimental
 */
abstract class Consts {

  static final String FULL = "$full_path$";
  static final String FIELD_PAYLOADS = "$payloads$";
  static final String PAYLOAD_PARENT = "p";
  static final char[] PAYLOAD_PARENT_CHARS = PAYLOAD_PARENT.toCharArray();

  /**
   * The following is a "field selector", an object which tells Lucene to
   * extract only a single field rather than a whole document.
   */
  public static final FieldSelector fullPathSelector = new FieldSelector() {
    public FieldSelectorResult accept(String fieldName) {
      if (fieldName.equals(FULL)) {
        return FieldSelectorResult.LOAD_AND_BREAK;
      }
      return FieldSelectorResult.NO_LOAD;
    }
  };

  /**
   * Delimiter used for creating the full path of a category from the list of
   * its labels from root. It is forbidden for labels to contain this
   * character.
   * <P>
   * Originally, we used \uFFFE, officially a "unicode noncharacter" (invalid
   * unicode character) for this purpose. Recently, we switched to the
   * "private-use" character \uF749.
   */
  //static final char DEFAULT_DELIMITER = '\uFFFE';
  static final char DEFAULT_DELIMITER = '\uF749';

}


text:
package cn.wanru.fund.nav.crawl.tencent;

import cn.wanru.fund.crawler.GenericPageable;

/**
 * @author xxf
 * @since 2017/9/14
 */
public class TencentPageable extends GenericPageable {

    private boolean yield7Days;

    public boolean isYield7Days() {
        return yield7Days;
    }

    public void setYield7Days(boolean yield7Days) {
        this.yield7Days = yield7Days;
    }
}


text:
package prefuse.data.parser;

/**
 * DataParser instance that parses long values from a text string. Long
 * values can be explicitly coded for by using an 'L' at the end of a
 * number. For example "42" could parse as an int or a long, but
 * "42L" will only parse as a long.
 *
 * @author jeffrey heer
 */
public class LongParser implements DataParser {

    /**
     * Returns long.class.
     * @see prefuse.data.parser.DataParser#getType()
     */
    public Class getType() {
        return long.class;
    }

    /**
     * @see prefuse.data.parser.DataParser#format(java.lang.Object)
     */
    public String format(Object value) {
        if ( value == null ) return null;
        if ( !(value instanceof Number) )
            throw new IllegalArgumentException(
              "This class can only format Objects of type Number.");
        return String.valueOf(((Number)value).longValue())+"L";
    }

    /**
     * @see prefuse.data.parser.DataParser#canParse(java.lang.String)
     */
    public boolean canParse(String text) {
        try {
            parseLong(text);
            return true;
        } catch ( DataParseException e ) {
            return false;
        }
    }

    /**
     * @see prefuse.data.parser.DataParser#parse(java.lang.String)
     */
    public Object parse(String text) throws DataParseException {
        return new Long(parseLong(text));
    }

    /**
     * Parse a long value from a text string.
     * @param text the text string to parse
     * @return the parsed long value
     * @throws DataParseException if an error occurs during parsing
     */
    public static long parseLong(String text) throws DataParseException {
        try {
            // allow trailing 'L' characters to signify a long
            if ( text.length() > 0 ) {
                char c = text.charAt(text.length()-1);
                if ( c == 'l' || c == 'L' )
                    text = text.substring(0,text.length()-1);
            }
            // parse the string
            return Long.parseLong(text);
        } catch ( NumberFormatException e ) {
            throw new DataParseException(e);
        }
    }

} // end of class LongParser


text:
using System;
using System.Web.Security;
using System.Web.UI;
using Vevo.Deluxe.WebUI.Marketing;
using Vevo.Domain;
using Vevo.WebUI.BaseControls;

public partial class Themes_ResponsiveGreen_Search : BaseMasterPage
{
    protected void Page_Load( object sender, EventArgs e )
    {
        if ( DataAccessContext.Configurations.GetBoolValue( "RestrictAccessToShop" ) )
        {
            if ( !Page.User.Identity.IsAuthenticated )
            {
                MainDivCenter.Style.Add( "margin", "auto" );
                MainDivCenter.Style.Add( "float", "none" );

                if ( IsRestrictedAccessPage() )
                {
                    FormsAuthentication.RedirectToLoginPage();
                }
            }
        }

        if ( DataAccessContext.Configurations.GetBoolValue( "PriceRequireLogin" ) )
        {
            if ( !Page.User.Identity.IsAuthenticated )
            {
                uxPriceRequireLoginPanel.Visible = true;
            }
        }

        AffiliateHelper.SetAffiliateCookie( AffiliateCode );
    }
}


text:
<?php
class ControllerCommonColumnRight extends Controller {
	public function index() {
		$this->load->model('design/layout');

		if (isset($this->request->get['route'])) {
			$route = (string)$this->request->get['route'];
		} else {
			$route = 'common/home';
		}

		$layout_id = 0;

		if ($route == 'product/category' && isset($this->request->get['path'])) {
			$this->load->model('catalog/category');

			$path = explode('_', (string)$this->request->get['path']);

			$layout_id = $this->model_catalog_category->getCategoryLayoutId(end($path));
		}

		if ($route == 'product/product' && isset($this->request->get['product_id'])) {
			$this->load->model('catalog/product');

			$layout_id = $this->model_catalog_product->getProductLayoutId($this->request->get['product_id']);
		}

		if ($route == 'information/information' && isset($this->request->get['information_id'])) {
			$this->load->model('catalog/information');

			$layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);
		}

		if (!$layout_id) {
			$layout_id = $this->model_design_layout->getLayout($route);
		}

		if (!$layout_id) {
			$layout_id = $this->config->get('config_layout_id');
		}

		$this->load->model('setting/module');

		$data['modules'] = array();

		$modules = $this->model_design_layout->getLayoutModules($layout_id, 'column_right');

		foreach ($modules as $module) {
			$part = explode('.', $module['code']);

			if (isset($part[0]) && $this->config->get('module_' . $part[0] . '_status')) {
				$module_data = $this->load->controller('extension/module/' . $part[0]);

				if ($module_data) {
					$data['modules'][] = $module_data;
				}
			}

			if (isset($part[1])) {
				$setting_info = $this->model_setting_module->getModule($part[1]);

				if ($setting_info && $setting_info['status']) {
					$output = $this->load->controller('extension/module/' . $part[0], $setting_info);

					if ($output) {
						$data['modules'][] = $output;
					}
				}
			}
		}

		return $this->load->view('common/column_right', $data);
	}
}


text:
<?php

declare(strict_types = 1);

namespace unreal4u\TelegramAPI\Telegram\Types\Custom;

use Psr\Log\LoggerInterface;
use unreal4u\TelegramAPI\Abstracts\TraversableCustomType;
use unreal4u\TelegramAPI\Telegram\Types\PhotoSize;

/**
 * Mockup class to generate a real telegram update representation
 */
class PhotoSizeArray extends TraversableCustomType
{
    public function __construct(array $data = null, LoggerInterface $logger = null)
    {
        if (count($data) !== 0) {
            foreach ($data as $id => $photo) {
                $this->data[$id] = new PhotoSize($photo, $logger);
            }
        }
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Contact - Business Casual Template for Bootstrap</title>

    <link href="css/bootstrap.css" rel="stylesheet">

    <link href="css/business-casual.css" rel="stylesheet">

Business Casual

The Plaza | 5483 Start Bootstrap Ave. | Beverly Hills, California 26892 | 555.519.2013

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                    Toggle navigation

                </button>
                Business Casual

Home

About

Blog

Contact

Contact business casual

Phone: 555.519.2013

Email: feedback@startbootstrap.com

Address: The Plaza
5483 Start Bootstrap Ave.
Beverley Hills, CA 26829

Contact form

This contact form is just the form elements, it is not a working form. You will have to make the form work by yourself, or take it out if you can't figure out how to make it work.

                    <form role="form">

                                Name
                                <input type="text" class="form-control">

                                Email Address
                                <input type="email" class="form-control">

                                Phone Number
                                <input type="tel" class="form-control">

                                Message
                                <textarea class="form-control" rows="6"></textarea>

                                <input type="hidden" name="save" value="contact">
                                <button type="submit" class="btn btn-default">Submit</button>

                    </form>

Copyright © Company 2013