text:
<?php

namespace Colecta\IntranetBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class VehicleController extends Controller
{

    public function indexAction()
    {
        return $this->render('ColectaIntranetBundle:Vehicle:index.html.twig', array());
    }
}

redpajama_set_name: RedPajamaGithub


text:
var Discord = require("discord.js");
var func = require("../utils/func.js")();
var rpgGameModule = require("./rpg/rpgGame.js");
var MusicBox = require("./music/musicBox.js");
var PlaylistManager = require("./music/playlistManager.js");
var MinecraftBridge = require("./minecraft/minecraftBridge.js");
var authDetails = require("../config/auth.json");
var osfrogData = require("../config/osfrogData.json");
var characterData = require('./rpg/characterData.json');

function bot(app) {
	var bot = new Discord.Client();
	var app = app;

	bot.musicBox = null;
	bot.minecraftBridge = new MinecraftBridge(bot);

	var rpgGame = null;
	var charList = null;
	var rpgHelp = null;
	var musicHelp = null;
	var playlistManager = null;

	bot.on("ready", function () {
		bot.setPlayingGame("♪ ♫ ♪ ♪ ♫");

		// Setup voice connection
		bot.joinVoiceChannel(bot.channels.get("name", "Music"), function(error, connection) {
			if (bot.musicBox !== null) {
				bot.musicBox.stop();
			}
			bot.musicBox = new MusicBox(bot, bot.channels.get("name", "music"), bot.channels.get("name", "Music"), connection);
			playlistManager = new PlaylistManager(bot, bot.channels.get("name", "music"));
			bot.musicBox.playRandom();
		});

		console.log("Ready to begin ! Serving in " + bot.channels.length + " channels");
	});

	bot.on("disconnected", function () {
		console.log("Disconnected");
		var reconnectTimer = setInterval(function() {
			console.log("Trying to reconnect");
			bot.login(authDetails.email, authDetails.password, function(error, token) {
				clearInterval(reconnectTimer);
			});
		}, 2000);
	});

	bot.musicNotification = function(action, data) {
		app.musicNotification(action, data);
	}

	bot.performCommand = function(msg) {
		var msg_args = msg.content.split(" ");
		msg_args.forEach(function(value, index) {
			msg_args[index] = value.toLowerCase();
		});

		// General channel management
		if (msg.channel.name !== "rpg" && msg.channel.name !== "music") {
			if (msg_args[0] === "ping") {
				bot.sendMessage(msg.channel, "Pong !");
			} else if (msg_args[0] === "/help" && msg_args[1] === undefined) {
				bot.sendMessage(msg.channel, "Commandes disponibles : \n - /osfrog \n - /roll [nbDice] [rollMax]");
			} else if (msg_args[0].toLowerCase() === "/osfrog") {
				bot.reply(msg, "LE BALANCED " + func.randElem(osfrogData.colors) + " " + func.randElem(osfrogData.adjs) + " " + func.randElem(osfrogData.nationality) + " " + func.randElem(osfrogData.nouns));
			} else if (msg_args[0].toLowerCase() === "/roll") {
				if (parseInt(msg_args[1],10) && parseInt(msg_args[2],10) && msg_args[3] === undefined) {
					bot.reply(msg, rollTheDice(parseInt(msg_args[1], 10), parseInt(msg_args[2], 10)));
				} else if (msg_args[1] == undefined) {
					bot.reply(msg, rollTheDice(1, 100));
				} else {
					bot.reply(msg, "Incorrect syntax : /roll [nbDice] [rollMax]");
				}
			}

			// RPG channel management
		} else if (msg.channel.name === "rpg") {
			// Initialize rpgGame environment
			if (rpgGame === null) {
				rpgGame = new rpgGameModule(bot, msg.channel);
			}

			// Play command, allow a player to choose his character
			if (msg_args[0] === "/play") {
				rpgGame.newPlayer(msg.author, msg_args[1]);

				// Listchar command, display a list of all available characters
			} else if (msg_args[0] === "/listcharacters" || msg_args[0] === "/listchars" || msg_args[0] === "/listchar" || msg_args[0] === "/listchararacter") {
				if (charList === null) {
					generateCharList();
				}
				bot.sendMessage(msg.channel, charList);

				// Help command : Display list of RPG command
			} else if (msg_args[0] === "/help") {
				if (rpgHelp === null) {
					generateRpgHelp();
				}
				bot.sendMessage(msg.channel, rpgHelp);

				// Info command : Display info on msg.author's character
			} else if (msg_args[0] === "/info") {
				if (rpgGame.playerHasCharacter(msg.author)) {
					bot.reply(msg, rpgGame.characters[msg.author.id].getInfo());
				} else {
					bot.reply(msg, "You don't have a character ! Use /play [Character name] to get one.");
				}

				// Pull command
			} else if (msg_args[0] === "/pull") {
				rpgGame.pull(msg.author);

				// Add stat command : Add skill point to stat (life, power, armor, luck)
			} else if (msg_args[0] === "/add" && msg_args[1] !== undefined) {
				if (msg_args[1] === "power" || msg_args[1] === "armor" || msg_args[1] === "life" || msg_args[1] === "luck") {
					if (parseInt(msg_args[2], 10)) {
						rpgGame.playerAddStat(msg.author, msg_args[1], parseInt(msg_args[2], 10));
					} else {
						rpgGame.playerAddStat(msg.author, msg_args[1], 1);
					}
				} else {
					bot.reply(msg, "Incorrect syntax : /add [Stat name (life, power, armor, luck)]");
				}

				// Cast command : Cast skill on target
			} else if (msg_args[0] === "/cast") {
				if (msg_args[1] !== undefined && msg_args[2] !== undefined) {
					rpgGame.playerUseSkillOnTarget(msg.author, msg_args[1], msg_args[2]);
				} else {
					bot.reply(msg, "Incorrect syntax : /cast [Skill name] [target (Playername, boss)]");
				}

				// Make player's char rest
			} else if (msg_args[0] === "/rest") {
				rpgGame.playerRest(msg.author);

				// Get current boss infos
			} else if (msg_args[0] === "/boss" || msg_args[0] === "/bossinfo") {
				if (rpgGame.boss !== null) {
					bot.sendMessage(msg, rpgGame.boss.getInfo());
				} else {
					bot.sendMessage(msg, "There's no boss, use /pull to fight the next boss !");
				}
			}
		} else if (msg.channel.name === "music") {
			if (msg_args[0] === "/next") {
				bot.musicBox.playRandom();
			} else if (msg_args[0] === "/current" || msg_args[0] === "/info" || msg_args[0] === "/title") {
				bot.musicBox.displayCurrent();
			} else if (msg_args[0] === "/play") {
				msg_args.shift();
				var filter = msg_args.join(" ");
				bot.musicBox.playSpecific(filter);
			} else if (msg_args[0] === "/queue") {
				msg_args.shift();
				var filter = msg_args.join(" ");
				bot.musicBox.addToQueue(filter);
			} else if (msg_args[0] === "/find" || msg_args[0] === "/search" || msg_args[0] === "/list") {
				msg_args.shift();
				var filter = msg_args.join(" ");
				bot.musicBox.findWith(filter);
			} else if (msg_args[0] === "/pause") {
				bot.musicBox.pause();
			} else if (msg_args[0] === "/resume") {
				bot.musicBox.recoverFromPause();
			} else if (msg_args[0] === "/stop") {
				bot.musicBox.stop();
			} else if (msg_args[0] === "/mode") {
				bot.musicBox.changeMode(msg_args[1]);
			} else if (msg_args[0] === "/guess") {
				msg_args.shift();
				var filter = msg_args.join(" ");
				var authorName = msg.author.username;
				bot.musicBox.guess(filter, authorName);
			} else if (msg_args[0] === "/score") {
				bot.musicBox.displayBlindtestScoreboard();
			} else if (msg_args[0] === "/come") {
				if (msg.author.voiceChannel !== null) {
					var channelName = msg.author.voiceChannel.name;
					bot.moveMember(bot.user, bot.channels.get("name", channelName));
				}
			} else if (msg_args[0] === "/leave") {
				bot.moveMember(bot.user, bot.channels.get("name", "Music"));
			} else if (msg_args[0] === "/pl-change" || msg_args[0] === "/plchange") {
				bot.musicBox.changePlaylist(msg_args[1]);
			} else if (msg_args[0] === "/pl-list" || msg_args[0] === "/pllist") {
				playlistManager.listPlaylist();
			} else if (msg_args[0] === "/pl-create" || msg_args[0] === "/plcreate") {
				playlistManager.createPlaylist(msg_args[1]);
			} else if (msg_args[0] === "/pl-add" || msg_args[0] === "/pladd") {
				msg_args.shift();
				var playlist = msg_args.shift();
				var filter = msg_args.join(" ");
				playlistManager.addOneToPlaylist(filter, playlist);
			} else if (msg_args[0] === "/pl-adds" || msg_args[0] === "/pladds") {
				msg_args.shift();
				var playlist = msg_args.shift();
				var filter = msg_args.join(" ");
				playlistManager.addMultipleToPlaylist(filter, playlist);
			} else if (msg_args[0] === "/pl-del" || msg_args[0] === "/pldel") {
				msg_args.shift();
				var playlist = msg_args.shift();
				var filter = msg_args.join(" ");
				playlistManager.removeOneFromPlaylist(filter, playlist);
			} else if (msg_args[0] === "/pl-dels" || msg_args[0] === "/pldels") {
				msg_args.shift();
				var playlist = msg_args.shift();
				var filter = msg_args.join(" ");
				playlistManager.removeMultipleFromPlaylist(filter, playlist);
			} else if (msg_args[0] === "/help" || msg_args[0] === "?") {
				if (musicHelp === null) {
					generateMusicHelp();
				}
				bot.sendMessage(msg.channel, musicHelp);
			} else if (msg_args[0] === "/setlyrics") {
				msg_args.shift();
				var lyrics = msg_args.join(" ");
				bot.musicBox.saveLyricsForCurentMusic(lyrics);
			} else if (msg_args[0] === "/togglelyrics") {
				bot.musicBox.toggleLyrics();
			} else if (msg_args[0] === "/lyrics") {
				bot.musicBox.showLyrics();
			} else if (msg_args[0] === "/addtts") {
				msg_args.shift();
				var tts = msg_args.join(" ");
				bot.musicBox.addTts(tts);
			} else if (msg_args[0] === "/deltts") {
				bot.musicBox.deleteTts(msg_args[1]);
			} else if (msg_args[0] === "/listtts") {
				bot.musicBox.listTts();
			}
			bot.musicBox.refreshPlaylistTree();
		}
	}

	bot.on("message", function (msg) {
		bot.performCommand(msg);
	});

	// Roll the dice
	var rollTheDice = function(nbRoll, maxRoll) {
		if (maxRoll < 1) maxRoll = 1;
		if (maxRoll > 100) maxRoll = 100;
		if (nbRoll < 1) nbRoll = 1;
		if (nbRoll > 10) nbRoll = 10;

		var rolls = '# (1 - ' + maxRoll  + ') x '  + nbRoll + ' -> ';
		for (var ii = 0; ii < nbRoll; ii++) {
			rollValue = Math.floor(Math.random()*maxRoll) + 1;
			rolls += '[' + rollValue + '] ';
		}
		return rolls + '#';
	}

	// Generate RPG character list
	var generateCharList = function() {
		charList = "Character List : \n";
		for (var key in characterData) {
			charList += "- " + characterData[key].name + " - " + characterData[key].title + "\n";
		}
	}

	var generateRpgHelp = function() {
		rpgHelp = "Command List : \n";
		rpgHelp += "- /listChar : List all characters \n";
		rpgHelp += "- /play [char name] : Pick a character \n";
		rpgHelp += "- /cast [skill name] [target (boss or Playername)] : Use skill on target\n";
		rpgHelp += "- /info : Get info on your character\n";
		rpgHelp += "- /bossinfo, /boss : Get info on the current boss\n";
		rpgHelp += "- /pull : Pull the next boss !";
	}

	// Generate Music help
	var generateMusicHelp = function() {
		musicHelp = "Command List : \n";
		musicHelp += "- /play [filter] : Find and play a music \n";
		musicHelp += "- /queue [filter] : Add a music to the music queue \n";
		musicHelp += "- /next : Play next music in queue or random music if music queue is empty \n";
		musicHelp += "- /find [filter] : Find musics matching filter \n";
		musicHelp += "- /pause : Pause current music or resume a paused music \n";
		musicHelp += "- /stop : Stop current music \n";
		musicHelp += "- /resume : resume a paused music \n";
		musicHelp += "- /info - /current - /title : Display current music (unavailable during blindtest mode) \n";
		musicHelp += "- /mode [jukebox/blindtest] : Change current music mode, either jukebox or blindtest \n";
		musicHelp += "- /guess [answer] : Guess the current music, during blindtest only \n";
		musicHelp += "- /score : Display blindtest scoreboard \n";
		musicHelp += "- /come : The bot comes to your channel \n";
		musicHelp += "- /leave : The bot goes back to music channel \n";
		musicHelp += "Lyrics : \n";
		musicHelp += "- /lyrics : Show lyrics for the current music (once per music) \n";
		musicHelp += "- /setlyrics [wall of text]: Set the lyrics for the currently playing song \n";
		musicHelp += "- /togglelyrics : Toggle lyrics display when music starts \n";
		musicHelp += "Playlist management : \n";
		musicHelp += "- /plchange [playlist name] : Change current playlist \n";
		musicHelp += "- /pllist : List all created playlists \n";
		musicHelp += "- /plcreate [playlist name] : Create a playlist \n";
		musicHelp += "- /pladd [playlist name] [music name] : Add a music to a playlist \n";
		musicHelp += "- /pladds [playlist name] [music filter] : Add multiple musics to a playlist \n";
		musicHelp += "- /pldel [playlist name] [music name] : Remove a music from a playlist \n";
		musicHelp += "- /pldels [playlist name] [music filter] : Remove multiple musics from a playlist \n";
		musicHelp += "Bot speech / tts: \n";
		musicHelp += "- /addtts [text] : Add a tts \n";
		musicHelp += "- /listtts [text] : List all available tts with their IDs \n";
		musicHelp += "- /deltts [tts ID] : Remove a tts using its ID \n";
	}

	// Login the bot to discord
	bot.login(authDetails.email, authDetails.password);

	return bot;
}

module.exports = bot;


text:
  - Support MOS 8.0.
  - Move ODL installation and configuration
    to main phase of deployment.
  - L3 traffic managed by ODL possible when vxlan
    tunneling is used.
  - Include snapshot of OpenDaylight Beryllium,
    stable version not available at this moment.
  - Get rid of hardcoded configurations related to specific ODL versions.
    Now plugin is more elastic and should support a broader
    number of ODL versions.
  - odl_network_scheme function overrided standard network scheme
    so custom network templates are not required.
  - ODL is no longer patched to use br-floating bridge.

## 0.7.0

  - Support for MOS 7.0
  - Include OpenDaylight Lithium SR2
  - Introduce separate role for ODL controller


text:
<?php

namespace Symfony\Tests\Component\DependencyInjection;

use Symfony\Component\DependencyInjection\Definition;

class DefinitionTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @covers Symfony\Component\DependencyInjection\Definition::__construct
     */
    public function testConstructor()
    {
        $def = new Definition('stdClass');
        $this->assertEquals('stdClass', $def->getClass(), '__construct() takes the class name as its first argument');

        $def = new Definition('stdClass', array('foo'));
        $this->assertEquals(array('foo'), $def->getArguments(), '__construct() takes an optional array of arguments as its second argument');
    }

    /**
     * @covers Symfony\Component\DependencyInjection\Definition::setFactoryMethod
     * @covers Symfony\Component\DependencyInjection\Definition::getFactoryMethod
     */
    public function testSetGetConstructor()
    {
        $def = new Definition('stdClass');
        $this->assertSame($def, $def->setFactoryMethod('foo'), '->setFactoryMethod() implements a fluent interface');
        $this->assertEquals('foo', $def->getFactoryMethod(), '->getFactoryMethod() returns the factory method name');
    }

    public function testSetGetFactoryService()
    {
        $def = new Definition('stdClass');
        $this->assertNull($def->getFactoryService());
        $this->assertSame($def, $def->setFactoryService('stdClass2'), "->setFactoryService() implements a fluent interface.");
        $this->assertEquals('stdClass2', $def->getFactoryService(), "->getFactoryService() returns current service to construct this service.");
    }

    /**
     * @covers Symfony\Component\DependencyInjection\Definition::setClass
     * @covers Symfony\Component\DependencyInjection\Definition::getClass
     */
    public function testSetGetClass()
    {
        $def = new Definition('stdClass');
        $this->assertSame($def, $def->setClass('foo'), '->setClass() implements a fluent interface');
        $this->assertEquals('foo', $def->getClass(), '->getClass() returns the class name');
    }

    /**
     * @covers Symfony\Component\DependencyInjection\Definition::setArguments
     * @covers Symfony\Component\DependencyInjection\Definition::getArguments
     * @covers Symfony\Component\DependencyInjection\Definition::addArgument
     */
    public function testArguments()
    {
        $def = new Definition('stdClass');
        $this->assertSame($def, $def->setArguments(array('foo')), '->setArguments() implements a fluent interface');
        $this->assertEquals(array('foo'), $def->getArguments(), '->getArguments() returns the arguments');
        $this->assertSame($def, $def->addArgument('bar'), '->addArgument() implements a fluent interface');
        $this->assertEquals(array('foo', 'bar'), $def->getArguments(), '->addArgument() adds an argument');
    }

    /**
     * @covers Symfony\Component\DependencyInjection\Definition::setMethodCalls
     * @covers Symfony\Component\DependencyInjection\Definition::addMethodCall
     * @covers Symfony\Component\DependencyInjection\Definition::hasMethodCall
     * @covers Symfony\Component\DependencyInjection\Definition::removeMethodCall
     */
    public function testMethodCalls()
    {
        $def = new Definition('stdClass');
        $this->assertSame($def, $def->setMethodCalls(array(array('foo', array('foo')))), '->setMethodCalls() implements a fluent interface');
        $this->assertEquals(array(array('foo', array('foo'))), $def->getMethodCalls(), '->getMethodCalls() returns the methods to call');
        $this->assertSame($def, $def->addMethodCall('bar', array('bar')), '->addMethodCall() implements a fluent interface');
        $this->assertEquals(array(array('foo', array('foo')), array('bar', array('bar'))), $def->getMethodCalls(), '->addMethodCall() adds a method to call');
        $this->assertTrue($def->hasMethodCall('bar'), '->hasMethodCall() returns true if first argument is a method to call registered');
        $this->assertFalse($def->hasMethodCall('no_registered'), '->hasMethodCall() returns false if first argument is not a method to call registered');
        $this->assertSame($def, $def->removeMethodCall('bar'), '->removeMethodCall() implements a fluent interface');
        $this->assertEquals(array(array('foo', array('foo'))), $def->getMethodCalls(), '->removeMethodCall() removes a method to call');
    }

    /**
     * @covers Symfony\Component\DependencyInjection\Definition::setFile
     * @covers Symfony\Component\DependencyInjection\Definition::getFile
     */
    public function testSetGetFile()
    {
        $def = new Definition('stdClass');
        $this->assertSame($def, $def->setFile('foo'), '->setFile() implements a fluent interface');
        $this->assertEquals('foo', $def->getFile(), '->getFile() returns the file to include');
    }

    /**
     * @covers Symfony\Component\DependencyInjection\Definition::setShared
     * @covers Symfony\Component\DependencyInjection\Definition::isShared
     */
    public function testSetIsShared()
    {
        $def = new Definition('stdClass');
        $this->assertTrue($def->isShared(), '->isShared() returns true by default');
        $this->assertSame($def, $def->setShared(false), '->setShared() implements a fluent interface');
        $this->assertFalse($def->isShared(), '->isShared() returns false if the instance must not be shared');
    }

    /**
     * @covers Symfony\Component\DependencyInjection\Definition::setConfigurator
     * @covers Symfony\Component\DependencyInjection\Definition::getConfigurator
     */
    public function testSetGetConfigurator()
    {
        $def = new Definition('stdClass');
        $this->assertSame($def, $def->setConfigurator('foo'), '->setConfigurator() implements a fluent interface');
        $this->assertEquals('foo', $def->getConfigurator(), '->getConfigurator() returns the configurator');
    }

    /**
     * @covers Symfony\Component\DependencyInjection\Definition::clearTags
     */
    public function testClearTags()
    {
        $def = new Definition('stdClass');
        $this->assertSame($def, $def->clearTags(), '->clearTags() implements a fluent interface');
        $def->addTag('foo', array('foo' => 'bar'));
        $def->clearTags();
        $this->assertEquals(array(), $def->getTags(), '->clearTags() removes all current tags');
    }

    /**
     * @covers Symfony\Component\DependencyInjection\Definition::addTag
     * @covers Symfony\Component\DependencyInjection\Definition::getTag
     * @covers Symfony\Component\DependencyInjection\Definition::getTags
     */
    public function testTags()
    {
        $def = new Definition('stdClass');
        $this->assertEquals(array(), $def->getTag('foo'), '->getTag() returns an empty array if the tag is not defined');
        $this->assertSame($def, $def->addTag('foo'), '->addTag() implements a fluent interface');
        $this->assertEquals(array(array()), $def->getTag('foo'), '->getTag() returns attributes for a tag name');
        $def->addTag('foo', array('foo' => 'bar'));
        $this->assertEquals(array(array(), array('foo' => 'bar')), $def->getTag('foo'), '->addTag() can adds the same tag several times');
        $def->addTag('bar', array('bar' => 'bar'));
        $this->assertEquals($def->getTags(), array(
            'foo' => array(array(), array('foo' => 'bar')),
            'bar' => array(array('bar' => 'bar')),
        ), '->getTags() returns all tags');
    }
}


text:
/**
 *
 */
package org.wso2.carbon.identity.oauth.user;

import javax.servlet.http.HttpServletRequest;

/**
 * Validates the User Info request against the specification
 */
public interface UserInfoRequestValidator {

    /**
     * Validates the UserInfo request and return the access token if validation
     * succeed. If validation failed, an {@code UserInfoEndpointException} will be
     * thrown. Scope validation must be done at the access token validation
     *
     * @param request
     * @return
     * @throws UserInfoEndpointException
     */
    public String validateRequest(HttpServletRequest request) throws UserInfoEndpointException;

}


text:
package com.facebook.buck.android;

import static com.facebook.buck.jvm.java.JavaCompilationConstants.ANDROID_JAVAC_OPTIONS;
import static com.facebook.buck.jvm.java.JavaCompilationConstants.DEFAULT_JAVAC;
import static org.junit.Assert.assertEquals;

import com.facebook.buck.io.file.MorePaths;
import com.facebook.buck.io.filesystem.ProjectFilesystem;
import com.facebook.buck.jvm.java.AnnotationProcessingParams;
import com.facebook.buck.jvm.java.ClasspathChecker;
import com.facebook.buck.jvm.java.CompilerParameters;
import com.facebook.buck.jvm.java.ExtraClasspathProvider;
import com.facebook.buck.jvm.java.JavacOptions;
import com.facebook.buck.jvm.java.JavacStep;
import com.facebook.buck.jvm.java.JavacToJarStepFactory;
import com.facebook.buck.model.BuildTarget;
import com.facebook.buck.model.BuildTargetFactory;
import com.facebook.buck.model.BuildTargets;
import com.facebook.buck.rules.BuildRule;
import com.facebook.buck.rules.BuildRuleResolver;
import com.facebook.buck.rules.DefaultSourcePathResolver;
import com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer;
import com.facebook.buck.rules.FakeBuildContext;
import com.facebook.buck.rules.FakeBuildableContext;
import com.facebook.buck.rules.FakeSourcePath;
import com.facebook.buck.rules.SingleThreadedBuildRuleResolver;
import com.facebook.buck.rules.SourcePathResolver;
import com.facebook.buck.rules.SourcePathRuleFinder;
import com.facebook.buck.rules.TargetGraph;
import com.facebook.buck.step.Step;
import com.facebook.buck.step.TestExecutionContext;
import com.facebook.buck.testutil.FakeProjectFilesystem;
import com.facebook.buck.testutil.MoreAsserts;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedSet;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
import org.junit.Test;

public class DummyRDotJavaTest {
  @Test
  public void testBuildSteps() throws IOException {
    ProjectFilesystem filesystem = new FakeProjectFilesystem();
    BuildRuleResolver ruleResolver =
        new SingleThreadedBuildRuleResolver(
            TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
    SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(ruleResolver);
    SourcePathResolver pathResolver = DefaultSourcePathResolver.from(ruleFinder);
    BuildRule resourceRule1 =
        ruleResolver.addToIndex(
            AndroidResourceRuleBuilder.newBuilder()
                .setRuleFinder(ruleFinder)
                .setBuildTarget(BuildTargetFactory.newInstance("//android_res/com/example:res1"))
                .setRDotJavaPackage("com.facebook")
                .setRes(FakeSourcePath.of("android_res/com/example/res1"))
                .build());
    setAndroidResourceBuildOutput(resourceRule1);
    BuildRule resourceRule2 =
        ruleResolver.addToIndex(
            AndroidResourceRuleBuilder.newBuilder()
                .setRuleFinder(ruleFinder)
                .setBuildTarget(BuildTargetFactory.newInstance("//android_res/com/example:res2"))
                .setRDotJavaPackage("com.facebook")
                .setRes(FakeSourcePath.of("android_res/com/example/res2"))
                .build());
    setAndroidResourceBuildOutput(resourceRule2);

    BuildTarget buildTarget = BuildTargetFactory.newInstance("//java/base:rule");
    DummyRDotJava dummyRDotJava =
        new DummyRDotJava(
            buildTarget,
            filesystem,
            ruleFinder,
            ImmutableSet.of(
                (HasAndroidResourceDeps) resourceRule1, (HasAndroidResourceDeps) resourceRule2),
            new JavacToJarStepFactory(
                pathResolver,
                ruleFinder,
                filesystem,
                DEFAULT_JAVAC,
                ANDROID_JAVAC_OPTIONS,
                ExtraClasspathProvider.EMPTY),
            /* forceFinalResourceIds */ false,
            Optional.empty(),
            Optional.of("R2"),
            /* useOldStyleableFormat */ false,
            /* skipNonUnionRDotJava */ false);

    FakeBuildableContext buildableContext = new FakeBuildableContext();
    List<Step> steps = dummyRDotJava.getBuildSteps(FakeBuildContext.NOOP_CONTEXT, buildableContext);
    assertEquals("DummyRDotJava returns an incorrect number of Steps.", 12, steps.size());

    Path rDotJavaSrcFolder =
        BuildTargets.getScratchPath(
            filesystem, dummyRDotJava.getBuildTarget(), "__%s_rdotjava_src__");
    Path rDotJavaBinFolder =
        BuildTargets.getScratchPath(
            filesystem, dummyRDotJava.getBuildTarget(), "__%s_rdotjava_bin__");
    Path rDotJavaOutputFolder =
        BuildTargets.getGenPath(
            filesystem, dummyRDotJava.getBuildTarget(), "__%s_dummyrdotjava_output__");
    String rDotJavaOutputJar =
        MorePaths.pathWithPlatformSeparators(
            String.format(
                "%s/%s.jar",
                rDotJavaOutputFolder,
                dummyRDotJava.getBuildTarget().getShortNameAndFlavorPostfix()));
    String genFolder = Paths.get("buck-out/gen/java/base/").toString();

    List<String> sortedSymbolsFiles =
        Stream.of((AndroidResource) resourceRule1, (AndroidResource) resourceRule2)
            .map(Object::toString)
            .collect(ImmutableList.toImmutableList());
    ImmutableSortedSet<Path> javaSourceFiles =
        ImmutableSortedSet.of(rDotJavaSrcFolder.resolve("com/facebook/R.java"));

    List<String> expectedStepDescriptions =
        new ImmutableList.Builder<String>()
            .addAll(makeCleanDirDescription(rDotJavaSrcFolder))
            .add("android-res-merge " + Joiner.on(' ').join(sortedSymbolsFiles))
            .add("android-res-merge " + Joiner.on(' ').join(sortedSymbolsFiles))
            .addAll(makeCleanDirDescription(rDotJavaBinFolder))
            .addAll(makeCleanDirDescription(rDotJavaOutputFolder))
            .add(String.format("mkdir -p %s", genFolder))
            .add(
                new JavacStep(
                        DEFAULT_JAVAC,
                        JavacOptions.builder(ANDROID_JAVAC_OPTIONS)
                            .setAnnotationProcessingParams(AnnotationProcessingParams.EMPTY)
                            .build(),
                        dummyRDotJava.getBuildTarget(),
                        pathResolver,
                        new FakeProjectFilesystem(),
                        new ClasspathChecker(),
                        CompilerParameters.builder()
                            .setOutputDirectory(rDotJavaBinFolder)
                            .setGeneratedCodeDirectory(Paths.get("generated"))
                            .setWorkingDirectory(Paths.get("working"))
                            .setSourceFilePaths(javaSourceFiles)
                            .setPathToSourcesList(
                                BuildTargets.getGenPath(
                                    filesystem, dummyRDotJava.getBuildTarget(), "__%s__srcs"))
                            .setClasspathEntries(ImmutableSortedSet.of())
                            .build(),
                        null,
                        null)
                    .getDescription(TestExecutionContext.newInstance()))
            .add(String.format("jar cf %s  %s", rDotJavaOutputJar, rDotJavaBinFolder))
            .add(String.format("check_dummy_r_jar_not_empty %s", rDotJavaOutputJar))
            .build();

    MoreAsserts.assertSteps(
        "DummyRDotJava.getBuildSteps() must return these exact steps.",
        expectedStepDescriptions,
        steps,
        TestExecutionContext.newInstance());

    assertEquals(
        ImmutableSet.of(rDotJavaBinFolder, Paths.get(rDotJavaOutputJar)),
        buildableContext.getRecordedArtifacts());
  }

  @Test
  public void testRDotJavaBinFolder() {
    ProjectFilesystem filesystem = new FakeProjectFilesystem();
    SourcePathRuleFinder ruleFinder =
        new SourcePathRuleFinder(
            new SingleThreadedBuildRuleResolver(
                TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer()));
    SourcePathResolver pathResolver = DefaultSourcePathResolver.from(ruleFinder);
    BuildTarget buildTarget = BuildTargetFactory.newInstance("//java/com/example:library");
    DummyRDotJava dummyRDotJava =
        new DummyRDotJava(
            buildTarget,
            new FakeProjectFilesystem(),
            ruleFinder,
            ImmutableSet.of(),
            new JavacToJarStepFactory(
                pathResolver,
                ruleFinder,
                filesystem,
                DEFAULT_JAVAC,
                ANDROID_JAVAC_OPTIONS,
                ExtraClasspathProvider.EMPTY),
            /* forceFinalResourceIds */ false,
            Optional.empty(),
            Optional.empty(),
            /* useOldStyleableFormat */ false,
            /* skipNonUnionRDotJava */ false);
    assertEquals(
        BuildTargets.getScratchPath(
            dummyRDotJava.getProjectFilesystem(),
            dummyRDotJava.getBuildTarget(),
            "__%s_rdotjava_bin__"),
        dummyRDotJava.getRDotJavaBinFolder());
  }

  private static ImmutableList<String> makeCleanDirDescription(Path dirname) {
    return ImmutableList.of(
        String.format("rm -f -r %s", dirname), String.format("mkdir -p %s", dirname));
  }

  private void setAndroidResourceBuildOutput(BuildRule resourceRule) {
    if (resourceRule instanceof AndroidResource) {
      ((AndroidResource) resourceRule).getBuildOutputInitializer();
    }
  }
}


text:
module NumbersInWords
  class Writer
    def initialize(that)
      @that = that
    end

    def call
      length = @that.to_s.length
      output =
        if length == 3
          # e.g. 113 splits into "one hundred" and "thirteen"
          write_groups(2)

          # more than one hundred less than one googol
        elsif length < LENGTH_OF_GOOGOL
          write_groups(3)

        elsif length >= LENGTH_OF_GOOGOL
          write_googols
        end
      output.strip
    end

    def group_words(size)
      # 1000 and over Numbers are split into groups of three
      groups = NumberGroup.groups_of @that, size
      powers = groups.keys.sort.reverse # put in descending order

      powers.each do |power|
        name = NumbersInWords::POWERS_OF_TEN[power]
        digits = groups[power]
        yield power, name, digits
      end
    end

    private

    def write_googols
      googols, remainder = NumberGroup.new(@that).split_googols
      output = ''

      output = output + ' ' + NumbersInWords.in_words(googols) + ' googol'
      if remainder.positive?
        prefix = ' '
        prefix += 'and ' if remainder < 100
        output = output + prefix + NumbersInWords.in_words(remainder)
      end

      output
    end

    def write_groups(group)
      # e.g. 113 splits into "one hundred" and "thirteen"
      output = ''
      group_words(group) do |power, name, digits|
        if digits.positive?
          prefix = ' '
          # no and between thousands and hundreds
          prefix += 'and ' if power.zero? && (digits < 100)
          output = output + prefix + NumbersInWords.in_words(digits)
          output = output + prefix + name unless power.zero?
        end
      end
      output
    end
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">Помошник обновления</string>
    <string name="app_token">5FUBZ5XKOXKI</string>
</resources>


text:
package com.pygmalios.reactiveinflux.spark.extensions

import com.pygmalios.reactiveinflux.spark.{DStreamExtensions, _}
import com.pygmalios.reactiveinflux.{PointNoTime, ReactiveInfluxDbName}
import org.apache.spark.rdd.RDD
import org.apache.spark.streaming.dstream.DStream

import scala.concurrent.duration.Duration

class PointDStreamExtensions[+T <: PointNoTime](dstream: DStream[T]) extends DStreamExtensions[T] {
  override def saveToInflux()(implicit reactiveInfluxDbParams: ReactiveInfluxDbName,
                              awaitAtMost: Duration): Unit = {
    dstream.foreachRDD { rdd: RDD[T] =>
      rdd.saveToInflux()
    }
  }
}


text:
package org.infinispan.configuration.global;

import org.infinispan.Version;
import org.infinispan.config.ConfigurationException;
import org.infinispan.marshall.AdvancedExternalizer;
import org.infinispan.marshall.Marshaller;
import org.infinispan.marshall.VersionAwareMarshaller;
import org.jboss.marshalling.ClassResolver;

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

/**
 * Configures serialization and marshalling settings.
 */
public class SerializationConfigurationBuilder extends AbstractGlobalConfigurationBuilder<SerializationConfiguration> {

   private Marshaller marshaller = new VersionAwareMarshaller();
   private short marshallVersion = Short.valueOf(Version.MAJOR_MINOR.replace(".", ""));
   private Map<Integer, AdvancedExternalizer<?>> advancedExternalizers = new HashMap<Integer, AdvancedExternalizer<?>>();
   private ClassResolver classResolver;

   SerializationConfigurationBuilder(GlobalConfigurationBuilder globalConfig) {
      super(globalConfig);
   }

   /**
    * Set the marshaller instance that will marshall and unmarshall cache entries.
    *
    * @param marshaller
    */
   public SerializationConfigurationBuilder marshaller(Marshaller marshaller) {
      this.marshaller = marshaller;
      return this;
   }

   /**
    * Largest allowable version to use when marshalling internal state. Set this to the lowest version cache instance in
    * your cluster to ensure compatibility of communications. However, setting this too low will mean you lose out on
    * the benefit of improvements in newer versions of the marshaller.
    *
    * @param marshallVersion
    */
   public SerializationConfigurationBuilder version(short marshallVersion) {
      this.marshallVersion = marshallVersion;
      return this;
   }

   /**
    * Largest allowable version to use when marshalling internal state. Set this to the lowest version cache instance in
    * your cluster to ensure compatibility of communications. However, setting this too low will mean you lose out on
    * the benefit of improvements in newer versions of the marshaller.
    *
    * @param marshallVersion
    */
   public SerializationConfigurationBuilder version(String marshallVersion) {
      this.marshallVersion = Version.getVersionShort(marshallVersion);
      return this;
   }

   /**
    * Helper method that allows for quick registration of an {@link org.infinispan.marshall.AdvancedExternalizer}
    * implementation alongside its corresponding identifier. Remember that the identifier needs to a be positive number,
    * including 0, and cannot clash with other identifiers in the system.
    *
    * @param id
    * @param advancedExternalizer
    */
   public <T> SerializationConfigurationBuilder addAdvancedExternalizer(int id, AdvancedExternalizer<T> advancedExternalizer) {
      AdvancedExternalizer<?> ext = advancedExternalizers.get(id);
      if (ext != null)
         throw new ConfigurationException(String.format(
               "Duplicate externalizer id found! Externalizer id=%d for %s is shared by another externalizer (%s)",
               id, advancedExternalizer.getClass().getName(), ext.getClass().getName()));

      advancedExternalizers.put(id, advancedExternalizer);
      return this;
   }

   /**
    * Helper method that allows for quick registration of an {@link org.infinispan.marshall.AdvancedExternalizer}
    * implementation alongside its corresponding identifier. Remember that the identifier needs to a be positive number,
    * including 0, and cannot clash with other identifiers in the system.
    *
    * @param advancedExternalizer
    */
   public <T> SerializationConfigurationBuilder addAdvancedExternalizer(AdvancedExternalizer<T> advancedExternalizer) {
      Integer id = advancedExternalizer.getId();
      if (id == null)
         throw new ConfigurationException(String.format(
               "No advanced externalizer identifier set for externalizer %s",
               advancedExternalizer.getClass().getName()));

      this.addAdvancedExternalizer(id.intValue(), advancedExternalizer);
      return this;
   }

   /**
    * Helper method that allows for quick registration of {@link org.infinispan.marshall.AdvancedExternalizer}
    * implementations.
    *
    * @param advancedExternalizers
    */
   public <T> SerializationConfigurationBuilder addAdvancedExternalizer(AdvancedExternalizer<T>... advancedExternalizers) {
      for (AdvancedExternalizer<T> advancedExternalizer : advancedExternalizers) {
         this.addAdvancedExternalizer(advancedExternalizer);
      }
      return this;
   }

   /**
    * Class resolver to use when unmarshallig objects.
    *
    * @param classResolver
    */
   public SerializationConfigurationBuilder classResolver(ClassResolver classResolver) {
      this.classResolver = classResolver;
      return this;
   }

   @Override
   protected void validate() {
      // No-op, no validation required
   }

   @Override
   SerializationConfiguration create() {
      return new SerializationConfiguration(
            marshaller, marshallVersion, advancedExternalizers, classResolver);
   }

   @Override
   protected
   SerializationConfigurationBuilder read(SerializationConfiguration template) {
      this.advancedExternalizers = template.advancedExternalizers();
      this.marshaller = template.marshaller();
      this.marshallVersion = template.version();
      this.classResolver = template.classResolver();

      return this;
   }

   @Override
   public String toString() {
      return "SerializationConfigurationBuilder{" +
            "advancedExternalizers=" + advancedExternalizers +
            ", marshaller=" + marshaller +
            ", marshallVersion=" + marshallVersion +
            ", classResolver=" + classResolver +
            '}';
   }

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

      SerializationConfigurationBuilder that = (SerializationConfigurationBuilder) o;

      if (marshallVersion != that.marshallVersion) return false;
      if (advancedExternalizers != null ? !advancedExternalizers.equals(that.advancedExternalizers) : that.advancedExternalizers != null)
         return false;
      if (marshaller != null ? !marshaller.equals(that.marshaller) : that.marshaller != null)
         return false;
      if (classResolver != null ? !classResolver.equals(that.classResolver) : that.classResolver != null)
         return false;

      return true;
   }

   @Override
   public int hashCode() {
      int result = marshaller != null ? marshaller.hashCode() : 0;
      result = 31 * result + marshallVersion;
      result = 31 * result + (advancedExternalizers != null ? advancedExternalizers.hashCode() : 0);
      result = 31 * result + (classResolver != null ? classResolver.hashCode() : 0);
      return result;
   }

}


text:
firefox-data-retrieval
======================

Retrieve information from Firefox database files (Violent Python Example)


text:
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using System.Threading.Tasks;

namespace Microsoft.Azure.WebJobs.Host.Timers
{
    internal class FixedDelayStrategy : IDelayStrategy
    {
        private readonly TimeSpan _delayInterval;

        public FixedDelayStrategy(TimeSpan delayInterval)
        {
            if (delayInterval.Ticks < 0)
            {
                throw new ArgumentOutOfRangeException("delayInterval", "The TimeSpan must not be negative.");
            }

            _delayInterval = delayInterval;
        }

        public TimeSpan GetNextDelay(bool executionSucceeded)
        {
            return _delayInterval;
        }

        public static ITaskSeriesTimer CreateTimer(IRecurrentCommand command, TimeSpan initialInterval,
            TimeSpan delayInterval, IWebJobsExceptionHandler exceptionHandler)
        {
            IDelayStrategy delayStrategy = new FixedDelayStrategy(delayInterval);
            ITaskSeriesCommand timerCommand = new RecurrentTaskSeriesCommand(command, delayStrategy);
            return new TaskSeriesTimer(timerCommand, exceptionHandler, Task.Delay(initialInterval));
        }
    }
}


text:
/**
 * Sort: a class that uses the quicksort algorithm to sort an
 *       array of objects.
 *
 * @author Sunita Mani
 */

package sun.misc;

public class Sort {

    private static void swap(Object arr[], int i, int j) {
        Object tmp;

        tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }

    /**
     * quicksort the array of objects.
     *
     * @param arr[] - an array of objects
     * @param left - the start index - from where to begin sorting
     * @param right - the last index.
     * @param comp - an object that implemnts the Compare interface to resolve thecomparison.
     */
    public static void quicksort(Object arr[], int left, int right, Compare comp) {
        int i, last;

        if (left >= right) { /* do nothing if array contains fewer than two */
            return;          /* two elements */
        }
        swap(arr, left, (left+right) / 2);
        last = left;
        for (i = left+1; i <= right; i++) {
            if (comp.doCompare(arr[i], arr[left]) < 0) {
                swap(arr, ++last, i);
            }
        }
        swap(arr, left, last);
        quicksort(arr, left, last-1, comp);
        quicksort(arr, last+1, right, comp);
    }

    public static void quicksort(Object arr[], Compare comp) {
        quicksort(arr, 0, arr.length-1, comp);
    }
}


text:
package org.apache.activemq.artemis.core.persistence.impl.journal;

/**
 * These record IDs definitions are meant to be public.
 *

 * If any other component or any test needs to validate user-record-types from the Journal directly
 * This is where the definitions will exist and this is what these tests should be using to verify
 * the IDs.
 */
public final class JournalRecordIds {

   // grouping journal record type

   public static final byte GROUP_RECORD = 20;

   // BindingsImpl journal record type

   public static final byte QUEUE_BINDING_RECORD = 21;

   public static final byte QUEUE_STATUS_RECORD = 22;

   /**
    * Records storing the current recordID number.
    *
    * @see org.apache.activemq.artemis.utils.IDGenerator
    * @see BatchingIDGenerator
    */
   public static final byte ID_COUNTER_RECORD = 24;

   public static final byte ADDRESS_SETTING_RECORD = 25;

   public static final byte SECURITY_SETTING_RECORD = 26;

   public static final byte DIVERT_RECORD = 27;

   // Message journal record types

   /**
    * This is used when a large message is created but not yet stored on the system.
    *

    * We use this to avoid temporary files missing
    */
   public static final byte ADD_LARGE_MESSAGE_PENDING = 29;

   public static final byte ADD_LARGE_MESSAGE = 30;

   public static final byte ADD_MESSAGE = 31;

   public static final byte ADD_REF = 32;

   public static final byte ACKNOWLEDGE_REF = 33;

   public static final byte UPDATE_DELIVERY_COUNT = 34;

   public static final byte PAGE_TRANSACTION = 35;

   public static final byte SET_SCHEDULED_DELIVERY_TIME = 36;

   public static final byte DUPLICATE_ID = 37;

   public static final byte HEURISTIC_COMPLETION = 38;

   public static final byte ACKNOWLEDGE_CURSOR = 39;

   public static final byte PAGE_CURSOR_COUNTER_VALUE = 40;

   public static final byte PAGE_CURSOR_COUNTER_INC = 41;

   public static final byte PAGE_CURSOR_COMPLETE = 42;

   public static final byte PAGE_CURSOR_PENDING_COUNTER = 43;

   public static final byte ADDRESS_BINDING_RECORD = 44;

   public static final byte ADD_MESSAGE_PROTOCOL = 45;

   public static final byte ADDRESS_STATUS_RECORD = 46;

   public static final byte USER_RECORD = 47;

   public static final byte ROLE_RECORD = 48;

   // Used to record the large message body on the journal when history is on
   public static final byte ADD_MESSAGE_BODY = 49;

}


text:
package org.apache.skywalking.apm.collector.remote.service;

import java.util.HashMap;
import java.util.Map;
import org.apache.skywalking.apm.collector.core.data.RemoteData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author peng-yongsheng
 */
public class CommonRemoteDataRegisterService implements RemoteDataRegisterService, RemoteDataIDGetter, RemoteDataInstanceCreatorGetter {

    private final Logger logger = LoggerFactory.getLogger(CommonRemoteDataRegisterService.class);

    private Integer id;
    private final Map<Class<? extends RemoteData>, Integer> dataClassMapping;
    private final Map<Integer, RemoteDataInstanceCreator> dataInstanceCreatorMapping;

    public CommonRemoteDataRegisterService() {
        this.id = 1;
        this.dataClassMapping = new HashMap<>();
        this.dataInstanceCreatorMapping = new HashMap<>();
    }

    @Override public void register(Class<? extends RemoteData> dataClass, RemoteDataInstanceCreator instanceCreator) {
        if (!dataClassMapping.containsKey(dataClass)) {
            dataClassMapping.put(dataClass, this.id);
            dataInstanceCreatorMapping.put(this.id, instanceCreator);
            this.id++;
        } else {
            logger.warn("The data class {} was registered.", dataClass.getName());
        }
    }

    @Override
    public Integer getRemoteDataId(Class<? extends RemoteData> dataClass) throws RemoteDataMappingIdNotFoundException {
        if (dataClassMapping.containsKey(dataClass)) {
            return dataClassMapping.get(dataClass);
        } else {
            throw new RemoteDataMappingIdNotFoundException("Could not found the id of remote data class " + dataClass.getName());
        }
    }

    @Override public RemoteDataInstanceCreator getInstanceCreator(
        Integer remoteDataId) throws RemoteDataInstanceCreatorNotFoundException {
        if (dataInstanceCreatorMapping.containsKey(remoteDataId)) {
            return dataInstanceCreatorMapping.get(remoteDataId);
        } else {
            throw new RemoteDataInstanceCreatorNotFoundException("Could not found the instance creator of remote data id " + remoteDataId);
        }
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.monitor.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/**
 * Definition of which performance counters will be collected and how they will be collected by this data collection
 * rule. Collected from both Windows and Linux machines where the counter is present.
 */
@Fluent
public final class PerfCounterDataSource {
    /*
     * List of streams that this data source will be sent to.
     * A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will
     * be sent to.
     */
    @JsonProperty(value = "streams")
    private List<KnownPerfCounterDataSourceStreams> streams;

    /*
     * The number of seconds between consecutive counter measurements (samples).
     */
    @JsonProperty(value = "samplingFrequencyInSeconds")
    private Integer samplingFrequencyInSeconds;

    /*
     * A list of specifier names of the performance counters you want to collect.
     * Use a wildcard (*) to collect a counter for all instances.
     * To get a list of performance counters on Windows, run the command 'typeperf'.
     */
    @JsonProperty(value = "counterSpecifiers")
    private List<String> counterSpecifiers;

    /*
     * A friendly name for the data source.
     * This name should be unique across all data sources (regardless of type) within the data collection rule.
     */
    @JsonProperty(value = "name")
    private String name;

    /**
     * Get the streams property: List of streams that this data source will be sent to. A stream indicates what schema
     * will be used for this data and usually what table in Log Analytics the data will be sent to.
     *
     * @return the streams value.
     */
    public List<KnownPerfCounterDataSourceStreams> streams() {
        return this.streams;
    }

    /**
     * Set the streams property: List of streams that this data source will be sent to. A stream indicates what schema
     * will be used for this data and usually what table in Log Analytics the data will be sent to.
     *
     * @param streams the streams value to set.
     * @return the PerfCounterDataSource object itself.
     */
    public PerfCounterDataSource withStreams(List<KnownPerfCounterDataSourceStreams> streams) {
        this.streams = streams;
        return this;
    }

    /**
     * Get the samplingFrequencyInSeconds property: The number of seconds between consecutive counter measurements
     * (samples).
     *
     * @return the samplingFrequencyInSeconds value.
     */
    public Integer samplingFrequencyInSeconds() {
        return this.samplingFrequencyInSeconds;
    }

    /**
     * Set the samplingFrequencyInSeconds property: The number of seconds between consecutive counter measurements
     * (samples).
     *
     * @param samplingFrequencyInSeconds the samplingFrequencyInSeconds value to set.
     * @return the PerfCounterDataSource object itself.
     */
    public PerfCounterDataSource withSamplingFrequencyInSeconds(Integer samplingFrequencyInSeconds) {
        this.samplingFrequencyInSeconds = samplingFrequencyInSeconds;
        return this;
    }

    /**
     * Get the counterSpecifiers property: A list of specifier names of the performance counters you want to collect.
     * Use a wildcard (*) to collect a counter for all instances. To get a list of performance counters on Windows, run
     * the command 'typeperf'.
     *
     * @return the counterSpecifiers value.
     */
    public List<String> counterSpecifiers() {
        return this.counterSpecifiers;
    }

    /**
     * Set the counterSpecifiers property: A list of specifier names of the performance counters you want to collect.
     * Use a wildcard (*) to collect a counter for all instances. To get a list of performance counters on Windows, run
     * the command 'typeperf'.
     *
     * @param counterSpecifiers the counterSpecifiers value to set.
     * @return the PerfCounterDataSource object itself.
     */
    public PerfCounterDataSource withCounterSpecifiers(List<String> counterSpecifiers) {
        this.counterSpecifiers = counterSpecifiers;
        return this;
    }

    /**
     * Get the name property: A friendly name for the data source. This name should be unique across all data sources
     * (regardless of type) within the data collection rule.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: A friendly name for the data source. This name should be unique across all data sources
     * (regardless of type) within the data collection rule.
     *
     * @param name the name value to set.
     * @return the PerfCounterDataSource object itself.
     */
    public PerfCounterDataSource withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }
}


text:
DATE=`date +"%Y-%m-%d %H:%M"`;
end=$(date --date=tomorrow +"%Y-%m-%d");
RANGE="{$end}:{2005-08-03}"

svn2cl --html --reparagraph --ignore-message-starting '*** empty' --title="phpList Changelog" --revision-link='http://phplist.svn.sourceforge.net/viewvc/phplist?view=revision&revision=' -r $RANGE
sed s/'<br\/>'/' '/g ChangeLog.html > cl
rm -f ChangeLog.html
mv cl ChangeLog.html
svn2cl  --reparagraph --ignore-message-starting '*** empty' --title="phpList Changelog" -r $RANGE


text:
from . import conf
from django.db import models
from django.conf import settings
from .signals import payment_process
from .signals import payment_completed
from .signals import payment_fail
from .utils import get_uuid

class Payment(models.Model):
    class STATUS:
        PROCESSED = 'processed'
        HOLD = 'hold'
        CANCEL = 'cancel'
        SUCCESS = 'success'
        FAIL = 'fail'

        CHOICES = (
            (PROCESSED, 'Processed'),
            (HOLD, 'Hold'),
            (CANCEL, 'Cancel'),
            (SUCCESS, 'Success'),
            (FAIL, 'Fail'),
        )

    class PAYMENT_TYPE:
        AB = 'AB'
        AC = 'AC'
        GP = 'GP'
        MA = 'MA'
        MC = 'MC'
        PB = 'PB'
        PC = 'PC'
        SB = 'SB'
        WM = 'WM'
        QW = 'QW'

        CHOICES = (
            (AB, u'Альфа-Клик'),
            (AC, u'Банковская карта'),
            (GP, u'Наличные через терминал'),
            (MA, u'MasterPass'),
            (MC, u'Мобильная коммерция'),
            (PB, u'Интернет-банк Промсвязьбанка'),
            (PC, u'Кошелек Яндекс.Денег'),
            (SB, u'Сбербанк Онлайн'),
            (WM, u'Кошелек WebMoney'),
            (QW, u'QiWi кошелёк'),
        )

    class CURRENCY:
        RUB = 643
        TEST = 10643

        CHOICES = (
            (RUB, u'Рубли'),
            (TEST, u'Тестовая валюта'),
        )

    user = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True,
                             verbose_name='Пользователь')
    customer_number = models.CharField('Номер заказа',
                                       unique=True, max_length=64,
                                       default=get_uuid)
    status = models.CharField('Результата', max_length=16,
                              choices=STATUS.CHOICES,
                              default=STATUS.PROCESSED)

    scid = models.PositiveIntegerField('Номер витрины',
                                       default=conf.SCID)
    shop_id = models.PositiveIntegerField('ID магазина',
                                          default=conf.SHOP_ID)
    payment_type = models.CharField('Способ платежа', max_length=2,
                                    default=PAYMENT_TYPE.PC,
                                    choices=PAYMENT_TYPE.CHOICES)
    invoice_id = models.CharField('Номер транзакции оператора',
                                  max_length=64, blank=True, null=True)
    order_amount = models.FloatField('Сумма заказа')
    shop_amount = models.DecimalField('Сумма полученная на р/с',
                                      max_digits=15,
                                      decimal_places=2,
                                      blank=True, null=True,
                                      help_text='За вычетом коммиссии')

    order_currency = models.PositiveIntegerField('Валюта платежа',
                                                 default=CURRENCY.RUB,
                                                 choices=CURRENCY.CHOICES)
    shop_currency = models.PositiveIntegerField('Валюта полученная на р/с',
                                                blank=True, null=True,
                                                default=CURRENCY.RUB,
                                                choices=CURRENCY.CHOICES)
    payer_code = models.CharField('Номер виртуального счета',
                                  max_length=33,
                                  blank=True, null=True)

    success_url = models.URLField('URL успешной оплаты',
                                  default=conf.SUCCESS_URL)
    fail_url = models.URLField('URL неуспешной оплаты', default=conf.FAIL_URL)

    cps_email = models.EmailField('Почта плательщика', blank=True, null=True)
    cps_phone = models.CharField('Телефон плательщика', max_length=15, blank=True, null=True)

    created = models.DateTimeField('Создан', auto_now_add=True)
    performed_datetime = models.DateTimeField('Обработан', blank=True, null=True)

    @property
    def is_payed(self):
        return self.status == self.STATUS.SUCCESS

    def send_signals(self):
        status = self.status
        if status == self.STATUS.PROCESSED:
            payment_process.send(sender=self)
        if status == self.STATUS.SUCCESS:
            payment_completed.send(sender=self)
        if status == self.STATUS.FAIL:
            payment_fail.send(sender=self)

    class Meta:
        ordering = ('-created', )
        verbose_name = 'платеж'
        verbose_name_plural = 'Платежи'


text:
  * Fixed a bug in `within_file_structure`.

# Version 0.2.6

  * Added mock_httr_response for mocking httr response objects.

# Version 0.2.5

  * Allow package stubbing for loaded, non-installed namespaces.

# Version 0.2.2

  * Added the `pretend_now_is` time-stubbing helper.

# Version 0.2.0

  * Can now stub methods coming from packages. For example,
    `package_stub("methods", "new", function(...) 'test', new('hello'))`
    will return `'test'`, as we have stubbed the `new` function
    in the `methods` package to just always return `'test'`.

    This can be very helpful when, e.g., wanting to stub HTTP
    requests (for example, by stubbing away RCurl functions).


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

namespace GAmOG.utils
{
    public class Rand
    {
        private static Rand instance;
        private static Random r;

        private Rand() { }

        public static Rand Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new Rand();
                    r = new Random();
                }
                return instance;
            }
        }

        public int randomNumber(int maxRange)
        {
            return r.Next(maxRange);
        }
    }

}


text:
Article 892
----
La simple omission d'un bien indivis donne lieu à un partage complémentaire
portant sur ce bien.


text:
package me.predatorray.bud.lisp.util;

import org.junit.Test;

import java.util.Arrays;
import java.util.Collection;
import java.util.Set;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class SetsTest {

    @Test
    public void testAsSet1() {
        Object[] objects = new Object [] {new Object(), new Object()};
        Set<Object> set = Sets.asSet(objects);
        assertEquals(2, set.size());
        for (Object object : objects) {
            assertTrue(set.contains(object));
        }
    }

    @Test
    public void testAsSet2() {
        Set<Object> set = Sets.asSet();
        assertEquals(0, set.size());
    }

    @Test
    public void testUnion1() {
        Collection<Object> collection1 = Arrays.asList(new Object(), new Object());
        Collection<Object> collection2 = Arrays.asList(new Object(), new Object(), new Object());
        Set<Object> union = Sets.union(collection1, collection2);
        assertEquals(5, union.size());
        for (Object o1 : collection1) {
            union.contains(o1);
        }
        for (Object o2 : collection2) {
            union.contains(o2);
        }
    }
}


text:
namespace bpo = boost::program_options;
typedef std::vector<std::string> stringvec;

int main( int argc, char** argv ){

  // Parse and validate command line arguments.
  // ------------------
  // use the boost command line option processing library to help out
  // with command line options
  std::ostringstream descstr;
  descstr << argv[0]
          << " <options> [<source-file>]+";
  bpo::options_description desc(descstr.str());
  desc.add_options()
    ("help,h", "this help message.")
    ("fraction,f",  bpo::value<double>()->default_value(0.05,"0.05"),
     "floating point number on the range [0,1].  "
     "If a TTree occupies a fraction on disk of the total space in the file "
     "that is less than <f>, then a detailed analysis of its branches will not be done")
    ("source,s",  bpo::value<stringvec>(), "source data file (multiple OK)");
  bpo::options_description all_opts("All Options.");
  all_opts.add(desc);
  // Each non-option argument is interpreted as the name of a file to be
  // processed. Any number of filenames is allowed.
  bpo::positional_options_description pd;
  pd.add("source", -1);
  // The variables_map contains the actual program options.
  bpo::variables_map vm;
  try {
    bpo::store(bpo::command_line_parser(argc, argv).options(all_opts).positional(pd).run(),
               vm);
    bpo::notify(vm);
  }
  catch (bpo::error const & e) {
    std::cerr << "Exception from command line processing in "
              << argv[0] << ": " << e.what() << "\n";
    return 2;
  }
  if (vm.count("help")) {
    std::cout << desc << std::endl;
    return 1;
  }

  // Get the desired minimum fraction
  double minimumFraction(-1.);
  if ( vm.count("fraction") ) {
    minimumFraction = vm["fraction"].as<double>();
    if (minimumFraction < 0 || minimumFraction > 1) {
      std::cerr << "Must choose fraction between 0 and 1\n"
                << "For usage and options list, please do 'product_sizes_dumper --help'.\n";
      return 4;
    }
  }

  // Get the names of the files we will process.
  stringvec file_names;
  size_t const file_count = vm.count("source");
  if (file_count < 1) {
    std::cerr << "One or more input files must be specified;"
         << " supply filenames as program arguments\n"
         << "For usage and options list, please do 'product_sizes_dumper --help'.\n";
    return 3;
  }
  file_names.reserve(file_count);
  cet::copy_all( vm["source"].as<stringvec>(),std::back_inserter(file_names));

  //=================================================================
  // Separates the output for multiple files.
  std::string const separator = "\n" + std::string(60,'=') + "\n";

  int n(-1);
  for ( auto const& filename : file_names ) {
    ++n;

    if ( file_names.size() > 1 && n!=0 ) std::cout << separator << std::endl;

    // Suppress warnings messages about "no dictionary".
    // This is a little dangerous since it might suppress other warnings too ...
    int errorSave     = gErrorIgnoreLevel;
    gErrorIgnoreLevel = kError;
    auto       file   = std::make_unique<TFile>( filename.c_str() );
    gErrorIgnoreLevel = errorSave;

    // Extract and print the information.
    art::RootSizeOnDisk info( filename, file.get() );
    file->Close();
    info.print(std::cout,minimumFraction);

    // Mark end of output for this file.
    if ( file_names.size() > 1 ) std::cout << "Done: " << filename << std::endl;

  }

  return 0;
}


text:
if (self == top && document.getElementById("jabs-content") == null) {
	var s = document.createElement("script");
	s.src = "http://localhost:8000/socket.io/socket.io.js";
	s.onload = function() {
		var s = document.createElement("script");
		s.src = "http://localhost:8000/inject.js";
		document.head.appendChild(s);
	};
	document.head.appendChild(s);

	document.body.setAttribute("data-jsreload", "on");

	kango.addMessageListener("b2c", function(event) {
		// event.data - the data sent with message
		if (event.data.running) {
			document.body.setAttribute("data-jsreload", "on");
		}
		else {
			document.body.setAttribute("data-jsreload", "off");
		}
	});

	kango.dispatchMessage("c2b", "hello");
}


text:
const db = require("./db.js");

exports.setRoute = (entity, router) => {
  return router.route('/' + entity).get(function(req, res) {
    return db.getAllResponses(res, req, entity);
  });
}


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

namespace NQuery.Compilation
{
	internal sealed class RowBufferEntryNamer : StandardVisitor
	{
		private const string EXPRESSION_NAME_FMT_STR = "Expr{0}";
		private const string UNION_NAME_FMT_STR = "Union{0}";

		private List<RowBufferEntry> _rowBufferEntries = new List<RowBufferEntry>();

		private void NameEntry(RowBufferEntry target, string formatString)
		{
			if (!_rowBufferEntries.Contains(target))
			{
				if (target.Name == null)
					target.Name = String.Format(CultureInfo.InvariantCulture, formatString, 1000 + _rowBufferEntries.Count);

				_rowBufferEntries.Add(target);
			}
		}

		public override AlgebraNode VisitConstantScanAlgebraNode(ConstantScanAlgebraNode node)
		{
			base.VisitConstantScanAlgebraNode(node);

			foreach (ComputedValueDefinition definedValue in node.DefinedValues)
				NameEntry(definedValue.Target, EXPRESSION_NAME_FMT_STR);

			return node;
		}

		public override AlgebraNode VisitNullScanAlgebraNode(NullScanAlgebraNode node)
		{
			foreach (RowBufferEntry entry in node.OutputList)
				NameEntry(entry, EXPRESSION_NAME_FMT_STR);

			return node;
		}

		public override AlgebraNode VisitTableAlgebraNode(TableAlgebraNode node)
		{
			base.VisitTableAlgebraNode(node);

			foreach (ColumnValueDefinition definedValue in node.DefinedValues)
				_rowBufferEntries.Add(definedValue.Target);

			return node;
		}

		public override AlgebraNode VisitJoinAlgebraNode(JoinAlgebraNode node)
		{
			base.VisitJoinAlgebraNode(node);

			if (node.ProbeBufferEntry != null)
				NameEntry(node.ProbeBufferEntry, EXPRESSION_NAME_FMT_STR);

			return node;
		}

		public override AlgebraNode VisitConcatAlgebraNode(ConcatAlgebraNode node)
		{
			base.VisitConcatAlgebraNode(node);

			foreach (UnitedValueDefinition definedValue in node.DefinedValues)
				NameEntry(definedValue.Target, UNION_NAME_FMT_STR);

			return node;
		}

		public override AlgebraNode VisitAggregateAlgebraNode(AggregateAlgebraNode node)
		{
			base.VisitAggregateAlgebraNode(node);

			foreach (AggregatedValueDefinition definedValue in node.DefinedValues)
				NameEntry(definedValue.Target, EXPRESSION_NAME_FMT_STR);

			return node;
		}

		public override AlgebraNode VisitComputeScalarAlgebraNode(ComputeScalarAlgebraNode node)
		{
			base.VisitComputeScalarAlgebraNode(node);

			foreach (ComputedValueDefinition definedValue in node.DefinedValues)
				NameEntry(definedValue.Target, EXPRESSION_NAME_FMT_STR);

			return node;
		}

		public override AstNode VisitTableSpoolRefAlgebraNode(StackedTableSpoolRefAlgebraNode node)
		{
			foreach (RowBufferEntry definedValue in node.DefinedValues)
				NameEntry(definedValue, EXPRESSION_NAME_FMT_STR);

			return node;
		}
	}
}


text:
import java.util.HashMap;
import java.util.Map;

import junit.framework.Assert;

import org.apache.struts2.StrutsStatics;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import test.ycsoft.testcomm.JunitSpringBase;

import com.ycsoft.beans.core.user.CUser;
import com.ycsoft.business.component.config.ExpressionUtil;
import com.ycsoft.business.dao.core.user.CUserDao;
import com.ycsoft.daos.core.JDBCException;

import exp.ExpUnit;

@SuppressWarnings("unchecked")
public class TestExpUnit extends  JunitSpringBase implements StrutsStatics {

	ExpUnit exp = new ExpUnit();

	@Autowired
	private CUserDao cUserDao;
	@Autowired
	private ExpressionUtil expressionUtil;

	@Test
	public void test1() throws JDBCException{
		CUser user = cUserDao.findByKey("4210");
		exp.setVariable(user);
		exp.setVariable("kckt","KCKT");

		String expStr = "stop_type==#kckt";
		Assert.assertEquals( exp.parseBoolean(expStr),true);

		expStr = "stop_type='abc' ";
		exp.getVariable(expStr);

		System.out.println(exp.getVariable("cust_id"));
		System.out.println(exp.getVariable("stop_type"));

	}

	@Test
	public void test2() throws Exception{
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("custId", "331538");
		System.out.print(expressionUtil.parseBoolean("490", params));
	}
	@Test
	public void test4() throws Exception{
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("custId", "100000280");
		System.out.print(expressionUtil.parseBoolean("406", params));
	}

	@Test
	public void test3() throws Exception{
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("feeSn", new String[]{"10001166"});
		System.out.print(expressionUtil.parseBoolean("426", params));
	}
	/**
	 * @param userDao the cUserDao to set
	 */
	public void setCUserDao(CUserDao userDao) {
		cUserDao = userDao;
	}

	@Before
	public void setUp() throws Exception {

	}

	@After
	public void tearDown() throws Exception {
	}

	/**
	 * @return the expressionComponent
	 */
	public ExpressionUtil getExpressionUtil() {
		return expressionUtil;
	}

	/**
	 * @param expressionComponent the expressionComponent to set
	 */
	public void setExpressionUtil(ExpressionUtil expressionUtil) {
		this.expressionUtil = expressionUtil;
	}

}


text: My implementation of Ash Furrow's tutorial, ch.4 of his book.


text:
/* Written by David MacKenzie <djm@ai.mit.edu>
   Modified by Akim Demaille <demaille@inf.enst.fr> */

#ifndef ARGMATCH_H_
# define ARGMATCH_H_ 1

# include <stddef.h>

# include "verify.h"

# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))

/* Assert there are as many real arguments as there are values
   (argument list ends with a NULL guard).  */

# define ARGMATCH_VERIFY(Arglist, Vallist) \
    verify (ARRAY_CARDINALITY (Arglist) == ARRAY_CARDINALITY (Vallist) + 1)

/* Return the index of the element of ARGLIST (NULL terminated) that
   matches with ARG.  If VALLIST is not NULL, then use it to resolve
   false ambiguities (i.e., different matches of ARG but corresponding
   to the same values in VALLIST).  */

ptrdiff_t argmatch (char const *arg, char const *const *arglist,
                    char const *vallist, size_t valsize);

# define ARGMATCH(Arg, Arglist, Vallist) \
  argmatch (Arg, Arglist, (char const *) (Vallist), sizeof *(Vallist))

/* xargmatch calls this function when it fails.  This function should not
   return.  By default, this is a function that calls ARGMATCH_DIE which
   in turn defaults to `exit (exit_failure)'.  */
typedef void (*argmatch_exit_fn) (void);
extern argmatch_exit_fn argmatch_die;

/* Report on stderr why argmatch failed.  Report correct values. */

void argmatch_invalid (char const *context, char const *value,
                       ptrdiff_t problem);

/* Left for compatibility with the old name invalid_arg */

# define invalid_arg(Context, Value, Problem) \
  argmatch_invalid (Context, Value, Problem)

/* Report on stderr the list of possible arguments.  */

void argmatch_valid (char const *const *arglist,
                     char const *vallist, size_t valsize);

# define ARGMATCH_VALID(Arglist, Vallist) \
  argmatch_valid (Arglist, (char const *) (Vallist), sizeof *(Vallist))

/* Same as argmatch, but upon failure, report an explanation of the
   failure, and exit using the function EXIT_FN. */

ptrdiff_t __xargmatch_internal (char const *context,
                                char const *arg, char const *const *arglist,
                                char const *vallist, size_t valsize,
                                argmatch_exit_fn exit_fn);

/* Programmer friendly interface to __xargmatch_internal. */

# define XARGMATCH(Context, Arg, Arglist, Vallist)              \
  ((Vallist) [__xargmatch_internal (Context, Arg, Arglist,      \
                                    (char const *) (Vallist),   \
                                    sizeof *(Vallist),          \
                                    argmatch_die)])

/* Convert a value into a corresponding argument. */

char const *argmatch_to_argument (char const *value,
                                  char const *const *arglist,
                                  char const *vallist, size_t valsize);

# define ARGMATCH_TO_ARGUMENT(Value, Arglist, Vallist)                  \
  argmatch_to_argument (Value, Arglist,                                 \
                        (char const *) (Vallist), sizeof *(Vallist))

#endif /* ARGMATCH_H_ */


text:
import { Injector } from "angular2/src/core/di";
import { NgZone } from 'angular2/src/core/zone/ng_zone';
import { MessageBus } from 'angular2/src/web_workers/shared/message_bus';
export declare function createInjector(zone: NgZone, bus: MessageBus): Injector;


text:
package com.spendingtracker.app;

import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import java.util.Observable;
import java.util.Observer;

/**
 * Created by Wilson on 4/23/14.
 */
public class Tab2Fragment extends Fragment implements Observer{

    private Button mCalculate;
    private Button mReset;
    private EditText mOriginalPriceView;
    private EditText mDiscountView;
    private TextView mAfterDiscount;
    private TextView mSaved;
    private TextView mTaxPct;
    private TextView mTaxValue;
    BaseApp mBase;

    public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
        if (container == null) {
            return null;
        }

        final View v = inflater.inflate(R.layout.tab2_frag_layout, container, false);
        final MyTextWatcher myTextWatcher = new MyTextWatcher();

        mBase = (BaseApp)getActivity().getApplication();
        mBase.getObserver().addObserver(this);
        mCalculate = (Button)v.findViewById(R.id.calculate_disc);
        mCalculate.setEnabled(false);
        mReset = (Button)v.findViewById(R.id.reset_disc);
        mOriginalPriceView = (EditText)v.findViewById(R.id.price_value);
        mDiscountView = (EditText)v.findViewById(R.id.discount_pct_value);
        mAfterDiscount = (TextView)v.findViewById(R.id.total_value);
        mSaved = (TextView)v.findViewById(R.id.saved_value);
        mTaxPct = (TextView)v.findViewById(R.id.tax_pct);
        mTaxValue = (TextView)v.findViewById(R.id.tax_value);

        mOriginalPriceView.addTextChangedListener(myTextWatcher);
        mDiscountView.addTextChangedListener(myTextWatcher);

        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO && android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
            mDiscountView.setTextColor(Color.BLACK);
            mOriginalPriceView.setTextColor(Color.BLACK);
        }

        mDiscountView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                if (i == EditorInfo.IME_ACTION_DONE)
                    mCalculate.performClick();
                return false;
            }
        });

        mCalculate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (mOriginalPriceView.getText() == null || mDiscountView.getText() == null || mTaxPct.getText() == null)
                    return;
                String originalPriceText = mOriginalPriceView.getText().toString();
                String discountText = mDiscountView.getText().toString();

                if (originalPriceText.isEmpty() || discountText.isEmpty()) {
                    mSaved.setText("");
                    mAfterDiscount.setText("");
                    return;
                }

                double originalPrice = Double.parseDouble(mOriginalPriceView.getText().toString());
                double discount = Double.parseDouble(mDiscountView.getText().toString());
                double taxPct = Double.parseDouble(mTaxPct.getText().toString());
                double save = originalPrice * (discount / 100);
                double finalPrice = originalPrice * ((100-discount) / 100);
                double tax = finalPrice * (taxPct / 100);
                finalPrice += tax;
                mTaxValue.setText("$"+String.format("%.2f", tax));
                mSaved.setText("$"+String.format("%.2f", save));
                mAfterDiscount.setText("$"+String.format("%.2f" ,finalPrice));
            }
        });

        mReset.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mOriginalPriceView.setText("");
                mDiscountView.setText("");
                mAfterDiscount.setText("");
                mSaved.setText("");
                mTaxValue.setText("$0.00");
                Toast.makeText(view.getContext(), "Values has been reset", Toast.LENGTH_LONG).show();
            }
        });
        return v;
    }

    @Override
    public void onResume() {
        super.onResume();
        mTaxPct.setText(String.valueOf(mBase.getObserver().getTax()));
    }

    @Override
    public void update(Observable observable, Object o) {
        mTaxPct.setText(String.valueOf(mBase.getObserver().getTax()));
        mCalculate.performClick();
    }

    class MyTextWatcher implements TextWatcher {

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            if (mOriginalPriceView.getText() == null || mOriginalPriceView.getText().toString().isEmpty() ||
                    mDiscountView.getText() == null || mDiscountView.getText().toString().isEmpty())
                mCalculate.setEnabled(false);
            else
                mCalculate.setEnabled(true);
        }

        @Override
        public void afterTextChanged(Editable editable) {
        }
    }
}


text:
Tools to connect to and work with [RogerOS](https://github.com/seomoz/roger-mesos), Moz's cluster OS based on mesos.

### Build
`$ python setup.py build`

### Run tests
`$ python setup.py test`

### Generate source distribution
`$ python setup.py sdist`

### Install
`$ python setup.py install`
OR
`pip install -e .`

### Use
* `roger -h`
* `roger <command> -h`

### Uninstall
`pip uninstall roger_mesos_tools`

### With virtualenv
```
virtualenv venv
source venv/bin/activate
pip install -e .
# run roger commands
deactivate
```


text:
@interface GPKGGeoPackageOverlay ()

@property (nonatomic, strong) NSObject<GPKGTileRetriever> *retriever;
@property (nonatomic) MKMapRect mapRect;
@property (nonatomic) CLLocationCoordinate2D center;

@end

@implementation GPKGGeoPackageOverlay

-(instancetype) initWithTileDao: (GPKGTileDao *) tileDao{
    return [self initWithTileDao:tileDao andScaling:nil];
}

-(instancetype) initWithTileDao: (GPKGTileDao *) tileDao andWidth: (int) width andHeight: (int) height{
    return [self initWithTileDao:tileDao andWidth:width andHeight:height andScaling:nil];
}

-(instancetype) initWithTileDao: (GPKGTileDao *) tileDao andScaling: (GPKGTileScaling *) scaling{
    float tileLength = [GPKGTileUtils tileLength];
    return [self initWithTileDao:tileDao andWidth:tileLength andHeight:tileLength andScaling:scaling];
}

-(instancetype) initWithTileDao: (GPKGTileDao *) tileDao andWidth: (int) width andHeight: (int) height andScaling: (GPKGTileScaling *) scaling{
    self = [super init];
    if(self != nil){
        self.tileSize = CGSizeMake(width, height);
        GPKGGeoPackageTileRetriever *retriever = [[GPKGGeoPackageTileRetriever alloc] initWithTileDao:tileDao andWidth:[NSNumber numberWithInt:width] andHeight:[NSNumber numberWithInt:height]];
        if(scaling != nil){
            [retriever setScaling:scaling];
        }
        [self initHelperWithRetriever:retriever];
    }
    return self;
}

-(void) initHelperWithRetriever: (GPKGGeoPackageTileRetriever *) retriever{
    self.retriever = retriever;
    SFPGeometryTransform *transform = [SFPGeometryTransform transformFromEpsg:PROJ_EPSG_WEB_MERCATOR andToEpsg:PROJ_EPSG_WORLD_GEODETIC_SYSTEM];
    GPKGBoundingBox *boundingBox = [[retriever webMercatorBoundingBox] transform:transform];
    self.mapRect = [boundingBox mapRect];
    self.center = [boundingBox center];

    //[self setMinimumZ:tileDao.minZoom];
    //[self setMaximumZ:tileDao.maxZoom];
}

-(BOOL) hasTileToRetrieveWithX: (NSInteger) x andY: (NSInteger) y andZoom: (NSInteger) zoom{
   return [self.retriever hasTileWithX:x andY:y andZoom:zoom];
}

-(NSData *) retrieveTileWithX: (NSInteger) x andY: (NSInteger) y andZoom: (NSInteger) zoom{

    NSData *tileData = nil;

    GPKGGeoPackageTile *geoPackageTile = [self.retriever tileWithX:x andY:y andZoom:zoom];
    if(geoPackageTile != nil){
        tileData = geoPackageTile.data;
    }

    return tileData;
}

- (CLLocationCoordinate2D)coordinate
{
    return _center;
}

- (MKMapRect)boundingMapRect
{
    return _mapRect;
}

@end


text:
Power simulations for count data in one factorial designs
===================

This app runs power calculations for one factorial designs.
One the left you can specify the expected `Effects` to simulate,
settings for the `Simulation` design and the `Inference` procedure.

To run the app with default options, simply hit the `Run simulation` Button and explore the results for a global test and a test for LOEC.
After making changes on the left, you have to hit the `Run simulation` Button again.

### Data
Count data are simulated from a negative binomial distribution ($NB(\mu, \kappa)$) with mean = $\mu$ and variance = $\mu + \mu^2 / \kappa$.

$\kappa$ is a dispersion parameter:

* if $\kappa \rightarrow 0$ overdispersion increases
* if $\kappa \rightarrow \infty$ data become Poisson distributed (no overdispersion)

The summary in the `Simulation-Design` tab gives mean and variances per treatment as well as graphical representation of the simulated data (assuming a sample size of 1000).

### Design
Data are simulated for a one factorial design with 4 treatments and a step effect between treatments 2 and 3:

Abundance in in treatments 1 + 2 are draw from $NB(\mu_c, \kappa)$, whereas the mean abundance in treatments 3 + 4 are reduced by factor $r$: $NB(r \times \mu_c, \kappa)$.
Therefore, the LOEC is at treatment 3 and NOEC at treatment 2.

Note, that $\kappa$ is equal between all treatments.

$\mu_c$, $\kappa$ and $r$ can be controlled by the sliders (on the left, `Effects`).
The `Simulation-Design` tab on the right gives a graphical representation of the design.
For demonstration purposes, 1000 data points per replicate are drawn from the specified design.

### Models

Two type of models are currently implemented:

1. Linear model on transformed data
2. Quasi-Poisson model

Both are computationally feasible and give correct Type I errors.

### Inference
The global treatment effect is assessed using an F-test.
LOEC is determined via Dunnett contrasts.
The type of hypothesis (one-sided / two-sided) can be specified (on the left, `Inference`).

### Simulations
Power is calculated using simulations.
The number of simulated datasets can be specified (currently max. 250 to take care of the server).
Moreover, up to 5 sample sizes (displayed on the x-axis) can be entered. (on the left, `Simulations`)

Press the `Run simulation` button to start the simulations.

## Output
Results for the global test and LOEC determination are given graphical and in tabular form on the right.
Both can be downloaded using the respective buttons.


text:
using System;
using System.Linq;
using Microsoft.Owin;
using Ninject.Activation;
using Ninject.Extensions.Factory;
using Ninject.Modules;

using Microsoft.AspNet.Identity.Owin;

using OnTheRoad.Identity;
using OnTheRoad.Logic.Contracts;
using OnTheRoad.MVC.Factories;

namespace OnTheRoad.MVC.App_Start.BindingModules
{
    public class AuthenticationBindingModule : NinjectModule
    {
        public override void Load()
        {
            this.Bind<IAuthenticationServiceFactory>()
                .ToFactory()
                .InSingletonScope();

            this.Bind<IRegisterService>()
                .ToMethod(this.AuthenticationServiceFactoryMethod)
                .Named("RegisterService");

            this.Bind<ILoginService>()
                .ToMethod(this.AuthenticationServiceFactoryMethod)
                .Named("LoginService");

            this.Bind<ConfigureAuthService>().ToSelf();
        }

        private AuthenticationService AuthenticationServiceFactoryMethod(IContext ctx)
        {
            var parameters = ctx.Parameters.ToList();

            var context = parameters[0].GetValue(ctx, null) as IOwinContext;
            if (context == null)
            {
                throw new ArgumentNullException("Invalid requested context type.");
            }

            var appUserManager = context.GetUserManager<ApplicationUserManager>();
            var appSignInManager = context.Get<ApplicationSignInManager>();

            return new AuthenticationService(appUserManager, appSignInManager);
        }
    }
}


text:
Studies, tests and so about Android app architecture and more

[![Build Status](https://travis-ci.org/rafaeltoledo/rxdagger-android.svg?branch=master)](https://travis-ci.org/rafaeltoledo/rxdagger-android)


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.yueny.demo</groupId>
	<artifactId>micros_cloud</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>pom</packaging>

	<properties>
		<java.version>1.8</java.version>
	</properties>

	<modules>
		<module>micros_cloud_spring_config_server</module>
		<module>micros_cloud_spring_config_client_for_soter</module>

		<module>micros_cloud_spring_discovery</module>
		<module>micros_cloud_spring_eureka</module>
		<module>micros_cloud_spring_eureka_client</module>
		<module>micros_cloud_spring_eureka_consumer</module>
		<module>micros_cloud_spring_hystrix</module>
		<module>micros_cloud_spring_hystrix_dashboard</module>
		<module>micros_cloud_spring_netflix</module>
		<module>micros_cloud_spring_zuul</module>
		<module>micros_cloud_spring_ribbon</module>
	</modules>

</project>


text:
SF.manager = (function() {
    var views = {} // id: View | TODO needs garbage collection
    ,   ajax  = function(target, data, callback) {};

    function getView (id, type, args) {
        var view = views[id];
        if (!view/* || !(view instanceof type)*/) {
            view = views[id] = SF.views[type].create(args);
        }
        return view;
    }

    return {
        init: function(options) {
            ajax = options.ajax;
        },
        requestFromServer: function(target, additionalData, callback){
            var data = additionalData || {};
            var that = this;
            ajax(target, data, function(response) {
                that.handleServerResponse(response);
                callback && callback();
            });
        },
        handleServerResponse: function(responseArray) {
            responseArray.forEach(function(response) {
                var view = getView(response.view.id, response.view.type, response.view.args);
                response.content && view.setContent(response.content);
                response.messages && response.messages.forEach(function(m) {
                    view.log(m);
                });

            });
        }
    };
})();


text:
import React, { Component } from 'react'
import AccordionTab from './AccordionTab'
import { Tab, Tabs } from 'react-bootstrap'
import GoogleChartsComponent from './GoogleChartsComponent'
import { SquealyDropdown } from './SquealyUtilsComponents'
import { GOOGLE_CHART_TYPE_OPTIONS } from './../Constant'
import configIcon from './../images/settings_icon.png'
import ChartConfigModal from './ChartConfigModal'
import {ErrorMessagePanel} from './ErrorMessageComponent'

export default class ResultSection extends Component {

  constructor() {
    super()
    this.state = {
      showModal: false
    }
  }

  modalVisibilityHandler = () => {
    this.setState({showModal: !this.state.showModal})
  }

  onVisualizationMode = (key) => {
    //Make the API call if Visualisation tab is selected.
    if (key === 2) {
      this.props.onHandleVisualizationTab()
    }
  }

  render() {
    const {
      resultData,
      selectedChartIndex,
      googleDefined,
      options,
      viewType,
      selectedChartChangeHandler,
      errorMessage,
      chartMode
    } = this.props
    const resultSectionOnSuccess =
      (googleDefined && resultData && resultData.hasOwnProperty('rows')) ?
          <Tabs defaultActiveKey={1} id="uncontrolled_tab_example" onSelect={this.onVisualizationMode}>
            <Tab eventKey={1} title="Data">
              <GoogleChartsComponent chartData={resultData}
                options={{}} chartType='Table'
                id={'response_table_' + selectedChartIndex} />
            </Tab>
            {
              chartMode &&
                <Tab eventKey={2} title="Visualisation">

                    <SquealyDropdown
                      name='chartType'
                      options={GOOGLE_CHART_TYPE_OPTIONS}
                      selectedValue={viewType}
                      onChangeHandler={(value)=>selectedChartChangeHandler({type: value})}
                    />

                  <GoogleChartsComponent chartData={resultData} options={options} chartType={viewType}
                    id={'visualisation_' + selectedChartIndex} />
                </Tab>
            }
          </Tabs> : null
    return (
      <AccordionTab heading='Results'>
        {
          errorMessage ?
            <ErrorMessagePanel
              className='error-box'
              errorMessage={errorMessage} /> :
            resultSectionOnSuccess
        }
        <ChartConfigModal
          chartConfiguration={options}
          showModal={this.state.showModal}
          closeModal={this.modalVisibilityHandler}
          selectedChartChangeHandler={selectedChartChangeHandler}
        />
      </AccordionTab>
    )
  }
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>Cândida</logradouro><bairro>Macaxeira</bairro><cidade>Recife</cidade><uf>PE</uf><cep>52090360</cep></feed>


text:
class TtsApiControllerTest : public testing::Test {
};

// Platform Tts implementation that does nothing.
class DummyTtsPlatformImpl : public TtsPlatformImpl {
 public:
  DummyTtsPlatformImpl() {}
  virtual ~DummyTtsPlatformImpl() {}
  virtual bool PlatformImplAvailable() OVERRIDE { return true; }
  virtual bool Speak(
      int utterance_id,
      const std::string& utterance,
      const std::string& lang,
      const VoiceData& voice,
      const UtteranceContinuousParameters& params) OVERRIDE {
    return true;
  }
  virtual bool IsSpeaking() OVERRIDE { return false; }
  virtual bool StopSpeaking() OVERRIDE { return true; }
  virtual void GetVoices(std::vector<VoiceData>* out_voices) OVERRIDE {}
  virtual std::string error() OVERRIDE { return std::string(); }
  virtual void clear_error() OVERRIDE {}
  virtual void set_error(const std::string& error) OVERRIDE {}
};

// Subclass of TtsController with a public ctor and dtor.
class TestableTtsController : public TtsController {
 public:
  TestableTtsController() {}
  virtual ~TestableTtsController() {}
};

TEST_F(TtsApiControllerTest, TestTtsControllerShutdown) {
  DummyTtsPlatformImpl platform_impl;
  TestableTtsController* controller =
      new TestableTtsController();
  controller->SetPlatformImpl(&platform_impl);

  Utterance* utterance1 = new Utterance(NULL);
  utterance1->set_can_enqueue(true);
  utterance1->set_src_id(1);
  controller->SpeakOrEnqueue(utterance1);

  Utterance* utterance2 = new Utterance(NULL);
  utterance2->set_can_enqueue(true);
  utterance2->set_src_id(2);
  controller->SpeakOrEnqueue(utterance2);

  // Make sure that deleting the controller when there are pending
  // utterances doesn't cause a crash.
  delete controller;
}