text:
package com.bumptech.glide.manager;

import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.ContextWrapper;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.util.Log;

import com.bumptech.glide.RequestManager;
import com.bumptech.glide.util.Util;

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

/**
 * A collection of static methods for creating new {@link com.bumptech.glide.RequestManager}s or retrieving existing
 * ones from activities and fragment.
 */
public class RequestManagerRetriever implements Handler.Callback {
    private static final String TAG = "RMRetriever";
    static final String FRAGMENT_TAG = "com.bumptech.glide.manager";

    /** The singleton instance of RequestManagerRetriever. */
    private static final RequestManagerRetriever INSTANCE = new RequestManagerRetriever();

    private static final int ID_REMOVE_FRAGMENT_MANAGER = 1;
    private static final int ID_REMOVE_SUPPORT_FRAGMENT_MANAGER = 2;

    /** The top application level RequestManager. */
    private volatile RequestManager applicationManager;

    // Visible for testing.
    /** Pending adds for RequestManagerFragments. */
    final Map<android.app.FragmentManager, RequestManagerFragment> pendingRequestManagerFragments =
            new HashMap<android.app.FragmentManager, RequestManagerFragment>();

    // Visible for testing.
    /** Pending adds for SupportRequestManagerFragments. */
    final Map<FragmentManager, SupportRequestManagerFragment> pendingSupportRequestManagerFragments =
            new HashMap<FragmentManager, SupportRequestManagerFragment>();

    /** Main thread handler to handle cleaning up pending fragment maps. */
    private final Handler handler;

    /**
     * Retrieves and returns the RequestManagerRetriever singleton.
     */
    public static RequestManagerRetriever get() {
        return INSTANCE;
    }

    // Visible for testing.
    RequestManagerRetriever() {
        handler = new Handler(Looper.getMainLooper(), this /* Callback */);
    }

    private RequestManager getApplicationManager(Context context) {
        // Either an application context or we're on a background thread.
        if (applicationManager == null) {
            synchronized (this) {
                if (applicationManager == null) {
                    // Normally pause/resume is taken care of by the fragment we add to the fragment or activity.
                    // However, in this case since the manager attached to the application will not receive lifecycle
                    // events, we must force the manager to start resumed using ApplicationLifecycle.
                    applicationManager = new RequestManager(context.getApplicationContext(),
                            new ApplicationLifecycle(), new EmptyRequestManagerTreeNode());
                }
            }
        }

        return applicationManager;
    }

    public RequestManager get(Context context) {
        if (context == null) {
            throw new IllegalArgumentException("You cannot start a load on a null Context");
        } else if (Util.isOnMainThread() && !(context instanceof Application)) {
            if (context instanceof FragmentActivity) {
                return get((FragmentActivity) context);
            } else if (context instanceof Activity) {
                return get((Activity) context);
            } else if (context instanceof ContextWrapper) {
                return get(((ContextWrapper) context).getBaseContext());
            }
        }

        return getApplicationManager(context);
    }

    public RequestManager get(FragmentActivity activity) {
        if (Util.isOnBackgroundThread()) {
            return get(activity.getApplicationContext());
        } else {
            assertNotDestroyed(activity);
            FragmentManager fm = activity.getSupportFragmentManager();
            return supportFragmentGet(activity, fm);
        }
    }

    public RequestManager get(Fragment fragment) {
        if (fragment.getActivity() == null) {
            throw new IllegalArgumentException("You cannot start a load on a fragment before it is attached");
        }
        if (Util.isOnBackgroundThread()) {
            return get(fragment.getActivity().getApplicationContext());
        } else {
            FragmentManager fm = fragment.getChildFragmentManager();
            return supportFragmentGet(fragment.getActivity(), fm);
        }
    }

    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    public RequestManager get(Activity activity) {
        if (Util.isOnBackgroundThread() || Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
            return get(activity.getApplicationContext());
        } else {
            assertNotDestroyed(activity);
            android.app.FragmentManager fm = activity.getFragmentManager();
            return fragmentGet(activity, fm);
        }
    }

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    private static void assertNotDestroyed(Activity activity) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed()) {
            throw new IllegalArgumentException("You cannot start a load for a destroyed activity");
        }
    }

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    public RequestManager get(android.app.Fragment fragment) {
        if (fragment.getActivity() == null) {
            throw new IllegalArgumentException("You cannot start a load on a fragment before it is attached");
        }
        if (Util.isOnBackgroundThread() || Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
            return get(fragment.getActivity().getApplicationContext());
        } else {
            android.app.FragmentManager fm = fragment.getChildFragmentManager();
            return fragmentGet(fragment.getActivity(), fm);
        }
    }

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    RequestManagerFragment getRequestManagerFragment(final android.app.FragmentManager fm) {
        RequestManagerFragment current = (RequestManagerFragment) fm.findFragmentByTag(FRAGMENT_TAG);
        if (current == null) {
            current = pendingRequestManagerFragments.get(fm);
            if (current == null) {
                current = new RequestManagerFragment();
                pendingRequestManagerFragments.put(fm, current);
                fm.beginTransaction().add(current, FRAGMENT_TAG).commitAllowingStateLoss();
                handler.obtainMessage(ID_REMOVE_FRAGMENT_MANAGER, fm).sendToTarget();
            }
        }
        return current;
    }

    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    RequestManager fragmentGet(Context context, android.app.FragmentManager fm) {
        RequestManagerFragment current = getRequestManagerFragment(fm);
        RequestManager requestManager = current.getRequestManager();
        if (requestManager == null) {
            requestManager = new RequestManager(context, current.getLifecycle(), current.getRequestManagerTreeNode());
            current.setRequestManager(requestManager);
        }
        return requestManager;
    }

    SupportRequestManagerFragment getSupportRequestManagerFragment(final FragmentManager fm) {
        SupportRequestManagerFragment current = (SupportRequestManagerFragment) fm.findFragmentByTag(FRAGMENT_TAG);
        if (current == null) {
            current = pendingSupportRequestManagerFragments.get(fm);
            if (current == null) {
                // 创建SupportRequestManagerFragment实例,并put到pendingSupportRequestManagerFragments
                // 这里创建了一个Fragment,目的是实现glide跟Activity或Fragment生命周期的绑定
                current = new SupportRequestManagerFragment();
                pendingSupportRequestManagerFragments.put(fm, current);
                fm.beginTransaction().add(current, FRAGMENT_TAG).commitAllowingStateLoss();
                handler.obtainMessage(ID_REMOVE_SUPPORT_FRAGMENT_MANAGER, fm).sendToTarget();
            }
        }
        return current;
    }

    RequestManager supportFragmentGet(Context context, FragmentManager fm) {
        SupportRequestManagerFragment current = getSupportRequestManagerFragment(fm);
        // SupportRequestManagerFragment中RequestManager是通过setRequestManager持有requestManager引用的,
        // 第一次是null
        RequestManager requestManager = current.getRequestManager();
        if (requestManager == null) {
            // 创建RequestManager实例
            requestManager = new RequestManager(context, current.getLifecycle(), current.getRequestManagerTreeNode());
            // 将该应用配置给SupportRequestManagerFragment实例
            current.setRequestManager(requestManager);
        }
        return requestManager;
    }

    @Override
    public boolean handleMessage(Message message) {
        boolean handled = true;
        Object removed = null;
        Object key = null;
        switch (message.what) {
            case ID_REMOVE_FRAGMENT_MANAGER:
                android.app.FragmentManager fm = (android.app.FragmentManager) message.obj;
                key = fm;
                removed = pendingRequestManagerFragments.remove(fm);
                break;
            case ID_REMOVE_SUPPORT_FRAGMENT_MANAGER:
                FragmentManager supportFm = (FragmentManager) message.obj;
                key = supportFm;
                removed = pendingSupportRequestManagerFragments.remove(supportFm);
                break;
            default:
                handled = false;
        }
        if (handled && removed == null && Log.isLoggable(TAG, Log.WARN)) {
            Log.w(TAG, "Failed to remove expected request manager fragment, manager: " + key);
        }
        return handled;
    }
}


text:
@implementation FSTheme

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (void)applyToController:(UIResponder *)controller {
    if ([controller isKindOfClass:[UINavigationController class]]) {
        UINavigationController *navigationController = (UINavigationController *)controller;

        navigationController.navigationBar.barStyle = self.navigationBarStyle;

        if (self.navigationBarBackgroundColor) {
            navigationController.navigationBar.barTintColor = self.navigationBarBackgroundColor;
            navigationController.popoverPresentationController.backgroundColor = self.navigationBarBackgroundColor;
        }

        if (self.navigationBarTintColor) {
            navigationController.navigationBar.tintColor = self.navigationBarTintColor;
        }

        if (self.navigationBarTitleColor) {
            [navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : self.navigationBarTitleColor}];
        }
    }

    if (self.headerFooterViewTintColor) {
        [UITableViewHeaderFooterView appearanceWhenContainedIn:[controller class], nil].tintColor = self.headerFooterViewTintColor;
    }

    if (self.headerFooterViewTextColor) {
        [UILabel appearanceWhenContainedIn:[UITableViewHeaderFooterView class], [controller class], nil].textColor = self.headerFooterViewTextColor;
    }

    if (self.tableViewBackgroundColor) {
        [UITableView appearanceWhenContainedIn:[controller class], nil].backgroundColor = self.tableViewBackgroundColor;
    }

    if (self.tableViewSeparatorColor) {
        [UITableView appearanceWhenContainedIn:[controller class], nil].separatorColor = self.tableViewSeparatorColor;
    }

    if (self.tableViewCellBackgroundColor) {
        [FSTableViewCell appearance].backgroundColor = self.tableViewCellBackgroundColor;
        [FSSourceTableViewCell appearance].backgroundColor = self.tableViewCellBackgroundColor;
        [FSListTableViewCell appearance].backgroundColor = self.tableViewCellBackgroundColor;
    }

    if (self.tableViewCellSelectedBackgroundColor) {
        [FSTableViewCell appearance].selectedBackgroundColor = self.tableViewCellSelectedBackgroundColor;
        [FSSourceTableViewCell appearance].selectedBackgroundColor = self.tableViewCellSelectedBackgroundColor;
        [FSListTableViewCell appearance].selectedBackgroundColor = self.tableViewCellSelectedBackgroundColor;
    }

    if (self.cellIconTintColor) {
        [FSTableViewCell appearance].tintColor = self.cellIconTintColor;
        [FSSourceTableViewCell appearance].tintColor = self.cellIconTintColor;
        [FSListTableViewCell appearance].tintColor = self.cellIconTintColor;
    }

    if (self.tableViewCellTextColor) {
        [UILabel appearanceWhenContainedIn:[UITableView class], [controller class], nil].appearanceTextColor = self.tableViewCellTextColor;
    }

    if (self.tableViewCellSelectedTextColor) {
        [UILabel appearanceWhenContainedIn:[UITableView class], [controller class], nil].appearanceHighlightedTextColor = self.tableViewCellSelectedTextColor;
    }

    if (self.tableViewCellImageViewBorderColor) {
        [FSTableViewCell appearance].imageViewBorderColor = self.tableViewCellImageViewBorderColor;
    }

    if (self.collectionViewBackgroundColor) {
        [UICollectionView appearanceWhenContainedIn:[controller class], nil].backgroundColor = self.collectionViewBackgroundColor;
    }

    if (self.collectionViewCellBackgroundColor) {
        [FSCollectionViewCell appearance].backgroundColor = self.collectionViewCellBackgroundColor;
    }

    if (self.collectionViewCellBorderColor) {
        [FSCollectionViewCell appearance].appearanceBorderColor = self.collectionViewCellBorderColor;
    }

    if (self.collectionViewCellTitleTextColor) {
        [FSCollectionViewCell appearance].appearanceTitleLabelTextColor = self.collectionViewCellTitleTextColor;
    }

    if (self.uploadButtonBackgroundColor) {
        [FSBarButtonItem appearance].backgroundColor = self.uploadButtonBackgroundColor;
    }

    if (self.uploadButtonTextColor) {
        [FSBarButtonItem appearance].normalTextColor = self.uploadButtonTextColor;
    }

    if (self.cellIconTintColor) {
        [UIImageView appearanceWhenContainedIn:[controller class], nil].tintColor = self.cellIconTintColor;
    }

    if (self.refreshControlTintColor) {
        [UIRefreshControl appearanceWhenContainedIn:[controller class], nil].tintColor = self.refreshControlTintColor;
    }

    if (self.refreshControlBackgroundColor) {
        [UIRefreshControl appearanceWhenContainedIn:[controller class], nil].backgroundColor = self.refreshControlBackgroundColor;
    }

    if (self.refreshControlAttributedTitle) {
        [UIRefreshControl appearanceWhenContainedIn:[controller class], nil].customAttributedTitle = self.refreshControlAttributedTitle;
    }

    if (self.searchBarBackgroundColor) {
        [UISearchBar appearanceWhenContainedIn:[controller class], nil].barTintColor = self.searchBarBackgroundColor;
    }

    if (self.searchBarTintColor) {
       [UISearchBar appearanceWhenContainedIn:[controller class], nil].tintColor = self.searchBarTintColor;
    }

    if (self.activityIndicatorColor) {
        [UIActivityIndicatorView appearanceWhenContainedIn:[controller class], nil].color = self.activityIndicatorColor;
    }

    if (self.progressCircleTrackColor) {
        [KAProgressLabel appearance].customTrackColor = self.progressCircleTrackColor;
    }

    if (self.progressCircleProgressColor) {
        [KAProgressLabel appearance].customProgressColor = self.progressCircleProgressColor;
    }
}
#pragma clang diagnostic pop

+ (void)applyDefaultToController:(UIResponder *)controller {
    [UICollectionView appearanceWhenContainedIn:[controller class], nil].backgroundColor = [UIColor whiteColor];
    [FSCollectionViewCell appearance].backgroundColor = [UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0];
}

+ (FSTheme *)filestackTheme {
    FSTheme *theme = [[FSTheme alloc] init];
    NSDictionary *attributes = @{NSForegroundColorAttributeName: [UIColor colorWithRed:0.94 green:0.94 blue:0.96 alpha:1]};

    theme.navigationBarStyle = UIBarStyleBlack;
    theme.navigationBarBackgroundColor = [UIColor colorWithRed:0.09 green:0.115 blue:0.17 alpha:1];
    theme.navigationBarTintColor = [UIColor colorWithRed:0.55 green:0.6 blue:0.63 alpha:1];
    theme.headerFooterViewTintColor = [UIColor colorWithRed:0.16 green:0.18 blue:0.22 alpha:1];
    theme.headerFooterViewTextColor = [UIColor whiteColor];
    theme.tableViewBackgroundColor = [UIColor colorWithRed:0.18 green:0.23 blue:0.27 alpha:1];
    theme.tableViewSeparatorColor = [UIColor colorWithRed:0.55 green:0.6 blue:0.63 alpha:1];
    theme.tableViewCellBackgroundColor = [UIColor colorWithRed:0.18 green:0.23 blue:0.27 alpha:1];
    theme.tableViewCellTextColor = [UIColor colorWithRed:0.94 green:0.94 blue:0.96 alpha:1];
    theme.tableViewCellSelectedBackgroundColor = [UIColor colorWithRed:0.95 green:1 blue:1 alpha:1];
    theme.tableViewCellSelectedTextColor = [UIColor colorWithRed:0.16 green:0.18 blue:0.22 alpha:1];
    theme.collectionViewBackgroundColor = [UIColor colorWithRed:0.18 green:0.23 blue:0.27 alpha:1];
    theme.collectionViewCellBackgroundColor = [UIColor colorWithRed:0.18 green:0.23 blue:0.27 alpha:1];
    theme.collectionViewCellBorderColor = [UIColor colorWithRed:0 green:0.6 blue:0.55 alpha:1];
    theme.collectionViewCellTitleTextColor = [UIColor colorWithRed:0.94 green:0.94 blue:0.96 alpha:1];
    theme.uploadButtonTextColor = [UIColor whiteColor];
    theme.uploadButtonBackgroundColor = [UIColor colorWithRed:0 green:0.6 blue:0.55 alpha:1];
    theme.cellIconTintColor = [UIColor colorWithRed:0 green:0.6 blue:0.55 alpha:1];
    theme.tableViewCellImageViewBorderColor = [UIColor colorWithRed:0.16 green:0.18 blue:0.22 alpha:1];
    theme.refreshControlTintColor = [UIColor colorWithRed:0.94 green:0.94 blue:0.96 alpha:1];
    theme.refreshControlAttributedTitle = [[NSAttributedString alloc] initWithString:@"Syncing data..." attributes:attributes];
    theme.searchBarBackgroundColor = [UIColor colorWithRed:0.16 green:0.18 blue:0.22 alpha:1];
    theme.searchBarTintColor = [UIColor colorWithRed:0 green:0.6 blue:0.55 alpha:1];
    theme.activityIndicatorColor = [UIColor colorWithRed:0.55 green:0.6 blue:0.63 alpha:1];
    theme.progressCircleTrackColor = [UIColor colorWithRed:0.18 green:0.23 blue:0.27 alpha:1.00];
    theme.progressCircleProgressColor = [UIColor colorWithRed:0.11 green:0.60 blue:0.55 alpha:1.00];

    return theme;
}

@end

redpajama_set_name: RedPajamaGithub


text:
AddCSLuaFile();

if SERVER then
	AddCSLuaFile("cl_menu.lua");
	include("sv_init.lua");
end

if CLIENT then
	include("cl_menu.lua");
end

SWEP.PrintName = "Pocket"
SWEP.Slot = 1
SWEP.SlotPos = 1
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true

SWEP.Base = "weapon_cs_base2"

SWEP.Author = "fprp Developers"
SWEP.Instructions = "Left click to pick up\nRight click to drop\nReload to open the menu"
SWEP.Contact = ""
SWEP.Purpose = ""
SWEP.IconLetter = ""

SWEP.ViewModelFOV = 62
SWEP.ViewModelFlip = false
SWEP.AnimPrefix	 = "rpg"
SWEP.WorldModel	= ""

SWEP.Spawnable = true
SWEP.AdminOnly = true
SWEP.Category = "fprp (Utility)"
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = ""

SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = ""

function SWEP:Initialize()
	self:SetHoldType("normal");
end

function SWEP:Deploy()
	return true
end

function SWEP:DrawWorldModel() end

function SWEP:PreDrawViewModel(vm)
	return true
end

function SWEP:Holster()
	if not SERVER then return true end

	self.Owner:DrawViewModel(true);
	self.Owner:DrawWorldModel(true);

	return true
end

function SWEP:PrimaryAttack()
	self.Weapon:SetNextPrimaryFire(CurTime() + 0.2);

	if not SERVER then return end

	local ent = self.Owner:GetEyeTrace().Entity
	local canPickup, message = hook.Call("canPocket", nil, self.Owner, ent);

	if not canPickup then
		if message then fprp.notify(self.Owner, 1, 4, message) end
		return
	end

	self.Owner:addPocketItem(ent);
end

function SWEP:SecondaryAttack()
	if not SERVER then return end

	local item = #self.Owner:getPocketItems();
	if item <= 0 then
		fprp.notify(self.Owner, 1, 4, fprp.getPhrase("pocket_no_items"));
		return
	end

	self.Owner:dropPocketItem(item);
end

function SWEP:Reload()
	if not CLIENT then return end

	fprp.openPocketMenu();
end

local meta = FindMetaTable("Player");
fprp.stub{
	name = "getPocketItems",
	description = "Get a player's pocket items.",
	parameters = {
	},
	returns = {
		{
			name = "items",
			description = "A table containing crucial information about the items in the pocket.",
			type = "table"
		}
	},
	metatable = meta,
	realm = "Shared"
}


text:
'use strict';

// Constants:
import { config } from '../config';
import constants from '../constants';

// Utilities:
import { join } from 'path';

export default { handler };

function handler (request, response) {
    let { type } = request.params;
    let extension = constants.EXTENSIONS[type];

    let { path, name } = request.query;
    let fileName = name + extension;
    path = path || join(process.cwd(), config.testDirectory, type, fileName);

    response.send({ path });
}


text:
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Social extends Model
{
    protected $table = 'social_logins';

    /**
     * Has Belongs to Only One User
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function user()
    {
        //return $this->belongsTo('App\Models\User');
        return $this->belongsTo('App\User');
    }
}


text:
define([
    'gids-resource'
], function () {
    'use strict';
    function Category (APIv2) {
        return APIv2('/category/:categoryId');
    }
    Category.$inject = ['APIv2'];
    Category.deps = ['gids.resource'];
    return Category;
});


text:
using System.Collections.Generic;
using System.Linq;
using BudgetAnalyser.Engine;
using BudgetAnalyser.Engine.Persistence;
using GalaSoft.MvvmLight.Messaging;

namespace BudgetAnalyser.ApplicationState
{
    /// <summary>
    /// A <see cref="MessageBase"/> message object that broadcasts to subscribed components that the application is about to save user state data.  In response to this message
    /// a subscribed component should add any data it wishes to persist.  Persistent data is not additive, if no data is added any existing persisted data is lost.
    /// </summary>
    public class ApplicationStateRequestedMessage : MessageBase
    {
        private readonly List<IPersistentApplicationStateObject> modelsToPersist = new List<IPersistentApplicationStateObject>();

        /// <summary>
        /// Gets all the persistent data for all subscribers.
        /// </summary>
        public IReadOnlyCollection<IPersistentApplicationStateObject> PersistentData => this.modelsToPersist;

        /// <summary>
        /// Each subscriber can call this method to include any data it wishes to persist.  This data is intended to be user state metadata. It is not intended to be used for
        /// wholesale application database data.
        /// </summary>
        /// <param name="model">
        /// The model to persist.  The type of this model will be used as a key and when data is loaded back from persistent storage this key (type) will be used
        /// to retrieve it.  No other component should use this type, or collisions will occur.
        /// </param>
        /// <exception cref="DuplicateNameException">Attempt to save application state with a model that has already been saved.</exception>
        public void PersistThisModel(IPersistentApplicationStateObject model)
        {
            if (this.modelsToPersist.Any(m => m.GetType() == model.GetType()))
            {
                throw new DuplicateNameException("Attempt to save application state with a model that has already been saved.");
            }

            this.modelsToPersist.Add(model);
        }
    }
}


text:
$packageName = 'sumo'
$installerType = 'exe'
$silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-'
$url = 'http://www.kcsoftwares.com/files/sumo_lite.exe'
$checksum = '1abc437d779e9f7a5b3b27f6889f779fd4b232bc789feb8e267c6cd02ee682b1'
$checksumType = 'sha256'
$validExitCodes = @(0)
$scriptPath = $(Split-Path -parent $MyInvocation.MyCommand.Definition)
$ahkExe = 'AutoHotKey'
$ahkFile = Join-Path $scriptPath "$($packageName)Install.ahk"

Start-Process $ahkExe $ahkFile
Install-ChocolateyPackage -PackageName "$packageName" `
                          -FileType "$installerType" `
                          -SilentArgs "$silentArgs" `
                          -Url "$url" `
                          -ValidExitCodes $validExitCodes `
                          -Checksum "$checksum" `
                          -ChecksumType "$checksumType"


text:
 package cs.karibu.helloworld.testdoubles;

import java.io.IOException;
import java.util.Stack;

import dk.au.cs.karibu.backend.ServerRequestHandler;
import dk.au.cs.karibu.producer.ChannelConnector;

/** A IPC implementation used for single-VM testing.
 * Connects a client request handler with a server
 * request handler using simple in-process method call.
 *
 * Augmented with code to simulate connection failures.
 * You can push exceptions to simulate onto a stack
 * using the 'pushException...' method. Then
 * the next calls to send will fail with the
 * next exception on the stack until it is
 * empty, after which normal send is resumed.
 *
 * @author Henrik Baerbak Christensen, Aarhus University
 *
 */
public class InVMInterProcessConnector implements ChannelConnector {

  private ServerRequestHandler serverRequestHandler;
  private boolean connectionIsOpen;
  private int countOfCallsToOpen;

  // The stack of exceptions to throw to simulate
  // send failures
  private Stack<Exception> exceptionToThrowStack;

  /** Create a connector that makes direct method calls to
   * the server request handler.
   * @param srh
   */
  public InVMInterProcessConnector(ServerRequestHandler srh) {
    this.serverRequestHandler = srh;
    connectionIsOpen = false;
    exceptionToThrowStack = new Stack<Exception>();
    countOfCallsToOpen = 0;
  }

  @Override
  public void openConnection() throws IOException {
    connectionIsOpen = true; countOfCallsToOpen++;
  }

  @Override
  public void closeConnection() throws IOException {
    connectionIsOpen = false;
  }

  public void pushExceptionToBeThrownAtNextSend(
      Exception theExceptionToThrow) {
    exceptionToThrowStack.push(theExceptionToThrow);
  }

  @Override
  public void send(byte[] bytes, String topic) throws IOException {
    if ( ! connectionIsOpen ) {
      throw new RuntimeException("Connection has not been opened / in VM connector");
    }

    if ( ! exceptionToThrowStack.isEmpty() ) {
      Exception nextToThrow = exceptionToThrowStack.pop();
      if ( nextToThrow instanceof RuntimeException ) {
        RuntimeException cache1 = (RuntimeException) nextToThrow;
        throw cache1;
      } else if ( nextToThrow instanceof IOException ) {
        IOException cache2 = (IOException)nextToThrow;
        throw cache2;
      }
    }
    serverRequestHandler.receive(bytes);
  }

  public int getCountOfCallsToOpen() {
    return countOfCallsToOpen;
  }

  @Override
  public boolean isOpen() {
    return connectionIsOpen;
  }
}


text:
package org.jivesoftware.openfire.plugin;

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

import javax.ws.rs.core.Response;

import org.jivesoftware.openfire.SharedGroupException;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.entity.RosterEntities;
import org.jivesoftware.openfire.entity.RosterItemEntity;
import org.jivesoftware.openfire.entity.UserEntities;
import org.jivesoftware.openfire.entity.UserEntity;
import org.jivesoftware.openfire.entity.UserGroupsEntity;
import org.jivesoftware.openfire.entity.UserProperty;
import org.jivesoftware.openfire.exceptions.ExceptionType;
import org.jivesoftware.openfire.exceptions.ServiceException;
import org.jivesoftware.openfire.group.Group;
import org.jivesoftware.openfire.group.GroupAlreadyExistsException;
import org.jivesoftware.openfire.group.GroupManager;
import org.jivesoftware.openfire.group.GroupNotFoundException;
import org.jivesoftware.openfire.lockout.LockOutManager;
import org.jivesoftware.openfire.roster.Roster;
import org.jivesoftware.openfire.roster.RosterItem;
import org.jivesoftware.openfire.roster.RosterManager;
import org.jivesoftware.openfire.user.User;
import org.jivesoftware.openfire.user.UserAlreadyExistsException;
import org.jivesoftware.openfire.user.UserManager;
import org.jivesoftware.openfire.user.UserNotFoundException;
import org.jivesoftware.openfire.utils.UserUtils;
import org.xmpp.packet.JID;

/**
 * The Class UserServicePluginNG.
 */
public class UserServicePluginNG {
    /** The Constant INSTANCE. */
    public static final UserServicePluginNG INSTANCE = new UserServicePluginNG();

    /** The user manager. */
    private UserManager userManager;

    /** The roster manager. */
    private RosterManager rosterManager;

    /** The server. */
    private XMPPServer server;

    /**
     * Gets the single instance of UserServicePluginNG.
     *
     * @return single instance of UserServicePluginNG
     */
    public static UserServicePluginNG getInstance() {
        return INSTANCE;
    }

    /**
     * Instantiates a new user service plugin ng.
     */
    private UserServicePluginNG() {
        server = XMPPServer.getInstance();
        userManager = server.getUserManager();
        rosterManager = server.getRosterManager();
    }

    /**
     * Creates the user.
     *
     * @param userEntity
     *            the user entity
     * @throws ServiceException
     *             the service exception
     */
    public void createUser(UserEntity userEntity) throws ServiceException {
        if (userEntity != null && !userEntity.getUsername().isEmpty()) {
            if (userEntity.getPassword() == null) {
                throw new ServiceException("Could not create new user, because password is null",
                        userEntity.getUsername(), "PasswordIsNull", Response.Status.BAD_REQUEST);
            }
            try {
                userManager.createUser(userEntity.getUsername(), userEntity.getPassword(), userEntity.getName(),
                        userEntity.getEmail());
            } catch (UserAlreadyExistsException e) {
                throw new ServiceException("Could not create new user", userEntity.getUsername(),
                        ExceptionType.USER_ALREADY_EXISTS_EXCEPTION, Response.Status.BAD_REQUEST);
            }
            addProperties(userEntity);
        }
    }

    /**
     * Update user.
     *
     * @param username
     *            the username
     * @param userEntity
     *            the user entity
     * @throws ServiceException
     *             the service exception
     */
    public void updateUser(String username, UserEntity userEntity) throws ServiceException {
        if (userEntity != null && !username.isEmpty()) {
            User user = getAndCheckUser(username);
            if (userEntity.getPassword() != null) {
                user.setPassword(userEntity.getPassword());
            }
            if (userEntity.getName() != null) {
                user.setName(userEntity.getName());
            }
            if (userEntity.getEmail() != null) {
                user.setEmail(userEntity.getEmail());
            }

            addProperties(userEntity);
        }
    }

    /**
     * Delete user.
     *
     * @param username
     *            the username
     * @throws ServiceException
     *             the service exception
     */
    public void deleteUser(String username) throws ServiceException {
        User user = getAndCheckUser(username);
        userManager.deleteUser(user);

        rosterManager.deleteRoster(server.createJID(username, null));
    }

    /**
     * Gets the user entities.
     *
     * @param userSearch
     *            the user search
     * @return the user entities
     */
    public UserEntities getUserEntities(String userSearch) {
        UserEntities userEntities = new UserEntities();
        userEntities.setUsers(UserUtils.convertUsersToUserEntities(userManager.getUsers(), userSearch));
        return userEntities;
    }

    /**
     * Gets the user entity.
     *
     * @param username
     *            the username
     * @return the user entity
     * @throws ServiceException
     *             the service exception
     */
    public UserEntity getUserEntity(String username) throws ServiceException {
        return UserUtils.convertUserToUserEntity(getAndCheckUser(username));
    }

    /**
     * Enable user.
     *
     * @param username
     *            the username
     * @throws ServiceException
     *             the service exception
     */
    public void enableUser(String username) throws ServiceException {
        getAndCheckUser(username);
        LockOutManager.getInstance().enableAccount(username);
    }

    /**
     * Disable user.
     *
     * @param username
     *            the username
     * @throws ServiceException
     *             the service exception
     */
    public void disableUser(String username) throws ServiceException {
        getAndCheckUser(username);
        LockOutManager.getInstance().disableAccount(username, null, null);
    }

    /**
     * Gets the roster entities.
     *
     * @param username
     *            the username
     * @return the roster entities
     * @throws ServiceException
     *             the service exception
     */
    public RosterEntities getRosterEntities(String username) throws ServiceException {
        Roster roster = getUserRoster(username);

        List<RosterItemEntity> rosterEntities = new ArrayList<RosterItemEntity>();
        for (RosterItem rosterItem : roster.getRosterItems()) {
            RosterItemEntity rosterItemEntity = new RosterItemEntity(rosterItem.getJid().toBareJID(),
                    rosterItem.getNickname(), rosterItem.getSubStatus().getValue());
            rosterItemEntity.setGroups(rosterItem.getGroups());

            rosterEntities.add(rosterItemEntity);
        }

        return new RosterEntities(rosterEntities);
    }

    /**
     * Adds the roster item.
     *
     * @param username
     *            the username
     * @param rosterItemEntity
     *            the roster item entity
     * @throws ServiceException
     *             the service exception
     * @throws UserAlreadyExistsException
     *             the user already exists exception
     * @throws SharedGroupException
     *             the shared group exception
     * @throws UserNotFoundException
     *             the user not found exception
     */
    public void addRosterItem(String username, RosterItemEntity rosterItemEntity) throws ServiceException,
            UserAlreadyExistsException, SharedGroupException, UserNotFoundException {
        Roster roster = getUserRoster(username);
        if (rosterItemEntity.getJid() == null) {
            throw new ServiceException("JID is null", "JID", "IllegalArgumentException", Response.Status.BAD_REQUEST);
        }
        JID jid = new JID(rosterItemEntity.getJid());

        try {
            roster.getRosterItem(jid);
            throw new UserAlreadyExistsException(jid.toBareJID());
        } catch (UserNotFoundException e) {
            // Roster item does not exist. Try to add it.
        }

        if (roster != null) {
            RosterItem rosterItem = roster.createRosterItem(jid, rosterItemEntity.getNickname(),
                    rosterItemEntity.getGroups(), false, true);
            UserUtils.checkSubType(rosterItemEntity.getSubscriptionType());
            rosterItem.setSubStatus(RosterItem.SubType.getTypeFromInt(rosterItemEntity.getSubscriptionType()));
            roster.updateRosterItem(rosterItem);
        }
    }

    /**
     * Update roster item.
     *
     * @param username
     *            the username
     * @param rosterJid
     *            the roster jid
     * @param rosterItemEntity
     *            the roster item entity
     * @throws ServiceException
     *             the service exception
     * @throws UserNotFoundException
     *             the user not found exception
     * @throws UserAlreadyExistsException
     *             the user already exists exception
     * @throws SharedGroupException
     *             the shared group exception
     */
    public void updateRosterItem(String username, String rosterJid, RosterItemEntity rosterItemEntity)
            throws ServiceException, UserNotFoundException, UserAlreadyExistsException, SharedGroupException {
        getAndCheckUser(username);

        Roster roster = getUserRoster(username);
        JID jid = new JID(rosterJid);
        RosterItem rosterItem = roster.getRosterItem(jid);

        if (rosterItemEntity.getNickname() != null) {
            rosterItem.setNickname(rosterItemEntity.getNickname());
        }
        if (rosterItemEntity.getGroups() != null) {
            rosterItem.setGroups(rosterItemEntity.getGroups());
        }
        UserUtils.checkSubType(rosterItemEntity.getSubscriptionType());

        rosterItem.setSubStatus(RosterItem.SubType.getTypeFromInt(rosterItemEntity.getSubscriptionType()));
        roster.updateRosterItem(rosterItem);
    }

    /**
     * Delete roster item.
     *
     * @param username
     *            the username
     * @param rosterJid
     *            the roster jid
     * @throws SharedGroupException
     *             the shared group exception
     * @throws ServiceException
     *             the service exception
     */
    public void deleteRosterItem(String username, String rosterJid) throws SharedGroupException, ServiceException {
        getAndCheckUser(username);
        Roster roster = getUserRoster(username);
        JID jid = new JID(rosterJid);

        if (roster.deleteRosterItem(jid, true) == null) {
            throw new ServiceException("Roster Item could not deleted", jid.toBareJID(), "RosterItemNotFound",
                    Response.Status.NOT_FOUND);
        }
    }

    /**
     * Gets the user groups.
     *
     * @param username
     *            the username
     * @return the user groups
     * @throws ServiceException
     *             the service exception
     */
    public List<String> getUserGroups(String username) throws ServiceException {
        User user = getAndCheckUser(username);
        Collection<Group> groups = GroupManager.getInstance().getGroups(user);
        List<String> groupNames = new ArrayList<String>();
        for (Group group : groups) {
            groupNames.add(group.getName());
        }

        return groupNames;
    }

    /**
     * Adds the user to group.
     *
     * @param username
     *            the username
     * @param userGroupsEntity
     *            the user groups entity
     * @throws ServiceException
     * @throws GroupAlreadyExistsException
     *             the group already exists exception
     */
    public void addUserToGroups(String username, UserGroupsEntity userGroupsEntity) throws ServiceException {
        if (userGroupsEntity != null) {
            Collection<Group> groups = new ArrayList<Group>();

            for (String groupName : userGroupsEntity.getGroupNames()) {
                Group group = null;
                try {
                    group = GroupManager.getInstance().getGroup(groupName);
                } catch (GroupNotFoundException e) {
                    // Create this group
                    group = createGroup(groupName);
                }
                groups.add(group);
            }
            for (Group group : groups) {
                group.getMembers().add(server.createJID(username, null));
            }
        }
    }

    /**
     * Delete user from groups.
     *
     * @param username
     *            the username
     * @param userGroupsEntity
     *            the user groups entity
     * @throws ServiceException
     *             the service exception
     */
    public void deleteUserFromGroups(String username, UserGroupsEntity userGroupsEntity) throws ServiceException {
        if (userGroupsEntity != null) {
            for (String groupName : userGroupsEntity.getGroupNames()) {
                Group group = null;
                try {
                    group = GroupManager.getInstance().getGroup(groupName);
                } catch (GroupNotFoundException e) {
                    throw new ServiceException("Could not find group", groupName, ExceptionType.GROUP_NOT_FOUND,
                            Response.Status.NOT_FOUND, e);
                }
                group.getMembers().remove(server.createJID(username, null));
            }
        }
    }

    /**
     * Gets the user entities by property key and or value.
     *
     * @param propertyKey
     *            the property key
     * @param propertyValue
     *            the property value (can be null)
     * @return the user entities by property
     * @throws ServiceException
     *             the service exception
     */
    public UserEntities getUserEntitiesByProperty(String propertyKey, String propertyValue) throws ServiceException {
        List<String> usernames = PropertyDAO.getUsernameByProperty(propertyKey, propertyValue);
        List<UserEntity> users = new ArrayList<UserEntity>();
        UserEntities userEntities = new UserEntities();

        for (String username : usernames) {
            users.add(getUserEntity(username));
        }

        userEntities.setUsers(users);
        return userEntities;
    }

    /**
     * Adds the properties.
     *
     * @param userEntity
     *            the user entity
     * @throws ServiceException
     *             the service exception
     */
    private void addProperties(UserEntity userEntity) throws ServiceException {
        User user = getAndCheckUser(userEntity.getUsername());
        user.getProperties().clear();
        if (userEntity.getProperties() != null) {
            for (UserProperty property : userEntity.getProperties()) {
                user.getProperties().put(property.getKey(), property.getValue());
            }
        }
    }

    /**
     * Creates the group.
     *
     * @param groupName
     *            the group name
     * @return the group
     * @throws ServiceException
     * @throws GroupAlreadyExistsException
     *             the group already exists exception
     */
    private Group createGroup(String groupName) throws ServiceException {
        Group group = null;
        try {
            group = GroupManager.getInstance().createGroup(groupName);
            group.getProperties().put("sharedRoster.showInRoster", "onlyGroup");
            group.getProperties().put("sharedRoster.displayName", groupName);
            group.getProperties().put("sharedRoster.groupList", "");
        } catch (GroupAlreadyExistsException e) {
            throw new ServiceException("Could not create group", groupName, ExceptionType.GROUP_ALREADY_EXISTS,
                    Response.Status.BAD_REQUEST, e);
        }
        return group;
    }

    /**
     * Gets the and check user.
     *
     * @param username
     *            the username
     * @return the and check user
     * @throws ServiceException
     *             the service exception
     */
    private User getAndCheckUser(String username) throws ServiceException {
        JID targetJID = server.createJID(username, null);
        if (targetJID.getNode() == null) {
            throw new ServiceException("Could not get user", username, ExceptionType.USER_NOT_FOUND_EXCEPTION,
                    Response.Status.NOT_FOUND);
        }

        try {
            return userManager.getUser(targetJID.getNode());
        } catch (UserNotFoundException e) {
            throw new ServiceException("Could not get user", username, ExceptionType.USER_NOT_FOUND_EXCEPTION,
                    Response.Status.NOT_FOUND, e);
        }
    }

    /**
     * Gets the user roster.
     *
     * @param username
     *            the username
     * @return the user roster
     * @throws ServiceException
     *             the service exception
     */
    private Roster getUserRoster(String username) throws ServiceException {
        try {
            return rosterManager.getRoster(username);
        } catch (UserNotFoundException e) {
            throw new ServiceException("Could not get user roster", username, ExceptionType.USER_NOT_FOUND_EXCEPTION,
                    Response.Status.NOT_FOUND, e);
        }
    }
}


text:
#pragma once

#include "raster/net/Service.h"
#include "raster/protocol/binary/Processor.h"

namespace rdd {

template <class P>
class BinaryAsyncServer : public Service {
 public:
  BinaryAsyncServer(acc::StringPiece name) : Service(name) {}
  ~BinaryAsyncServer() override {}

  void makeChannel(int port, const TimeoutOption& timeout) override {
    Peer peer;
    peer.setFromLocalPort(port);
    channel_ = std::make_shared<Channel>(
        peer,
        timeout,
        acc::make_unique<BinaryTransportFactory>(),
        acc::make_unique<BinaryProcessorFactory<P>>());
  }
};

} // namespace rdd


text:
class Cell
  include ActiveModel::Model

  VALID_INPUT_RANGE = (1..9)

  attr_accessor :value, :locked

  delegate :to_s, to: :value

  validates :value,
    allow_nil: true,
    numericality: { only_integer: true },
    inclusion: { in: VALID_INPUT_RANGE }

  validates :locked,
    inclusion: { in: [true, false] }

  def partial_answer?
    value.nil?
  end
end


text:
<?php

namespace Ekyna\Bundle\CmsBundle\Helper;

use Ekyna\Bundle\CmsBundle\Model\PageInterface;
use Ekyna\Bundle\CmsBundle\Repository\PageRepository;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfony\Component\HttpFoundation\Request;

/**
 * Class PageHelper
 * @package Ekyna\Bundle\CmsBundle\Helper
 * @author  Étienne Dauvergne <contact@ekyna.com>
 */
class PageHelper
{
    const PAGES_ROUTES_CACHE_KEY = 'cms_pages_routes';

    /**
     * @var PageRepository
     */
    protected $repository;

    /**
     * @var AdapterInterface
     */
    protected $cache;

    /**
     * @var string
     */
    private $homeRoute;

    /**
     * @var array
     */
    private $routes;

    /**
     * @var Request
     */
    private $request;

    /**
     * @var PageInterface
     */
    private $currentPage = false;

    /**
     * @var PageInterface
     */
    private $homePage = false;

    /**
     * Constructor.
     *
     * @param PageRepository   $repository
     * @param AdapterInterface $cache
     * @param string           $homeRoute
     */
    public function __construct(PageRepository $repository, AdapterInterface $cache, string $homeRoute)
    {
        $this->repository = $repository;
        $this->cache      = $cache;
        $this->homeRoute  = $homeRoute;
    }

    /**
     * Initializes the helper.
     *
     * @param Request $request
     *
     * @return PageInterface|null
     */
    public function init(Request $request): ?PageInterface
    {
        $this->request = $request;

        return $this->getCurrent();
    }

    /**
     * Finds the page by route.
     *
     * @param Request $request
     *
     * @return PageInterface|null
     */
    public function findByRequest(Request $request): ?PageInterface
    {
        if (null !== $route = $request->attributes->get('_route', null)) {
            return $this->findByRoute($route);
        }

        return null;
    }

    /**
     * Finds the page by route.
     *
     * @param string $route
     *
     * @return PageInterface|null
     */
    public function findByRoute(string $route): ?PageInterface
    {
        if (!in_array($route, $this->getCmsRoutes(), true)) {
            return null;
        }

        return $this->repository->findOneByRoute($route, true);
    }

    /**
     * Returns the current page.
     *
     * @return PageInterface|null
     */
    public function getCurrent(): ?PageInterface
    {
        if (false === $this->currentPage) {
            if (null === $this->request) {
                throw new \RuntimeException('The page helper must be initialized first.');
            }
            $this->currentPage = $this->findByRequest($this->request);
        }

        return $this->currentPage;
    }

    /**
     * Returns the home page.
     *
     * @return PageInterface|null
     */
    public function getHomePage(): ?PageInterface
    {
        if (false === $this->homePage) {
            $this->homePage = $this->findByRoute($this->homeRoute);
        }

        return $this->homePage;
    }

    /**
     * Returns the request.
     *
     * @return Request
     */
    public function getRequest(): Request
    {
        return $this->request;
    }

    /**
     * Returns the page repository.
     *
     * @return PageRepository
     */
    public function getPageRepository(): PageRepository
    {
        return $this->repository;
    }

    /**
     * Returns the cms routes list.
     *
     * @return array
     */
    private function getCmsRoutes(): array
    {
        if ($this->routes) {
            return $this->routes;
        }

        $item = $this->cache->getItem(self::PAGES_ROUTES_CACHE_KEY);

        if ($item->isHit()) {
            return $this->routes = $item->get();
        }

        $routes = $this->repository->getPagesRoutes();

        $item->set($routes);
        $this->cache->save($item);

        return $this->routes = $routes;
    }
}


text: Tests that comments in stylesheets are parsed correctly by the DevTools.


text:
<?php

require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_StartupPack extends RODSPacket
{
    public function __construct($user = "", $zone = "", $relVersion = RODS_REL_VERSION,
                                $apiVersion = RODS_API_VERSION, $option = NULL)
    {
        $packlets = array("irodsProt" => 1, "connectCnt" => 0,
            "proxyUser" => $user, "proxyRcatZone" => $zone, "clientUser" => $user,
            "clientRcatZone" => $zone, "relVersion" => $relVersion,
            "apiVersion" => $apiVersion, "option" => $option);
        parent::__construct("StartupPack_PI", $packlets);
    }

}


text:
package org.apache.camel.builder.component.dsl;

import javax.annotation.Generated;
import org.apache.camel.Component;
import org.apache.camel.builder.component.AbstractComponentBuilder;
import org.apache.camel.builder.component.ComponentBuilder;
import org.apache.camel.component.xslt.XsltComponent;

/**
 * Transforms XML payload using an XSLT template.
 *
 * Generated by camel-package-maven-plugin - do not edit this file!
 */
@Generated("org.apache.camel.maven.packaging.ComponentDslMojo")
public interface XsltComponentBuilderFactory {

    /**
     * XSLT (camel-xslt)
     * Transforms XML payload using an XSLT template.
     *
     * Category: core,transformation
     * Since: 1.3
     * Maven coordinates: org.apache.camel:camel-xslt
     */
    static XsltComponentBuilder xslt() {
        return new XsltComponentBuilderImpl();
    }

    /**
     * Builder for the XSLT component.
     */
    interface XsltComponentBuilder extends ComponentBuilder<XsltComponent> {
        /**
         * Cache for the resource content (the stylesheet file) when it is
         * loaded. If set to false Camel will reload the stylesheet file on each
         * message processing. This is good for development. A cached stylesheet
         * can be forced to reload at runtime via JMX using the
         * clearCachedStylesheet operation.
         *
         * The option is a: boolean type.
         *
         * Default: true
         * Group: producer
         */
        default XsltComponentBuilder contentCache(boolean contentCache) {
            doSetProperty("contentCache", contentCache);
            return this;
        }
        /**
         * Whether the producer should be started lazy (on the first message).
         * By starting lazy you can use this to allow CamelContext and routes to
         * startup in situations where a producer may otherwise fail during
         * starting and cause the route to fail being started. By deferring this
         * startup to be lazy then the startup failure can be handled during
         * routing messages via Camel's routing error handlers. Beware that when
         * the first message is processed then creating and starting the
         * producer may take a little time and prolong the total processing time
         * of the processing.
         *
         * The option is a: boolean type.
         *
         * Default: false
         * Group: producer
         */
        default XsltComponentBuilder lazyStartProducer(boolean lazyStartProducer) {
            doSetProperty("lazyStartProducer", lazyStartProducer);
            return this;
        }
        /**
         * Whether the component should use basic property binding (Camel 2.x)
         * or the newer property binding with additional capabilities.
         *
         * The option is a: boolean type.
         *
         * Default: false
         * Group: advanced
         */
        default XsltComponentBuilder basicPropertyBinding(
                boolean basicPropertyBinding) {
            doSetProperty("basicPropertyBinding", basicPropertyBinding);
            return this;
        }
        /**
         * To use a custom XSLT transformer factory, specified as a FQN class
         * name.
         *
         * The option is a: java.lang.String type.
         *
         * Group: advanced
         */
        default XsltComponentBuilder transformerFactoryClass(
                java.lang.String transformerFactoryClass) {
            doSetProperty("transformerFactoryClass", transformerFactoryClass);
            return this;
        }
        /**
         * A configuration strategy to apply on freshly created instances of
         * TransformerFactory.
         *
         * The option is a:
         * org.apache.camel.component.xslt.TransformerFactoryConfigurationStrategy type.
         *
         * Group: advanced
         */
        default XsltComponentBuilder transformerFactoryConfigurationStrategy(
                org.apache.camel.component.xslt.TransformerFactoryConfigurationStrategy transformerFactoryConfigurationStrategy) {
            doSetProperty("transformerFactoryConfigurationStrategy", transformerFactoryConfigurationStrategy);
            return this;
        }
        /**
         * To use a custom UriResolver. Should not be used together with the
         * option 'uriResolverFactory'.
         *
         * The option is a: javax.xml.transform.URIResolver type.
         *
         * Group: advanced
         */
        default XsltComponentBuilder uriResolver(
                javax.xml.transform.URIResolver uriResolver) {
            doSetProperty("uriResolver", uriResolver);
            return this;
        }
        /**
         * To use a custom UriResolver which depends on a dynamic endpoint
         * resource URI. Should not be used together with the option
         * 'uriResolver'.
         *
         * The option is a:
         * org.apache.camel.component.xslt.XsltUriResolverFactory
         * type.
         *
         * Group: advanced
         */
        default XsltComponentBuilder uriResolverFactory(
                org.apache.camel.component.xslt.XsltUriResolverFactory uriResolverFactory) {
            doSetProperty("uriResolverFactory", uriResolverFactory);
            return this;
        }
    }

    class XsltComponentBuilderImpl
            extends
                AbstractComponentBuilder<XsltComponent>
            implements
                XsltComponentBuilder {
        @Override
        protected XsltComponent buildConcreteComponent() {
            return new XsltComponent();
        }
        @Override
        protected boolean setPropertyOnComponent(
                Component component,
                String name,
                Object value) {
            switch (name) {
            case "contentCache": ((XsltComponent) component).setContentCache((boolean) value); return true;
            case "lazyStartProducer": ((XsltComponent) component).setLazyStartProducer((boolean) value); return true;
            case "basicPropertyBinding": ((XsltComponent) component).setBasicPropertyBinding((boolean) value); return true;
            case "transformerFactoryClass": ((XsltComponent) component).setTransformerFactoryClass((java.lang.String) value); return true;
            case "transformerFactoryConfigurationStrategy": ((XsltComponent) component).setTransformerFactoryConfigurationStrategy((org.apache.camel.component.xslt.TransformerFactoryConfigurationStrategy) value); return true;
            case "uriResolver": ((XsltComponent) component).setUriResolver((javax.xml.transform.URIResolver) value); return true;
            case "uriResolverFactory": ((XsltComponent) component).setUriResolverFactory((org.apache.camel.component.xslt.XsltUriResolverFactory) value); return true;
            default: return false;
            }
        }
    }
}


text:
{% load staticfiles i18n humanize bootstrap3 menu gravatar %}{% generate_menu %}<!DOCTYPE html>

    <meta charset="utf-8">
    <title>{% block head_title %}Accesso{% endblock %}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="{% block head_description %}Authentication provider for openpolis network{% endblock %}">
    <meta name="author" content="{% block page_author %}joke2k{% endblock %}">

    {% block css %}

    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">

    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap-theme.min.css">

    <link rel="stylesheet" href="//cdn.jsdelivr.net/fontawesome/latest/css/font-awesome.css"/>

    <link href="{% static 'css/bootstrap-social.css' %}" rel="stylesheet">
    <link href="{% static 'css/project.css' %}" rel="stylesheet">
    {% endblock css %}

    <link rel="icon" href="{% static 'images/favicon.ico' %}" />

    {% block extra_head %}{% endblock %}

{% block body %}

{#
#}
{#
#}
{#        {{ project_title }}#}
{#
#}
{#            {% if request.user.is_authenticated %}#}
{#
{% trans "Emails" %}
#}
{#
{% trans "Connections" %}
#}
{#
{% trans "Password" %}
#}
{#
{% trans "Logout" %}
#}
{#            {% else %}#}
{#
{% trans "Sign Up" %}
#}
{#
{% trans "Log In" %}
#}
{#            {% endif %}#}
{#
#}
{#
#}
{#
#}

{{ site.name }}

{% block container %}

    {% if request.user.is_authenticated %}

{{ request.user }}

                    {{ request.user.last_login|naturaltime }}

            {% for item in menus.user_menu %}
            {% if item.separator %}

{% endif %}

                {% if item.icon %} {% endif %}{{ item.title }}

            {% endfor %}

    {% endif %}

    {% bootstrap_messages %}

    {% block content %}

Use this document as a way to quick start any new project.

    {% endblock content %}

{% endblock container %}

{% block modal %}{% endblock modal %}

{% block javascript %}

{% endblock javascript %}
{% endblock %}{# end block body #}
{% block extra_body %}
{% endblock %}


text:
using DataStructures.LDS.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace DataStructuresTests.LSD.Common
{
    [TestClass]
    public class dllQueueTests
    {

        [TestMethod]
        [ExpectedException(typeof(InvalidOperationException))]
        public void EmptyQueue_Dequeue_ThrowsException()
        {
            dllQueue<int> queue = new dllQueue<int>();
            queue.Dequeue();
        }

        [TestMethod]
        public void EmptyQueue_IsEmpty_RetursTrue()
        {
            dllQueue<int> queue = new dllQueue<int>();
            bool isEmptyResult = queue.IsEmpty();

            Assert.IsTrue(isEmptyResult);
        }

        [TestMethod]
        public void EnqueueOneElement_IsEmpty_RetursFalse()
        {
            dllQueue<int> queue = new dllQueue<int>();
            int valueToEnqueue = -1;

            queue.Enqueue(valueToEnqueue);
            bool isEmptyResult = queue.IsEmpty();

            Assert.IsFalse(isEmptyResult);
        }

        [TestMethod]
        public void EnqueueOneElement_DequeueOnce_IsEmpty_ReturnsTrue()
        {
            dllQueue<int> queue = new dllQueue<int>();
            int element = -1;
            queue.Enqueue(element);
            queue.Dequeue();
            bool isEmptyResult = queue.IsEmpty();

            Assert.IsTrue(isEmptyResult);
        }

        [TestMethod]
        public void EnqueueTwoElements_DequeueOnce_IsEmpty_ReturnsFalse()
        {
            dllQueue<int> queue = new dllQueue<int>();
            int firstElement = 1;
            int secElement = 2;

            queue.Enqueue(firstElement);
            queue.Enqueue(secElement);
            queue.Dequeue();

            bool isEmptyRes = queue.IsEmpty();

            Assert.IsFalse(isEmptyRes);
        }

        [TestMethod]
        public void EnqueueOneElement_Dequeue_BothElementsAreEqual()
        {
            dllQueue<int> queue = new dllQueue<int>();
            int element = -1;
            queue.Enqueue(element);
            int dequeueResult = queue.Dequeue();

            Assert.AreEqual(element, dequeueResult);
        }

        [TestMethod]
        public void EnqueueTwoElement_Dequeue_ReturnsFirstElement()
        {
            dllQueue<int> queue = new dllQueue<int>();
            int firstElement = 1;
            int secElement = 2;

            queue.Enqueue(firstElement);
            queue.Enqueue(secElement);
            int dequeueElement = queue.Dequeue();

            Assert.AreEqual(firstElement, dequeueElement);
        }

        [TestMethod]
        public void Enqueue100Elements_DequeueOnec_ReturnFirstElement()
        {
            int size = 100;
            int[] elements = new int[size];
            dllQueue<int> queue = new dllQueue<int>();

            for (int i = 0; i < size; i++)
            {
                elements[i] = i;
                queue.Enqueue(elements[i]);
            }

            int dequeueElement = queue.Dequeue();
            Assert.AreEqual(elements[0], dequeueElement);

        }

        [TestMethod]
        public void Enqueue100Elements_DequeueAllElements_AllElementsAreEqual()
        {
            int size = 100;
            int[] elements = new int[size];
            dllQueue<int> queue = new dllQueue<int>();

            for (int i = 0; i < size; i++)
            {
                elements[i] = i;
                queue.Enqueue(elements[i]);
            }

            int[] dequeueArray = new int[size];
            for (int i = 0; i < size; i++)
            {
                dequeueArray[i] = queue.Dequeue();
            }

            CollectionAssert.AreEqual(elements, dequeueArray);
        }

    }
}


text:
package main

import (
	"encoding/json"
	"fmt"
	"os"
	"strings"

	log "github.com/Sirupsen/logrus"
	"github.com/codegangsta/cli"
	netatmo "github.com/dhogborg/netatmo-api-go"
)

// DeviceCollection contains filterd device collection
type DeviceCollection struct {
	NetatmoStations []*netatmo.Device
	Modules         []*netatmo.Device
}

func (d *DeviceCollection) Stations() []*netatmo.Device { return d.NetatmoStations }

func main() {
	app := cli.NewApp()
	app.Name = "atnetgo"
	app.Usage = "Read values from the Netatmo API and write to stdout"
	app.Version = "0.0.4"
	app.Author = "github.com/dhogborg"
	app.Email = "d@hogborg.se"

	app.Action = func(c *cli.Context) {
		d := getDevices(c)
		listPrint(d)
	}

	app.Commands = []cli.Command{
		cli.Command{
			Name:  "pretty",
			Usage: "Pretty print the stations and the modules attached",
			Action: func(c *cli.Context) {
				d := getDevices(c)
				prettyPrint(d)
			},
		},
		cli.Command{
			Name:  "list",
			Usage: "List the modules and the values in a greppable list",
			Action: func(c *cli.Context) {
				d := getDevices(c)
				listPrint(d)
			},
		},
		cli.Command{
			Name:  "json",
			Usage: "Output a machine readable json string",
			Action: func(c *cli.Context) {
				d := getDevices(c)
				jsonPrint(d)
			},
		},
		cli.Command{
			Name:  "influx",
			Usage: "Output InfluxDB line format",
			Action: func(c *cli.Context) {
				d := getDevices(c)
				linePrint(d)
			},
		},
	}

	app.Flags = []cli.Flag{
		cli.StringFlag{
			Name:   "user,u",
			Usage:  "Netatmo login name",
			EnvVar: "NETATMO_USER",
		},
		cli.StringFlag{
			Name:   "password,p",
			Usage:  "Netatmo password",
			EnvVar: "NETATMO_PASSWORD",
		},
		cli.StringFlag{
			Name:   "station,s",
			Usage:  "A station filter, default to none (print everything)",
			EnvVar: "NETATMO_STATION",
		},
	}

	app.Run(os.Args)
}

func getDevices(ctx *cli.Context) *DeviceCollection {

	config := netatmo.Config{
		ClientID:     NetatmoAppID,
		ClientSecret: NetatmoAppSecret,
		Username:     ctx.GlobalString("user"),
		Password:     ctx.GlobalString("password"),
	}

	n, err := netatmo.NewClient(config)
	if err != nil {
		log.WithFields(log.Fields{
			"error": err.Error(),
		}).Error("client error")
		os.Exit(1)
	}

	dc, err := n.Read()
	if err != nil {
		log.WithFields(log.Fields{
			"error": err.Error(),
		}).Error("unable to fetch device collection")
		os.Exit(1)
	}

	collection := filterDevices(ctx, dc)

	return collection

}

func filterDevices(ctx *cli.Context, dc *netatmo.DeviceCollection) *DeviceCollection {
	collection := &DeviceCollection{
		NetatmoStations: dc.Stations(),
	}

	if sfilter := ctx.GlobalString("station"); sfilter != "" {
		stations := []*netatmo.Device{}
		for _, station := range collection.Stations() {
			if matchesFilter(station, sfilter) {
				stations = append(stations, station)
			}
		}
		collection.NetatmoStations = stations
	}

	return collection
}

func matchesFilter(device *netatmo.Device, filter string) bool {
	return strings.Index(device.StationName, filter) > -1
}

func listPrint(devices *DeviceCollection) {
	for _, station := range devices.Stations() {
		for _, module := range station.Modules() {
			_, data := module.Data()
			for dataType, value := range data {
				fmt.Printf("%s: %s: %s: %s\n", station.StationName, module.ModuleName, dataType, valueString(value))
			}
		}
	}
}

func jsonPrint(devices *DeviceCollection) {

	block := map[string]interface{}{}

	for _, station := range devices.Stations() {
		sblock := map[string]interface{}{}
		for _, module := range station.Modules() {
			mblock := map[string]string{}
			_, data := module.Data()
			for dataType, value := range data {
				mblock[dataType] = valueString(value)
			}
			sblock[module.ModuleName] = mblock
		}
		block[station.StationName] = sblock
	}

	b, err := json.Marshal(block)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(b))
}

func prettyPrint(devices *DeviceCollection) {
	for _, station := range devices.Stations() {
		fmt.Printf("Station: %s\n", station.StationName)
		for _, module := range station.Modules() {
			fmt.Printf("\t%s:\n", module.ModuleName)
			_, data := module.Data()
			for dataType, value := range data {
				fmt.Printf("\t\t%s: %s\n", dataType, valueString(value))
			}
		}
	}
}

func linePrint(devices *DeviceCollection) {

	// some values should be represented as integers
	typeSuffix := func(t string) string {
		typemap := map[string]string{
			"co2":      "i",
			"humidity": "i",
			"noise":    "i",
		}
		if s, ok := typemap[strings.ToLower(t)]; ok {
			return s
		}
		return ""
	}

	tags := make([]string, 2)

	for _, station := range devices.Stations() {
		tags[0] = "station=" + strings.ToLower(station.StationName)

		for _, module := range station.Modules() {
			tags[1] = "module=" + strings.ToLower(module.ModuleName)

			_, data := module.Data()
			for dataType, value := range data {
				tagstr := strings.Join(tags, ",")
				tagstr = strings.Replace(tagstr, " ", "_", -1)
				fmt.Printf("%s,%s value=%s%s\n", strings.ToLower(dataType), tagstr, valueString(value), typeSuffix(dataType))
			}
		}
	}
}

func valueString(value interface{}) string {
	switch value := value.(type) {
	case float32, float64:
		return fmt.Sprintf("%0.2f", value)
	case string:
		return value
	case int, int32, int64:
		return fmt.Sprintf("%d", value)
	default:
		return "-"
	}
}


text:
ROOT = $(PEGASUS_ROOT)

PEGASUS_ZOS_PROGRAM_OBJECT = yes

DIR = Clients/ipinfo
include $(ROOT)/mak/config.mak

LIBRARIES = \
    pegcliutils \
    pegclient \
    peggetoopt \
    pegcommon

PROGRAM = ipinfo
SOURCES = IPInfoException.cpp \
          IPInfo.cpp \
          IPRoute.cpp \
          BIPTLEp.cpp \
          IPPEp.cpp \

include $(ROOT)/mak/program.mak

tests:

poststarttests:
	$(PROGRAM)


text:
package org.apache.kafka.clients.admin;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.apache.kafka.clients.HostResolver;
import org.apache.kafka.clients.admin.CreateTopicsResult.TopicMetadataAndConfig;
import org.apache.kafka.clients.admin.internals.MetadataOperationContext;
import org.apache.kafka.clients.consumer.OffsetAndMetadata;
import org.apache.kafka.common.KafkaException;
import org.apache.kafka.common.KafkaFuture;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.Uuid;
import org.apache.kafka.common.internals.KafkaFutureImpl;

public class AdminClientTestUtils {

    /**
     * Helper to create a ListPartitionReassignmentsResult instance for a given Throwable.
     * ListPartitionReassignmentsResult's constructor is only accessible from within the
     * admin package.
     */
    public static ListPartitionReassignmentsResult listPartitionReassignmentsResult(Throwable t) {
        KafkaFutureImpl<Map<TopicPartition, PartitionReassignment>> future = new KafkaFutureImpl<>();
        future.completeExceptionally(t);
        return new ListPartitionReassignmentsResult(future);
    }

    /**
     * Helper to create a CreateTopicsResult instance for a given Throwable.
     * CreateTopicsResult's constructor is only accessible from within the
     * admin package.
     */
    public static CreateTopicsResult createTopicsResult(String topic, Throwable t) {
        KafkaFutureImpl<TopicMetadataAndConfig> future = new KafkaFutureImpl<>();
        future.completeExceptionally(t);
        return new CreateTopicsResult(Collections.singletonMap(topic, future));
    }

    /**
     * Helper to create a DeleteTopicsResult instance for a given Throwable.
     * DeleteTopicsResult's constructor is only accessible from within the
     * admin package.
     */
    public static DeleteTopicsResult deleteTopicsResult(String topic, Throwable t) {
        KafkaFutureImpl<Void> future = new KafkaFutureImpl<>();
        future.completeExceptionally(t);
        return DeleteTopicsResult.ofTopicNames(Collections.singletonMap(topic, future));
    }

    /**
     * Helper to create a ListTopicsResult instance for a given topic.
     * ListTopicsResult's constructor is only accessible from within the
     * admin package.
     */
    public static ListTopicsResult listTopicsResult(String topic) {
        KafkaFutureImpl<Map<String, TopicListing>> future = new KafkaFutureImpl<>();
        future.complete(Collections.singletonMap(topic, new TopicListing(topic, Uuid.ZERO_UUID, false)));
        return new ListTopicsResult(future);
    }

    /**
     * Helper to create a CreatePartitionsResult instance for a given Throwable.
     * CreatePartitionsResult's constructor is only accessible from within the
     * admin package.
     */
    public static CreatePartitionsResult createPartitionsResult(String topic, Throwable t) {
        KafkaFutureImpl<Void> future = new KafkaFutureImpl<>();
        future.completeExceptionally(t);
        return new CreatePartitionsResult(Collections.singletonMap(topic, future));
    }

    /**
     * Helper to create a DescribeTopicsResult instance for a given topic.
     * DescribeTopicsResult's constructor is only accessible from within the
     * admin package.
     */
    public static DescribeTopicsResult describeTopicsResult(String topic, TopicDescription description) {
        KafkaFutureImpl<TopicDescription> future = new KafkaFutureImpl<>();
        future.complete(description);
        return DescribeTopicsResult.ofTopicNames(Collections.singletonMap(topic, future));
    }

    public static DescribeTopicsResult describeTopicsResult(Map<String, TopicDescription> topicDescriptions) {
        return DescribeTopicsResult.ofTopicNames(topicDescriptions.entrySet().stream()
                .collect(Collectors.toMap(Map.Entry::getKey, e -> KafkaFuture.completedFuture(e.getValue()))));
    }

    public static ListConsumerGroupOffsetsResult listConsumerGroupOffsetsResult(Map<TopicPartition, OffsetAndMetadata> offsets) {
        return new ListConsumerGroupOffsetsResult(KafkaFuture.completedFuture(offsets));
    }

    public static ListConsumerGroupOffsetsResult listConsumerGroupOffsetsResult(KafkaException exception) {
        final KafkaFutureImpl<Map<TopicPartition, OffsetAndMetadata>> future = new KafkaFutureImpl<>();
        future.completeExceptionally(exception);
        return new ListConsumerGroupOffsetsResult(future);
    }

    /**
     * Used for benchmark. KafkaAdminClient.getListOffsetsCalls is only accessible
     * from within the admin package.
     */
    public static List<KafkaAdminClient.Call> getListOffsetsCalls(KafkaAdminClient adminClient,
                                                                  MetadataOperationContext<ListOffsetsResult.ListOffsetsResultInfo, ListOffsetsOptions> context,
                                                                  Map<TopicPartition, OffsetSpec> topicPartitionOffsets,
                                                                  Map<TopicPartition, KafkaFutureImpl<ListOffsetsResult.ListOffsetsResultInfo>> futures) {
        return adminClient.getListOffsetsCalls(context, topicPartitionOffsets, futures);
    }

    /**
     * Helper to create a KafkaAdminClient with a custom HostResolver accessible to tests outside this package.
     */
    public static Admin create(Map<String, Object> conf, HostResolver hostResolver) {
        return KafkaAdminClient.createInternal(new AdminClientConfig(conf, true), null, hostResolver);
    }
}


text:
title: 'CoG Kits: A Bridge between Commodity Distributed Computing and High-Performance
  Grids'
subtitle: ''
summary: ''
authors:
- Gregor von Laszewski
- Ian Foster
- Jarek Gawor
- Warren Smith
- Steve Tuecke
tags: []
categories: []
date: '2000-06-01'
lastmod: 2021-09-16T16:08:02-04:00
featured: false
draft: false

# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
image:
  caption: ''
  focal_point: ''
  preview_only: false

# Projects (optional).
#   Associate this post with one or more of your projects.
#   Simply enter your project's folder or file name without extension.
#   E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`.
#   Otherwise, set `projects = []`.
projects: []
publishDate: '2021-09-16T20:08:02.930715Z'
publication_types:
- '1'
abstract: ''
publication: '*Proceedings of the ACM 2000 conference on Java Grande*'
url_pdf: https://laszewski.github.io/papers/vonLaszewski-cog-final.pdf
doi: 10.1145/337449.337491
---


text:
namespace arangodb {
namespace options {
class ProgramOptions;
}
namespace application_features {
class ApplicationServer;

class ApplicationFeature {
  friend class ApplicationServer;

 public:
  ApplicationFeature() = delete;
  ApplicationFeature(ApplicationFeature const&) = delete;
  ApplicationFeature& operator=(ApplicationFeature const&) = delete;

  virtual ~ApplicationFeature() = default;

  enum class State {
    UNINITIALIZED,
    INITIALIZED,
    VALIDATED,
    PREPARED,
    STARTED,
    STOPPED,
    UNPREPARED
  };

  // return the ApplicationServer instance
  ApplicationServer& server() const { return _server; }

  // return the feature's name
  std::string_view name() const noexcept { return _name; }

  bool isOptional() const { return _optional; }
  bool isRequired() const { return !_optional; }

  State state() const { return _state; }

  // whether or not the feature is enabled
  bool isEnabled() const { return _enabled; }

  // enable the feature
  void enable() { setEnabled(true); }

  // disable the feature entirely. if disabled, the feature's options will be
  // ignored and no methods apart from `collectOptions` will be called for the
  // feature
  void disable() { setEnabled(false); }

  // disable the feature, and perform no checks if it's optional
  void forceDisable() { _enabled = false; }

  // enable or disable a feature
  void setEnabled(bool value) {
    if (!value && !isOptional()) {
      THROW_ARANGO_EXCEPTION_MESSAGE(
          TRI_ERROR_BAD_PARAMETER,
          std::string{"cannot disable non-optional feature '"}
              .append(name())
              .append("'"));
    }
    _enabled = value;
  }

  // names of features required to be enabled for this feature to be enabled
  std::vector<size_t> const& dependsOn() const { return _requires; }

  // whether the feature starts before another
  template<typename T, typename Server>
  bool doesStartBefore() const {
    static_assert(std::is_base_of_v<ApplicationFeature, T>);
    static_assert(std::is_base_of_v<ApplicationServer, Server>);

    return doesStartBefore(Server::template id<T>());
  }

  // whether the feature starts after another
  template<typename T, typename Server>
  bool doesStartAfter() const {
    return !doesStartBefore<T, Server>();
  }

  // add the feature's options to the global list of options. this method will
  // be called regardless of whether to feature is enabled or disabled
  virtual void collectOptions(std::shared_ptr<options::ProgramOptions>);

  // load options from somewhere. this method will only be called for enabled
  // features
  virtual void loadOptions(std::shared_ptr<options::ProgramOptions>,
                           char const* binaryPath);

  // validate the feature's options. this method will only be called for active
  // features, after the ApplicationServer has determined which features should
  // be turned off globally. in order to abort further processing in case of
  // invalid parameter values, the feature should bail out by calling
  // FATAL_ERROR_EXIT.
  virtual void validateOptions(std::shared_ptr<options::ProgramOptions>);

  // allows process control
  virtual void daemonize();

  // preparation phase for feature in the preparation phase, the features must
  // not start any threads. furthermore, they must not write any files under
  // elevated privileges if they want other features to access them, or if they
  // want to access these files with dropped privileges
  virtual void prepare();

  // start the feature
  virtual void start();

  // notify the feature about a soft shutdown request
  virtual void initiateSoftShutdown();

  // notify the feature about a shutdown request
  virtual void beginShutdown();

  // stop the feature
  virtual void stop();

  // shut down the feature
  virtual void unprepare();

  // return startup dependencies for feature
  auto const& startsAfter() const { return _startsAfter; }

  // return startup dependencies for feature
  auto const& startsBefore() const { return _startsBefore; }

  size_t registration() const { return _registration; }

 protected:
  ApplicationFeature(ApplicationServer& server, size_t registration,
                     std::string_view name);

  template<typename Server, typename Impl>
  ApplicationFeature(Server& server, const Impl&)
      : ApplicationFeature{server, Server::template id<Impl>(), Impl::name()} {}

  void setOptional() { setOptional(true); }

  // make the feature optional (or not)
  void setOptional(bool value) { _optional = value; }

  // note that this feature requires another to be present
  void dependsOn(size_t other) { _requires.emplace_back(other); }

  // register a start dependency upon another feature
  template<typename T, typename Server>
  void startsAfter() {
    startsAfter(Server::template id<T>());
  }

  void startsAfter(size_t type);

  // register a start dependency upon another feature
  template<typename T, typename Server>
  void startsBefore() {
    startsBefore(Server::template id<T>());
  }

  void startsBefore(size_t type);

  // determine all direct and indirect ancestors of a feature
  auto const& ancestors() const {
    TRI_ASSERT(_ancestorsDetermined);
    return _ancestors;
  }

  template<typename T, typename Server>
  void onlyEnabledWith() {
    _onlyEnabledWith.emplace(Server::template id<T>());
  }

  // return the list of other features that this feature depends on
  auto const& onlyEnabledWith() const { return _onlyEnabledWith; }

 private:
  // whether the feature starts before another
  bool doesStartBefore(size_t type) const;

  void addAncestorToAllInPath(
      std::vector<
          std::pair<size_t, std::reference_wrapper<ApplicationFeature>>>& path,
      size_t ancestorType);

  // set a feature's state. this method should be called by the
  // application server only
  void state(State state) { _state = state; }

  // determine all direct and indirect ancestors of a feature
  void determineAncestors(size_t as);

  // pointer to application server
  ApplicationServer& _server;

  // type registration for lookup within the ApplicationServer
  size_t _registration;

  // name of feature
  std::string_view _name;

  // names of other features required to be enabled if this feature
  // is enabled
  std::vector<size_t> _requires;

  // a list of start dependencies for the feature
  containers::FlatHashSet<size_t> _startsAfter;

  // a list of start dependencies for the feature
  containers::FlatHashSet<size_t> _startsBefore;

  // list of direct and indirect ancestors of the feature
  containers::FlatHashSet<size_t> _ancestors;

  // enable this feature only if the following other features are enabled
  containers::FlatHashSet<size_t> _onlyEnabledWith;

  // state of feature
  State _state;

  // whether or not the feature is enabled
  bool _enabled;

  // whether or not the feature is optional
  bool _optional;

  bool _ancestorsDetermined;
};

template<typename ServerT>
class ApplicationFeatureT : public ApplicationFeature {
 public:
  using Server = ServerT;

  Server& server() const noexcept {
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
    auto* p = dynamic_cast<Server*>(&ApplicationFeature::server());
    TRI_ASSERT(p);
    return *p;
#else
    return static_cast<Server&>(ApplicationFeature::server());
#endif
  }

  // register a start dependency upon another feature
  template<typename T>
  void startsAfter() {
    ApplicationFeature::startsAfter<T, Server>();
  }

  // register a start dependency upon another feature
  template<typename T>
  void startsBefore() {
    ApplicationFeature::startsBefore<T, Server>();
  }

  template<typename T>
  void onlyEnabledWith() {
    ApplicationFeature::onlyEnabledWith<T, Server>();
  }

  template<typename T>
  bool doesStartBefore() const {
    return ApplicationFeature::doesStartBefore<T, Server>();
  }

  template<typename T>
  bool doesStartAfter() const {
    return ApplicationFeature::doesStartAfter<T, Server>();
  }

 protected:
  template<typename Impl>
  ApplicationFeatureT(Server& server, const Impl&)
      : ApplicationFeatureT(server, Server::template id<Impl>(), Impl::name()) {
  }

  ApplicationFeatureT(Server& server, size_t registration,
                      std::string_view name)
      : ApplicationFeature{server, registration, name} {}
};

}  // namespace application_features
}  // namespace arangodb


text:
SYNONYM

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

#### Published in
Annls Sci. Nat. , Bot. , sér. 4 12: 295 (1859)

#### Original name
Pannaria praetermissa Nyl.

### Remarks
null


text:
import expect from 'expect';
import recur from './../../lib/utils/recur';

describe('recur function', function () {
  function increment(x) {
    return x + 1;
  }

  const x = 1;

  it('should return the arguments if times is 0 or less', function () {
    let result = recur(increment, x, 0);
    expect(result).toBe(x);

    result = recur(increment, x, -1);
    expect(result).toBe(x);
  });

  it('should call a function recursively X times', function () {
    let times = 1;
    let result = recur(increment, x, times);
    expect(result).toBe(2);

    times = 5;
    result = recur(increment, x, times);
    expect(result).toBe(6);
  });

  it('should throw if times is not a number', function () {
    expect(() => recur(increment, x, null)).toThrow();
  });
});


text:
package scala

import scala.annotation.meta._

@field
final class volatile extends scala.annotation.StaticAnnotation


text:
import sys
import json
import locale
import numpy as np
import matplotlib
import os
import warnings
from sklearn import preprocessing

warnings.simplefilter('ignore', np.RankWarning)

InDir = ""

if (len(sys.argv) > 1):
    InDir = sys.argv[1]
else:
    InDir = "./"

GeneratePlot = True
if (len(sys.argv) > 2):
    if sys.argv[2] == "n":
        GeneratePlot = False
    else:
        GeneratePlot = True

toSave = []

d = ["tract-num","weekday","polynomial","error"]
toSave.append(d)

for file in os.listdir(InDir):
#for i in range(1):
#Debug
    #file = InFile

    if not file.endswith(".csv"):
        continue
    if file.find('061') == -1:
        continue

    print file
    Tract = file.split(".")[0]
    #Tract = file.split(".")[1]

    data = []

    with open(InDir + file) as f:
        headers = f.readline()

        line = f.readline()
        while line != "":
            data.append(str.strip(line).split(","))
            line = f.readline()

    # Need to translate the Y axis - scales go from 00:00 (midnight) to 23:45 in 15 minute increments.
    # Thus there are 24*4 points - label them from 0 to 95
    for i in range(len(data)):
        time = data[i][1].split(":")
        time[0] = locale.atoi(time[0])

        if time[1] == '0':
            time[1] == '00'

        time[1] = locale.atoi(time[1])
        y =  (time[1]/15) + (time[0] * 4)
        data[i].append(y)

        data[i][0] = locale.atoi(data[i][0])
        data[i][2] = locale.atoi(data[i][2])

    #arrays to accept our values
    data_by_days = [[],[],[],[],[],[],[]]

    #Build our x,y where x is our time (encoded) and y is the number of trips during that period for that day.
    for i in range(len(data)):
        data_by_days[data[i][0]].append([data[i][3],data[i][2]])

    polynomials = []

    #sort the array

    labels = {0: "Monday",
    1: "Tuesday",
    2: "Wednesday",
    3: "Thursday",
    4: "Friday",
    5: "Saturday",
    6: "Sunday"}

    import matplotlib.pyplot as plt

    for i in range(len(data_by_days)):
    #for i in range(1):
        data_by_days[i] = sorted(data_by_days[i], key=lambda x: x[0])
        if len(data_by_days[i]) < 30:
            #Just Connect the dots and move on
            continue

        x = []
        y = []
        for j in range(len(data_by_days[i])):
            x.append(data_by_days[i][j][0])
            y.append(data_by_days[i][j][1])

        x = np.array(x)
        y = np.array(y)

        #Normalizing on a 1d array is depriciated. Transfer to 2d for normalization
        y = y.reshape(-1, 1)
        min_max_scaler = preprocessing.MinMaxScaler()
        y = min_max_scaler.fit_transform(y)

        #Bring it back to a 1d array.
        y = y.flatten()

        polyCount = 1
        bestResid = 1000000
        bestPoly = []
        decreasing = True

        # try at least the first five polynomial cuves - then continue until we get a decrease in SSE
        while polyCount <= 5 or decreasing:
            #print "calculatingFit"
            z, residual, _, _, _ = np.polyfit(x,y,polyCount, full=True)

            if residual < bestResid:
                bestResid = residual
                bestPoly = z
                decreasing = True
                #print "Better residual found."
            else:
                decreasing = False

            polyCount += 1

        #print "Using " + str(len(bestPoly)) + " residuals.\nTried " + str(polyCount) + "."

        #print Tract
        #Output the coefficients into the csv file.
        val = [Tract, i, bestPoly.tolist(), bestResid.tolist()]
        toSave.append(val)
        if (GeneratePlot):
            p = np.poly1d(bestPoly)
            #print bestPoly

            alpha = 1

            if i < 4:
                alpha = .2

            xp = np.linspace(0, 100, 600)
            _ = plt.plot(x, y, '.', xp, p(xp), '-', label=labels[i], alpha=alpha)
    if (GeneratePlot):
        plt.ylim(-.25, 1.5)
        plt.legend(loc='upper left')
        fig = matplotlib.pyplot.gcf()
        fig.set_size_inches(18.5, 10.5, forward=True)
        fig.savefig('./out-figures/' + Tract +'-combined.png')
        fig.clf()
        #graph with pyplot

#close the out-csv file.
with open(InDir + 'csv-out/lines-of-fit.json', 'w+') as outfile:
    json.dump(toSave, outfile)


text:
public class AutomaticMachine : Ammunition
{
    private const double WeightConst = 6.3;

    public AutomaticMachine(string name)
        : base(name, WeightConst)
    {
    }
}


text:
// <copyright file="AssetFileMetadata.cs" company="Microsoft">Copyright 2013 Microsoft Corporation</copyright>
// <license>
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </license>

namespace Microsoft.WindowsAzure.MediaServices.Client.Metadata
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Xml.Linq;

    /// <summary>
    /// Represents a media file produced by the encoding <see cref="IJob"/>.
    /// </summary>
    public class AssetFileMetadata
    {
        /// <summary>
        /// Gets the name of the media file.
        /// </summary>
        public string Name { get; internal set; }

        /// <summary>
        /// Gets the size of the media file in bytes.
        /// </summary>
        public long Size { get; internal set; }

        /// <summary>
        /// Gets the play back duration of the media file.
        /// </summary>
        public TimeSpan Duration { get; internal set; }

        /// <summary>
        /// Gets a collection of source media files that was processed in order to produce this output media file.
        /// </summary>
        public IEnumerable<Source> Sources { get; internal set; }

        /// <summary>
        /// Gets a collection of audio tracks contained in the media file.
        /// </summary>
        public IEnumerable<AudioTrack> AudioTracks { get; internal set; }

        /// <summary>
        /// Gets a collection of video tracks contained in the media file.
        /// </summary>
        public IEnumerable<VideoTrack> VideoTracks { get; internal set; }

        internal static AssetFileMetadata Load(XElement assetFileElement)
        {
            AssetFileMetadata assetFileMetadata = new AssetFileMetadata();

            assetFileMetadata.Name = assetFileElement.GetAttributeOrDefault(AssetMetadataParser.NameAttributeName);
            assetFileMetadata.Size = assetFileElement.GetAttributeAsLongOrDefault(AssetMetadataParser.SizeAttributeName);
            assetFileMetadata.Duration = assetFileElement.GetAttributeAsTimeSpanOrDefault(AssetMetadataParser.DurationAttributeName);

            assetFileMetadata.Sources = ParseSources(assetFileElement.Element(AssetMetadataParser.SourcesElementName));
            assetFileMetadata.VideoTracks = ParseVideoTracks(assetFileElement.Element(AssetMetadataParser.VideoTracksElementName));
            assetFileMetadata.AudioTracks = ParseAudioTracks(assetFileElement.Element(AssetMetadataParser.AudioTracksElementName));

            return assetFileMetadata;
        }

        private static IEnumerable<Source> ParseSources(XElement sourcesElement)
        {
            IEnumerable<Source> sources = null;

            if (sourcesElement != null)
            {
                sources = sourcesElement
                    .Elements(AssetMetadataParser.SourceElementName)
                    .Select(s => Source.Load(s))
                    .ToArray();
            }

            return sources;
        }

        private static IEnumerable<VideoTrack> ParseVideoTracks(XElement videoTracksElement)
        {
            IEnumerable<VideoTrack> videoTracks = null;

            if (videoTracksElement != null)
            {
                videoTracks = videoTracksElement
                    .Elements(AssetMetadataParser.VideoTrackElementName)
                    .Select(v => VideoTrack.Load(v))
                    .ToArray();
            }

            return videoTracks;
        }

        private static IEnumerable<AudioTrack> ParseAudioTracks(XElement audioTracksElement)
        {
            IEnumerable<AudioTrack> audioTracks = null;

            if (audioTracksElement != null)
            {
                audioTracks = audioTracksElement
                    .Elements(AssetMetadataParser.AudioTrackElementName)
                    .Select(a => AudioTrack.Load(a))
                    .ToArray();
            }

            return audioTracks;
        }
    }
}