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

        <meta content="text/html; charset=iso-8859-1" http-equiv="content-type">
        <title>Weighted overlay</title>
        <link rel="stylesheet" type="text/css" href="Help.css">

Weighted overlay

            This tool performs a weighted overlay on multiple input images. It can be
            used to combine multiple factors with varying levels of weight or relative
            importance. The Weighted Overlay tool is similar to the
            Weighted Sum tool but is
            more powerful because it automatically converts the input factors to a
            common  user-defined scale and allows the user to specify benefit
                factors and cost factors. A benefit factor is a factor
            for which higher values are more suitable. A cost factor is a
            factor for which higher values are less suitable. By default,
            Weighted Overlay assumes that input images are benefit
            factors, unless the Cost? checkbox is checked.
            Constraints are absolute restriction with values of 0 (unsuitable)
            and 1 (suitable). This tool is particularly useful for performing
            multi-criteria evaluations (MCE).

Notice that the algorithm will convert the user-defined factor
            weights internally such that the sum of the weights is always
            equal to one. As such, the user can specify the relative weights
            as decimals, percentages, or relative weightings (e.g. slope is
            2 times more important than elevation, in which case the weights
            may not sum to 1 or 100).

NoData valued grid cells in any of the input images
            will be assigned NoData values in the output image. The
            output raster is of the float data type and continuous
            data scale.

See Also:

Weighted sum

Scripting:

The following is an example of a Python script that uses this tool:

                wd = pluginHost.getWorkingDirectory()

                # image1;weight1;image2;weight2;...
                inputData = wd + "input1.dep" + ";" + "0.2" + ";" + wd + "input2.dep" + ";" + "0.8"

                # You may have multiple input files but they must

                # be separated by semicolons in the string.

                constraintsFiles = wd + "constraint1.dep" + ";" + wd + "constraint2.dep" + ";" + wd + "constraint3.dep"

                outputFile = wd + "output.dep"

                commonScale = "0-1" # must be 0-1, 0-100, or 0-255

                args = [inputData, constraintsFiles, outputFile, commonScale]

                pluginHost.runPlugin("WeightedOverlay", args, False)

This is a Groovy script also using this tool:

                def wd = pluginHost.getWorkingDirectory()

                // image1;weight1;image2;weight2;...
                def inputData = wd + "input1.dep" + ";" + "0.2" + ";" + wd + "input2.dep" + ";" + "0.8"

                // You may have multiple input files but they must

                // be separated by semicolons in the string.

                def constraintsFiles = wd + "constraint1.dep" + ";" + wd + "constraint2.dep" + ";" + wd + "constraint3.dep"

                def outputFile = wd + "output.dep"

                def commonScale = "0-255" // must be 0-1, 0-100, or 0-255

                String[] args = [inputData, constraintsFiles, outputFile, commonScale]

                pluginHost.runPlugin("WeightedOverlay", args, false)

Credits:

John Lindsay (2012) email: jlindsay@uoguelph.ca


text:
package ru.job4j.heroes;

public class Wizard extends Elfs {
    public Wizard() {
        super();
        setDemage(10);
    }

    public Wizard(double life, boolean privelege, double demage, double demageSecond) {
        super(life, privelege, demage, demageSecond);
    }

    public Wizard(boolean privelege, double demage, double demageSecond) {
        super(privelege, demage, demageSecond);
    }

    void spell(Heroes hero) {

        hero.setPrivelege(true);

    }

    @Override
    public void atack(Heroes hero) {
        super.atack(hero);
        System.out.println("Magic Atack - 10D");
    }
}

redpajama_set_name: RedPajamaGithub


text:
<form name="formHolder.loan" id="formHolder.loan" novalidate>

		  <input type="checkbox" ng-model="data.loan.loan_paid" ng-checked="data.loan.loan_paid"> Mark Paid

	Date
	<input type="date" class="form-control" name="loan_date" ng-model="data.loan.loan_date" required>
	Date is required

	Type
	<select class="form-control" name="loan_type" ng-value="data.loan.loan_type" ng-model="data.loan.loan_type" ng-options="lt.type as lt.type for lt in data.loans_types track by lt.type" required></select>
	Type is required

	Description
	<input type="text" class="form-control" name="loan_description" ng-model="data.loan.loan_description" required>
	Description is required

	Amount
	<input type="text" class="form-control" name="loan_amount" ng-model="data.loan.loan_amount" required>
	Amount is required

	Offset
	<input type="text" class="form-control" name="loan_offset" ng-model="data.loan.loan_offset">

	Monthly Payment (Full)
	<input type="text" class="form-control" name="loan_monthly" ng-model="data.loan.loan_monthly" required>
	Monthly full payment is required

	Monthly Payment (First Half)
	<input type="text" class="form-control" name="loan_monthly_first" ng-model="data.loan.loan_monthly_first" required>
	First half payment is required

	Monthly Payment (Second Half)
	<input type="text" class="form-control" name="loan_monthly_second" ng-model="data.loan.loan_monthly_second" required>
	Second half payment is required

	No of months
	<input type="text" class="form-control" name="loan_months" ng-model="data.loan.loan_months" required>
	No of months is required

	Effectivity Date
	<input type="date" class="form-control" name="loan_effectivity" ng-model="data.loan.loan_effectivity" required>
	Monthly payment required

</form>


text:
package com.microsoft.azure.management.kusto.v2019_05_15;

import com.microsoft.azure.arm.model.HasInner;
import com.microsoft.azure.arm.resources.models.HasManager;
import com.microsoft.azure.management.kusto.v2019_05_15.implementation.KustoManager;
import com.microsoft.azure.management.kusto.v2019_05_15.implementation.DatabasePrincipalListResultInner;
import com.microsoft.azure.management.kusto.v2019_05_15.implementation.DatabasePrincipalInner;
import java.util.List;

/**
 * Type representing DatabasePrincipalListResult.
 */
public interface DatabasePrincipalListResult extends HasInner<DatabasePrincipalListResultInner>, HasManager<KustoManager> {
    /**
     * @return the value value.
     */
    List<DatabasePrincipalInner> value();

}


text:
name: Compatible Certification Request
about: Start a request for a compatible certification
title: 'MicroProfile Config [Version] Compatible Certification Request'
labels: 'Certification :trophy:'
assignees: ''

---

- [ ] Organization Name ("Organization") and, if applicable, URL:

  // Add here
- [ ] Product Name, Version and download URL (if applicable):

  // Add here
- [ ] Specification Name, Version and download URL:

   // Add here
- [ ] (Optional) TCK Version, digital SHA-256 fingerprint and download URL:

  // Add here
- [ ] Public URL of TCK Results Summary:

  // Add here
- [ ] Any Additional Specification Certification Requirements:

  // Add here
- [ ] Java runtime used to run the implementation:

  // Add here
- [ ] Summary of the information for the certification environment, operating system, cloud, ...:

  // Add here
- [ ] By checking this box I acknowledge that the Organization I represent accepts the terms of the [EFTL](https://www.eclipse.org/legal/tck.php).
- [ ] By checking this box I attest that all TCK requirements have been met, including any compatibility rules.


text:
class MakeExistingTranscriptsManual < SeedMigration::Migration
  def up
    # update the existing transcripts to be manual uploads
    Transcript.update_all(transcript_type: 1)
  end

  def down
    Transcript.update_all(transcript_type: 0)
  end
end


text: /usr/local/bin/bundle exec $1 $2


text:
layout: post
date: '2015-05-30'
title: "Demetrios Young Sophisticates Style 2863 Sleeveless Chapel Train Ballgown"
category: Demetrios
tags: [Demetrios,Ballgown,Sweetheart,Chapel Train,Sleeveless]
---
### Demetrios Young Sophisticates Style 2863
Just **$349.99**
###   Sleeveless Chapel Train Ballgown

BRANDS	Demetrios

Silhouette	Ballgown

Neckline	Sweetheart

Hemline/Train	Chapel Train

Sleeve	Sleeveless

Buy it: [https://www.readybrides.com/en/demetrios/17776-demetrios-style-2863.html](https://www.readybrides.com/en/demetrios/17776-demetrios-style-2863.html)


text:
<?php

namespace Phalcon\Forms\Element;

/**
 * Phalcon\Forms\Element\Check
 *
 * Component INPUT[type=check] for forms
 */
class Check extends \Phalcon\Forms\Element
{

    /**
     * Renders the element widget returning html
     *
     * @param array $attributes
     * @return string
     */
    public function render($attributes = null) {}

}


text:
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * Base test class used by all test shell tests.  Provides boiler plate
 * code to create and destroy a new test shell for each gTest test.
 */

#ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_TEST_H__
#define WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_TEST_H__

#include <string>

#include "base/file_path.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/glue/window_open_disposition.h"
#include "webkit/tools/test_shell/test_shell.h"

class TestShellTest : public testing::Test {
 protected:
  // Returns the path "test_case_path/test_case".
  GURL GetTestURL(const FilePath& test_case_path,
                  const std::string& test_case);

  virtual void SetUp() OVERRIDE;
  virtual void TearDown() OVERRIDE;

  // Don't refactor away; some unittests override this!
  virtual void CreateEmptyWindow();

 protected:
  // Location of SOURCE_ROOT/webkit/data/
  FilePath data_dir_;

  TestShell* test_shell_;
};

#endif // WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_TEST_H__


text:
<?php

namespace Very\Contracts\Support;

interface Jsonable
{
    /**
     * Convert the object to its JSON representation.
     *
     * @param  int  $options
     * @return string
     */
    public function toJson($options = 0);
}


text:
default[:opsworks_bundler][:version] = '1.3.5'
default[:opsworks_bundler][:executable] = '/usr/local/bin/bundle'


text:
#import <Foundation/Foundation.h>
#import "JCSFoundationConstants.h"

@protocol JCSActionSheet <NSObject>

+ (id)actionSheetWithMessage:(NSString *)message;
- (void)show;
- (NSInteger)addButtonWithTitle:(NSString *)title action:(JCSActionBlock)action;
- (void)addCancelButtonWithTitle:(NSString *)title action:(JCSActionBlock)action;
- (void)addDestructiveButtonWithTitle:(NSString *)title action:(JCSActionBlock)action;

@end


text:
package com.esri.gpt.server.openls.provider.components;
import java.util.HashMap;
import java.util.Map;

import org.w3c.dom.Document;

import com.esri.gpt.server.openls.provider.services.geocode.GeocodeParams;
import com.esri.gpt.server.openls.provider.services.map.GetPortrayMapCapabilitiesParams;
import com.esri.gpt.server.openls.provider.services.map.PortrayMapParams;
import com.esri.gpt.server.openls.provider.services.poi.DirectoryParams;
import com.esri.gpt.server.openls.provider.services.reversegeocode.ReverseGeocodeParams;
import com.esri.gpt.server.openls.provider.services.route.DetermineRouteParams;

/**
 * Options associated with a CSW operation request.
 */
public class RequestOptions {

  /** instance variables ====================================================== */
  private Map<String,Object>    additionalOptions = new HashMap<String,Object>();
  private GetPortrayMapCapabilitiesParams getPortrayMapCapabilitiesOptions = new GetPortrayMapCapabilitiesParams();
  private PortrayMapParams      portrayMapOptions = new PortrayMapParams();
  private DetermineRouteParams 	determineRouteParams = new DetermineRouteParams();
  private DirectoryParams       directoryOptions = new DirectoryParams();
  private GeocodeParams 		geocodeOptions = new GeocodeParams();
  private ReverseGeocodeParams  reverseGeocodeOptions = new ReverseGeocodeParams();
  private Document              requestDom;
  private String                requestXml;
  /** constructors ============================================================ */

  /** Default constructor */
  public RequestOptions() {
    super();
  }

  /** properties ============================================================== */

  public DetermineRouteParams getDetermineRouteParams() {
		return determineRouteParams;
	}

	public void setDetermineRouteParams(DetermineRouteParams determineRouteParams) {
		this.determineRouteParams = determineRouteParams;
	}

	public DirectoryParams getDirectoryOptions() {
		return directoryOptions;
	}

	public void setDirectoryOptions(DirectoryParams directoryOptions) {
		this.directoryOptions = directoryOptions;
	}

	public GeocodeParams getGeocodeOptions() {
		return geocodeOptions;
	}

	public void setGeocodeOptions(GeocodeParams geocodeOptions) {
		this.geocodeOptions = geocodeOptions;
	}

	public ReverseGeocodeParams getReverseGeocodeOptions() {
		return reverseGeocodeOptions;
	}

	public void setReverseGeocodeOptions(ReverseGeocodeParams reverseGeocodeOptions) {
		this.reverseGeocodeOptions = reverseGeocodeOptions;
	}

  /**
   * Gets the free form map of additional options.
   * @return the additional options
   */
  public Map<String,Object> getAdditionalOptions() {
    return this.additionalOptions;
  }
  /**
   * Sets the free form map of additional options.
   * @param additionalOptions the additional options
   */
  public void setAdditionalOptions(Map<String,Object> additionalOptions) {
    this.additionalOptions = additionalOptions;
  }

  /**
   * Gets the DescribeRecord request options.
   * @return the DescribeRecord options
   */
  public DetermineRouteParams getDescribeRecordOptions() {
    return this.determineRouteParams;
  }
  /**
   * Sets the DescribeRecord request options.
   * @param options the DescribeRecord options
   */
  public void setDescribeRecordOptions(DetermineRouteParams options) {
    this.determineRouteParams = options;
  }

  /**
   * Gets the XML request document.
   * @return the XML request document (can be null)
   */
  public Document getRequestDom() {
    return this.requestDom;
  }
  /**
   * Sets the XML request document.
   * @param requestDom the XML request document
   */
  public void setRequestDom(Document requestDom) {
    this.requestDom = requestDom;
  }

  /**
   * Gets the request XML.
   * @return the request XML (can be null)
   */
  public String getRequestXml() {
    return this.requestXml;
  }
  /**
   * Sets the request XML.
   * @param xml the request XML (can be null)
   */
  public void setRequestXml(String xml) {
    this.requestXml = xml;
  }

/**
 * @param portrayMapOptions the portrayMapOptions to set
 */
public void setPortrayMapOptions(PortrayMapParams portrayMapOptions) {
	this.portrayMapOptions = portrayMapOptions;
}

/**
 * @return the portrayMapOptions
 */
public PortrayMapParams getPortrayMapOptions() {
	return portrayMapOptions;
}

/**
 * @param getPortrayMapCapabilitiesOptions the getPortrayMapCapabilitiesOptions to set
 */
public void setGetPortrayMapCapabilitiesOptions(
		GetPortrayMapCapabilitiesParams getPortrayMapCapabilitiesOptions) {
	this.getPortrayMapCapabilitiesOptions = getPortrayMapCapabilitiesOptions;
}

/**
 * @return the getPortrayMapCapabilitiesOptions
 */
public GetPortrayMapCapabilitiesParams getGetPortrayMapCapabilitiesOptions() {
	return getPortrayMapCapabilitiesOptions;
}

}


text:
package gerador.de.memes.meme.adapter;

import gerador.de.memes.meme.R;
import gerador.de.memes.meme.stuff.Meme;
import java.util.List;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.FailReason;
import com.nostra13.universalimageloader.core.assist.SimpleImageLoadingListener;
import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class GridAdapter extends BaseAdapter {

	private Context mContext;

	private List<Meme> memes;

    private DisplayImageOptions options;

    private ImageLoader iLoader;

    public GridAdapter(Context mContext, List<Meme> memes) {
		this.mContext = mContext;
		this.memes = memes;

		options = new DisplayImageOptions.Builder()
		.cacheInMemory(true)
		.cacheOnDisc(true)
		.showImageOnFail(R.drawable.warning)
		.build();

		iLoader = ImageLoader.getInstance();
		ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(mContext)
			.build();
		iLoader.init(config);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return memes.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return memes.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		// TODO Auto-generated method stub
		final ImageView imageView;
        if (arg1 == null) {
            imageView = new ImageView(mContext);
            imageView.setLayoutParams(new GridView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
            imageView.setPadding(5, 5, 5, 5);
            imageView.setVisibility(View.GONE);
            imageView.setBackgroundColor(mContext.getResources().getColor(android.R.color.transparent));
        } else {
            imageView = (ImageView) arg1;
        }

        iLoader.displayImage("http://i.imgur.com/"+memes.get(arg0).getId()+"b.jpg", imageView, options,
        		new SimpleImageLoadingListener() {

					@Override
					public void onLoadingCancelled(String imageUri, View view) {
						super.onLoadingCancelled(imageUri, view);
			            imageView.setVisibility(View.VISIBLE);
			            imageView.setImageResource(R.drawable.warning);
					}

					@Override
					public void onLoadingComplete(String imageUri, View view,
							Bitmap loadedImage) {
						super.onLoadingComplete(imageUri, view, loadedImage);
			            imageView.setVisibility(View.VISIBLE);
					}

					@Override
					public void onLoadingFailed(String imageUri, View view,
							FailReason failReason) {
						super.onLoadingFailed(imageUri, view, failReason);
			            imageView.setVisibility(View.VISIBLE);
			            imageView.setImageResource(R.drawable.warning);
					}

					@Override
					public void onLoadingStarted(String imageUri, View view) {
						super.onLoadingStarted(imageUri, view);
			            imageView.setVisibility(View.GONE);
					}

        });

        return imageView;
	}

}


text:
using System;

/* Write a program that creates an array containing all letters from the alphabet (A-Z).
Read a word from the console and print the index of each of its letters in the array. */

class IndexOfLetters
{
    static void Main()
    {
        char[] alphabet = new char[26];
        for (int i = 0; i < alphabet.Length; i++)
        {
            alphabet[i] = (char)('a' + i);
        }
        Console.Write("Type in a word and press ENTER: ");
        string word = Console.ReadLine().ToLower();

        for (int i = 0; i < word.Length; i++)
        {
            for (int j = 0; j < alphabet.Length; j++)
            {
                if (word[i] == alphabet[j])
                {
                    Console.WriteLine(" {0} --> {1}", word[i], j);
                }
            }
        }
    }
}


text:
package q5;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

// TODO
// Use locks and condition variables to implement the bathroom protocol
public class BathroomLockProtocol implements Protocol {
	// declare the lock and conditions here

	private Lock m_lock = new ReentrantLock();
	private Lock m_lockUpdate = new ReentrantLock();

	private Condition m_maleWait = m_lock.newCondition();
	private Condition m_femaleWait = m_lock.newCondition();

	public volatile int m_male = 0;
	public volatile int m_female = 0;

	public void enterMale() {
		m_lock.lock();

		try {
			while (m_female > 0) {
				m_maleWait.await();
			}

			m_lockUpdate.lock();
			m_male++;
			m_lockUpdate.unlock();

		} catch (InterruptedException e) {
			e.printStackTrace();
		} finally {
			m_lock.unlock();
		}
	}

	public void leaveMale() {
		m_lock.lock();

		try {

			m_male--;

			if (m_male == 0) {
				m_femaleWait.signalAll();
			}

		} finally {
			m_lock.unlock();
		}
	}

	public void enterFemale() {
		m_lock.lock();

		try {
			while (m_male > 0) {
				m_femaleWait.await();
			}

			m_lockUpdate.lock();
			m_female++;
			m_lockUpdate.unlock();

		} catch (InterruptedException e) {
			e.printStackTrace();
		} finally {
			m_lock.unlock();
		}

	}

	public void leaveFemale() {
		m_lock.lock();

		try {
			m_female--;

			if (m_female == 0) {
				m_maleWait.signalAll();
			}
		} finally {
			m_lock.unlock();
		}

	}
}


text:
using NMF.Collections.Generic;
using NMF.Collections.ObjectModel;
using NMF.Expressions;
using NMF.Expressions.Linq;
using NMF.Models;
using NMF.Models.Collections;
using NMF.Models.Expressions;
using NMF.Models.Meta;
using NMF.Models.Repository;
using NMF.Serialization;
using NMF.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using TTC2017.SmartGrids.CIM;
using TTC2017.SmartGrids.CIM.IEC61970.Core;
using TTC2017.SmartGrids.CIM.IEC61970.Topology;
using TTC2017.SmartGrids.CIM.IEC61970.Wires;

namespace TTC2017.SmartGrids.CIM.IEC61970.StateVariables
{

    public class TopologicalIslandTopologicalNodesCollection : ObservableOppositeOrderedSet<ITopologicalIsland, ITopologicalNode>
    {

        public TopologicalIslandTopologicalNodesCollection(ITopologicalIsland parent) :
                base(parent)
        {
        }

        private void OnItemDeleted(object sender, System.EventArgs e)
        {
            this.Remove(((ITopologicalNode)(sender)));
        }

        protected override void SetOpposite(ITopologicalNode item, ITopologicalIsland parent)
        {
            if ((parent != null))
            {
                item.Deleted += this.OnItemDeleted;
                item.TopologicalIsland = parent;
            }
            else
            {
                item.Deleted -= this.OnItemDeleted;
                if ((item.TopologicalIsland == this.Parent))
                {
                    item.TopologicalIsland = parent;
                }
            }
        }
    }
}


text:
package adept.common;

import java.util.Map;

import static com.google.common.base.Preconditions.checkArgument;
import java.io.Serializable;

/**
 * The Class ConversationElementTag, which represents an SGML tag within a structured document.
 * This class has been included to make the DEFT annotations compatible with the representations used by
 * the community, and otherwise doesn't have a lot of semantic justification.
 */
public class ConversationElementTag implements Serializable {

	private static final long serialVersionUID = 5258320815351914885L;

	protected final String tagName;

    // Could be made immutable.
    protected final Map<String,Token> attributes;

    protected final CharOffset charOffset;

	public ConversationElementTag(String tagName, Map<String,Token> attributes, int begin, int end) {
        checkArgument(attributes!=null);
        for( Map.Entry<String, Token> entry : attributes.entrySet()) {
            checkArgument(entry.getKey()!=null);
            checkArgument(entry.getValue()!=null);
        }
        this.tagName = tagName;
        this.attributes = attributes;
        this.charOffset = new CharOffset(begin, end);
	}

	public String getTagName() { return tagName; }

	public Map<String,Token> getAttributes() {
        return attributes;
	}

	public CharOffset getCharOffset() {
        return charOffset;
	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<ldswebml type="image" uri="/media-library/images/motherhood#mother-son-haircut-1020202" xml:lang="eng" locale="eng" status="publish" xmlns:its="http://www.w3.org/2005/11/its">
  <search-meta>
      <uri-title its:translate="no">mother-son-haircut-1020202</uri-title>
      <source>mother-son-haircut-1020202</source>
      <publication-type its:translate="no">image</publication-type>
      <media-type its:translate="no">image</media-type>
      <publication value="ldsorg">LDS.org</publication>
      <publication-date value="2013-04-22">2013-04-22</publication-date>
      <title/>
      <description/>
      <collections>
          <collection its:translate="no">global-search</collection>
          <collection its:translate="no">media</collection>
          <collection its:translate="no">images</collection>
      </collections>
      <subjects>
          <subject>motherhood</subject>
          <subject>mother</subject>
          <subject>mothers</subject>
          <subject>son</subject>
          <subject>haircut</subject>
      </subjects>
  </search-meta>
  <no-search>
      <path>http://media.ldscdn.org/images/media-library/motherhood/mother-son-haircut-1020202-gallery.jpg</path>
      <images>
          http://media.ldscdn.org/images/media-library/motherhood/mother-son-haircut-1020202-thumbnail.jpg
      </images>
          <download-urls>
              <download-url>
                  Mobile
                  <size>474 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/motherhood/mother-son-haircut-1020202-mobile.jpg</path>
              </download-url>
              <download-url>
                  Tablet
                  <size>567 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/motherhood/mother-son-haircut-1020202-tablet.jpg</path>
              </download-url>
              <download-url>
                  Print
                  <size>1.2 MB</size>
                  <path>http://media.ldscdn.org/images/media-library/motherhood/mother-son-haircut-1020202-print.jpg</path>
              </download-url>
              <download-url>
                  Wallpaper
                  <size>2.6 MB</size>
                  <path>http://media.ldscdn.org/images/media-library/motherhood/mother-son-haircut-1020202-wallpaper.jpg</path>
              </download-url>
          </download-urls>
  </no-search>
</ldswebml>


text:
package com.facebook.buck.event.isolated;

import com.facebook.buck.core.build.execution.context.actionid.ActionId;
import com.facebook.buck.core.exceptions.HumanReadableException;
import com.facebook.buck.core.model.BuildId;
import com.facebook.buck.core.util.log.Logger;
import com.facebook.buck.downward.model.ChromeTraceEvent;
import com.facebook.buck.downward.model.ChromeTraceEvent.ChromeTraceEventStatus;
import com.facebook.buck.downward.model.EventTypeMessage;
import com.facebook.buck.downward.model.EventTypeMessage.EventType;
import com.facebook.buck.downward.model.StepEvent.StepStatus;
import com.facebook.buck.downwardapi.protocol.DownwardProtocol;
import com.facebook.buck.downwardapi.utils.DownwardApiUtils;
import com.facebook.buck.event.BuckEvent;
import com.facebook.buck.event.ConsoleEvent;
import com.facebook.buck.event.ExternalEvent;
import com.facebook.buck.event.IsolatedEventBus;
import com.facebook.buck.event.SimplePerfEvent;
import com.facebook.buck.event.StepEvent;
import com.facebook.buck.event.utils.EventBusUtils;
import com.facebook.buck.util.timing.Clock;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import com.google.protobuf.AbstractMessage;
import com.google.protobuf.Duration;
import java.io.IOException;
import java.io.OutputStream;
import java.time.Instant;
import java.util.concurrent.Phaser;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

/**
 * Event bus that writes directly to its associated output stream. Only handles events associated
 * with Downward API.
 */
public class DefaultIsolatedEventBus implements IsolatedEventBus {

  private static final Logger LOG = Logger.get(DefaultIsolatedEventBus.class);

  private static final long WAIT_FOR_EVENTS_TIMEOUT = 1;
  private static final TimeUnit WAIT_FOR_EVENTS_TIMEOUT_UNIT = TimeUnit.SECONDS;

  private final BuildId buildId;
  private final OutputStream outputStream;
  private final Clock clock;
  private final long startExecutionEpochMillis;
  private final DownwardProtocol downwardProtocol;
  private final Phaser phaser;
  private final boolean measureWaitedTime;
  private final ActionId defaultActionId;

  public DefaultIsolatedEventBus(
      BuildId buildId,
      OutputStream outputStream,
      Clock clock,
      DownwardProtocol downwardProtocol,
      ActionId defaultActionId) {
    this(
        buildId, outputStream, clock, clock.currentTimeMillis(), downwardProtocol, defaultActionId);
  }

  @VisibleForTesting
  public DefaultIsolatedEventBus(
      BuildId buildId,
      OutputStream outputStream,
      Clock clock,
      long startExecutionEpochMillis,
      DownwardProtocol downwardProtocol,
      ActionId defaultActionId) {
    this(
        buildId,
        outputStream,
        clock,
        startExecutionEpochMillis,
        downwardProtocol,
        false,
        defaultActionId);
  }

  @VisibleForTesting
  DefaultIsolatedEventBus(
      BuildId buildId,
      OutputStream outputStream,
      Clock clock,
      long startExecutionEpochMillis,
      DownwardProtocol downwardProtocol,
      boolean measureWaitedTime,
      ActionId defaultActionId) {
    this.buildId = buildId;
    this.outputStream = outputStream;
    this.clock = clock;
    this.startExecutionEpochMillis = startExecutionEpochMillis;
    this.downwardProtocol = downwardProtocol;
    this.defaultActionId = defaultActionId;
    this.phaser = new Phaser();
    this.measureWaitedTime = measureWaitedTime;
  }

  @Override
  public BuildId getBuildId() {
    return buildId;
  }

  @Override
  public void post(ConsoleEvent event) {
    post(event, Thread.currentThread().getId());
  }

  @Override
  public void post(ConsoleEvent event, long threadId) {
    configureWithTimestamp(event, threadId);
    writeConsoleEvent(event);
  }

  @Override
  public void post(ExternalEvent event) {
    post(event, Thread.currentThread().getId());
  }

  @Override
  public void post(ExternalEvent event, long threadId) {
    configureWithTimestamp(event, threadId);
    writeExternalEvent(event);
  }

  @Override
  public void post(StepEvent event, ActionId actionId) {
    post(event, actionId, Thread.currentThread().getId());
  }

  @Override
  public void post(StepEvent event, ActionId actionId, long threadId) {
    configureWithTimestamp(event, threadId);
    writeStepEvent(event, actionId);
  }

  @Override
  public void post(StepEvent event, ActionId actionId, Instant atTime, long threadId) {
    EventBusUtils.configureEvent(event, atTime, threadId, clock, buildId);
    writeStepEvent(event, actionId);
  }

  @Override
  public void post(SimplePerfEvent event, ActionId actionId) {
    post(event, actionId, Thread.currentThread().getId());
  }

  @Override
  public void post(SimplePerfEvent event, ActionId actionId, Instant atTime) {
    post(event, actionId, atTime, Thread.currentThread().getId());
  }

  @Override
  public void post(SimplePerfEvent event, ActionId actionId, long threadId) {
    timestamp(event, threadId);
    writeChromeTraceEvent(event, actionId);
  }

  @Override
  public void post(SimplePerfEvent event, ActionId actionId, Instant atTime, long threadId) {
    EventBusUtils.configureEvent(event, atTime, threadId, clock, buildId);
    writeChromeTraceEvent(event, actionId);
  }

  @Override
  public void postWithoutConfiguring(SimplePerfEvent event, ActionId actionId) {
    Preconditions.checkState(event.isConfigured(), "Event must be configured");
    writeChromeTraceEvent(event, actionId);
  }

  @Override
  public void timestamp(ConsoleEvent event) {
    configureWithTimestamp(event, Thread.currentThread().getId());
  }

  @Override
  public void timestamp(StepEvent event) {
    configureWithTimestamp(event, Thread.currentThread().getId());
  }

  @Override
  public void timestamp(SimplePerfEvent event) {
    timestamp(event, Thread.currentThread().getId());
  }

  @Override
  public void timestamp(SimplePerfEvent event, long threadId) {
    configureWithTimestamp(event, threadId);
  }

  @Override
  public void close() {
    waitTillAllEventsProcessed();
  }

  private void configureWithTimestamp(BuckEvent event, long threadId) {
    event.configure(
        clock.currentTimeMillis(),
        clock.nanoTime(),
        clock.threadUserNanoTime(threadId),
        threadId,
        buildId);
  }

  private void writeExternalEvent(ExternalEvent event) {
    EventTypeMessage eventTypeMessage =
        EventTypeMessage.newBuilder().setEventType(EventType.EXTERNAL_EVENT).build();
    com.facebook.buck.downward.model.ExternalEvent externalEvent =
        com.facebook.buck.downward.model.ExternalEvent.newBuilder()
            .putAllData(event.getData())
            .build();
    writeToNamedPipe(eventTypeMessage, externalEvent);
  }

  private void writeConsoleEvent(ConsoleEvent event) {
    EventTypeMessage eventTypeMessage =
        EventTypeMessage.newBuilder().setEventType(EventType.CONSOLE_EVENT).build();
    com.facebook.buck.downward.model.ConsoleEvent consoleEvent =
        com.facebook.buck.downward.model.ConsoleEvent.newBuilder()
            .setLogLevel(DownwardApiUtils.convertLogLevel(event.getLevel()))
            .setMessage(event.getMessage())
            .build();
    writeToNamedPipe(eventTypeMessage, consoleEvent);
  }

  private void writeStepEvent(StepEvent event, ActionId actionId) {
    EventTypeMessage eventTypeMessage =
        EventTypeMessage.newBuilder().setEventType(EventType.STEP_EVENT).build();
    com.facebook.buck.downward.model.StepEvent stepEvent =
        com.facebook.buck.downward.model.StepEvent.newBuilder()
            .setEventId(getEventId(event))
            .setStepStatus(getStepStatus(event))
            .setStepType(event.getShortStepName())
            .setDescription(event.getDescription())
            .setDuration(getDuration(event))
            .setActionId(actionId != null ? actionId.getValue() : defaultActionId.getValue())
            .build();
    writeToNamedPipe(eventTypeMessage, stepEvent);
  }

  private int getEventId(BuckEvent event) {
    return (int) event.getEventKey().getValue();
  }

  private void writeChromeTraceEvent(SimplePerfEvent event, ActionId actionId) {
    EventTypeMessage eventTypeMessage =
        EventTypeMessage.newBuilder().setEventType(EventType.CHROME_TRACE_EVENT).build();
    ChromeTraceEventStatus eventStatus = convertEventType(event.getEventType());
    ChromeTraceEvent chromeTraceEvent =
        ChromeTraceEvent.newBuilder()
            .setEventId(getEventId(event))
            .setCategory(event.getCategory())
            .setTitle(event.getTitle().getValue())
            .setStatus(eventStatus)
            .putAllData(Maps.transformValues(event.getEventInfo(), Object::toString))
            .setDuration(getDuration(event))
            .setActionId(actionId != null ? actionId.getValue() : defaultActionId.getValue())
            .build();
    writeToNamedPipe(eventTypeMessage, chromeTraceEvent);
  }

  private Duration getDuration(BuckEvent event) {
    return EventBusUtils.millisToDuration(event.getTimestampMillis() - startExecutionEpochMillis);
  }

  private ChromeTraceEventStatus convertEventType(SimplePerfEvent.Type eventType) {
    switch (eventType) {
      case STARTED:
        return ChromeTraceEventStatus.BEGIN;

      case FINISHED:
        return ChromeTraceEventStatus.END;

      case UPDATED:
      default:
        return ChromeTraceEventStatus.UNKNOWN;
    }
  }

  private StepStatus getStepStatus(StepEvent event) {
    if (event instanceof StepEvent.Started) {
      return StepStatus.STARTED;
    }

    if (event instanceof StepEvent.Finished) {
      return StepStatus.FINISHED;
    }

    return StepStatus.UNKNOWN;
  }

  private void writeToNamedPipe(EventTypeMessage eventType, AbstractMessage payload) {
    phaser.register();
    try {
      writeIntoStream(eventType, payload);
    } catch (IOException e) {
      LOG.error(e, "Failed to write buck event %s of type", payload, eventType.getEventType());
    } finally {
      phaser.arriveAndDeregister();
    }
  }

  @VisibleForTesting
  void writeIntoStream(EventTypeMessage eventType, AbstractMessage payload) throws IOException {
    // events processing could be blocked here waiting for an opportunity to write into the same
    // output stream.
    downwardProtocol.write(eventType, payload, outputStream);
  }

  @Override
  public void waitTillAllEventsProcessed() {
    if (!measureWaitedTime) {
      awaitTillProcessed();
    } else {
      long startTime = System.nanoTime();
      awaitTillProcessed();
      long runTimeInMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
      LOG.info("Waited for " + runTimeInMillis + " ms");
    }
  }

  private void awaitTillProcessed() {
    if (phaser.getRegisteredParties() == 0) {
      // no events to wait
      return;
    }

    try {
      int phase = phaser.getPhase();
      phaser.awaitAdvanceInterruptibly(
          phase, WAIT_FOR_EVENTS_TIMEOUT, WAIT_FOR_EVENTS_TIMEOUT_UNIT);
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      LOG.warn(e, "Interrupted while waiting for events to process");
    } catch (TimeoutException e) {
      throw new HumanReadableException(
          e,
          String.format(
              "Timeout while waiting for event bus events to process. %s ms elapsed!",
              +WAIT_FOR_EVENTS_TIMEOUT_UNIT.toMillis(WAIT_FOR_EVENTS_TIMEOUT)));
    }
  }

  @VisibleForTesting
  int getUnprocessedEventsCount() {
    return phaser.getRegisteredParties();
  }
}


text:
<?php

namespace RavelryApi\Tests\Functional;

class LibraryTest extends TestCase
{
    public function testSearch()
    {
        $result = $this->client->library->search([
            'username' => 'TheLoopyEwe',
            'type' => 'book',
            'page' => 2,
            'page_size' => 5,
        ]);

        $this->assertInternalType('integer', $result['volumes'][0]['id']);
        $this->assertInternalType('boolean', $result['volumes'][0]['has_downloads']);
        $this->assertArrayHasKey('title', $result['volumes'][0]);
        $this->assertArrayHasKey('author_name', $result['volumes'][0]);
        $this->assertInternalType('array', $result['volumes'][0]['cover_image_size']);
        $this->assertArrayHasKey('cover_image_url', $result['volumes'][0]);
    }
}


text:
package org.mapfish.print.map.geotools;

import org.geotools.data.FeatureSource;
import org.geotools.data.collection.CollectionFeatureSource;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.mapfish.print.ExceptionUtils;
import org.mapfish.print.attribute.map.MapfishMapContext;
import org.mapfish.print.config.Template;
import org.mapfish.print.http.MfClientHttpRequestFactory;
import org.mapfish.print.map.AbstractLayerParams;

import java.io.IOException;
import java.util.concurrent.ExecutorService;
import javax.annotation.Nonnull;

/**
 *
Parses GeoJSON from the request data.

 *
Type: geojson

 */
public final class GeoJsonLayer extends AbstractFeatureSourceLayer {

    /**
     * Constructor.
     *
     * @param executorService       the thread pool for doing the rendering.
     * @param featureSourceSupplier a function that creates the feature source.  This will only be called once.
     * @param styleSupplier         a function that creates the style for styling the features. This will only be called once.
     * @param renderAsSvg           is the layer rendered as SVG?
     * @param params the parameters for this layer
     */
    public GeoJsonLayer(final ExecutorService executorService,
                        final FeatureSourceSupplier featureSourceSupplier,
                        final StyleSupplier<FeatureSource> styleSupplier,
                        final boolean renderAsSvg,
                        final AbstractLayerParams params) {
        super(executorService, featureSourceSupplier, styleSupplier, renderAsSvg, params);
    }

    /**
      *
Renders GeoJSON layers.

      *
Type: geojson

      * [[examples=json_styling,datasource_multiple_maps,printwms_tyger_ny_EPSG_900913]]
      */
    public static final class Plugin extends AbstractFeatureSourceLayerPlugin<GeoJsonParam> {

        private static final String TYPE = "geojson";
        private static final String COMPATIBILITY_TYPE = "vector";

        /**
         * Constructor.
         */
        public Plugin() {
            super(TYPE, COMPATIBILITY_TYPE);
        }

        @Override
        public GeoJsonParam createParameter() {
            return new GeoJsonParam();
        }

        @Nonnull
        @Override
        public GeoJsonLayer parse(@Nonnull final Template template,
                                  @Nonnull final GeoJsonParam param) throws IOException {
            return new GeoJsonLayer(
                    this.forkJoinPool,
                    createFeatureSourceSupplier(template, param.geoJson),
                    createStyleFunction(template, param.style),
                    template.getConfiguration().renderAsSvg(param.renderAsSvg),
                    param);
        }

        private FeatureSourceSupplier createFeatureSourceSupplier(final Template template,
                                                                    final String geoJsonString) {
            return new FeatureSourceSupplier() {
                @Nonnull
                @Override
                public FeatureSource load(@Nonnull final MfClientHttpRequestFactory requestFactory,
                                          @Nonnull final MapfishMapContext mapContext) {
                    final FeaturesParser parser = new FeaturesParser(requestFactory, mapContext.isForceLongitudeFirst());
                    SimpleFeatureCollection featureCollection;
                    try {
                        featureCollection = parser.autoTreat(template, geoJsonString);
                        return new CollectionFeatureSource(featureCollection);
                    } catch (IOException e) {
                        throw ExceptionUtils.getRuntimeException(e);
                    }
                }
            };
        }
    }

    /**
     * The parameters for creating a layer that renders GeoJSON formatted data.
     */
    public static class GeoJsonParam extends AbstractVectorLayerParam {
        /**
         * A geojson formatted string or url to the geoJson or the raw GeoJSON data.
         *

         * The url can be a file url, however if it is it must be relative to the configuration directory.
         */
        public String geoJson;
    }
}


text:
require 'helper'
require 'set'
require 'example-apps'

class TestBoolProp < Test::Unit::TestCase
  include QmfTestHelpers

  def setup
    @child_pid = nil
  end

  def test_property_identities
    app_setup QmfBoolProp

    objs = $console.objects(:class=>"QmfBoolProp")
    ids = Set.new

    assert_equal QmfBoolProp::SIZE, objs.size

    objs.each do |obj|
      assert_equal((obj.int_id % 2 == 0), obj.is_id_even)
      ids << obj[:int_id]
    end

    assert_equal objs.size, ids.size

    objs.size.times do |x|
      assert ids.include?(x), "ids should include #{x}, which is less than #{objs.size}"
    end
  end
end


text:
package com.gdevelop.gwt.syncrpc.spawebtest.shared;

public class UnauthenticateException extends Exception {

	private static final long serialVersionUID = 1L;

	public UnauthenticateException() {
	}
}


text:
Coco Elb DNS Registrator
=================================

[![Circle CI](https://circleci.com/gh/Financial-Times/coco-elb-dns-registrator/tree/master.png?style=shield)](https://circleci.com/gh/Financial-Times/coco-elb-dns-registrator/tree/master)
[![Go Report Card](https://goreportcard.com/badge/github.com/Financial-Times/coco-elb-dns-registrator)](https://goreportcard.com/report/github.com/Financial-Times/coco-elb-dns-registrator)

Registers ELB CNAME in Dyn to the domains passed in as params.

How to Build & Run the binary
-----------------------------

1. Build and test:

        go build
        go test

2. Run:

        export ELB_NAME="coreos-up-176d2040" \
            && export DOMAINS="xp-up,xp-read-up" \
            && export KONSTRUCTOR_BASE_URL="https://dns-api.in.ft.com/v2" \
            && export KONSTRUCTOR_API_KEY="***" \
            && ./coco-elb-dns-registrator


text:
The [TripleO][] installer for OpenStack includes support for Fluentd
and Sensu clients.  See [tripleo-integration.md][] in the `docs/`
subdirectory of this repository.

[tripleo-integration.md]: docs/tripleo-integration.md

# Contributing

If you encounter problems with or have suggestions about
opstools-ansible, open an issue on our [Github issue tracker][].

If you would like to contribute code, documentation, or other changes
to the project, please read the [docs/developers.md][] document located in
the `docs/` subdirectory of this repository.

[github issue tracker]: https://github.com/centos-opstools/opstools-ansible/issues
[developers.md]: docs/developers.md

# License

Copyright 2016 [Red Hat, Inc.][redhat]

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.

[redhat]: http://www.redhat.com/


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Anthostomella subconica Rehm

### Remarks
null


text:
<?php

namespace Yosymfony\Spress\Core\Tests\ContentManager\Generator\Pagination;

use Yosymfony\Spress\Core\DataSource\Item;
use Yosymfony\Spress\Core\ContentManager\Generator\Pagination\PaginationGenerator;

class PaginationGeneratorTest extends \PHPUnit_Framework_TestCase
{
    protected $pagination;

    public function setUp()
    {
        $this->pagination = new PaginationGenerator();
    }

    public function testPaginateWithDefaulPermalink()
    {
        $post1 = new Item('Post 1', 'posts/2015-05-26-hi', []);
        $post2 = new Item('Post 2', 'posts/2015-05-26-welcome', []);

        $collections = [
            'posts' => [$post1, $post2],
        ];

        $templateItem = new Item('Paginator content', 'blog/index.html', ['max_page' => 1]);
        $templateItem->setPath('blog/index.html', Item::SNAPSHOT_PATH_RELATIVE);

        $pageItems = $this->pagination->generateItems($templateItem, $collections);

        $this->assertTrue(is_array($pageItems));
        $this->assertCount(2, $pageItems);
        $this->assertContainsOnly('\Yosymfony\Spress\Core\DataSource\ItemInterface', $pageItems);

        $page1 = $pageItems[0];

        $this->assertEquals('blog/index.html', $page1->getPath(Item::SNAPSHOT_PATH_RELATIVE));
        $this->assertEquals('/blog', $page1->getPath(Item::SNAPSHOT_PATH_PERMALINK));
        $this->assertEquals('Paginator content', $page1->getContent());

        $attrPage1 = $page1->getAttributes();

        $this->assertArrayHasKey('pagination', $attrPage1);
        $this->assertArrayHasKey('items', $attrPage1['pagination']);
        $this->assertArrayHasKey('per_page', $attrPage1['pagination']);
        $this->assertArrayHasKey('total_items', $attrPage1['pagination']);
        $this->assertArrayHasKey('total_pages', $attrPage1['pagination']);
        $this->assertArrayHasKey('page', $attrPage1['pagination']);
        $this->assertArrayHasKey('previous_page', $attrPage1['pagination']);
        $this->assertArrayHasKey('previous_page_path', $attrPage1['pagination']);
        $this->assertArrayHasKey('previous_page_url', $attrPage1['pagination']);
        $this->assertArrayHasKey('next_page', $attrPage1['pagination']);
        $this->assertArrayHasKey('next_page_path', $attrPage1['pagination']);
        $this->assertArrayHasKey('next_page_url', $attrPage1['pagination']);

        $this->assertCount(1, $attrPage1['pagination']['items']);
        $this->assertEquals(1, $attrPage1['pagination']['per_page']);
        $this->assertEquals(2, $attrPage1['pagination']['total_items']);
        $this->assertEquals(2, $attrPage1['pagination']['total_pages']);
        $this->assertEquals(1, $attrPage1['pagination']['page']);
        $this->assertEquals(2, $attrPage1['pagination']['next_page']);
        $this->assertEquals('blog/page2/index.html', $attrPage1['pagination']['next_page_path']);
        $this->assertEquals('/blog/page2', $attrPage1['pagination']['next_page_url']);

        $this->assertNull($attrPage1['pagination']['previous_page']);
        $this->assertNull($attrPage1['pagination']['previous_page_path']);
        $this->assertNull($attrPage1['pagination']['previous_page_url']);

        $page2 = $pageItems[1];

        $this->assertEquals('blog/page2/index.html', $page2->getPath(Item::SNAPSHOT_PATH_RELATIVE));
        $this->assertEquals('/blog/page2', $page2->getPath(Item::SNAPSHOT_PATH_PERMALINK));
        $this->assertEquals('Paginator content', $page2->getContent());

        $attrPage2 = $page2->getAttributes();

        $this->assertArrayHasKey('pagination', $attrPage2);
        $this->assertArrayHasKey('items', $attrPage2['pagination']);
        $this->assertArrayHasKey('per_page', $attrPage2['pagination']);
        $this->assertArrayHasKey('total_items', $attrPage2['pagination']);
        $this->assertArrayHasKey('total_pages', $attrPage2['pagination']);
        $this->assertArrayHasKey('page', $attrPage2['pagination']);
        $this->assertArrayHasKey('previous_page', $attrPage2['pagination']);
        $this->assertArrayHasKey('previous_page_path', $attrPage2['pagination']);
        $this->assertArrayHasKey('previous_page_url', $attrPage2['pagination']);
        $this->assertArrayHasKey('next_page', $attrPage2['pagination']);
        $this->assertArrayHasKey('next_page_path', $attrPage2['pagination']);
        $this->assertArrayHasKey('next_page_url', $attrPage2['pagination']);

        $this->assertCount(1, $attrPage2['pagination']['items']);
        $this->assertEquals(1, $attrPage2['pagination']['per_page']);
        $this->assertEquals(2, $attrPage2['pagination']['total_items']);
        $this->assertEquals(2, $attrPage2['pagination']['total_pages']);
        $this->assertEquals(2, $attrPage2['pagination']['page']);
        $this->assertEquals(1, $attrPage2['pagination']['previous_page']);
        $this->assertEquals('blog/index.html', $attrPage2['pagination']['previous_page_path']);
        $this->assertEquals('/blog', $attrPage2['pagination']['previous_page_url']);

        $this->assertNull($attrPage2['pagination']['next_page']);
        $this->assertNull($attrPage2['pagination']['next_page_path']);
        $this->assertNull($attrPage2['pagination']['next_page_url']);
    }

    public function testPaginateWithCustomPermalink()
    {
        $post1 = new Item('Post 1', 'posts/2015-05-26-hi', []);
        $post2 = new Item('Post 2', 'posts/2015-05-26-welcome', []);

        $collections = [
            'posts' => [$post1, $post2],
        ];

        $templateItem = new Item('Paginator content', 'blog/index.html', ['max_page' => 1, 'permalink' => '/page:num.html']);
        $templateItem->setPath('blog/index.html', Item::SNAPSHOT_PATH_RELATIVE);

        $pageItems = $this->pagination->generateItems($templateItem, $collections);

        $this->assertTrue(is_array($pageItems));
        $this->assertCount(2, $pageItems);

        $page1 = $pageItems[0];
        $this->assertEquals('blog/page1.html', $page1->getPath(Item::SNAPSHOT_PATH_RELATIVE));
        $this->assertEquals('/blog/page1.html', $page1->getPath(Item::SNAPSHOT_PATH_PERMALINK));

        $page2 = $pageItems[1];
        $this->assertEquals('blog/page2.html', $page2->getPath(Item::SNAPSHOT_PATH_RELATIVE));
        $this->assertEquals('/blog/page2.html', $page2->getPath(Item::SNAPSHOT_PATH_PERMALINK));
    }

    public function testPaginateRootDir()
    {
        $post1 = new Item('Post 1', 'posts/2015-05-26-hi', []);
        $post2 = new Item('Post 2', 'posts/2015-05-26-welcome', []);

        $collections = [
            'posts' => [$post1, $post2],
        ];

        $templateItem = new Item('Paginator content', 'index.html', ['max_page' => 1]);
        $templateItem->setPath('index.html', Item::SNAPSHOT_PATH_RELATIVE);

        $pageItems = $this->pagination->generateItems($templateItem, $collections);

        $this->assertTrue(is_array($pageItems));
        $this->assertCount(2, $pageItems);

        $page1 = $pageItems[0];

        $this->assertEquals('index.html', $page1->getPath(Item::SNAPSHOT_PATH_RELATIVE));
        $this->assertEquals('/', $page1->getPath(Item::SNAPSHOT_PATH_PERMALINK));
        $this->assertEquals('Paginator content', $page1->getContent());

        $attrPage1 = $page1->getAttributes();

        $this->assertArrayHasKey('pagination', $attrPage1);
        $this->assertArrayHasKey('items', $attrPage1['pagination']);
        $this->assertArrayHasKey('per_page', $attrPage1['pagination']);
        $this->assertArrayHasKey('total_items', $attrPage1['pagination']);
        $this->assertArrayHasKey('total_pages', $attrPage1['pagination']);
        $this->assertArrayHasKey('page', $attrPage1['pagination']);
        $this->assertArrayHasKey('previous_page', $attrPage1['pagination']);
        $this->assertArrayHasKey('previous_page_path', $attrPage1['pagination']);
        $this->assertArrayHasKey('previous_page_url', $attrPage1['pagination']);
        $this->assertArrayHasKey('next_page', $attrPage1['pagination']);
        $this->assertArrayHasKey('next_page_path', $attrPage1['pagination']);
        $this->assertArrayHasKey('next_page_url', $attrPage1['pagination']);

        $this->assertCount(1, $attrPage1['pagination']['items']);
        $this->assertEquals(1, $attrPage1['pagination']['per_page']);
        $this->assertEquals(2, $attrPage1['pagination']['total_items']);
        $this->assertEquals(2, $attrPage1['pagination']['total_pages']);
        $this->assertEquals(1, $attrPage1['pagination']['page']);
        $this->assertEquals(2, $attrPage1['pagination']['next_page']);
        $this->assertEquals('page2/index.html', $attrPage1['pagination']['next_page_path']);
        $this->assertEquals('/page2', $attrPage1['pagination']['next_page_url']);

        $this->assertNull($attrPage1['pagination']['previous_page']);
        $this->assertNull($attrPage1['pagination']['previous_page_path']);
        $this->assertNull($attrPage1['pagination']['previous_page_url']);

        $page2 = $pageItems[1];

        $this->assertEquals('page2/index.html', $page2->getPath(Item::SNAPSHOT_PATH_RELATIVE));
        $this->assertEquals('/page2', $page2->getPath(Item::SNAPSHOT_PATH_PERMALINK));
        $this->assertEquals('Paginator content', $page2->getContent());

        $attrPage2 = $page2->getAttributes();

        $this->assertArrayHasKey('pagination', $attrPage2);
        $this->assertArrayHasKey('items', $attrPage2['pagination']);
        $this->assertArrayHasKey('per_page', $attrPage2['pagination']);
        $this->assertArrayHasKey('total_items', $attrPage2['pagination']);
        $this->assertArrayHasKey('total_pages', $attrPage2['pagination']);
        $this->assertArrayHasKey('page', $attrPage2['pagination']);
        $this->assertArrayHasKey('previous_page', $attrPage2['pagination']);
        $this->assertArrayHasKey('previous_page_path', $attrPage2['pagination']);
        $this->assertArrayHasKey('previous_page_url', $attrPage2['pagination']);
        $this->assertArrayHasKey('next_page', $attrPage2['pagination']);
        $this->assertArrayHasKey('next_page_path', $attrPage2['pagination']);
        $this->assertArrayHasKey('next_page_url', $attrPage2['pagination']);

        $this->assertCount(1, $attrPage2['pagination']['items']);
        $this->assertEquals(1, $attrPage2['pagination']['per_page']);
        $this->assertEquals(2, $attrPage2['pagination']['total_items']);
        $this->assertEquals(2, $attrPage2['pagination']['total_pages']);
        $this->assertEquals(2, $attrPage2['pagination']['page']);
        $this->assertEquals(1, $attrPage2['pagination']['previous_page']);
        $this->assertEquals('index.html', $attrPage2['pagination']['previous_page_path']);
        $this->assertEquals('/', $attrPage2['pagination']['previous_page_url']);

        $this->assertNull($attrPage2['pagination']['next_page']);
        $this->assertNull($attrPage2['pagination']['next_page_path']);
        $this->assertNull($attrPage2['pagination']['next_page_url']);
    }
}


text:
[![Build Status](https://travis-ci.org/iqrfsdk/clibspi-mcu.svg?branch=master)](https://travis-ci.org/iqrfsdk/clibspi-mcu)

IQRF SPI library for uC with TR-7x upload functionality.
Targeted for Arduino boards.

**Supported IQRF OS version of the TR-7x module:**

- IQRF OS v4.03D

## Documentation:

- please, refer to current IQRF Startup Package for updated IQRF SPI specification

## Integration
If the user wishes to use the services of the library, the files [```IQRF.c```](src/IQRF.c), [```IQRF.h```](src/IQRF.h), [```IQRFPgm.c```](src/IQRFPgm.c), [```IQRFPgm.h```](src/IQRFPgm.h), [```IQRFPort.cpp```](src/IQRFPort.cpp) and [```IQRFPort.h```](src/IQRFPort.h) must be included in user's project. If the user does not need programming features for the TR module, the files ```IQRFPgm.c``` and ```IQRFPgm.h``` are not required. The ```IQRFPort.cpp``` and ```IQRFPort.h``` files are platform-dependent and contain a platform interface for a platform-independent library core. If the library is used on a different platform than Arduino, the user must modify the ```IQRFPort.cpp``` and ```IQRFPort.h``` files for the platform used. The following macros and functions must be modified.

**MACROS**
-   ```#define iqrfGetSysTick()``` - Get the system timer value (SysTick)
-   ```#define TICKS_IN_SECOND``` - Frequency of the system timer in Hz
-   ```#define iqrfDelayMs(T)``` - Delay function. Time ```T``` in ms

**FUNCTIONS**
-   ```void iqrfKernelTimingInit(void)``` - Initialize timer to 1000us period. In interrupt service rutine of timer, call the IQRF SPI communication driver ```void iqrfDriver(void)```
-   ```void iqrfKernelTimingFastMode(void)``` - Change the timer period to 200us (time interval for fast SPI communication for TR-7xD modules)
-   ```void iqrfTrPowerOff(void)``` - Turn OFF power supply of TR module
-   ```void iqrfTrPowerOn(void)``` - Turn ON power supply of TR module
-   ```void iqrfTrEnterPgmMode(void)``` - Switch TR module to programming mode
-   ```uint8_t iqrfSendSpiByte(uint8_t Tx_Byte)``` - Send / receive one byte to / from TR module over SPI bus
-   ```void iqrfDeselectTRmodule(void)``` - Deactivate selection signal of TR module
-   ```uint8_t iqrfReadByteFromFile(void)``` - Read one byte from the currently open file, with the new code for TR module

## API functions
-   ```void iqrfInit(T_IQRF_RX_HANDLER UserIqrfRxHandler)``` - Initialize IQRF SPI communication library. ```UserIqrfRxHandler``` is pointer on the user's callback function to process the received packet
-   ```uint8_t iqrfSendData(uint8_t *DataBuffer, uint8_t DataLength)``` - The function sends the data packet to TR module via SPI interface. The user fills the ```DataBuffer``` with its data and defines size of data packet. The function must be called periodically, if returns code ```IQRF_OPERATION_IN_PROGRESS```. Periodically function calling is necessary end, when returns one of the following return codes:
    -   ```IQRF_OPERATION_OK``` - operation OK, data sent successfully
    -   ```IQRF_TR_MODULE_WRITE_ERR```  - operation ERROR, data not sent
    -   ```IQRF_WRONG_DATA_SIZE```  - operation ERROR, wrong data size specified
    -   ```IQRF_TR_MODULE_NOT_READY```  - operation ERROR, TR module is not ready

-   ```void iqrfSendPacket(uint8_t SpiCmd, uint8_t *UserDataBuffer, uint8_t UserDataLength)``` - The function will start the process of sending the packet to the TR module. The packet is sent in the background, by the IQRF SPI communications driver. The user set the ```SpiCmd``` command (see IQRF SPI specification), fills ```UserDataBuffer```  with its data and defines size of data packet. Before calling the function, check the IQRF broadcast buffer status. Use the ```uint8_t iqrfGetTxBufferStatus(void)``` function, to do this.
-   ```void iqrfSuspendDriver(void)``` - Temporary suspend IQRF SPI comunication driver
-   ```void iqrfRunDriver(void)``` - Run suspended IQRF SPI communication driver
-   ```void iqrfTrPowerOff(void)``` - Turn OFF power supply of TR module
-   ```void iqrfTrPowerOn(void)``` - Turn ON power supply of TR module
-   ```void iqrfTrReset(void)``` - Reset TR module
-   ```void iqrfTrEnterPgmMode(void)``` - Switch TR module to programming mode
-   ```void iqrfTrEndPgmMode(void)``` - End of programming mode
-   ```uint8_t iqrfGetSpiStatus(void)``` - Get SPI status of TR module (see IQRF SPI specification). Function returns one of the following return codes:
    -   ```NO_MODULE``` - SPI not working (HW error)
    -   ```SPI_DATA_TRANSFER```  - SPI data transfer in progress
    -   ```SPI_DISABLED```  - SPI not working (disabled)
    -   ```SPI_CRCM_OK```  - SPI not ready (full buffer, last CRCM ok)
    -   ```SPI_CRCM_ERR```  - SPI not ready (full buffer, last CRCM error)
    -   ```COMMUNICATION_MODE```  - SPI ready (communication mode)
    -   ```PROGRAMMING_MODE```  - SPI ready (programming mode)
    -   ```DEBUG_MODE```  - SPI ready (debugging mode)
    -   ```SPI_SLOW_MODE```  - SPI not working in background
    -   ```SPI_USER_STOP```  - state after stopSPI();

-   ```uint8_t iqrfGetLibraryStatus(void)``` - Get status of IQRF SPI communication library. Function returns one of the following return codes:
    -   ```IQRF_READY``` - IQRF communication library is ready
    -   ```IQRF_READ```  - IQRF communication library is busy, processing requests for reading
    -   ```IQRF_WRITE```  - IQRF communication library is busy, processing requests for witing

-   ```uint8_t iqrfGetTxBufferStatus(void)``` - Get status of TX buffer of IQRF SPI communication library. Function returns one of the following return codes:
    -   ```IQRF_BUFFER_FREE``` - Buffer is ready for new packet
    -   ```IQRF_BUFFER_BUSY```  - Buffer is bussy

-   ```uint16_t iqrfGetOsVersion(void)``` - Get TR module OS version
-   ```uint16_t iqrfGetOsBuild(void)``` - Get TR module OS build
-   ```uint32_t iqrfGetModuleId(void)``` - Get TR module ID
-   ```uint16_t iqrfGetMcuType(void)``` - Get TR module MCU type. Function returns one of the following return codes:
    -   ```MCU_UNKNOWN```
    -   ```PIC16LF819```
    -   ```PIC16LF88```
    -   ```PIC16F886```
    -   ```PIC16LF1938```

-   ```uint16_t iqrfGetModuleType(void)``` - Get TR module type. Function returns one of the following return codes:
    -   ```TR_52D```
    -   ```TR_58D_RJ```
    -   ```TR_72D```
    -   ```TR_53D```
    -   ```TR_54D```
    -   ```TR_55D```
    -   ```TR_56D```
    -   ```TR_76D```

-   ```uint16_t iqrfGetFccStatus(void)``` - Get TR module FCC status. Function returns one of the following return codes:
    -   ```FCC_NOT_CERTIFIED```
    -   ```FCC_CERTIFIED```

-   ```uint8_t iqrfGetModuleIbk(uint8_t Cnt)``` - Get specific byte of TR module IBK (Individual bonding key).

-   ```uint8_t iqrfGetModuleInfoRawData(uint8_t Cnt)``` - Get specific byte of TR module identification RAW data.

-   ```uint8_t iqrfPgmCheckCodeFile(void)``` - The function checking the format accuracy of the programing file. Use of this function you can to see in the [```Console.ino```](https://github.com/iqrfsdk/clibspi-mcu/blob/master/examples/Console/Console/Console.ino) example file. The user opens the programming file and fills the structure ```IQRF_PGM_FILE_INFO  CodeFileInfo``` with informations about  programming file. The function must be called periodically if it returns the code in the range 0 to 100. Periodically function calling is necessary end, when returns one of the following return codes:
    -   ```IQRF_PGM_SUCCESS``` - programming file is OK
    -   ```IQRF_PGM_ERROR```  - programming file format ERROR

-   ```uint8_t iqrfPgmWriteCodeFile(void)``` - The function writes the programing file to TR module. Use of this function you can to see in the [```Console.ino```](https://github.com/iqrfsdk/clibspi-mcu/blob/master/examples/Console/Console/Console.ino) example file. The user opens the programming file and fills the structure ```IQRF_PGM_FILE_INFO  CodeFileInfo``` with informations about  programming file. The function must be called periodically if it returns the code in the range 0 to 100. Periodically function calling is necessary end, when returns one of the following return codes:
    -   ```IQRF_PGM_SUCCESS``` - programming OK, file has been written successfully
    -   ```IQRF_PGM_ERROR```  - programming ERROR, file hasn't been written successfully

-   ```uint8_t iqrfPgmWriteKeyOrPass(uint8_t BufferContent, uint8_t *Buffer)``` - The function writes the USER PASSWORD or USER KEY to TR module. Use of this function you can to see in the [```Console.ino```](https://github.com/iqrfsdk/clibspi-mcu/blob/master/examples/Console/Console/Console.ino) example file. The user fills the 16 byte buffer with the USER PASSWORD or USER KEY and selects if the USER PASSWORD or USER KEY will be written. The function must be called periodically if it returns the code 0. Periodically function calling is necessary end, when returns one of the following return codes:
    -   ```IQRF_PGM_SUCCESS``` - programming OK, USER PASSWORD or USER KEY has been written successfully
    -   ```IQRF_PGM_ERROR```  - programming ERROR, USER PASSWORD or USER KEY hasn't been written successfully

## Console commands:

- `rst`: clears the screen
- `ls`: lists of files on the SD card
- `stat`: shows SPI status of the TR module (e.g. 0x80, 0x81 ...)
- `trrst`: resets of the TR module
- `trpwroff`: turns off the power of the TR module
- `trpwron`: turns on the power of the TR module
- `trinfo`: shows TR module info
- `trpgmmode`: switches TR module into programming mode
- `send string`: sends ASCII string to the TR module
- `pgm hex file.hex`: tests and uploads file `*.hex` into TR module
- `pgm iqrf file.iqrf`: tests and uploads file `*.iqrf` into TR module
- `pgm trcnfg file.trcnfg`: tests and uploads file `*.trcnfg` into TR module
- `pgm pass file.bin`: tests and uploads USER PASSWORD from file `*.bin` into TR module
- `pgm key file.bin`: tests and uploads USER KEY from file `*.bin` into TR module

## License
This library is licensed under Apache License 2.0:

 > Copyright 2015-2018 IQRF Tech s.r.o.
 >
 > 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.


text:
class Dijkstra

  def initialize
    @target_source_min_distance_path_hash = {}
    @analized_vertices = []
  end

  def analized?(vertex)
    @analized_vertices.include?(vertex)
  end

  def distance(a,b)
    if analized?(a)
      @target_source_min_distance_path_hash[b][a][:distance]
    else
      hash_tmp = target_source_min_distance_path_hash( a )
      return false unless hash_tmp[b][a]
      hash_tmp[b][a][:distance]
    end
  end

  def distance_one_to_n(one)
    if analized?(one)
      target_min_distance_hash(one)
    else
      target_source_min_distance_path_hash( one )
      target_min_distance_hash(one)
    end
  end

  def path(a,b)
    if analized?(a)
      @target_source_min_distance_path_hash[b][a][:path]
    else
      hash_tmp = target_source_min_distance_path_hash( a )
      return false unless hash_tmp[b][a]
      hash_tmp[b][a][:path]
    end
  end

  def path_one_to_n(one)
    if analized?(one)
      target_min_path_hash(one)
    else
      target_source_min_distance_path_hash( one )
      target_min_path_hash(one)
    end
  end

  def cluster(a,b,used_vertices=[])
    vertices = []
    n_path = path_one_to_n(a)
    return [] unless @target_source_min_distance_path_hash[b]
    interchange_vertices = n_path.values.flatten.uniq
    interchange_vertices.each do |vertex|
      path = @target_source_min_distance_path_hash[b][vertex][:path] if @target_source_min_distance_path_hash[b][vertex]
      next unless path
      vertices.concat(path)
    end

    vertices.uniq - used_vertices
  end

  def cluster_one_to_n(a)
    tmp = {}
    path_one_to_n(a).keys.each do |b|
      tmp[b] = cluster(a,b)
    end
    tmp
  end

#####################
  def target_source_min_distance_path_hash( vertex )
    # make start point
    target_source_min_distance_path_hash_init(vertex)

    out_edges = vertex.out_edges.sort{ |a,b| a.weight <=> b.weight }

    out_edges.each_with_index do |out_edge,index|
      target = out_edge.target
      unless airo_check_and_update(out_edge)
        next if analized?(target)

        target_source_min_distance_path_hash_init(target)

        target_out_edges = target.out_edges.sort{ |a,b| a.weight <=> b.weight }
        out_edges.concat(target_out_edges)

      end
    end
    @target_source_min_distance_path_hash
  end

  def target_source_min_distance_path_hash_init(vertex)
    @analized_vertices << vertex
    @target_source_min_distance_path_hash[vertex] ||= {}
    @target_source_min_distance_path_hash[vertex][vertex] ||= {}
    @target_source_min_distance_path_hash[vertex][vertex][:distance] = 0
    @target_source_min_distance_path_hash[vertex][vertex][:path]     = [vertex]
  end

  def airo_check_and_update(edge)
    airo = true
    pre_vertex = edge.source
    interchange = edge.target

    @target_source_min_distance_path_hash[interchange] ||={}
    @target_source_min_distance_path_hash[pre_vertex].each do |source,distance_path|
      next_distance = distance_path[:distance] + edge.weight
      @target_source_min_distance_path_hash[interchange][source] ||= {}
      if !@target_source_min_distance_path_hash[interchange][source][:distance] or @target_source_min_distance_path_hash[interchange][source][:distance] > next_distance
        airo = false
        @target_source_min_distance_path_hash[interchange][source][:distance]   = next_distance
        @target_source_min_distance_path_hash[interchange][source][:path]     ||= []
        @target_source_min_distance_path_hash[interchange][source][:path]       = distance_path[:path] + [interchange]

        target_min_distance_hash(interchange).each do |target,distance|
          @target_source_min_distance_path_hash[target][source] ||= {}
          if !@target_source_min_distance_path_hash[target][source][:distance] or @target_source_min_distance_path_hash[target][source][:distance] > distance + next_distance
            @target_source_min_distance_path_hash[target][source][:distance] = distance + next_distance
            @target_source_min_distance_path_hash[target][source][:path] =  distance_path[:path] + @target_source_min_distance_path_hash[target][interchange][:path]
          end
        end
      end
    end
    airo
  end

  def target_min_distance_hash(source)
    target_min_distance_hash = {}
    @target_source_min_distance_path_hash.each do |target,source_distance_path|
      target_min_distance_hash[target] = source_distance_path[source][:distance] if source_distance_path[source]
    end
    target_min_distance_hash
  end

  def target_min_path_hash(source)
    target_min_distance_hash = {}
    @target_source_min_distance_path_hash.each do |target,source_distance_path|
      target_min_distance_hash[target] = source_distance_path[source][:path] if source_distance_path[source]
    end
    target_min_distance_hash
  end
end


text:
@implementation PicoBoolConverter

-(NSString *)write:(NSNumber *)value withConfig:(PicoConfig *)config {
    if ([value boolValue]) {
        return @"true";
    } else {
        return @"false";
    }
}

-(NSNumber *)read:(NSString *)value withConfig:(PicoConfig *)config {
    NSString *lower = [value lowercaseString];
    NSNumber *result = nil;
    if ([lower isEqualToString:@"true"]) {
        result = @YES;
    } else if ([lower isEqualToString:@"1"]) {
        result = @YES;
    } else {
        result = @NO;
    }
    return result;
}

@end


text:
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>

<modulesynopsis metafile="perchild.xml.meta">

<name>perchild</name>
<description>Multi-Processing Module allowing for daemon processes serving
requests to be assigned a variety of different userids</description>
<status>MPM</status>
<sourcefile>perchild.c</sourcefile>
<identifier>mpm_perchild_module</identifier>

    <note type="warning">
      This module is not functional.  Development of this module is not
      complete and is not currently active.  Do not use
      <module>perchild</module> unless you are a programmer willing to
      help fix it.
    </note>

This Multi-Processing Module (MPM) implements a hybrid
    multi-process, multi-threaded web server. A fixed number of
    processes create threads to handle requests. Fluctuations in
    load are handled by increasing or decreasing the number of
    threads in each process.

<seealso>Setting which addresses and ports Apache
uses</seealso>

<title>How it works</title>

A single control process launches the number of child processes
    indicated by the <directive module="perchild">NumServers</directive>
    directive at server startup. Each child process creates threads as
    specified in the <directive module="mpm_common">StartThreads</directive> directive.
    The individual threads then
    listen for connections and serve them when they arrive.

Apache always tries to maintain a pool of <dfn>spare</dfn> or
    idle server threads, which stand ready to serve incoming
    requests. In this way, clients do not need to wait for new
    threads to be created. For each child process, Apache assesses
    the number of idle threads and creates or destroys threads to
    keep this number within the boundaries specified by
    <directive module="mpm_common">MinSpareThreads</directive>
    and <directive module="mpm_common">MaxSpareThreads</directive>.
    Since this process is very self-regulating, it is rarely
    necessary to modify these directives from their default values.
    The maximum number of clients that may be served simultaneously
    is determined by multiplying the number of server processes
    that will be created (<directive
    module="perchild">NumServers</directive>) by the maximum
    number of threads created in each process
    (<directive module="mpm_common">MaxThreadsPerChild</directive>).

While the parent process is usually started as root under
    Unix in order to bind to port 80, the child processes and
    threads are launched by Apache as a less-privileged user. The
    <directive module="mpm_common">User</directive> and <directive
    module="mpm_common">Group</directive> directives are used to
    set the privileges of the Apache child processes. The child
    processes must be able to read all the content that will be
    served, but should have as few privileges beyond that as
    possible. In addition, unless <program>suexec</program> is used,
    these directives also set the privileges which will be inherited
    by CGI scripts.

<directive module="mpm_common">MaxRequestsPerChild</directive>
    controls how frequently the
    server recycles processes by killing old ones and launching new
    ones.

<title>Working with different user-IDs</title>

The <module>perchild</module> MPM adds the extra ability to
      specify that particular processes should serve requests under
      different user-IDs. These user-IDs can then be associated with
      specific virtual hosts. You have to use one <directive
      module="perchild">ChildPerUserID</directive> directive for
      every user/group combination you want to be run. Then you can tie
      particular virtual hosts to that user and group IDs.

The following example runs 7 child processes. Two of them are run
      under user1/group1. The next four are run
      under user2/group2 and the remaining
      process uses the <directive module="mpm_common"
      >User</directive> and <directive module="mpm_common">Group</directive>
      of the main server:

      <example><title>Global config</title>
        NumServers 7

        ChildPerUserID user1 group1 2

        ChildPerUserID user2 group2 4
      </example>

Using unbalanced numbers of processes as above is useful, if the
      particular virtual hosts produce different load. The assignment to
      the virtual hosts is easily done as in the example below. In
      conclusion with the example above the following assumes, that
      server2 has to serve about twice of the hits of
      server1.

      <example><title>Example</title>
        NameVirtualHost *

        <VirtualHost *>

        <indent>
          ServerName fallbackhost

          # no assignment; use fallback

        </indent>
        </VirtualHost>

        <VirtualHost *>

        <indent>
          ServerName server1

          AssignUserID user1 group1

        </indent>
        </VirtualHost>

        <VirtualHost *>

        <indent>
          ServerName server2

          AssignUserID user2 group2

        </indent>
        </VirtualHost>
      </example>

<directivesynopsis location="mpm_common"><name>AcceptMutex</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>BS2000Account</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>CoreDumpDirectory</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>EnableExceptionHook</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>Group</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>PidFile</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>Listen</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>ListenBacklog</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>LockFile</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>MaxRequestsPerChild</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>MaxSpareThreads</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>MinSpareThreads</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>ScoreBoardFile</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>ReceiveBufferSize</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>SendBufferSize</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>ServerLimit</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>StartThreads</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>ThreadLimit</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>User</name>
</directivesynopsis>

<directivesynopsis>
<name>AssignUserID</name>
<description>Tie a virtual host to a user and group ID</description>
<syntax>AssignUserID <var>user-id</var> <var>group-id</var></syntax>
<contextlist><context>virtual host</context></contextlist>

<usage>

Tie a virtual host to a specific user/group combination. Requests
    addressed to the virtual host where this directive appears will be
    served by a process running with the specified user and group ID.

The user and group ID has to be assigned to a number of children
    in the global server config using the <directive module="perchild"
    >ChildPerUserID</directive> directive. See the section above for a
    configuration example.

</usage>
</directivesynopsis>

<directivesynopsis>
<name>ChildPerUserID</name>
<description>Specify user ID and group ID for a number of child
processes</description>
<syntax>ChildPerUserID <var>user-id</var> <var>group-id</var>
<var>num-children</var></syntax>
<contextlist><context>server config</context></contextlist>

<usage>

Specify a user ID and group ID for a number of child processes.
    The third argument, <var>num-children</var>, is the number of child
    processes to start with the specified user and group. It does
    not represent a specific child number. In order to use this
    directive, the server must be run initially as root.
    If you start the server as a non-root user, it will fail to change
    to the lesser privileged user.

If the total number of child processes, found by totaling all of the
    third arguments to all <directive>ChildPerUserID</directive> directives
    in the config file, is less than <directive module="perchild"
    >NumServers</directive>, then all remaining children will inherit the
    <directive module="mpm_common">User</directive> and <directive
    module="mpm_common">Group</directive> settings from the main server.
    See the section above for a configuration
    example.

    <note type="warning"><title>Security</title>

Don't set <var>user-id</var> (or <var>group-id</var>) to
      root unless you know exactly what you are doing, and
      what the dangers are.

    </note>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>MaxThreadsPerChild</name>
<description>Maximum number of threads per child process</description>
<syntax>MaxThreadsPerChild <var>number</var></syntax>
<default>MaxThreadsPerChild 64</default>
<contextlist><context>server config</context></contextlist>

<usage>

This directive sets the maximum number of threads that will be
    created in each child process. To increase this value beyond its
    default, it is necessary to change the value of the <directive
    module="mpm_common">ThreadLimit</directive> directive and stop and
    re-start the server.

</usage>
</directivesynopsis>

<directivesynopsis>
<name>NumServers</name>
<description>Total number of children alive at the same time</description>
<syntax>NumServers <var>number</var></syntax>
<default>NumServers 2</default>
<contextlist><context>server config</context></contextlist>

<usage>

The <directive>NumServers</directive> directive determines the number
    of children alive at the same time. This number should be large enough to
    handle the requests for the entire site. To increase this value beyond the
    value of 8, it is necessary to change the value of the
    <directive module="mpm_common">ServerLimit</directive> directive and stop
    and re-start the server. See the section above for a configuration example.

</usage>
</directivesynopsis>

</modulesynopsis>


text:
<?php

use yii\db\Schema;
use yii\db\Migration;

class m150202_073328_create_season_ticket_table extends Migration
{
    public function safeUp()
    {
        // MySql table options
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';

        //timetable table
        $this->createTable(
            '{{%season_ticket}}',
            [
                'id' => Schema::TYPE_PK,
                'title' => Schema::TYPE_STRING. '(80) NOT NULL',
                'description' => Schema::TYPE_STRING. '(255) NULL',
                'cost' => Schema::TYPE_DECIMAL. '(10,2) NOT NULL DEFAULT 0.00',
                'amount' => Schema::TYPE_INTEGER. " NULL COMMENT 'Количество занятий'",
                'limit_format' => Schema::TYPE_SMALLINT . "(1) NULL COMMENT 'Лимит формат - дни, недели, месяца... '",
                'limit_value' => Schema::TYPE_INTEGER . " NULL COMMENT 'лимит значение - максимальная длительность абонемента (зависит от формата).'",
            ],
            $tableOptions
        );

    }

    public function safeDown()
    {
        $this->dropTable('{{%season_ticket}}');
    }
}


text:
@implementation NSArray (Annex)

- (id)combineWithObject:(id)obj block:(id (^)(id, id))block
{
    id result = obj;
    for(id value in self)
        result = block(result, value);
    return result;
}

- (NSArray *)mapObjectsWithBlock:(id (^)(id object))block
{
    return [[self combineWithObject:[NSMutableArray arrayWithCapacity:[self count]] block:^NSMutableArray *(NSMutableArray *acc, id value) {
        [acc addObject:block(value)];
        return acc;
    }] copy];
}

- (NSArray *)withoutNulls
{
    NSArray* temp = [self arrayByRemovingObjectsOfClass:[NSNull class]];
    NSMutableArray* result = [NSMutableArray arrayWithCapacity:[temp count]];
    for(id obj in temp)
    {
        if([obj respondsToSelector:@selector(withoutNulls)])
            [result addObject:[obj withoutNulls]];
        else
            [result addObject:obj];
    }

    return [result copy];
}

- (NSArray *)arrayByRemovingObjectsOfClass:(Class)aClass
{
    NSMutableArray* results = [NSMutableArray array];

    for(id o in self)
    {
        if([o isKindOfClass:aClass] == NO)
            [results addObject:o];
    }

    return [results copy];
}

- (id)objectAtIndex:(NSUInteger)index ifKindOf:(Class)kind
{
    return [self objectAtIndex:index ifKindOf:kind defaultValue:nil];
}

- (id)objectAtIndex:(NSUInteger)index ifKindOf:(Class)kind defaultValue:(id)defaultValue
{
    if(self.count <= index)
    {
        return nil;
    }

    id obj = self[index];
    return [obj isKindOfClass:kind] ? obj : defaultValue;
}

#pragma mark - Type specific helpers

- (NSArray*)arrayAtIndex:(NSUInteger)index
{
    return [self arrayAtIndex:index defaultValue:@[]];
}

- (NSArray*)arrayAtIndex:(NSUInteger)index defaultValue:(NSArray*)defaultValue
{
    return [self objectAtIndex:index ifKindOf:[NSArray class] defaultValue:defaultValue];
}

- (NSDictionary*)dictionaryAtIndex:(NSUInteger)index
{
    return [self dictionaryAtIndex:index defaultValue:@{}];
}

- (NSDictionary*)dictionaryAtIndex:(NSUInteger)index defaultValue:(NSDictionary*)defaultValue
{
    return [self objectAtIndex:index ifKindOf:[NSDictionary class] defaultValue:defaultValue];
}

- (NSString*)stringAtIndex:(NSUInteger)index
{
    return [self stringAtIndex:index defaultValue:@""];
}

- (NSString*)stringAtIndex:(NSUInteger)index defaultValue:(NSString*)defaultValue
{
    return [self objectAtIndex:index ifKindOf:[NSString class] defaultValue:defaultValue];
}

- (NSNumber*)numberAtIndex:(NSUInteger)index
{
    return [self numberAtIndex:index defaultValue:nil];
}

- (NSNumber*)numberAtIndex:(NSUInteger)index defaultValue:(NSNumber*)defaultValue
{
    return [self objectAtIndex:index ifKindOf:[NSNumber class] defaultValue:defaultValue];
}

- (BOOL)boolAtIndex:(NSUInteger)index defaultValue:(BOOL)defaultValue
{
    NSNumber* defVal = @(defaultValue);
    return [[self objectAtIndex:index ifKindOf:[NSNumber class] defaultValue:defVal] boolValue];
}

- (NSDate*)dateAtIndex:(NSUInteger)index
{
    return [self dateAtIndex:index defaultValue:nil];
}

- (NSDate*)dateAtIndex:(NSUInteger)index defaultValue:(NSDate*)defaultValue
{
    return [self objectAtIndex:index ifKindOf:[NSDate class] defaultValue:defaultValue];
}

- (instancetype)filterObjectsUsingBlock:(BOOL (^)(id))block
{
    return [[self combineWithObject:[NSMutableArray array] block:^NSMutableArray*(NSMutableArray* array, id object) {
        if(block(object))
            [array addObject:object];
        return array;
    }] copy];
}

@end


text:
#ifndef ZBE_JSON_RESOURCES_LOADERS_JSONSPRITEOGLMODELSHEETLOADER_H_
#define ZBE_JSON_RESOURCES_LOADERS_JSONSPRITEOGLMODELSHEETLOADER_H_

#include <filesystem>
#include <fstream>
#include <iostream>

#include "ZBE/JSON/graphics/JSONGraphicsLoaders.h"
#include "ZBE/SDL/OGL/SDLOGLWindow.h"
#include "ZBE/resources/loaders/RsrcLoader.h"
#include "ZBE/resources/definitions.h"

#include "ZBE/factories/Factory.h"

#include "ZBE/core/system/system.h"

namespace zbe {

/** \brief JSON loader for SimpleModelOGLModelSheet's
*/
class ZBEAPI JSONSpriteOGLModelSheetLoader : public RsrcLoader {
public:

 /** \brief Empty constructir. Creted object needs to be setup
  */
//JSONSpriteOGLModelSheetLoader() = default;
 /* \brief It sets up the window to be used.
 */
 void setWindow(std::shared_ptr<SDLOGLWindow> window) {
   this->window = window;
 }

 /** \brief Load an image
  *  \param filePath Path to image file.
  *  \return An id to the image loaded.
  */
 void load(std::filesystem::path filePath);

 /** \brief Tells if a file extension is loadable.
  *  \param extension Image file extension.
  *  \return True if the extensions is loadable.
  */
 bool isLoadable(std::filesystem::path extension) {
   static const std::filesystem::path ext(".json");
   return (ext.compare(extension) == 0);
 }

private:
  std::shared_ptr<SDLOGLWindow> window = nullptr;
  RsrcStore<OGLModelSheet<uint64_t, Vector2D, Vector2D>> &rsrcModelSheet = RsrcStore<OGLModelSheet<uint64_t, Vector2D, Vector2D>>::getInstance();
  RsrcStore<ImgDef> &rsrcImgDef = RsrcStore<ImgDef>::getInstance();
  NameRsrcDictionary& nrd = NameRsrcDictionary::getInstance();
};

class JSONSpriteOGLModelSheetLoaderFtry : virtual public Factory {
public:

  /** \brief Builds a JSONSpriteOGLModelSheetLoader.
   *  \param name Name for the created JSONSpriteOGLModelSheetLoader.
   *  \param cfgId JSONSpriteOGLModelSheetLoader's configuration id.
   */
  void create(std::string name, uint64_t cfgId){
    using namespace std::string_literals;
    auto jsoglmsl = std::make_shared<JSONSpriteOGLModelSheetLoader>();
    rsrclRsrc.insert("RsrcLoader."s + name, jsoglmsl);
    jsoglmslRsrc.insert("JSONSpriteOGLModelSheetLoader."s + name, jsoglmsl);
  }

  /** \brief Setup the desired tool. The tool will be complete after this step.
   *  \param name Name of the tool.
   *  \param cfgId Tool's configuration id.
   */
  void setup(std::string name, uint64_t cfgId){
    using namespace std::string_literals;
    using namespace nlohmann;
    std::shared_ptr<json> cfg = configRsrc.get(cfgId);

    if(cfg) {
      auto j = *cfg;
      json window = j["window"];
      if(!window.is_string()) {
        SysError::setError("Bad config for JSONSpriteOGLModelSheetLoaderFtry - window."s + window.get<std::string>());
        return;
      }

      auto winname = j["window"].get<std::string>();
      auto win = sdlOGLWindowRsrc.get("SDLOGLWindow."s + winname);

      auto jsoglmsl = jsoglmslRsrc.get("JSONSpriteOGLModelSheetLoader."s + name);
      jsoglmsl->setWindow(win);
    } else {
      SysError::setError("JSONSpriteOGLModelSheetLoaderFtry config for "s + name + " not found."s);
    }
  }

private:
  RsrcStore<nlohmann::json> &configRsrc = RsrcStore<nlohmann::json>::getInstance();
  RsrcStore<SDLOGLWindow> &sdlOGLWindowRsrc = RsrcStore<SDLOGLWindow>::getInstance();
  RsrcStore<JSONSpriteOGLModelSheetLoader> &jsoglmslRsrc = RsrcStore<JSONSpriteOGLModelSheetLoader>::getInstance();
  RsrcStore<RsrcLoader> &rsrclRsrc = RsrcStore<RsrcLoader>::getInstance();

};

}  // namespace zbe

#endif  // ZBE_JSON_RESOURCES_LOADERS_JSONSPRITEOGLMODELSHEETLOADER_H_


text:
package org.jetbrains.jps.builders.java;

import com.intellij.util.PathUtil;
import org.jetbrains.jps.builders.JpsBuildTestCase;
import org.jetbrains.jps.model.java.JavaSourceRootType;
import org.jetbrains.jps.model.java.JpsJavaExtensionService;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.module.JpsModuleDependency;
import org.jetbrains.jps.util.JpsPathUtil;

/**
 * @author nik
 */
public class DependentModulesCompilationTest extends JpsBuildTestCase {
  public void testSimpleDependency() {
    String depRoot = PathUtil.getParentPath(createFile("dep/A.java", "class A{}"));
    String mainRoot = PathUtil.getParentPath(createFile("main/B.java", "class B extends A{}"));
    JpsModule main = addModule("main", mainRoot);
    JpsModule dep = addModule("dep", depRoot);
    main.getDependenciesList().addModuleDependency(dep);
    rebuildAllModules();
  }

  public void testTestOnProductionDependency() {
    String depRoot = PathUtil.getParentPath(createFile("dep/A.java", "class A{}"));
    String testRoot = PathUtil.getParentPath(createFile("test/B.java", "class B extends A{}"));
    JpsModule main = addModule("main");
    main.addSourceRoot(JpsPathUtil.pathToUrl(testRoot), JavaSourceRootType.TEST_SOURCE);
    JpsModule dep = addModule("dep", depRoot);
    main.getDependenciesList().addModuleDependency(dep);
    rebuildAllModules();
  }

  public void testTransitiveDependencyViaDummyModule() {
    String depRoot = PathUtil.getParentPath(createFile("dep/A.java", "class A{}"));
    String mainRoot = PathUtil.getParentPath(createFile("main/B.java", "class B extends A{}"));
    JpsModule main = addModule("main", mainRoot);
    JpsModule dep = addModule("dep", depRoot);
    JpsModule dummy = addModule("dummy");
    JpsModule dummy2 = addModule("dummy2");
    dep.getDependenciesList().addModuleDependency(main);//force 'main' to be built before 'dep' unless transitive dependency is correctly considered
    main.getDependenciesList().addModuleDependency(dummy);
    addExportedDependency(dummy, dummy2);
    addExportedDependency(dummy2, dep);
    dummy2.getDependenciesList().addModuleDependency(dummy);
    rebuildAllModules();
  }

  private static void addExportedDependency(JpsModule main, JpsModule dep) {
    JpsModuleDependency dependency = main.getDependenciesList().addModuleDependency(dep);
    JpsJavaExtensionService.getInstance().getOrCreateDependencyExtension(dependency).setExported(true);
  }
}