text:
function plotMagReportMsg_MagMHopRpt(address, message, connectionName)
%hack, fix later!!!!
% Because MagReportMsgs report very quickly, you may get a steady stream of
% reports if your threshold is set too low.  MAGMHOPRPT.ReportMsgFlag is a
% flag to shut of message reports while you tune the report threshold

global APPS;
if (isfield(APPS,'MAGMHOPRPT') && APPS.MAGMHOPRPT.rptMsgFlag)
    moteID = message.get_sourceMoteID;
    x = floor(mod(moteID,100)/10);
    y = mod(mod(moteID,100),10);
    fprintf(1,'moteID=%d x=%d y=%d\n',moteID,x,y);
    figure(1); clf
    axis([-1 9 -1 5]);
    hold on
    for n1=0:8
        for n2=0:4
            plot(n1,n2,'k.');
        end
    end
    plot(x,y,'ro','MarkerSize',15);
    drawnow
end

redpajama_set_name: RedPajamaGithub


text:
package com.github.danzx.zekke.config;

/**
 * Available profiles in the application.
 *
 * @author Daniel Pedraza-Arcega
 */
public class Profiles {

    public static final String DEVELOPMENT = "dev";
    public static final String STAGING = "staging";
    public static final String PRODUCTION = "prod";

    protected Profiles() {
        throw new AssertionError();
    }
}


text:
<!DOCTYPE html>

		<title>Hippiemarkt Amsterdam XL</title>

		{!! Html::style('/assets/fonts/stylesheet.css') !!}
		<link href="https://fonts.googleapis.com/css?family=Roboto:500,700,900" rel="stylesheet">
		<link href='http://fonts.googleapis.com/css?family=Bitter' rel='stylesheet' type='text/css'>

		{!! Html::style('/assets/css/moederdagmarkt-abcoude/style.css') !!}

		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">

Roteer uw telefoon naar portrait

			<input type="button" class="aanmelden standhouders" value="">
			<input type="button" class="aanmelden winkeliersvereniging" value="">

Aanmelden Moederdag Markt AbcoudeHier kunt u zich aanmelden als standhouder voor de Moederdag Markt Abcoude.

				<form class="test-form" action="test.php" method="post">
					<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
	                <input type="hidden" name="markt_id" value="4" />
	                <input type="hidden" name="winkeliersvereniging" value="0" />

1Bedrijfs- &

Persoons-gegevens

				        Bedrijfsnaam*: <input type="text" name="bedrijfsnaam" required/>
				        Voornaam*: <input type="text" name="voornaam" required/>
				        Achternaam*: <input type="text" name="achternaam" required/>
				        Telefoon*: <input type="tel" name="telefoon" maxlength="10" required/>
				        E-mail*: <input type="email" name="email"  placeholder="info@hippiemarktderondevenen.nl" required/>
				        Website: <input type="text" name="website" />

2Adresgegevens

				        Straat*: <input type="text" name="straat" required/>
				        Huisnummer*: <input type="text" name="huisnummer" required/>
				        Toevoeging: <input type="text" name="toevoeging" />
				        Postcode*: <input type="text" name="postcode" maxlength="6" required/>
				        Woonplaats*: <input type="text" name="woonplaats" required/>

3Markt gegevens

						Gevel vrij:<input type="checkbox" name="gevelvrij">

							Food/non-food*:
							<input type="radio" name="foodNonfood" value="food">food (€121,- per plek)

                            <input type="radio" name="foodNonfood" value="non-food" checked="checked">non food

				        Aantal kramen (4 meter, €75,- incl. BTW): <input type="number" name="kramen" value="0"/>
				        Aantal grondplekken (4 meter, €65,- incl. BTW): <input type="number" name="grondplekken" value="0"/>

							Producten*:

							<input type="checkbox" class="producten" name="producten[0]" value="grote-maten">Grote maten kleding
                            <input type="checkbox" class="producten" name="producten[1]" value="dames-kleding">Dameskleding
                            <input type="checkbox" class="producten" name="producten[2]" value="heren-kleding">Herenkleding
                            <input type="checkbox" class="producten" name="producten[3]" value="kinder-kleding">Kinderkleding
                            <input type="checkbox" class="producten" name="producten[4]" value="baby-kleding">Babykleding
                            <input type="checkbox" class="producten" name="producten[5]" value="fashion-accesoires">Kledingaccesoires
                            <input type="checkbox" class="producten" name="producten[6]" value="schoenen">Schoenen
                            <input type="checkbox" class="producten" name="producten[7]" value="lifestyle">Lifestyle
                            <input type="checkbox" class="producten" name="producten[8]" value="woon-accessoires">Woonaccessoires
                            <input type="checkbox" class="producten" name="producten[9]" value="kunst">Kunst
                            <input type="checkbox" class="producten" name="producten[10]" value="sieraden">Sieraden
                            <input type="checkbox" class="producten" name="producten[11]" value="tassen">Tassen
                            <input type="checkbox" class="producten" name="producten[12]" value="brocante">Brocante
                            <input type="checkbox" class="producten" name="producten[13]" value="dierenspullen">Dierenspullen
                            <input type="checkbox" class="producten" name="producten[14]" value="anders">Anders

				     	<input type="button" name="Aanmelden" value="aanmelden"/>

				</form>


text:
import ma = require('azure-pipelines-task-lib/mock-answer');
import tmrm = require('azure-pipelines-task-lib/mock-run');
import path = require('path');
import assert = require('assert');
import mocks = require('./mockWebApi');

let rootDir = path.join(__dirname, '../../Tasks', 'TagBuild');
let taskPath = path.join(rootDir, 'tagBuild.js');
let tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);

tmr.registerMock('azure-devops-node-api/WebApi', mocks.MockWebApi);

// set variables
process.env["SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"] = "http://localhost:8080/tfs/defaultcollection";
process.env["SYSTEM_TEAMPROJECT"] = "demo";
process.env["BUILD_BUILDID"] = "1";
process.env["RELEAS_RELEASEID"] = "22";
process.env["SYSTEM_ACCESSTOKEN"] = "faketoken";

// set inputs
tmr.setInput('tags', 'tag1');
tmr.setInput('type', 'Build');

tmr.run();

// need setTimeout because of async methods
setTimeout(() => {
    if ("demo" !== mocks.MockWebApi.taggerCall.project ||
        "Build" !== mocks.MockWebApi.taggerCall.callType ||
        1 !== mocks.MockWebApi.taggerCall.id ||
        !mocks.MockWebApi.taggerCall.tags.some(t => t === "tag1") ||
        mocks.MockWebApi.taggerCall.tags.length !== 1) {
        console.log(mocks.MockWebApi.taggerCall);
        console.error("Tagging failed.");
    } else {
        console.log("Tagging successful!");
    }
}, 100);


text:
<?php

namespace DialogFlow\Exception;

use DialogFlow\Model\Query;

/**
 * Class DialogException
 *
 * @package DialogFlow\Exception
 */
class DialogException extends \RuntimeException
{
    /**
     * @var string
     */
    private $sessionId;

    /**
     * @var Query
     */
    private $query;

    public function __construct($message, $sessionId, Query $query)
    {
        parent::__construct($message);

        $this->sessionId = $sessionId;
        $this->query = $query;
    }

    /**
     * @return string
     */
    public function getSessionId()
    {
        return $this->sessionId;
    }

    /**
     * @return Query
     */
    public function getQuery()
    {
        return $this->query;
    }

}


text:
.class public abstract Lcom/google/android/gms/ads/internal/client/zzn$zza;
.super Landroid/os/Binder;

# interfaces
.implements Lcom/google/android/gms/ads/internal/client/zzn;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/google/android/gms/ads/internal/client/zzn;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x409
    name = "zza"
.end annotation

.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/google/android/gms/ads/internal/client/zzn$zza$zza;
    }
.end annotation

# direct methods
.method public constructor <init>()V
    .registers 2

    invoke-direct {p0}, Landroid/os/Binder;-><init>()V

    const-string v0, "com.google.android.gms.ads.internal.client.IAdClickListener"

    invoke-virtual {p0, p0, v0}, Lcom/google/android/gms/ads/internal/client/zzn$zza;->attachInterface(Landroid/os/IInterface;Ljava/lang/String;)V

    return-void
.end method

.method public static zzf(Landroid/os/IBinder;)Lcom/google/android/gms/ads/internal/client/zzn;
    .registers 3

    if-nez p0, :cond_4

    const/4 v0, 0x0

    :goto_3
    return-object v0

    :cond_4
    const-string v0, "com.google.android.gms.ads.internal.client.IAdClickListener"

    invoke-interface {p0, v0}, Landroid/os/IBinder;->queryLocalInterface(Ljava/lang/String;)Landroid/os/IInterface;

    move-result-object v0

    if-eqz v0, :cond_13

    instance-of v1, v0, Lcom/google/android/gms/ads/internal/client/zzn;

    if-eqz v1, :cond_13

    check-cast v0, Lcom/google/android/gms/ads/internal/client/zzn;

    goto :goto_3

    :cond_13
    new-instance v0, Lcom/google/android/gms/ads/internal/client/zzn$zza$zza;

    invoke-direct {v0, p0}, Lcom/google/android/gms/ads/internal/client/zzn$zza$zza;-><init>(Landroid/os/IBinder;)V

    goto :goto_3
.end method

# virtual methods
.method public asBinder()Landroid/os/IBinder;
    .registers 1

    return-object p0
.end method

.method public onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
    .registers 7
    .param p1, "code"    # I
    .param p2, "data"    # Landroid/os/Parcel;
    .param p3, "reply"    # Landroid/os/Parcel;
    .param p4, "flags"    # I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    const/4 v0, 0x1

    sparse-switch p1, :sswitch_data_1c

    invoke-super {p0, p1, p2, p3, p4}, Landroid/os/Binder;->onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    move-result v0

    :goto_8
    return v0

    :sswitch_9
    const-string v1, "com.google.android.gms.ads.internal.client.IAdClickListener"

    invoke-virtual {p3, v1}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    goto :goto_8

    :sswitch_f
    const-string v1, "com.google.android.gms.ads.internal.client.IAdClickListener"

    invoke-virtual {p2, v1}, Landroid/os/Parcel;->enforceInterface(Ljava/lang/String;)V

    invoke-virtual {p0}, Lcom/google/android/gms/ads/internal/client/zzn$zza;->onAdClicked()V

    invoke-virtual {p3}, Landroid/os/Parcel;->writeNoException()V

    goto :goto_8

    nop

    :sswitch_data_1c
    .sparse-switch
        0x1 -> :sswitch_f
        0x5f4e5446 -> :sswitch_9
    .end sparse-switch
.end method


text:
title: Img Align Attribute
localeTitle: Img Выровнять атрибут
---
## Img Выровнять атрибут

Атрибут align для изображения указывает, где изображение должно быть выровнено в соответствии с окружающим элементом.

Значения атрибута:
right - Выровнять изображение вправо left - выравнивание изображения влево
top - Выравнивание изображения вверх
bottom - выравнивание изображения до нижней
middle - Выравнивание изображения до середины

Например:

```html

<!DOCTYPE html>
 <html lang="en">
  <head>
   <title>Img Align Attribute</title>
 </head>
 <body>
  <p>This is an example. <img src="image.png" alt="Image" align="middle"> More text right here
  <img src="image.png" alt="Image" width="100"/>
  </body>
 </html>
```

Мы также можем выровнять по правому краю, если хотим:

```html

<p>This is another example<img src="image.png" alt="Image" align="right"></p>
```

**Обратите внимание, что атрибут align не поддерживается в HTML5, и вместо этого вы должны использовать CSS. Тем не менее, он по-прежнему поддерживается всеми основными браузерами.**

#### Дополнительная информация:

[Статья MDN в теге img и его атрибутах](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img)


text:
package com.cody.xf.widget.pullloadmorerecyclerview;

import android.support.v4.widget.SwipeRefreshLayout;

/**
 * Created by WuXiaolong on 2015/7/7.
 * SwipeRefreshLayoutOnRefresh
 */
public class SwipeRefreshLayoutOnRefresh implements SwipeRefreshLayout.OnRefreshListener {
    private PullLoadMoreRecyclerView mPullLoadMoreRecyclerView;

    public SwipeRefreshLayoutOnRefresh(PullLoadMoreRecyclerView pullLoadMoreRecyclerView) {
        this.mPullLoadMoreRecyclerView = pullLoadMoreRecyclerView;
    }

    @Override
    public void onRefresh() {
        if (!mPullLoadMoreRecyclerView.isRefresh()) {
            mPullLoadMoreRecyclerView.setIsRefresh(true);
            mPullLoadMoreRecyclerView.refresh();
        }
    }
}


text:
package mcjty.deepresonance.setup;

import mcjty.deepresonance.items.manual.GuiDeepResonanceManual;
import mcjty.lib.blocks.GenericBlock;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;

public class GuiProxy implements IGuiHandler {

    /** This is used to keep track of GUIs that we make*/
    private static int modGuiIndex = 0;

    public static final int GUI_MANUAL_MAIN = modGuiIndex++;
    public static final int GUI_SMELTER = modGuiIndex++;
    public static final int GUI_CRYSTALIZER = modGuiIndex++;
    public static final int GUI_PURIFIER = modGuiIndex++;
    public static final int GUI_PEDESTAL = modGuiIndex++;
    public static final int GUI_VALVE = modGuiIndex++;
    public static final int GUI_LASER = modGuiIndex++;

    @Override
    public Object getServerGuiElement(int guiID, EntityPlayer entityPlayer, World world, int x, int y, int z) {
        BlockPos pos = new BlockPos(x, y, z);
        if (guiID == GUI_MANUAL_MAIN) {
            return null;
        } else {
            Block block = world.getBlockState(pos).getBlock();
            if (block instanceof GenericBlock) {
                GenericBlock genericBlock = (GenericBlock) block;
                TileEntity te = world.getTileEntity(pos);
                return genericBlock.createServerContainer(entityPlayer, te);
            }
            return null;
        }
    }

    @Override
    public Object getClientGuiElement(int guiID, EntityPlayer entityPlayer, World world, int x, int y, int z) {
        BlockPos pos = new BlockPos(x, y, z);
        if (guiID == GUI_MANUAL_MAIN) {
            return new GuiDeepResonanceManual();
        }  else {
            Block block = world.getBlockState(pos).getBlock();
            if (block instanceof GenericBlock) {
                GenericBlock genericBlock = (GenericBlock) block;
                TileEntity te = world.getTileEntity(pos);
                return genericBlock.createClientGui(entityPlayer, te);
            }
            return null;
        }
    }
}


text:
/**
 * Toolbar plugin overrides
 * https://prismjs.com/plugins/toolbar
 * This is the third-most popular plugin
 * Used in conjunction with Show Language, Copy to Clipboard Button, and/or Download Button
 */

/* The 'containers' holding the buttons (or pills) themselves */
div.code-toolbar > .toolbar.toolbar > .toolbar-item {
	margin-right: unset; /* default: not set; there is no spacing */
}

/* Styling the buttons (or pills) */
/* Feel free to style them separately if that's what you prefer */
div.code-toolbar > .toolbar.toolbar > .toolbar-item > button,
div.code-toolbar > .toolbar.toolbar > .toolbar-item > a,
div.code-toolbar > .toolbar.toolbar > .toolbar-item > span {
	background: unset;
	color: unset;
	padding: unset;
	border-radius: unset;
}

div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover,
div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus,
div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover,
div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus,
div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover,
div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus {
	background: unset;
	color: unset;
}


text:
<?php

namespace Chamilo\Core\Repository\ContentObject\LearningPath\Test\Unit\Service;

use Chamilo\Core\Repository\ContentObject\LearningPath\Service\TreeNodeDataService;
use Chamilo\Core\Repository\ContentObject\LearningPath\Storage\DataClass\LearningPath;
use Chamilo\Core\Repository\ContentObject\LearningPath\Storage\DataClass\TreeNodeData;
use Chamilo\Core\Repository\ContentObject\LearningPath\Storage\Repository\TreeNodeDataRepository;
use Chamilo\Core\User\Storage\DataClass\User;
use Chamilo\Libraries\Architecture\Test\Test;

/**
 * Tests the TreeNodeDataService
 *
 * @author Sven Vanpoucke - Hogeschool Gent
 */
class TreeNodeDataServiceTest extends Test
{
    /**
     * @var TreeNodeDataRepository | \PHPUnit_Framework_MockObject_MockObject
     */
    protected $treeNodeDataRepositoryMock;

    /**
     * The subject under test
     *
     * @var TreeNodeDataService
     */
    protected $treeNodeDataService;

    /**
     * Set up before each test
     */
    protected function setUp()
    {
        $this->treeNodeDataRepositoryMock = $this->getMockBuilder(TreeNodeDataRepository::class)
            ->disableOriginalConstructor()
            ->getMock();

        $this->treeNodeDataService = new TreeNodeDataService($this->treeNodeDataRepositoryMock);
    }

    /**
     * Tear down after each test
     */
    protected function tearDown()
    {
        unset($this->treeNodeDataRepositoryMock);
        unset($this->treeNodeDataService);
    }

    public function testGetTreeNodesDataForLearningPath()
    {
        $learningPath = new LearningPath();
        $treeNodesData = array(new TreeNodeData());

        $this->treeNodeDataRepositoryMock->expects($this->once())
            ->method('findTreeNodesDataForLearningPath')
            ->with($learningPath)
            ->will($this->returnValue($treeNodesData));

        $this->treeNodeDataService->getTreeNodesDataForLearningPath($learningPath);
    }

    public function testGetTreeNodesDataByContentObjects()
    {
        $contentObjectIds = array(5, 10);
        $treeNodesData = array(new TreeNodeData());

        $this->treeNodeDataRepositoryMock->expects($this->once())
            ->method('findTreeNodesDataByContentObjects')
            ->with($contentObjectIds)
            ->will($this->returnValue($treeNodesData));

        $this->treeNodeDataService->getTreeNodesDataByContentObjects($contentObjectIds);
    }

    public function testGetTreeNodesDataByUserId()
    {
        $userId = 2;
        $treeNodesData = array(new TreeNodeData());

        $this->treeNodeDataRepositoryMock->expects($this->once())
            ->method('findTreeNodesDataByUserId')
            ->with($userId)
            ->will($this->returnValue($treeNodesData));

        $this->treeNodeDataService->getTreeNodesDataByUserId(2);
    }

    /**
     * @expectedException \InvalidArgumentException
     */
    public function testGetTreeNodesDataWithInvalidUserId()
    {
        $this->treeNodeDataService->getTreeNodesDataByUserId('test');
    }

    /**
     * @expectedException \InvalidArgumentException
     */
    public function testGetTreeNodesDataWithUserId0()
    {
        $this->treeNodeDataService->getTreeNodesDataByUserId(0);
    }

    public function testGetTreeNodeDataById()
    {
        $treeNodeData = new TreeNodeData();
        $treeNodeData->setId(4);

        $this->treeNodeDataRepositoryMock->expects($this->once())
            ->method('findTreeNodeData')
            ->with(4)
            ->will($this->returnValue($treeNodeData));

        $this->treeNodeDataService->getTreeNodeDataById(4);
    }

    /**
     * @expectedException \RuntimeException
     */
    public function testGetTreeNodeDataByIdWithTreeNodeNotFound()
    {
        $this->treeNodeDataService->getTreeNodeDataById(4);
    }

    public function testCreateTreeNodeDataForLearningPath()
    {
        $learningPath = new LearningPath();
        $learningPath->setId(2);
        $user = new User();
        $user->setId(3);

        $this->mockCreate();

        $treeNodeData = $this->treeNodeDataService->createTreeNodeDataForLearningPath($learningPath, $user);
        $this->assertInstanceOf(TreeNodeData::class, $treeNodeData);
    }

    public function testCreateTreeNodeDataForLearningPathCorrectLearningPathId()
    {
        $learningPath = new LearningPath();
        $learningPath->setId(2);
        $user = new User();
        $user->setId(3);

        $this->mockCreate();

        $treeNodeData = $this->treeNodeDataService->createTreeNodeDataForLearningPath($learningPath, $user);
        $this->assertEquals(2, $treeNodeData->getLearningPathId());
    }

    public function testCreateTreeNodeDataForLearningPathCorrectContentObjectId()
    {
        $learningPath = new LearningPath();
        $learningPath->setId(2);
        $user = new User();
        $user->setId(3);

        $this->mockCreate();

        $treeNodeData = $this->treeNodeDataService->createTreeNodeDataForLearningPath($learningPath, $user);
        $this->assertEquals(2, $treeNodeData->getContentObjectId());
    }

    public function testCreateTreeNodeDataForLearningPathCorrectUserId()
    {
        $learningPath = new LearningPath();
        $learningPath->setId(2);
        $user = new User();
        $user->setId(3);

        $this->mockCreate();

        $treeNodeData = $this->treeNodeDataService->createTreeNodeDataForLearningPath($learningPath, $user);
        $this->assertEquals(3, $treeNodeData->getUserId());
    }

    /**
     * @expectedException \RuntimeException
     */
    public function testCreateThrowsExceptionWhenFailed()
    {
        $treeNodeData = new TreeNodeData();
        $this->mockCreate(false);
        $this->treeNodeDataService->createTreeNodeData($treeNodeData);
    }

    public function testUpdate()
    {
        $treeNodeData = new TreeNodeData();
        $this->mockUpdate();
        $this->treeNodeDataService->updateTreeNodeData($treeNodeData);
    }

    /**
     * @expectedException \RuntimeException
     */
    public function testUpdateThrowsExceptionWhenFailed()
    {
        $treeNodeData = new TreeNodeData();
        $this->mockUpdate(false);
        $this->treeNodeDataService->updateTreeNodeData($treeNodeData);
    }

    public function testDelete()
    {
        $treeNodeData = new TreeNodeData();
        $this->mockDelete();
        $this->treeNodeDataService->deleteTreeNodeData($treeNodeData);
    }

    /**
     * @expectedException \RuntimeException
     */
    public function testDeleteThrowsExceptionWhenFailed()
    {
        $treeNodeData = new TreeNodeData();
        $this->mockDelete(false);
        $this->treeNodeDataService->deleteTreeNodeData($treeNodeData);
    }

    public function testCountTreeNodesDataForLearningPath()
    {
        $learningPath = new LearningPath();
        $this->treeNodeDataRepositoryMock->expects($this->once())
            ->method('countTreeNodesDataForLearningPath')
            ->with($learningPath)
            ->will($this->returnValue(5));

        $this->assertEquals(5, $this->treeNodeDataService->countTreeNodesDataForLearningPath($learningPath));
    }

    public function testDeleteTreeNodesFromLearningPath()
    {
        $learningPath = new LearningPath();

        $this->treeNodeDataRepositoryMock->expects($this->once())
            ->method('deleteTreeNodesFromLearningPath')
            ->with($learningPath)
            ->will($this->returnValue(true));

        $this->treeNodeDataService->deleteTreeNodesFromLearningPath($learningPath);
    }

    /**
     * @expectedException \RuntimeException
     */
    public function testDeleteTreeNodesFromLearningPathThrowsExceptionWhenFailed()
    {
        $learningPath = new LearningPath();
        $this->treeNodeDataService->deleteTreeNodesFromLearningPath($learningPath);
    }

    public function testDeleteTreeNodeDataForLearningPath()
    {
        $learningPath = new LearningPath();

        $this->treeNodeDataRepositoryMock->expects($this->once())
            ->method('deleteTreeNodeDataForLearningPath')
            ->with($learningPath)
            ->will($this->returnValue(true));

        $this->treeNodeDataService->deleteTreeNodeDataForLearningPath($learningPath);
    }

    /**
     * @expectedException \RuntimeException
     */
    public function testDeleteTreeNodeDataForLearningPathThrowsExceptionWhenFailed()
    {
        $learningPath = new LearningPath();
        $this->treeNodeDataService->deleteTreeNodeDataForLearningPath($learningPath);
    }

    protected function mockCreate($returnValue = true)
    {
        $this->treeNodeDataRepositoryMock->expects($this->once())
            ->method('create')
            ->will($this->returnValue($returnValue));
    }

    protected function mockDelete($returnValue = true)
    {
        $this->treeNodeDataRepositoryMock->expects($this->once())
            ->method('delete')
            ->will($this->returnValue($returnValue));
    }

    protected function mockUpdate($returnValue = true)
    {
        $this->treeNodeDataRepositoryMock->expects($this->once())
            ->method('update')
            ->will($this->returnValue($returnValue));
    }
}


text:
import { Accounts } from 'meteor/accounts-base';
import { Meteor } from 'meteor/meteor';

import { Notifications } from '../../app/notifications/client';
import { IUser } from '../../definition/IUser';
import { UserStatus } from '../../definition/UserStatus';
import { Presence } from '../lib/presence';

const STATUS_MAP = [UserStatus.OFFLINE, UserStatus.ONLINE, UserStatus.AWAY, UserStatus.BUSY];

export const interestedUserIds = new Set<IUser['_id']>();

export const saveUser = (
	user: Pick<IUser, '_id' | 'username' | 'status' | 'statusText' | 'avatarETag'>,
	force = false,
): void => {
	// do not update my own user, my user's status will come from a subscription
	if (user._id === (Accounts as any).connection?._userId) {
		return;
	}

	const found = (Meteor.users as any)._collection._docs._map[user._id];

	if (found && force) {
		Meteor.users.update(
			{ _id: user._id },
			{
				$set: {
					username: user.username,
					// name: user.name,
					// utcOffset: user.utcOffset,
					status: user.status,
					statusText: user.statusText,
					...(user.avatarETag && { avatarETag: user.avatarETag }),
				},
			},
		);

		return;
	}

	if (!found) {
		Meteor.users.insert(user);
	}
};

Meteor.startup(() => {
	Notifications.onLogged(
		'user-status',
		([_id, username, status, statusText]: [
			IUser['_id'],
			IUser['username'],
			number,
			IUser['statusText'],
		]) => {
			Presence.notify({
				_id,
				username,
				status: STATUS_MAP[status],
				statusText,
			});
			if (!interestedUserIds.has(_id)) {
				return;
			}

			saveUser({ _id, username, status: STATUS_MAP[status], statusText }, true);
		},
	);
});


text:
package org.squiddev.plethora.gameplay.modules.glasses;

import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.squiddev.plethora.gameplay.Plethora;
import org.squiddev.plethora.gameplay.modules.PlethoraModules;
import org.squiddev.plethora.gameplay.neural.NeuralHelpers;

import java.util.HashSet;
import java.util.concurrent.atomic.AtomicInteger;

import static net.minecraftforge.common.util.Constants.NBT;
import static org.squiddev.plethora.gameplay.neural.ItemComputerHandler.MODULE_DATA;

@Mod.EventBusSubscriber(modid = Plethora.ID)
public final class CanvasHandler {
	public static final int ID_2D = 0;
	public static final int ID_3D = 1;

	public static final int WIDTH = 512;
	public static final int HEIGHT = 512 / 16 * 9;

	private static final AtomicInteger id = new AtomicInteger(0);
	private static final HashSet<CanvasServer> server = new HashSet<>();

	private static final Int2ObjectMap<CanvasClient> client = new Int2ObjectOpenHashMap<>();

	private CanvasHandler() {
	}

	public static int nextId() {
		return id.getAndIncrement();
	}

	public static void addServer(CanvasServer canvas) {
		synchronized (server) {
			server.add(canvas);
			Plethora.network.sendTo(canvas.getAddMessage(), canvas.getPlayer());
		}
	}

	public static void removeServer(CanvasServer canvas) {
		synchronized (server) {
			server.remove(canvas);
			Plethora.network.sendTo(canvas.getRemoveMessage(), canvas.getPlayer());
		}
	}

	public static void addClient(CanvasClient canvas) {
		synchronized (client) {
			client.put(canvas.id, canvas);
		}
	}

	public static void removeClient(CanvasClient canvas) {
		synchronized (client) {
			client.remove(canvas.id);
		}
	}

	public static CanvasClient getClient(int id) {
		synchronized (client) {
			return client.get(id);
		}
	}

	public static void clear() {
		synchronized (server) {
			server.clear();
		}
		synchronized (client) {
			client.clear();
		}
	}

	@SubscribeEvent
	public static void update(TickEvent.ServerTickEvent event) {
		if (event.phase != TickEvent.Phase.START) return;

		synchronized (server) {
			for (CanvasServer canvas : server) {
				MessageCanvasUpdate update = canvas.getUpdateMessage();
				if (update != null) {
					Plethora.network.sendTo(update, canvas.getPlayer());
				}
			}
		}
	}

	@SideOnly(Side.CLIENT)
	private static CanvasClient getCanvas() {
		EntityPlayer playerMP = Minecraft.getMinecraft().player;
		ItemStack stack = NeuralHelpers.getStack(playerMP);

		if (stack.isEmpty()) return null;

		NBTTagCompound tag = stack.getTagCompound();
		if (tag == null || !tag.hasKey(MODULE_DATA, NBT.TAG_COMPOUND)) return null;

		NBTTagCompound modules = tag.getCompoundTag(MODULE_DATA);
		if (!modules.hasKey(PlethoraModules.GLASSES_S, NBT.TAG_COMPOUND)) {
			return null;
		}

		NBTTagCompound data = modules.getCompoundTag(PlethoraModules.GLASSES_S);
		if (!data.hasKey("id", NBT.TAG_ANY_NUMERIC)) return null;

		int id = data.getInteger("id");
		return getClient(id);
	}

	@SubscribeEvent
	@SideOnly(Side.CLIENT)
	public static void render2DOverlay(RenderGameOverlayEvent.Post event) {
		if (event.getType() != RenderGameOverlayEvent.ElementType.HELMET) return;

		CanvasClient canvas = getCanvas();
		if (canvas == null) return;

		// If we've no font renderer then we're probably not quite ready yet
		Minecraft mc = Minecraft.getMinecraft();
		if (mc.fontRenderer == null) return;

		GlStateManager.pushMatrix();

		// The hotbar renders at -90 (See GuiIngame#renderTooltip)
		GlStateManager.translate(0, 0, -100);

		ScaledResolution resolution = event.getResolution();
		GlStateManager.scale(resolution.getScaledWidth_double() / WIDTH, resolution.getScaledHeight_double() / HEIGHT, 2);

		synchronized (canvas) {
			canvas.drawChildren(canvas.getChildren(ID_2D).iterator());
		}

		GlStateManager.color(1.0f, 1.0f, 1.0f);
		GlStateManager.enableTexture2D();
		GlStateManager.enableCull();

		GlStateManager.popMatrix();
	}

	@SubscribeEvent
	@SideOnly(Side.CLIENT)
	public static void onWorldRender(RenderWorldLastEvent event) {
		CanvasClient canvas = getCanvas();
		if (canvas == null) return;

		synchronized (canvas) {
			canvas.drawChildren(canvas.getChildren(ID_3D).iterator());
		}

		GlStateManager.color(1.0f, 1.0f, 1.0f);
		GlStateManager.enableTexture2D();
		GlStateManager.enableCull();
		GlStateManager.enableDepth();
		GlStateManager.disableAlpha();
	}
}


text:
using System.Runtime.CompilerServices;
using log4net;

namespace FileIssues
{
    public static class LogHelper
    {
        public static ILog GetLogger([CallerFilePath] string fileName = "")
        {
            return LogManager.GetLogger(fileName);
        }
    }
}


text:
<?php
ini_set('max_execution_time', 600);
set_time_limit(0);

//~~~~~~~~~~~ Main bookmarks page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

function compare($X, $Y) {
	return($Y['count'] - $X['count']);
}

if (!empty($_GET['userid'])) {
	if (!check_perms('users_override_paranoia')) {
		error(403);
	}
	$UserID = $_GET['userid'];
	if (!is_number($UserID)) {
		error(404);
	}
	$DB->query("
		SELECT Username
		FROM users_main
		WHERE ID = '$UserID'");
	list($Username) = $DB->next_record();
} else {
	$UserID = $LoggedUser['ID'];
}

$Sneaky = $UserID !== $LoggedUser['ID'];
$Title = $Sneaky ? "$Username's bookmarked torrent groups" : 'Your bookmarked torrent groups';

// Loop through the result set, building up $Collage and $TorrentTable
// Then we print them.
$Collage = array();
$TorrentTable = '';

$NumGroups = 0;
$ArtistCount = array();

list($GroupIDs, $CollageDataList, $TorrentList) = Users::get_bookmarks($UserID);
foreach ($GroupIDs as $GroupID) {
	if (!isset($TorrentList[$GroupID])) {
		continue;
	}
	$Group = $TorrentList[$GroupID];
	extract(Torrents::array_group($Group));
	list(, $Sort, $AddedTime) = array_values($CollageDataList[$GroupID]);

	// Handle stats and stuff
	$NumGroups++;

	if ($Artists) {
		foreach ($Artists as $Artist) {
			if (!isset($ArtistCount[$Artist['id']])) {
				$ArtistCount[$Artist['id']] = array('name' => $Artist['name'], 'count' => 1);
			} else {
				$ArtistCount[$Artist['id']]['count']++;
			}
		}
	}

	$TorrentTags = new Tags($TagList);

	if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
			unset($ExtendedArtists[2]);
			unset($ExtendedArtists[3]);
			$DisplayName = Artists::display_artists($ExtendedArtists);
	} elseif (count($Artists) > 0) {
			$DisplayName = Artists::display_artists(array('1' => $Artists));
	} else {
		$DisplayName = '';
	}
	$DisplayName .= ''.$GroupName.'';
	if ($GroupYear > 0) {
		$DisplayName = "$DisplayName [$GroupYear]";
	}
	if ($GroupVanityHouse) {
		$DisplayName .= ' [VH]';
	}
	$SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : '';

	// Start an output buffer, so we can store this output in $TorrentTable
	ob_start();
	if (count($Torrents) > 1 || $GroupCategoryID == 1) {
			// Grouped torrents
			$ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] === 1);
?>
			<tr class="group discog<?=$SnatchedGroupClass?>" id="group_<?=$GroupID?>">

					<div id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
						<a href="#" class="tooltip show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event);" title="Collapse this group. Hold "Ctrl" while clicking to collape all groups on this page.">

					<div title="<?=$TorrentTags->title()?>" class="tooltip <?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>">

					<?=$DisplayName?>

<?		if (!$Sneaky) { ?>
						<a href="#group_<?=$GroupID?>" class="brackets remove_bookmark" onclick="Unbookmark('torrent', <?=$GroupID?>, ''); return false;">Remove bookmark

<?		} ?>
						<?=time_diff($AddedTime);?>

<?=$TorrentTags->format()?>

<?
		$LastRemasterYear = '-';
		$LastRemasterTitle = '';
		$LastRemasterRecordLabel = '';
		$LastRemasterCatalogueNumber = '';
		$LastMedia = '';

		$EditionID = 0;
		unset($FirstUnknown);

		foreach ($Torrents as $TorrentID => $Torrent) {

			if ($Torrent['Remastered'] && !$Torrent['RemasterYear']) {
				$FirstUnknown = !isset($FirstUnknown);
			}
			$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';

			if (
				$Torrent['RemasterTitle'] != $LastRemasterTitle
				|| $Torrent['RemasterYear'] != $LastRemasterYear
				|| $Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel
				|| $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber
				|| $FirstUnknown
				|| $Torrent['Media'] != $LastMedia
			) {
				$EditionID++;
?>
	<tr class="group_torrent groupid_<?=$GroupID?> edition<?=$SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] === 1 ? ' hidden' : '')?>">
		<a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" class="tooltip" title="Collapse this edition. Hold "Ctrl" while clicking to collapse all editions in this torrent group.">− <?=Torrents::edition_string($Torrent, $Group)?>

<?
			}
			$LastRemasterTitle = $Torrent['RemasterTitle'];
			$LastRemasterYear = $Torrent['RemasterYear'];
			$LastRemasterRecordLabel = $Torrent['RemasterRecordLabel'];
			$LastRemasterCatalogueNumber = $Torrent['RemasterCatalogueNumber'];
			$LastMedia = $Torrent['Media'];
?>
	<tr class="group_torrent torrent_row groupid_<?=$GroupID?> edition_<?=$EditionID?><?=$SnatchedTorrentClass . $SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] === 1 ? ' hidden' : '')?>">

			[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" class="tooltip" title="Download">DL
<?			if (Torrents::can_use_token($Torrent)) { ?>
			| <a href="torrents.php?action=download&id=<?=$TorrentID ?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" class="tooltip" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL
<?			} ?>
			| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" class="tooltip" title="Report">RP ]

			  »  <a href="torrents.php?id=<?=$GroupID?>&torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?>

		<?=Format::get_size($Torrent['Size'])?>
		<?=number_format($Torrent['Snatched'])?>
		<td class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>"><?=number_format($Torrent['Seeders'])?>
		<?=number_format($Torrent['Leechers'])?>

<?
		}
	} else {
		// Viewing a type that does not require grouping

		list($TorrentID, $Torrent) = each($Torrents);

		$DisplayName = ''.$GroupName.'';

		if ($Torrent['IsSnatched']) {
			$DisplayName .= ' ' . Format::torrent_label('Snatched!');
		}
		if ($Torrent['FreeTorrent'] === '1') {
			$DisplayName .= ' ' . Format::torrent_label('Freeleech!');
		} elseif ($Torrent['FreeTorrent'] === '2') {
			$DisplayName .= ' ' . Format::torrent_label('Neutral leech!');
		} elseif ($Torrent['PersonalFL']) {
			$DisplayName .= ' ' . Format::torrent_label('Personal Freeleech!');
		}
		$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
?>
	<tr class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>" id="group_<?=$GroupID?>">

			<div title="<?=$TorrentTags->title()?>" class="tooltip <?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>">

				[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" class="tooltip" title="Download">DL
<?		if (Torrents::can_use_token($Torrent)) { ?>
				| <a href="torrents.php?action=download&id=<?=$TorrentID ?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" class="tooltip" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL
<?		} ?>
				| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" class="tooltip" title="Report">RP ]

			<?=$DisplayName?>

<?=$TorrentTags->format()?>

<?		if (!$Sneaky) { ?>
			<a href="#group_<?=$GroupID?>" class="brackets remove_bookmark" onclick="Unbookmark('torrent', <?=$GroupID?>, ''); return false;">Remove bookmark
<?		} ?>
			<?=time_diff($AddedTime);?>

		<?=Format::get_size($Torrent['Size'])?>
		<?=number_format($Torrent['Snatched'])?>
		<td class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>"><?=number_format($Torrent['Seeders'])?>
		<?=number_format($Torrent['Leechers'])?>

<?
	}
	$TorrentTable .= ob_get_clean();

	// Album art

	ob_start();

	$DisplayName = '';
	if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
		unset($ExtendedArtists[2]);
		unset($ExtendedArtists[3]);
		$DisplayName .= Artists::display_artists($ExtendedArtists, false);
	} elseif (count($Artists) > 0) {
		$DisplayName .= Artists::display_artists(array('1' => $Artists), false);
	}
	$DisplayName .= $GroupName;
	if ($GroupYear > 0) {
		$DisplayName = "$DisplayName [$GroupYear]";
	}
	$Tags = display_str($TorrentTags->format());
	$PlainTags = implode(', ', $TorrentTags->get_tags());
?>
		<li class="image_group_<?=$GroupID?>">
			<a href="torrents.php?id=<?=$GroupID?>" class="bookmark_<?=$GroupID?>">
<?	if ($WikiImage) { ?>
				<img class="tooltip_interactive" src="<?=ImageTools::process($WikiImage, true)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>
 <?=$Tags?>" data-title-plain="<?="$DisplayName ($PlainTags)"?>" width="118" />
<?	} else { ?>

<?=$DisplayName?>

<?	} ?>

<?
	$Collage[] = ob_get_clean();

}

$CollageCovers = isset($LoggedUser['CollageCovers']) ? (int)$LoggedUser['CollageCovers'] : 25;
$CollagePages = array();
for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
	$Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers);
	$CollagePage = '';
	foreach ($Groups as $Group) {
		$CollagePage .= $Group;
	}
	$CollagePages[] = $CollagePage;
}

View::show_header($Title, 'browse,collage');
?>

<? if (!$Sneaky) { ?><a href="feeds.php?feed=torrents_bookmarks_t_<?=$LoggedUser['torrent_pass']?>&user=<?=$LoggedUser['ID']?>&auth=<?=$LoggedUser['RSS_Auth']?>&passkey=<?=$LoggedUser['torrent_pass']?>&authkey=<?=$LoggedUser['AuthKey']?>&name=<?=urlencode(SITE_NAME.': Bookmarked Torrents')?>"><img src="<?=STATIC_SERVER?>/common/symbols/rss.png" alt="RSS feed" /> <? } ?><?=$Title?>

			Torrents
			Artists
			Collages
			Requests
<? if (count($TorrentList) > 0) { ?>

			<a href="bookmarks.php?action=remove_snatched&auth=<?=$LoggedUser['AuthKey']?>" class="brackets" onclick="return confirm('Are you sure you want to remove the bookmarks for all items you\'ve snatched?');">Remove snatched
			Manage torrents
<? } ?>

<? if (count($TorrentList) === 0) { ?>

You have not bookmarked any torrents.

<?
	View::show_footer();
	die();
} ?>

Stats

Torrent groups: <?=$NumGroups?>

Artists: <?=count($ArtistCount)?>

Top Tags

<? Tags::format_top(5) ?>

Top Artists

<?
	$Indent = "\t\t\t\t";
	if (count($ArtistCount) > 0) {
		echo "$Indent
\n";
		uasort($ArtistCount, 'compare');
		$i = 0;
		foreach ($ArtistCount as $ID => $Artist) {
			$i++;
			if ($i > 10) {
				break;
			}
?>

<a href="artist.php?id=<?=$ID?>"><?=display_str($Artist['name'])?> (<?=$Artist['count']?>)

<?
		}
		echo "$Indent
\n";
	} else {
		echo "$Indent
\n";
		echo "$Indent\t
There are no artists to display.
\n";
		echo "$Indent
\n";
	}
?>

<?
if ($CollageCovers !== 0) { ?>

Cover art

<?
	$Page1 = array_slice($Collage, 0, $CollageCovers);
	foreach ($Page1 as $Group) {
		echo $Group;
	}
?>

<?	if ($NumGroups > $CollageCovers) { ?>

			<< First |
			< Prev |
<?		for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
			<span id="pagelink<?=$i?>" class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i === 0) ? ' selected' : '')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); return false;"><?=($CollageCovers * $i + 1)?>-<?=min($NumGroups, $CollageCovers * ($i + 1))?><?=(($i !== ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : '')?>
<?		} ?>
			<span id="nextbar" class="<?=(($NumGroups / $CollageCovers > 5) ? 'hidden' : '')?>"> |
			Next >
			<span id="lastpage" class="<?=(ceil($NumGroups / $CollageCovers) === 2 ? 'invisible' : '')?>"> | <a href="#" id="lastpage" class="pageslink" onclick="collageShow.page(<?=(ceil($NumGroups / $CollageCovers) - 1)?>, this); return false;">Last >>

<?
	}
}
?>

				Torrents
				Size
				<img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/snatched.png" class="tooltip" alt="Snatches" title="Snatches" />
				<img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/seeders.png" class="tooltip" alt="Seeders" title="Seeders" />
				<img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/leechers.png" class="tooltip" alt="Leechers" title="Leechers" />

<?=$TorrentTable?>

<?
View::show_footer();


text:
class RenameFilenameToPapers < ActiveRecord::Migration
  def change
  	rename_column :papers, :FileName, :file_name
  end
end


text:
angular.module("mainPage").controller("MainPageController", [
  "$scope",
  "Authentication",
	function($scope, Authentication)
  {
		$scope.authentication = Authentication;
	}
]);


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

namespace BuildDoc.Test
{
    class Program
    {
        static void Main(string[] args)
        {
            //解析文档
            IBuildWord iw = new BuildWord();

        }
    }
}


text:
"""
Classifier trained on Image-Chat turns 2 and 3 to classify the personality of an example
given only the current utterance as context.
"""

from parlai.core.build_data import download_models

def download(datapath):
    model_type = 'curr_only_classifier'
    # v1.1 vacuumed the model file to be smaller
    version = 'v1.1'
    opt = {'datapath': datapath, 'model_type': model_type}
    fnames = [f'{version}.tar.gz']
    download_models(
        opt=opt,
        fnames=fnames,
        model_folder='style_gen',
        version=version,
        use_model_type=True,
    )


text:
use std::error::Error;
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;

mod herd;
mod request;

#[macro_use]
extern crate clap;
extern crate nix;

extern crate yaml_rust;

use clap::{Arg, App};
use yaml_rust::{YamlLoader, Yaml};

fn main() {

    let matches = App::new("herd")
                        .version("0.0.1")
                        .about("Does http loadtesting")
                        .arg(Arg::with_name("config")
                                    .short("c")
                                    .long("config")
                                    .help("Sets a custom config file")
                                    .takes_value(true))
                        .arg(Arg::with_name("threads")
                                    .help("Sets the number of threads to spawn")
                                    .long("threads")
                                    .short("t")
                                    .takes_value(true)
                                    .required(true)
                                    .conflicts_with("config"))
                        .arg(Arg::with_name("requests")
                                    .help("Sets the number of requests")
                                    .long("requests")
                                    .short("r")
                                    .required(true)
                                    .takes_value(true)
                                    .conflicts_with("config"))
                        .arg(Arg::with_name("host")
                                    .help("Sets the host")
                                    .index(1)
                                    .required(true)
                                    .conflicts_with("config"))
                        .get_matches();

    if matches.is_present("config") {
        let config_file = matches.value_of("config").unwrap();
        println!("Using config file: {}", config_file);

        let path = Path::new(config_file);
        let display = path.display();

        let mut file = match File::open(&path) {
            Err(why) => panic!("couldn't open {}: {}", display,
                                            Error::description(&why)),
            Ok(file) => file,
        };

        let mut s = String::new();
        match file.read_to_string(&mut s) {
            Err(why) => panic!("couldn't read {}: {}", display,
                                            Error::description(&why)),
            Ok(_) => print!("{} contains:\n{}", display, s),
        }

        let docs = YamlLoader::load_from_str(&s).unwrap();
        let doc = &docs[0].as_hash().unwrap();
        let config_block = doc.get(&Yaml::from_str("Hosts"));
        for v in config_block.iter() {
            let config_host_vec = v.as_vec().unwrap();
            let host = config_host_vec[0].as_hash().unwrap()
                                         .get(&Yaml::from_str("Host")).unwrap().as_str();
            let requests = config_host_vec[0].as_hash().unwrap()
                                             .get(&Yaml::from_str("Requests")).unwrap().as_i64();
            let threads = config_host_vec[0].as_hash().unwrap()
                                            .get(&Yaml::from_str("Threads")).unwrap().as_i64();

            manage_herd(threads.unwrap(), requests.unwrap(), &host.unwrap());

        }

    } else {

        let threads = value_t!(matches.value_of("threads"), i64).unwrap();
        let requests = value_t!(matches.value_of("requests"), i64).unwrap();

        let host = matches.value_of("host").unwrap();

        manage_herd(threads, requests, host);

    }
}

fn manage_herd(threads: i64, requests: i64, host: &str) -> () {
    let process_threshold = 1000;
    let processes = threads / process_threshold;

    for _x in 1..processes {
        let _pid = nix::unistd::fork();
    }

    if threads >= process_threshold {
        herd::release(process_threshold, requests, &host);
    }else{
        herd::release(threads, requests, &host);
    }

}


text:
'use strict'

var fs = require('vigour-fs-promised')
var path = require('path')
var url = require('url')

module.exports = function(req, res, next){
  var Config = global.Config
  var parsedUrl = url.parse(req.url, true)
  var query = parsedUrl.query
  if (query.$action !== 'file-list') {
    return next()
  }

  var fullPath = path.join(Config.gaston['base-path'], parsedUrl.pathname)
  fs.existsAsync(fullPath)
    .then((exists) => {
      if(!exists){
        return res.status(404).send('file/directory not found')
      }
      return fs.statAsync(fullPath)
        .then((stat) => {
          if(!stat.isDirectory()){
            return res.status(400).send('Bad Request')
          }
          getFiles(fullPath)
            .then((files) => res.status(200).json(files))
        })
    })
}

var getFiles = function(fullPath){
  var fileList
  return fs.readdirAsync(fullPath)
    .then((files) => files.filter((file) => file.indexOf('.') !== 0))
    .then((files) => {
      fileList = files
      var promises = []
      for(let i = 0, l = files.length; i < l; i++){
        let file = files[i]
        promises.push(fs.statAsync(path.join(fullPath, file)))
      }
      return Promise.all(promises)
    })
    .then((stats) => {
      let parsedFiles = []
      for(let i = 0, l = fileList.length; i < l; i++){
        let file = fileList[i]
        let stat = stats[i]
        parsedFiles.push({
          name: file,
          size: stat.size,
          isDir: stat.isDirectory(),
          created: stat.ctime,
          modified: stat.mtime
        })
      }
      return parsedFiles
    })
}


text:
package com.sun.xml.internal.org.jvnet.staxex;

import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;

// for testing method
//import com.sun.xml.internal.stream.writers.XMLStreamWriterImpl;

/**
 * This class implements a BASE64 Encoder. It is implemented as
 * a FilterOutputStream, so one can just wrap this class around
 * any output stream and write bytes into this filter. The Encoding
 * is done as the bytes are written out.
 *
 * @author John Mani
 * @author Bill Shannon
 * @author Martin Grebac
 */

public class Base64EncoderStream extends FilterOutputStream {
    private byte[] buffer;      // cache of bytes that are yet to be encoded
    private int bufsize = 0;    // size of the cache

    private XMLStreamWriter outWriter;

    public Base64EncoderStream(OutputStream out) {
        super(out);
        buffer = new byte[3];
    }

    /**
     * Create a BASE64 encoder that encodes the specified input stream
     */
    public Base64EncoderStream(XMLStreamWriter outWriter, OutputStream out) {
        super(out);
        buffer = new byte[3];
        this.outWriter = outWriter;
    }

    /**
     * Encodes len bytes from the specified
     * byte array starting at offset off to
     * this output stream.
     *
     * @param      b     the data.
     * @param      off   the start offset in the data.
     * @param      len   the number of bytes to write.
     * @exception  IOException  if an I/O error occurs.
     */
    @Override
    public void write(byte[] b, int off, int len) throws IOException {
        for (int i = 0; i < len; i++)
            write(b[off + i]);
    }

    /**
     * Encodes b.length bytes to this output stream.
     * @param      b   the data to be written.
     * @exception  IOException  if an I/O error occurs.
     */
    @Override
    public void write(byte[] b) throws IOException {
        write(b, 0, b.length);
    }

    /**
     * Encodes the specified byte to this output stream.
     * @param      c   the byte.
     * @exception  IOException  if an I/O error occurs.
     */
    @Override
    public void write(int c) throws IOException {
        buffer[bufsize++] = (byte)c;
        if (bufsize == 3) { // Encoding unit = 3 bytes
            encode();
            bufsize = 0;
        }
    }

    /**
     * Flushes this output stream and forces any buffered output bytes
     * to be encoded out to the stream.
     * @exception  IOException  if an I/O error occurs.
     */
    @Override
    public void flush() throws IOException {
        if (bufsize > 0) { // If there's unencoded characters in the buffer ..
            encode();      // .. encode them
            bufsize = 0;
        }
        out.flush();
        try {
            outWriter.flush();
        } catch (XMLStreamException ex) {
            Logger.getLogger(Base64EncoderStream.class.getName()).log(Level.SEVERE, null, ex);
            throw new IOException(ex);
        }
    }

    /**
     * Forces any buffered output bytes to be encoded out to the stream
     * and closes this output stream
     */
    @Override
    public void close() throws IOException {
        flush();
        out.close();
    }

    /** This array maps the characters to their 6 bit values */
    private final static char pem_array[] = {
        'A','B','C','D','E','F','G','H', // 0
        'I','J','K','L','M','N','O','P', // 1
        'Q','R','S','T','U','V','W','X', // 2
        'Y','Z','a','b','c','d','e','f', // 3
        'g','h','i','j','k','l','m','n', // 4
        'o','p','q','r','s','t','u','v', // 5
        'w','x','y','z','0','1','2','3', // 6
        '4','5','6','7','8','9','+','/'  // 7
    };

    private void encode() throws IOException {
        byte a, b, c;
        char[] buf = new char[4];
        if (bufsize == 1) {
            a = buffer[0];
            b = 0;
            c = 0;
            buf[0] = pem_array[(a >>> 2) & 0x3F];
            buf[1] = pem_array[((a << 4) & 0x30) + ((b >>> 4) & 0xf)];
            buf[2] = '='; // pad character
            buf[3] = '='; // pad character
        } else if (bufsize == 2) {
            a = buffer[0];
            b = buffer[1];
            c = 0;
            buf[0] = pem_array[(a >>> 2) & 0x3F];
            buf[1] = pem_array[((a << 4) & 0x30) + ((b >>> 4) & 0xf)];
            buf[2] = pem_array[((b << 2) & 0x3c) + ((c >>> 6) & 0x3)];
            buf[3] = '='; // pad character
        } else {
            a = buffer[0];
            b = buffer[1];
            c = buffer[2];
            buf[0] = pem_array[(a >>> 2) & 0x3F];
            buf[1] = pem_array[((a << 4) & 0x30) + ((b >>> 4) & 0xf)];
            buf[2] = pem_array[((b << 2) & 0x3c) + ((c >>> 6) & 0x3)];
            buf[3] = pem_array[c & 0x3F];
        }
        try {
            outWriter.writeCharacters(buf, 0, 4);
        } catch (XMLStreamException ex) {
            Logger.getLogger(Base64EncoderStream.class.getName()).log(Level.SEVERE, null, ex);
            throw new IOException(ex);
        }
    }

//    public static void main(String argv[]) throws Exception {
//      FileInputStream infile = new FileInputStream(new File(argv[0]));
//        StringWriter sw = new StringWriter();
//        XMLStreamWriterImpl wi = new XMLStreamWriterImpl(sw, null);
//        ByteArrayOutputStream baos = new ByteArrayOutputStream();
//      Base64EncoderStream encoder = new Base64EncoderStream(wi, baos);
//      int c;
//
//      while ((c = infile.read()) != -1)
//          encoder.write(c);
//      encoder.close();
//
//        System.out.println("SW: " + sw.toString());
//        System.out.println("BAOS: " + baos.toString());
//
//    }
}


text:
package ins.platform.menu.web;

import ins.framework.web.Struts2Action;
import ins.platform.menu.service.facade.MenuService;

import com.opensymphony.xwork2.ActionContext;

public class MenuAction extends Struts2Action {
	private static final long serialVersionUID = 1L;

	private String companyCode;

	private String userCode;

	private String gradeCodes = "";

	private String systemCode;

	private Integer menuId;

	private String menuContent;

	private int powerType;

	private String gradesIdString = "";

	private String request_locale;

	private transient MenuService menuService;

	public String showMenu() {
		menuContent = menuService.showMenu(menuId, companyCode, userCode, gradeCodes, systemCode, ActionContext
				.getContext().getLocale(), powerType, gradesIdString);
		return SUCCESS;
	}

	public void setCompanyCode(String companyCode) {
		this.companyCode = companyCode;
	}

	public void setGradeCodes(String gradeCodes) {
		this.gradeCodes = gradeCodes;
	}

	public void setSystemCode(String systemCode) {
		this.systemCode = systemCode;
	}

	public void setUserCode(String userCode) {
		this.userCode = userCode;
	}

	public void setMenuService(MenuService menuService) {
		this.menuService = menuService;
	}

	public String getMenuContent() {
		return menuContent;
	}

	public void setMenuContent(String menuContent) {
		this.menuContent = menuContent;
	}

	public String getCompanyCode() {
		return companyCode;
	}

	public String getGradeCodes() {
		return gradeCodes;
	}

	public String getSystemCode() {
		return systemCode;
	}

	public String getUserCode() {
		return userCode;
	}

	public Integer getMenuId() {
		return menuId;
	}

	public void setMenuId(Integer menuId) {
		this.menuId = menuId;
	}

	public int getPowerType() {
		return powerType;
	}

	public void setPowerType(int powerType) {
		this.powerType = powerType;
	}

	public String getGradesIdString() {
		return gradesIdString;
	}

	public void setGradesIdString(String gradesIdString) {
		this.gradesIdString = gradesIdString;
	}

	public String getRequest_locale() {
		return request_locale;
	}

	public void setRequest_locale(String requestLocale) {
		request_locale = requestLocale;
	}

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.8"/>
<title>Assimp: vector2.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

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

Assimp
    v3.1.1 (June 2014)

Main Page

Related Pages

Namespaces

Classes

Files

File List

File Members

include

assimp

Classes |
Typedefs |
Variables

vector2.h File Reference

Classes

class  	aiVector2t< TReal >

 	Represents a two-dimensional vector.  More...

Typedefs

typedef aiVector2t< float > 	aiVector2D

Variables

class aiVector2t 	PACK_STRUCT

Typedef Documentation

          typedef aiVector2t<float> aiVector2D

Variable Documentation

          class aiVector2t  PACK_STRUCT

<address class="footer">
Generated on Wed Feb 18 2015 13:46:03 for Assimp by

 1.8.8
</address>


text:
package storage

import (
	json "encoding/json"
	easyjson "github.com/mailru/easyjson"
	jlexer "github.com/mailru/easyjson/jlexer"
	jwriter "github.com/mailru/easyjson/jwriter"
)

// suppress unused package warning
var (
	_ *json.RawMessage
	_ *jlexer.Lexer
	_ *jwriter.Writer
	_ easyjson.Marshaler
)

func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage(in *jlexer.Lexer, out *ClearDataForOriginParams) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeString()
		in.WantColon()
		if in.IsNull() {
			in.Skip()
			in.WantComma()
			continue
		}
		switch key {
		case "origin":
			out.Origin = string(in.String())
		case "storageTypes":
			out.StorageTypes = string(in.String())
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage(out *jwriter.Writer, in ClearDataForOriginParams) {
	out.RawByte('{')
	first := true
	_ = first
	if !first {
		out.RawByte(',')
	}
	first = false
	out.RawString("\"origin\":")
	out.String(string(in.Origin))
	if !first {
		out.RawByte(',')
	}
	first = false
	out.RawString("\"storageTypes\":")
	out.String(string(in.StorageTypes))
	out.RawByte('}')
}

// MarshalJSON supports json.Marshaler interface
func (v ClearDataForOriginParams) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ClearDataForOriginParams) MarshalEasyJSON(w *jwriter.Writer) {
	easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage(w, v)
}

// UnmarshalJSON supports json.Unmarshaler interface
func (v *ClearDataForOriginParams) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage(&r, v)
	return r.Error()
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ClearDataForOriginParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage(l, v)
}


text:
<?php
namespace Mw\Metamorph\Domain\Model\State;

use TYPO3\Flow\Annotations as Flow;

/**
 * @package    Mw\Metamorph
 * @subpackage Domain\Model\State
 *
 * @Flow\Scope("prototype")
 */
class PackageMapping {

	const ACTION_MORPH = 'MORPH';

	const ACTION_IGNORE = 'IGNORE';

	/**
	 * @var string
	 * @Flow\Validate(type="NotEmpty")
	 */
	protected $extensionKey;

	/**
	 * @var string
	 * @Flow\Validate(type="Mw.Metamorph:PackageKey")
	 */
	protected $packageKey;

	/**
	 * @var string
	 * @Flow\Validate(type="NotEmpty")
	 */
	protected $filePath;

	/**
	 * @var string
	 * @Flow\Validate(
	 *   type="Mw.Metamorph:ElementOf",
	 *   options={"set"={PackageMapping::ACTION_MORPH, PackageMapping::ACTION_IGNORE}}
	 * )
	 */
	protected $action = self::ACTION_MORPH;

	/**
	 * @var string
	 */
	protected $description;

	/**
	 * @var string
	 */
	protected $version;

	/**
	 * @var array
	 */
	protected $authors = [];

	/**
	 * @var array
	 */
	protected $fileExcludePatterns = [];

	public function __construct($filePath, $extensionKey = NULL) {
		$this->filePath     = $filePath;
		$this->extensionKey = $extensionKey ?: basename($filePath);
	}

	/**
	 * @return string
	 */
	public function getFilePath() {
		return $this->filePath;
	}

	/**
	 * @return string
	 */
	public function getExtensionKey() {
		return $this->extensionKey;
	}

	/**
	 * @param string $packageKey
	 */
	public function setPackageKey($packageKey) {
		$this->packageKey = $packageKey;
	}

	/**
	 * @return string
	 */
	public function getPackageKey() {
		return $this->packageKey;
	}

	/**
	 * @param string $description
	 */
	public function setDescription($description) {
		$this->description = $description;
	}

	/**
	 * @return string
	 */
	public function getDescription() {
		return $this->description;
	}

	/**
	 * @param string $version
	 */
	public function setVersion($version) {
		$this->version = $version;
	}

	/**
	 * @return string
	 */
	public function getVersion() {
		return $this->version;
	}

	/**
	 * @param string $name
	 * @param string $email
	 */
	public function addAuthor($name, $email = NULL) {
		$author = ['name' => $name];
		if (NULL !== $email) {
			$author['email'] = $email;
		}
		$this->authors[] = $author;
	}

	/**
	 * @return array
	 */
	public function getAuthors() {
		return $this->authors;
	}

	/**
	 * @return string
	 */
	public function getAction() {
		return $this->action;
	}

	public function addFileExcludePattern($pattern) {
		$this->fileExcludePatterns[] = $pattern;
	}

	public function getFileExcludePatterns() {
		return $this->fileExcludePatterns;
	}

	public function isFileIncluded($filename) {
		foreach ($this->fileExcludePatterns as $pattern) {
			if (preg_match($pattern, $filename)) {
				return FALSE;
			}
		}
		return TRUE;
	}

}


text:
package org.apache.jackrabbit.oak.plugins.document;

import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;

import com.google.common.collect.ImmutableList;

import org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore;
import org.junit.Test;

import static org.apache.jackrabbit.oak.plugins.document.Collection.SETTINGS;
import static org.apache.jackrabbit.oak.plugins.document.FormatVersion.V0;
import static org.apache.jackrabbit.oak.plugins.document.FormatVersion.V1_0;
import static org.apache.jackrabbit.oak.plugins.document.FormatVersion.V1_2;
import static org.apache.jackrabbit.oak.plugins.document.FormatVersion.V1_4;
import static org.apache.jackrabbit.oak.plugins.document.FormatVersion.V1_6;
import static org.apache.jackrabbit.oak.plugins.document.FormatVersion.V1_8;
import static org.apache.jackrabbit.oak.plugins.document.FormatVersion.valueOf;
import static org.apache.jackrabbit.oak.plugins.document.RecoveryHandler.NOOP;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

public class FormatVersionTest {

    @Test
    public void canRead() {
        assertTrue(V1_8.canRead(V1_8));
        assertTrue(V1_8.canRead(V1_6));
        assertTrue(V1_8.canRead(V1_4));
        assertTrue(V1_8.canRead(V1_2));
        assertTrue(V1_8.canRead(V1_0));
        assertTrue(V1_8.canRead(V0));
        assertFalse(V1_6.canRead(V1_8));
        assertTrue(V1_6.canRead(V1_6));
        assertTrue(V1_6.canRead(V1_4));
        assertTrue(V1_6.canRead(V1_2));
        assertTrue(V1_6.canRead(V1_0));
        assertTrue(V1_6.canRead(V0));
        assertFalse(V1_4.canRead(V1_8));
        assertFalse(V1_4.canRead(V1_6));
        assertTrue(V1_4.canRead(V1_4));
        assertTrue(V1_4.canRead(V1_2));
        assertTrue(V1_4.canRead(V1_0));
        assertTrue(V1_4.canRead(V0));
        assertFalse(V1_2.canRead(V1_8));
        assertFalse(V1_2.canRead(V1_6));
        assertFalse(V1_2.canRead(V1_4));
        assertTrue(V1_2.canRead(V1_2));
        assertTrue(V1_2.canRead(V1_0));
        assertTrue(V1_2.canRead(V0));
        assertFalse(V1_0.canRead(V1_8));
        assertFalse(V1_0.canRead(V1_6));
        assertFalse(V1_0.canRead(V1_4));
        assertFalse(V1_0.canRead(V1_2));
        assertTrue(V1_0.canRead(V1_0));
        assertTrue(V1_0.canRead(V0));
    }

    @Test
    public void toStringValueOf() {
        for (FormatVersion v : FormatVersion.values()) {
            String s = v.toString();
            assertSame(v, valueOf(s));
        }
    }

    @Test
    public void valueOfUnknown() {
        String s = "0.9.7";
        FormatVersion v = valueOf(s);
        assertEquals(s, v.toString());
    }

    @Test
    public void versionOf() throws Exception {
        DocumentStore store = new MemoryDocumentStore();
        FormatVersion v = FormatVersion.versionOf(store);
        assertSame(V0, v);
    }

    @Test
    public void writeTo() throws Exception {
        DocumentStore store = new MemoryDocumentStore();
        // must not write dummy version
        assertFalse(V0.writeTo(store));
        // upgrade
        for (FormatVersion v : ImmutableList.of(V1_0, V1_2, V1_4, V1_6, V1_8)) {
            assertTrue(v.writeTo(store));
            assertSame(v, FormatVersion.versionOf(store));
        }
    }

    @Test(expected = DocumentStoreException.class)
    public void downgrade() throws Exception {
        DocumentStore store = new MemoryDocumentStore();
        assertTrue(V1_4.writeTo(store));
        // must not downgrade
        V1_2.writeTo(store);
    }

    @Test(expected = DocumentStoreException.class)
    public void activeClusterNodes() throws Exception {
        DocumentStore store = new MemoryDocumentStore();
        V1_0.writeTo(store);
        ClusterNodeInfo.getInstance(store, NOOP, null, null, 1);
        V1_2.writeTo(store);
    }

    @Test(expected = DocumentStoreException.class)
    public void concurrentUpdate1() throws Exception {
        DocumentStore store = new MemoryDocumentStore() {
            private final AtomicBoolean once = new AtomicBoolean(false);
            @Override
            public <T extends Document> T findAndUpdate(Collection<T> collection,
                                                        UpdateOp update) {
                if (collection == SETTINGS
                        && !once.getAndSet(true)) {
                    V1_2.writeTo(this);
                }
                return super.findAndUpdate(collection, update);
            }
        };
        V1_0.writeTo(store);
        V1_2.writeTo(store);
    }

    @Test(expected = DocumentStoreException.class)
    public void concurrentUpdate2() throws Exception {
        DocumentStore store = new MemoryDocumentStore() {
            private final AtomicBoolean once = new AtomicBoolean(false);

            @Override
            public <T extends Document> boolean create(Collection<T> collection,
                                                       List<UpdateOp> updateOps) {
                if (collection == SETTINGS
                        && !once.getAndSet(true)) {
                    V1_0.writeTo(this);
                }
                return super.create(collection, updateOps);
            }
        };
        V1_0.writeTo(store);
    }
}


text:
MACHINE_IP=`'/mnt/c/Program Files/Docker Toolbox/docker-machine.exe' ls 2>/dev/null | grep default | awk '{ print $5}'`

export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="$MACHINE_IP"
export DOCKER_CERT_PATH="/mnt/c/Users/$USER/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"

DOCKER_COMMAND=`echo -n "$@" | sed -E 's/\/mnt\/([a-z])\//\/\/\1\//g'`
eval /usr/bin/docker $DOCKER_COMMAND


text:
"""Package with reusable and extendable model classes.

This package contains base classes, for example, for
:class:`test suites <robot.model.testsuite.TestSuite>`,
:class:`test cases <robot.model.testcase.TestCase>` and
:class:`keywords <robot.model.keyword.Keyword>`, and for other generic
functionality, such as :mod:`visitors <robot.model.visitor>`.

These classes are extended both in :mod:`robot.result` and :mod:`robot.running`
packages and used also elsewhere.

This package is considered stable.
"""

from .configurer import SuiteConfigurer
from .testsuite import TestSuite
from .testcase import TestCase
from .keyword import Keyword, Keywords
from .message import Message
from .modifier import ModelModifier
from .tags import Tags, TagPattern, TagPatterns
from .criticality import Criticality
from .namepatterns import SuiteNamePatterns, TestNamePatterns
from .visitor import SuiteVisitor
from .totalstatistics import TotalStatisticsBuilder
from .statistics import Statistics
from .imports import Imports
from .itemlist import ItemList


text:
Select item to view

                {{ entry.fields.title }}
                Untitled


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:jpa="http://www.springframework.org/schema/data/jpa"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:util="http://www.springframework.org/schema/util"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
          http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
          http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
          http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

   <util:properties id="properties" location="classpath:#{envPropertiesFile}" />

   <!-- directory to scan for repository classes -->
   <jpa:repositories base-package="com.repaskys.repositories"/>

   <bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
      <property name="entityManagerFactory" ref="entityManagerFactory"/>
   </bean>

   <!-- refer to http://static.springsource.org/spring/docs/3.1.0.RELEASE/reference/html/orm.html#orm-jpa-setup-lcemfb -->
   <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
      <property name="persistenceUnitName" value="jpa.url"/>
      <property name="jpaVendorAdapter">
         <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
            <property name="generateDdl" value="true"/>
            <property name="databasePlatform" value="${database.dialect}"/>
            <property name="showSql" value="true"/>
         </bean>
      </property>
      <!-- TODO do I need a load time weaver? -->
      <property name="dataSource" ref="dataSource"/>
   </bean>

   <!-- Could also use javax.validation.Validation.buildDefaultValidatorFactory() but I'm not sure what the difference is. -->
   <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>

   <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>

</beans>


text:
using System;
using System.Diagnostics;
using System.Text;
using NUnit.Framework;

namespace ServiceStack.Redis.Tests
{
	[TestFixture, Category("Integration")]
	public class RedisClientTestsBase
	{
	    protected string CleanMask = null;
		protected RedisClient Redis;

		protected void Log(string fmt, params object[] args)
		{
			Debug.WriteLine("{0}", string.Format(fmt, args).Trim());
		}

		[TestFixtureSetUp]
		public void TestFixtureSetUp()
		{
			RedisClient.NewFactoryFn = () => new RedisClient(TestConfig.SingleHost);
            using (var redis = RedisClient.New())
            {
                redis.FlushAll();
            }
		}

		[SetUp]
		public virtual void OnBeforeEachTest()
		{
			Redis = RedisClient.New();
		}

        [TearDown]
        public virtual void TearDown()
        {
            if (Redis.NamespacePrefix != null && CleanMask == null) CleanMask = Redis.NamespacePrefix + "*";
            if (CleanMask != null) Redis.SearchKeys(CleanMask).ForEach(t => Redis.Del(t));
            Redis.Dispose();
        }

        protected string PrefixedKey(string key)
        {
            return string.Concat(Redis.NamespacePrefix, key);
        }

		public RedisClient GetRedisClient()
		{
			var client = new RedisClient(TestConfig.SingleHost);
			return client;
		}

		public RedisClient CreateRedisClient()
		{
			var client = new RedisClient(TestConfig.SingleHost);
			return client;
		}

		public string GetString(byte[] stringBytes)
		{
			return Encoding.UTF8.GetString(stringBytes);
		}

		public byte[] GetBytes(string stringValue)
		{
			return Encoding.UTF8.GetBytes(stringValue);
		}
	}
}


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>CSS Grid - Holy Grail 2</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
  <link rel="stylesheet" href="css/style.css">

    Header

    Left Sidebar

    Article

    Right Sidebar

    Footer


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;
using Microsoft.WindowsAzure.Storage.Queue;
using System.Diagnostics;
using System.Configuration;

namespace Contoso.Apps.SportsLeague.WorkerRole
{
    public class AzureStorageMethods
    {
        private const string receiptBlobName = "receipts";
        private CloudBlobClient blobClient;
        private CloudBlobContainer blobContainer;
        CloudStorageAccount storageAccount;

        public AzureStorageMethods()
        {
            storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["BlobConnectionString"]);
        }

        /// <summary>
        /// Upload the generated receipt Pdf to Blob storage.
        /// </summary>
        /// <param name="file">Byte array containig the Pdf file contents to be uploaded.</param>
        /// <param name="fileName">The desired filename of the uploaded file.</param>
        /// <returns></returns>
        public string UploadPdfToBlob(byte[] file, string fileName)
        {
            // Create the blob client.
            blobClient = storageAccount.CreateCloudBlobClient();

            // Retrieve a reference to a container.
            blobContainer = blobClient.GetContainerReference(receiptBlobName);

            // Create the container if it doesn't already exist.
            blobContainer.CreateIfNotExists(BlobContainerPublicAccessType.Blob);

            string fileUri = string.Empty;

            CloudBlockBlob blockBlob = blobContainer.GetBlockBlobReference(fileName);

            using (var stream = new MemoryStream(file))
            {
                // Upload the in-memory Pdf file to blob storage.
                blockBlob.UploadFromStream(stream);
            }

            fileUri = blockBlob.Uri.ToString();

            return fileUri;
        }

        /// <summary>
        /// Grabs the next pending queue message containing the next order
        /// whose receipt we need to generate.
        /// </summary>
        /// <returns></returns>
        public async Task<int> GetOrderIdFromQueue()
        {
            int orderId = 0;

            // Create the queue client.
            CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();

            // Retrieve a reference to a queue.
            CloudQueue queue = queueClient.GetQueueReference("receiptgenerator");

            // Create the queue if it doesn't already exist.
            if (await queue.CreateIfNotExistsAsync())
            {
                Console.WriteLine("Queue '{0}' Created", queue.Name);
            }
            else
            {
                Console.WriteLine("Queue '{0}' Exists", queue.Name);
            }

            // Get the next message.
            CloudQueueMessage retrievedMessage = await queue.GetMessageAsync();

            if (retrievedMessage != null)
            {
                Trace.TraceInformation("Retrieved Queue Message: " + retrievedMessage.AsString);
                // Process the message in less than 30 seconds, and then delete the message.
                await queue.DeleteMessageAsync(retrievedMessage);
                int.TryParse(retrievedMessage.AsString, out orderId);
            }

            return orderId;
        }
    }
}


text:
SCRIPT_ABS_PATH=$(cd "$(dirname "$0")" && pwd)
. ${SCRIPT_ABS_PATH}/common-env.sh

echo .

echo stopping zookeeper...
${KAFKA_BIN_PATH}/zookeeper-server-stop.sh


text:
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>MathBox - Test: Atomicity.</title>

  <!--
    Tests whether property changes are applied immediately and without a frame of lag.
  -->

  <style type="text/css" media="screen">
    html, body { height: 100%; }
    body { margin: 0; padding: 0 }
    canvas { display: block }
  </style>

  <script type="text/javascript" charset="utf-8" src="../vendor/domready.js"></script>
  <script type="text/javascript" charset="utf-8" src="../build/MathBox-bundle.js"></script>

  <script type="text/javascript" charset="utf-8">
  /**
   * Bootstrap
   */
  DomReady.ready(function() {
    ThreeBox.preload([
      '../shaders/snippets.glsl.html',
    ], function () {

      // MathBox boilerplate
      var mathbox = window.mathbox = mathBox({
        cameraControls: true,
        cursor:         true,
        controlClass:   ThreeBox.OrbitControls,
        elementResize:  true,
        fullscreen:     true,
        screenshot:     true,
        stats:          false,
        scale:          1,
      }).start();

      // Viewport camera/setup
      mathbox
        // Polar viewport
        .viewport({
          type: 'polar',
          range: [[-π, π], [-2, 2]],
          scale: [1, 1],
          polar: 1,
          fold: 2,
          power: 2,
        })
        .camera({
          orbit: 3.5,
          phi: τ/6,
          theta: 0.3,
        })
        .transition(200)

        // Setup
        .grid({
          n: [64, 2],
        })
        .curve({
          n: 1,
          pointSize: 20,
          data: [[1, 1]],
          points: true,
          line: false,
        })

        // Instant change at 320
        .animate('viewport', { fold: 2, power: 2 }, { duration: 0, delay: 50 })
        .animate('viewport', { fold: 1, power: 1 }, { duration: 0, delay: 270 })
        .animate('curve', { data: [[2, 1]] }, { duration: 0, delay: 320 })

    });
  });
  </script>

  <script type="text/javascript" charset="utf-8">
  </script>

</head>
<body>
</body>
</html>


text: pip list --format=legacy --outdated | awk '{print $1}' | xargs pip install --upgrade