text:
package money.machine

import Akka._

import akka.http.scaladsl.Http
import akka.http.scaladsl.model.HttpRequest
import akka.http.scaladsl.unmarshalling.Unmarshal
import money.machine.ExchangeBalances.Balances
import money.machine.ExchangeRate.SOME_EXCHANGE
import spray.json.{RootJsonFormat, pimpString}

import scala.collection._
import scala.concurrent.duration.DurationLong
import scala.concurrent.{Await, Future}

// @forma.tter:off
object Bittrex extends adapter.Bittrex
object Cryptopia extends adapter.Cryptopia
object Poloniex extends adapter.Poloniex
object HitBtc extends adapter.HitBtc

/**
  * api for crypto exchanges / plugin structure for exchange adapters
  */
object Exchange {

  final val exchanges: List[SOME_EXCHANGE] = List[SOME_EXCHANGE](Cryptopia, Poloniex, Bittrex, HitBtc)
}

trait Exchange[E<:Exchange[E]] {

  val debug = false

  type OrderBookResponseType
  implicit val orderBookResponseFormat: RootJsonFormat[OrderBookResponseType]
  type BalancesResponseType
  implicit val balancesResponseFormat: RootJsonFormat[BalancesResponseType]
  type PlaceOrderResponseType
  implicit val placeOrderResponseFormat: RootJsonFormat[PlaceOrderResponseType]
  type CancelOrderResponseType
  implicit val cancelOrderResponseFormat: RootJsonFormat[CancelOrderResponseType]
  type OpenOrdersResponseType
  implicit val openOrdersResponseFormat: RootJsonFormat[OpenOrdersResponseType]

  def currencies: immutable.Seq[Currency] = tokens.collect{ case c:Currency => c }
  def coins: immutable.Seq[Coin] = tokens.collect{ case c:Coin => c }
  def tokens: immutable.Seq[Token]
  def supports(symbol: Token): Boolean = tokens.contains(symbol)

  def tradeRateLimit = Percent(0.8)

  def maxTradePrice[CC<:Currency](cc:CC): Price[CC] = cc match {
    case _:BTC.type => Price(0.025, cc)
  }

  def minTradePrice[CC<:Currency](cc:CC): Price[CC] = cc match {
    case _:BTC.type => Price(0.0002, cc)
  }

  def minCoinTradeVolume[C<:Coin,CC<:Currency](priceRate: PriceRate[C,CC]): TradeVolume[C, CC] =
    priceRate.coinVolume(minTradePrice(priceRate.currency))

  def maxCoinTradeVolume[C<:Coin,CC<:Currency](priceRate: PriceRate[C,CC]): TradeVolume[C, CC] =
    priceRate.coinVolume(maxTradePrice(priceRate.currency))

  def coinVolumeRange[C<:Coin,CC<:Currency](c:C,cc:CC): CoinVolumeRange[C,CC] = {
    val priceRate: PriceRate[C,CC] = Await.result(this.priceRate(c,cc), 10 seconds)
    CoinVolumeRange(minCoinTradeVolume(priceRate), maxCoinTradeVolume(priceRate))
  }

  def request(request: HttpRequest): Future[String] =
    Http()
      .singleRequest(request)
      .flatMap(r => Unmarshal(r.entity).to[String])
      .map { s =>
        if (debug) println(s)
        s
      }

  def orderBookRequest: Coin => Currency => HttpRequest
  def toOrderBook[C<:Coin, CC<:Currency](coin: C, currency: CC)(response: OrderBookResponseType): OrderBook[E,C,CC]
  def orderBook[C<:Coin, CC<:Currency](coin: C, currency: CC): Future[OrderBook[E,C,CC]] = {
    assert(supports(coin))
    assert(supports(currency))

    request(orderBookRequest(coin)(currency))
      .map(_.parseJson.convertTo[OrderBookResponseType])
      .map(toOrderBook(coin, currency))
  }

  /** highest bid price rate */
  def priceRate[C<:Coin, CC<:Currency](coin: C, currency: CC): Future[PriceRate[C,CC]] =
    orderBook(coin, currency).map(ob => ob.bids.head.volume.priceRate)

  def balancesRequest: HttpRequest

  def toBalances: BalancesResponseType => Balances

  def balances: Future[Balances] =
    request(balancesRequest)
      .map(s => s.parseJson.convertTo[BalancesResponseType])
      .map(toBalances)

  def toOrderId[C<:Coin, CC<:Currency]: (C,CC) => PlaceOrderResponseType => OrderId[E,C,CC]

  private def cancelIfNotFilled[C<:Coin, CC<:Currency](orderId: OrderId[E,C,CC]): Unit = {
    for {
      openOrders <- openOrders(orderId.coin, orderId.currency)
      if orderId.id != "-" && openOrders.contains(orderId)
      _ <- cancel(orderId)
    } yield ()
  }

  def placeOrderRequest[C<:Coin, CC<:Currency](order: NewOrder[E,C,CC]): HttpRequest

  def place[C<:Coin, CC<:Currency](order: NewOrder[E,C,CC], immediateFillOrCancel: Boolean = false): Future[OrderId[E,C,CC]] = {
    assert(supports(order.coin))
    assert(supports(order.currency))

    val orderId = request(placeOrderRequest(order))
      .map(s => s.parseJson.convertTo[PlaceOrderResponseType])
      .map(toOrderId(order.coin, order.currency))

    orderId.map { orderId =>
      if (immediateFillOrCancel) {
        // cancel eventually
        Akka.actorSystem.scheduler.scheduleOnce(delay = 10 seconds)(cancelIfNotFilled(orderId))
      }
      orderId
    }
  }

  def cancelOrderRequest[C<:Coin, CC<:Currency](orderId: OrderId[E,C,CC]): HttpRequest

  def cancelOrderSuccess: CancelOrderResponseType => Boolean

  def cancel[C<:Coin, CC<:Currency](orderId: OrderId[E,C,CC]): Future[Boolean] = {
    if (orderId.id == "-") Future { true } // was filled immediately
    else request(cancelOrderRequest(orderId))
      .map(s => s.parseJson.convertTo[CancelOrderResponseType])
      .map(cancelOrderSuccess)
  }

  def openOrdersRequest[C<:Coin, CC<:Currency](coin: C, currency: CC): HttpRequest

  def toOrderIds[C<:Coin, CC<:Currency]: (C,CC) => OpenOrdersResponseType => immutable.Seq[OrderId[E,C,CC]]

  def openOrders[C<:Coin, CC<:Currency](coin: C, currency: CC): Future[immutable.Seq[OrderId[E,C,CC]]] = {
    assert(supports(coin))
    assert(supports(currency))

    request(openOrdersRequest(coin, currency))
      .map(s => s.parseJson.convertTo[OpenOrdersResponseType])
      .map(toOrderIds(coin, currency))
  }

  override def toString: String = this.getClass.getSimpleName.split("\\$").last
}


text:
local function getPlayerID(plr)
    local c=getElementData(client,"character")
    if not c or not c.id then return nil end
    return tonumber(c.id)
end

addEvent("onRequestBankPermission", true)
addEventHandler("onRequestBankPermission", resourceRoot, function()
        local c=getElementData(client,"character")
        if not c or not c.id then
            triggerClientEvent(client,"doFillATMInfo", resourceRoot, false)
            return
        end
        local dbid=tonumber(getElementData(client,"auth:uid"))
        if not dbid then
            triggerClientEvent(client,"doFillATMInfo", resourceRoot, false)
            return
        end
        local sr=exports["psz-mysql"]:pobierzWyniki("SELECT bank_money FROM psz_postacie WHERE userid="..(tonumber(dbid) or 0).." LIMIT 1")
        if not sr or not sr.bank_money then
            triggerClientEvent(client,"doFillATMInfo", resourceRoot, false)
            return
        end
        triggerClientEvent(client,"doFillATMInfo", resourceRoot, true, tonumber(sr.bank_money))
    end)

addEvent("doATMOperation", true)
addEventHandler("doATMOperation", resourceRoot, function(kwota)
        if kwota>0 and kwota>getPlayerMoney(client) then return end -- komunikat bledu po stronie klienta
        local dbid=getElementData(client,"auth:uid")
        if not dbid then return end -- nie powinno sie zdarzyc

        if kwota>0 then

            if getPlayerMoney(client)<kwota then return end

            takePlayerMoney(client, kwota)
            exports["psz-mysql"]:zapytanie("UPDATE psz_postacie SET bank_money=bank_money+"..(tonumber(kwota) or 0).." WHERE userid="..tonumber(dbid).." LIMIT 1")
            exports["psz-admin"]:gameView_add("BANK wplata "..getPlayerName(client).."/"..dbid.."/"..getPlayerSerial(client).." kwota "..kwota.."$")

        elseif kwota<0 then

            local sr=exports["psz-mysql"]:pobierzWyniki("SELECT `bank_money` FROM `psz_postacie` WHERE userid="..tonumber(dbid).." LIMIT 1")
            if not sr or not sr.bank_money then return end -- nie opwinno sie wydarzyc
            sr.bank_money=tonumber(sr.bank_money)
            if (sr.bank_money<math.abs(kwota)) then
                outputChatBox("Nie masz tyle środków na koncie!", client, 255,0,0)
                return
            end

            exports["psz-mysql"]:zapytanie("UPDATE psz_postacie SET bank_money=bank_money-"..math.abs(tonumber(kwota)).." WHERE userid="..tonumber(dbid).." LIMIT 1")
            exports["psz-admin"]:gameView_add("BANK wyplata "..getPlayerName(client).."/"..dbid.."/"..getPlayerSerial(client).." kwota "..kwota.."$")
            givePlayerMoney(client, math.abs(kwota))
        end

    end)

redpajama_set_name: RedPajamaGithub


text:
import json
import logging

from kubeflow.testing import ks_util, test_util, util
from kubeflow.tf_operator import test_runner, tf_job_client
from kubeflow.tf_operator import util as tf_operator_util
from kubernetes import client as k8s_client

TFJOB_COMPONENT_NAME = "distributed_training"

class DistributedTrainingJobTests(test_util.TestCase):

  def __init__(self, args):
    namespace, name, env = test_runner.parse_runtime_params(args)
    self.app_dir = args.app_dir
    self.env = env
    self.namespace = namespace
    self.tfjob_version = args.tfjob_version
    self.params = args.params
    super(DistributedTrainingJobTests, self).__init__(
      class_name="DistributedTrainingJobTests", name=name)

  # Run a distributed training TFJob, wait for it to complete, and check for pod/service
  # creation errors.
  def run_distributed_training_job(self, component):
    tf_operator_util.load_kube_config()
    api_client = k8s_client.ApiClient()

    # Setup the ksonnet app
    tf_operator_util.setup_ks_app(self.app_dir, self.env, self.namespace, component,
                         self.params)

    # Create the TF job
    ks_cmd = ks_util.get_ksonnet_cmd(self.app_dir)
    util.run([ks_cmd, "apply", self.env, "-c", component], cwd=self.app_dir)
    logging.info("Created job %s in namespaces %s", self.name, self.namespace)

    # Wait for the job to either be in Running state or a terminal state
    logging.info("Wait for conditions Running, Succeeded, or Failed")
    results = tf_job_client.wait_for_condition(
      api_client,
      self.namespace,
      self.name, ["Running", "Succeeded", "Failed"],
      version=self.tfjob_version,
      status_callback=tf_job_client.log_status)
    logging.info("Current TFJob:\n %s", json.dumps(results, indent=2))

    # Wait for the job to complete.
    logging.info("Waiting for job to finish.")
    results = tf_job_client.wait_for_job(
      api_client,
      self.namespace,
      self.name,
      self.tfjob_version,
      status_callback=tf_job_client.log_status)
    logging.info("Final TFJob:\n %s", json.dumps(results, indent=2))

    if not tf_job_client.job_succeeded(results):
      self.failure = "Job {0} in namespace {1} in status {2}".format(
        self.name, self.namespace, results.get("status", {}))
      logging.error(self.failure)
      return

    # Check for creation failures.
    creation_failures = tf_job_client.get_creation_failures_from_tfjob(
      api_client, self.namespace, results)
    if creation_failures:
      logging.warning(creation_failures)

    # Delete the TFJob.
    tf_job_client.delete_tf_job(
      api_client, self.namespace, self.name, version=self.tfjob_version)
    logging.info("Waiting for job %s in namespaces %s to be deleted.",
                 self.name, self.namespace)
    tf_job_client.wait_for_delete(
      api_client,
      self.namespace,
      self.name,
      self.tfjob_version,
      status_callback=tf_job_client.log_status)

  # Run a distributed training TFJob, wait for it to complete, and check for pod/service
  # creation errors.
  def test_distributed_training_independent_worker(self):
    self.run_distributed_training_job(TFJOB_COMPONENT_NAME + "_" +
                                      self.tfjob_version)

if __name__ == "__main__":
  test_runner.main(module=__name__)


text:
/*
	runif runs commands only when a given environment variable is set.

		Usage:
		  runif [OPTIONS] Key Command Args...

		Application Options:
		  -d, --delay-exit=SECONDS    Delay program exit by this many seconds when command does not get run (0)
		  -e, --exit-with-error       Exit with non-zero exit status when Key is unset or false (false)

		Help Options:
		  -h, --help                  Show this help message

		Arguments:
		  Key:                        The name of the environment variable that must be true in order for command to be run
		  Command:                    The command to run
		  Args:                       Arguments to pass to command
*/
package main

import (
	"fmt"
	"github.com/jessevdk/go-flags"
	"os"
	"os/exec"
	"path"
	"runtime"
	"strings"
	"syscall"
	"time"
)

const VERSION = "1.0.1"

var opts struct {
	DelayExit     int    `short:"d" long:"delay-exit" default:"0" value-name:"SECONDS" description:"Delay program exit by this many seconds when command does not get run"`
	ExitWithError bool   `short:"e" long:"exit-with-error" default:"false" description:"Exit with non-zero exit status when Key is unset or false"`
	Version       func() `short:"v" long:"version" description:"Display version information"`

	Positional struct {
		Key     string   `description:"The name of the environment variable that must be true in order for command to be run"`
		Command string   `description:"The command to run"`
		Args    []string `description:"Arguments to pass to command"`
	} `positional-args:"yes" required:"yes"`
}

// ParseFlags parses the argument flags passed to the program
// or exits accordingly if parsing fails.
func ParseFlags() {
	_, err := flags.Parse(&opts)
	if err != nil {
		e := err.(*flags.Error)
		switch e.Type {
		case flags.ErrTag:
			// ErrTag means you have messed up the tags in the opts struct
			panic(e.Message)
		case flags.ErrHelp:
			// ErrHelp means -h or --help was passed.
			os.Exit(0)
		default:
			os.Exit(1)
		}
	}
}

// ExecCommand executes the given command with given arguments.
// Program execution will terminate with an appropriate error if the command
// cannot be executed.
func ExecCommand(command string, args []string) {
	binary, err := exec.LookPath(command)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}

	args = append([]string{command}, args...)
	err = syscall.Exec(binary, args, os.Environ())
	if err != nil {
		panic(err)
	}
}

// IsTruthy returns true if the value of s is truthy.
// Truthy is determined to be the values "1", "yes" and "true" in any variation
// of capitalization.
func IsTruthy(s string) bool {
	upper := strings.ToUpper(s)
	return (upper == "YES" || upper == "TRUE" || upper == "1")
}

func init() {
	opts.Version = func() {
		fmt.Printf(
			"%s version %s (compiled with %s for %s/%s)\n",
			path.Base(os.Args[0]), VERSION, runtime.Version(), runtime.GOOS, runtime.GOARCH,
		)
		os.Exit(0)
	}
}

func main() {
	ParseFlags()

	if IsTruthy(os.Getenv(opts.Positional.Key)) {
		ExecCommand(opts.Positional.Command, opts.Positional.Args)
	} else {
		time.Sleep(time.Duration(opts.DelayExit) * time.Second)
		if opts.ExitWithError {
			os.Exit(1)
		}
	}
}


text:
Repo Organization
=================
Our repo relies heavily on templates and automation tools/scripts. This means a lot of content in the repo is generated for viewing only. With certain exceptions as explained below, you will either make changes to templates or the template data bindings.

Folder Structure
----------------
Our repos are constructed and maintained using [PowerBuild](https://buildcenter.github.io/powerbuild). For example, a C# repo will have a structure that resembles this:

```
README.md
icon.png
LICENSE.txt
THIRD-PARTY-LICENSE.txt
Build.cmd
build.sh
Docs/
    README.md
    ...
    conceptual/
        ...
    api/
        ...
Source/
    global.bsd
    BuildOrder.ini
    buildnum.ini
    myproject1
        project.bsd
        Embed/
            ...
        Properties
            StringData.csv
        Source/
            Class1.cs
            ...
        Templates/
            mytemplate.pstmpl
            ...
        Resources/
            ...
    myproject1.Tests
        project.bsd
        Embed/
            ...
        Properties
            StringData.csv
        Source/
            Class1.cs
            ...
        Templates/
            mytemplate.pstmpl
            ...
        Resources/
            ...
Tools/
    BuildScript/
        ...
    PowerBuild/
        ...
```

Important paths
---------------
The build process assumed a couple of paths when building .NET projects. You can change them by modifying
the file 'Tools/BuildScript/configs/path.bsd'. Remember to use forward slash `/`, not backslash `\`.

- E:/bin/dotnetcore/1.0.4
  - Location of .NETCore SDK 1.0.4
  - Variable name: `DotNetCoreDir`
- E:/Credentials/builder/EcmaPrivateKey.snk
  - Strong name key (private) for signing projects.
  - Variable name: `CredentialDir`
  - Note: You can modify the folder path, but the filename is hardcoded.
- E:/Credentials/builder/EcmaPublicKey.snk
  - Strong name key (public) for signing projects.
  - Variable name: `CredentialDir`
  - Note: You can modify the folder path, but the filename is hardcoded.
- E:/Credentials/builder/NugetPushApi.json
  - NuGet API key for publishing packages built.
  - Variable name: `CredentialDir`
  - Note: You can modify the folder path, but the filename is hardcoded.
- E:/pkgs/nuget
  - Will download (restore) packages required by projects here.
  - Variable name: `WorkingPkgDir`
- E:/pkgs/nuget-local
  - Will copy output packages to this folder (release/publish mode)
  - Variable name: `LocalPackageOutputDir`

*Last updated on 24 May, 2017*


text:
package org.springframework.security.ldap.authentication;

import static org.junit.Assert.*;

import org.junit.*;
import org.springframework.ldap.core.DirContextOperations;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.SpringSecurityMessageSource;
import org.springframework.security.ldap.AbstractLdapIntegrationTests;
import org.springframework.security.ldap.search.FilterBasedLdapUserSearch;

/**
 * Tests for {@link BindAuthenticator}.
 *
 * @author Luke Taylor
 */
public class BindAuthenticatorTests extends AbstractLdapIntegrationTests {
    //~ Instance fields ================================================================================================

    private BindAuthenticator authenticator;
    private Authentication bob;

    //~ Methods ========================================================================================================

    @Before
    public void setUp() {
        authenticator = new BindAuthenticator(getContextSource());
        authenticator.setMessageSource(new SpringSecurityMessageSource());
        bob = new UsernamePasswordAuthenticationToken("bob", "bobspassword");

    }

    @Test(expected=BadCredentialsException.class)
    public void emptyPasswordIsRejected() {
        authenticator.authenticate(new UsernamePasswordAuthenticationToken("jen", ""));
    }

    @Test
    public void testAuthenticationWithCorrectPasswordSucceeds() {
        authenticator.setUserDnPatterns(new String[] {"uid={0},ou=people", "cn={0},ou=people"});

        DirContextOperations user = authenticator.authenticate(bob);
        assertEquals("bob", user.getStringAttribute("uid"));
        authenticator.authenticate(new UsernamePasswordAuthenticationToken("mouse, jerry", "jerryspassword"));
    }

    @Test
    public void testAuthenticationWithInvalidUserNameFails() {
        authenticator.setUserDnPatterns(new String[] {"uid={0},ou=people"});

        try {
            authenticator.authenticate(new UsernamePasswordAuthenticationToken("nonexistentsuser", "password"));
            fail("Shouldn't be able to bind with invalid username");
        } catch (BadCredentialsException expected) {}
    }

    @Test
    public void testAuthenticationWithUserSearch() throws Exception {
        //DirContextAdapter ctx = new DirContextAdapter(new DistinguishedName("uid=bob,ou=people"));
        authenticator.setUserSearch(new FilterBasedLdapUserSearch("ou=people", "(uid={0})", getContextSource()));
        authenticator.afterPropertiesSet();
        authenticator.authenticate(bob);
        // SEC-1444
        authenticator.setUserSearch(new FilterBasedLdapUserSearch("ou=people", "(cn={0})", getContextSource()));
        authenticator.authenticate(new UsernamePasswordAuthenticationToken("mouse, jerry", "jerryspassword"));
        authenticator.authenticate(new UsernamePasswordAuthenticationToken("slash/guy", "slashguyspassword"));
        // SEC-1661
        authenticator.setUserSearch(new FilterBasedLdapUserSearch("ou=\\\"quoted people\\\"", "(cn={0})", getContextSource()));
        authenticator.authenticate(new UsernamePasswordAuthenticationToken("quote\"guy", "quoteguyspassword"));
        authenticator.setUserSearch(new FilterBasedLdapUserSearch("", "(cn={0})", getContextSource()));
        authenticator.authenticate(new UsernamePasswordAuthenticationToken("quote\"guy", "quoteguyspassword"));
    }
/*
    @Test
    public void messingWithEscapedChars() throws Exception {
        Hashtable<String,String> env = new Hashtable<String,String>();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
        env.put(Context.PROVIDER_URL, "ldap://127.0.0.1:22389/dc=springsource,dc=com");
        env.put(Context.SECURITY_AUTHENTICATION, "simple");
        env.put(Context.SECURITY_PRINCIPAL, "cn=admin,dc=springsource,dc=com");
        env.put(Context.SECURITY_CREDENTIALS, "password");

        InitialDirContext idc = new InitialDirContext(env);
        SearchControls searchControls = new SearchControls();
        searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE);
        DistinguishedName baseDn = new DistinguishedName("ou=\\\"quoted people\\\"");
        NamingEnumeration<SearchResult> matches = idc.search(baseDn, "(cn=*)", new Object[] {"quoteguy"}, searchControls);

        while(matches.hasMore()) {
            SearchResult match = matches.next();
            DistinguishedName dn = new DistinguishedName(match.getName());
            System.out.println("**** Match: " + match.getName() + " ***** " + dn);

        }
    }
*/
    @Test
    public void testAuthenticationWithWrongPasswordFails() {
        authenticator.setUserDnPatterns(new String[] {"uid={0},ou=people"});

        try {
            authenticator.authenticate(new UsernamePasswordAuthenticationToken("bob", "wrongpassword"));
            fail("Shouldn't be able to bind with wrong password");
        } catch (BadCredentialsException expected) {}
    }

    @Test
    public void testUserDnPatternReturnsCorrectDn() {
        authenticator.setUserDnPatterns(new String[] {"cn={0},ou=people"});
        assertEquals("cn=Joe,ou=people", authenticator.getUserDns("Joe").get(0));
    }
}


text:
import React from 'react'
import {Product} from '../'

const ProductList = ({products, compare}) =>
  <div className="row mt-3">
      {products.map(product =>
        <Product key={product.id} product={product} compare={compare} />
      )}
  </div>;

export default ProductList


text:
/*!
\ingroup PkgBoxIntersectionDConcepts
\cgalConcept

The `BoxIntersectionTraits_d` concept is used for the intersection algorithms for
sequences of iso-oriented boxes. This concept defines the access
functions to the dimension, the `id`-number, and the boundaries of
the boxes manipulated in these algorithms.

\cgalRefines `Assignable`

\cgalHasModel CGAL::Box_intersection_d::Box_traits_d

\sa \link PkgBoxIntersectionD_box_intersection_d `CGAL::box_intersection_d()` \endlink
\sa \link PkgBoxIntersectionD_box_self_intersection_d `CGAL::box_self_intersection_d()` \endlink
\sa \link PkgBoxIntersectionD_box_intersection_all_pairs_d `CGAL::box_intersection_all_pairs_d()` \endlink
\sa \link PkgBoxIntersectionD_box_self_intersection_all_pairs_d `CGAL::box_self_intersection_all_pairs_d()` \endlink

*/

class BoxIntersectionTraits_d {
public:

/// \name Types
/// @{

/*!
type used for passing box parameters in the
functions below. Since we support in our algorithms
passing the boxes by value as well as passing them as pointers, this
type can be either `const B&`, `B*`, or `const B*`
respectively, where `B` is the actual box type. The difference
to the box handle type lies in the first case where the box handle
would be `B` where this type is `const B&`.
*/
typedef unspecified_type Box_parameter;

/*!
number type to represent the box
boundaries. Allowed are the built-in types `int`, `unsigned
int`, `float`, and `double`.
*/
typedef unspecified_type NT;

/*!
type for the `id`-number,
model of the `LessThanComparable` concept.
*/
typedef unspecified_type ID;

/*!
returns the dimension of the box.
*/
static int dimension();

/*!
returns the unique `id`-number for the `box`.
*/
static ID id(Box_parameter box);

/*!
returns the lower boundary of the `box` in dimension
`d`, \f$ 0 \leq\f$`d`\f$ < \f$`dimension()`.
*/
static NT min_coord( Box_parameter box, int d);

/*!
returns the upper boundary of the `box` in dimension
`d`, \f$ 0 \leq\f$`d`\f$ < \f$`dimension()`.
*/
static NT max_coord( Box_parameter box, int d);

/// @}

}; /* end BoxIntersectionTraits_d */


text:
package com.views;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.widget.Scroller;

/**
 * Created by IntelliJ IDEA. User: li_jianhua Date: 2014-7-9 下午4:25:04
 * To change this template use File | Settings | File Templates.
 * Description:
 * 仿Launcher中的WorkSapce,可以左右、上下滑动切换屏幕的
 */
public class ScrollLayout extends ViewGroup {

	private static final String TAG = "ScrollLayout";
	private Scroller mScroller;
	private VelocityTracker mVelocityTracker;

	private int mCurScreen;
	private int mDefaultScreen = 0;

	private static final int TOUCH_STATE_REST = 0;
	private static final int TOUCH_STATE_SCROLLING = 1;

	private static final int SNAP_VELOCITY = 600;

	private int mTouchState = TOUCH_STATE_REST;
	private int mTouchSlop;
	private float mLastMotionX;
	@SuppressWarnings("unused")
	private float mLastMotionY;

	private int currentScreenIndex = 0;

	public int getCurrentScreenIndex() {
		return currentScreenIndex;
	}

	public void setCurrentScreenIndex(int currentScreenIndex) {
		this.currentScreenIndex = currentScreenIndex;
	}

	public ScrollLayout(Context context, AttributeSet attrs) {
		this(context, attrs, 0);
		// TODO Auto-generated constructor stub
	}

	public ScrollLayout(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		// TODO Auto-generated constructor stub
		mScroller = new Scroller(context);

		mCurScreen = mDefaultScreen;
		mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
	}

	@Override
	protected void onLayout(boolean changed, int l, int t, int r, int b) {
		// TODO Auto-generated method stub
		int childLeft = 0;
		final int childCount = getChildCount();
		for (int i = 0; i < childCount; i++) {
			final View childView = getChildAt(i);
			if (childView.getVisibility() != View.GONE) {
				final int childWidth = childView.getMeasuredWidth();
				childView.layout(childLeft, 0, childLeft + childWidth,
						childView.getMeasuredHeight());
				childLeft += childWidth;
			}
		}
	}

	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		Log.e(TAG, "onMeasure");
		super.onMeasure(widthMeasureSpec, heightMeasureSpec);

		final int width = MeasureSpec.getSize(widthMeasureSpec);
		final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
		/**
		 * wrap_content 浼犺繘鍘荤殑鏄疉T_MOST 鍥哄畾鏁帮拷?鎴杅ill_parent 浼犲叆鐨勬ā寮忔槸EXACTLY
		 */
		if (widthMode != MeasureSpec.EXACTLY) {
		/*	throw new IllegalStateException(
					"ScrollLayout only canmCurScreen run at EXACTLY mode!");*/
		}

		final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
		if (heightMode != MeasureSpec.EXACTLY) {
			/*throw new IllegalStateException(
					"ScrollLayout only can run at EXACTLY mode!");*/
		}

		// The children are given the same width and height as the scrollLayout
		final int count = getChildCount();
		for (int i = 0; i < count; i++) {
			getChildAt(i).measure(widthMeasureSpec, heightMeasureSpec);
		}
		System.out.println("moving to screen " + mCurScreen);
		scrollTo(mCurScreen * width, 0);
	}

	/**
	 * According to the position of current layout scroll to the destination
	 * page.
	 */
	public void snapToDestination() {
		final int screenWidth = getWidth();
		final int destScreen = (getScrollX() + screenWidth / 2) / screenWidth;
		snapToScreen(destScreen);
	}

	public void snapToScreen(int whichScreen) {
		// get the valid layout page
		whichScreen = Math.max(0, Math.min(whichScreen, getChildCount() - 1));
		if (getScrollX() != (whichScreen * getWidth())) {

			final int delta = whichScreen * getWidth() - getScrollX();
			mScroller.startScroll(getScrollX(), 0, delta, 0,
					Math.abs(delta) * 2);
			mCurScreen = whichScreen;
			invalidate(); // Redraw the layout
		}
	}

	public void setToScreen(int whichScreen) {
		whichScreen = Math.max(0, Math.min(whichScreen, getChildCount() - 1));
		mCurScreen = whichScreen;
		scrollTo(whichScreen * getWidth(), 0);
	}

	public int getCurScreen() {
		return mCurScreen;
	}

	@Override
	public void computeScroll() {
		// TODO Auto-generated method stub
		if (mScroller.computeScrollOffset()) {
			scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
			postInvalidate();
		}
	}

	@SuppressWarnings("unused")
	@Override
	public boolean onTouchEvent(MotionEvent event) {
		// TODO Auto-generated method stub

		if (mVelocityTracker == null) {
			mVelocityTracker = VelocityTracker.obtain();
		}
		mVelocityTracker.addMovement(event);

		final int action = event.getAction();
		final float x = event.getX();
		final float y = event.getY();

		switch (action) {
		case MotionEvent.ACTION_DOWN:
			Log.e(TAG, "event down!");
			if (!mScroller.isFinished()) {
				mScroller.abortAnimation();
			}
			mLastMotionX = x;
			break;

		case MotionEvent.ACTION_MOVE:
			int deltaX = (int) (mLastMotionX - x);
			mLastMotionX = x;

			scrollBy(deltaX, 0);
			break;

		case MotionEvent.ACTION_UP:
			Log.e(TAG, "event : up");

			// if (mTouchState == TOUCH_STATE_SCROLLING) {
			final VelocityTracker velocityTracker = mVelocityTracker;
			velocityTracker.computeCurrentVelocity(1000);
			int velocityX = (int) velocityTracker.getXVelocity();

			Log.e(TAG, "velocityX:" + velocityX);

			if (velocityX > SNAP_VELOCITY && mCurScreen > 0) {
				// Fling enough to move left
				Log.e(TAG, "snap left");
				onScreenChangeListener.onScreenChange(mCurScreen - 1);
				System.out.println("mCurScreen=" + (mCurScreen - 1));
				snapToScreen(mCurScreen - 1);
			} else if (velocityX < -SNAP_VELOCITY
					&& mCurScreen < getChildCount() - 1) {
				// Fling enough to move right
				Log.e(TAG, "snap right");
				onScreenChangeListener.onScreenChange(mCurScreen + 1);
				//鍙線鍙崇Щ鍔ㄦ墠鍔犺浇鏁版嵁
				onScreenChangeListenerDataLoad.onScreenChange(mCurScreen+1);
				snapToScreen(mCurScreen + 1);
			} else {
				snapToDestination();
			}

			if (mVelocityTracker != null) {
				mVelocityTracker.recycle();
				mVelocityTracker = null;
			}
			// }
			mTouchState = TOUCH_STATE_REST;
			break;
		case MotionEvent.ACTION_CANCEL:
			mTouchState = TOUCH_STATE_REST;
			break;
		}

		return true;
	}

	@Override
	public boolean onInterceptTouchEvent(MotionEvent ev) {
		// TODO Auto-generated method stub
		Log.e(TAG, "onInterceptTouchEvent-slop:" + mTouchSlop);

		final int action = ev.getAction();
		if ((action == MotionEvent.ACTION_MOVE)
				&& (mTouchState != TOUCH_STATE_REST)) {
			return true;
		}

		final float x = ev.getX();
		final float y = ev.getY();

		switch (action) {
		case MotionEvent.ACTION_MOVE:
			final int xDiff = (int) Math.abs(mLastMotionX - x);
			if (xDiff > mTouchSlop) {
				mTouchState = TOUCH_STATE_SCROLLING;

			}
			break;

		case MotionEvent.ACTION_DOWN:
			mLastMotionX = x;
			mLastMotionY = y;
			mTouchState = mScroller.isFinished() ? TOUCH_STATE_REST
					: TOUCH_STATE_SCROLLING;
			break;

		case MotionEvent.ACTION_CANCEL:
		case MotionEvent.ACTION_UP:
			mTouchState = TOUCH_STATE_REST;
			break;
		}

		return mTouchState != TOUCH_STATE_REST;
	}

	//鍒嗛〉鐩戝惉
	public interface OnScreenChangeListener {
		void onScreenChange(int currentIndex);
	}

	private OnScreenChangeListener onScreenChangeListener;

	public void setOnScreenChangeListener(
			OnScreenChangeListener onScreenChangeListener) {
		this.onScreenChangeListener = onScreenChangeListener;
	}

	public interface OnScreenChangeListenerDataLoad {
		void onScreenChange(int currentIndex);
	}
	private OnScreenChangeListenerDataLoad onScreenChangeListenerDataLoad;

	public void setOnScreenChangeListenerDataLoad(OnScreenChangeListenerDataLoad onScreenChangeListenerDataLoad) {
		this.onScreenChangeListenerDataLoad = onScreenChangeListenerDataLoad;
	}

}


text:
package com.adobe.acs.commons.mcp.impl.processes;

import com.adobe.acs.commons.mcp.AdministratorsOnlyProcessDefinitionFactory;
import com.adobe.acs.commons.mcp.ProcessDefinitionFactory;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.event.jobs.JobManager;

@Component
@Service(ProcessDefinitionFactory.class)
public class DeepPruneFactory extends AdministratorsOnlyProcessDefinitionFactory<DeepPrune> {

    @Reference
    private JobManager jobManager;

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

    @Override
    public DeepPrune createProcessDefinitionInstance() {
        return new DeepPrune(jobManager);
    }
}


text:
<?php

// ----------------------------------------------------------------------
// Original Author of file: Walid Nouh
// Purpose of file:
// ----------------------------------------------------------------------
if (!defined('GLPI_ROOT')) {
   die("Sorry. You can't access directly to this file");
}

/**
* Rule class store all informations about a GLPI rule :
*   - description
*   - criterias
*   - actions
**/
class RuleDictionnaryPrinter extends RuleCached {

   // From Rule
   public $right    = 'rule_dictionnary_printer';
   public $can_sort = true;

   function getTitle() {
      global $LANG;

      return $LANG['rulesengine'][39];
   }

   function maxActionsCount() {
      return 4;
   }

   function showCacheRuleHeader() {
      global $LANG;

      echo "
" . $LANG['rulesengine'][100] . " : " . $this->fields["name"];
      echo "
";

      echo "
" . $LANG['rulesengine'][104] . "	";
      echo "" . $LANG['common'][5] . " " . $LANG['rulesengine'][108]."	";
      echo "" . $LANG['rulesengine'][105] . "	";
      echo "" . $LANG['peripherals'][33] . "	";
      echo "" . $LANG['common'][5] . " " . $LANG['rulesengine'][105]."	";
      echo "" . $LANG['rulesengine'][132] . "
";
   }

   function showCacheRuleDetail($fields) {
      global $LANG;

      echo "" . $fields["old_value"] . "	";
      echo "" . $fields["manufacturer"] . "	";
      echo "". ($fields["new_value"] != '' ? $fields["new_value"]
                                                                : $LANG['rulesengine'][106])."	";
      echo "".
             ($fields["is_global"] != '' ? Dropdown::getGlobalSwitch($fields["is_global"])
                                         : $LANG['rulesengine'][106]) . "	";
      echo "" .
            ((isset($fields["new_manufacturer"]) && $fields["new_manufacturer"] != '')
             ? Dropdown::getDropdownName("glpi_manufacturers", $fields["new_manufacturer"])
             : $LANG['rulesengine'][106]) . "	";
      echo "";

      if ($fields["ignore_ocs_import"] == '') {
         echo " ";
      } else {
         echo Dropdown::getYesNo($fields["ignore_ocs_import"]);
      }
      echo "	";
   }

   function getCriterias() {
      global $LANG;

      $criterias = array();
      $criterias['name']['field'] = 'name';
      $criterias['name']['name']  = $LANG['common'][16];
      $criterias['name']['table'] = 'glpi_printers';

      $criterias['manufacturer']['field'] = 'name';
      $criterias['manufacturer']['name']  = $LANG['common'][5];
      $criterias['manufacturer']['table'] = '';
/*
      $criterias['PORT']['field'] = 'PORT';
      $criterias['PORT']['name']  = $LANG['setup'][175];
      $criterias['PORT']['table'] = '';

      $criterias['DRIVER']['field'] = 'DRIVER';
      $criterias['DRIVER']['name']  = $LANG['printers'][32];
      $criterias['DRIVER']['table'] = '';

      $criterias['model']['field'] = 'model';
      $criterias['model']['name']  = $LANG['common'][22];
      $criterias['model']['table'] = '';

      $criterias['type']['field'] = 'type';
      $criterias['type']['name']  = $LANG['common'][17];
      $criterias['type']['table'] = '';
*/

      $criterias['comment']['field'] = 'comment';
      $criterias['comment']['name']  = $LANG['common'][25];
      $criterias['comment']['table'] = '';

      return $criterias;
   }

   function getActions() {
      global $LANG;

      $actions = array();
      $actions['name']['name']          = $LANG['common'][16];
      $actions['name']['force_actions'] = array('assign', 'regex_result');

      $actions['_ignore_ocs_import']['name'] = $LANG['rulesengine'][132];
      $actions['_ignore_ocs_import']['type'] = 'yesonly';

      $actions['manufacturer']['name']  = $LANG['common'][5];
      $actions['manufacturer']['table'] = 'glpi_manufacturers';
      $actions['manufacturer']['type']  = 'dropdown';

      $actions['is_global']['name']  = $LANG['peripherals'][33];
      $actions['is_global']['type']  = 'dropdown_management';

      return $actions;
   }

}

?>


text:
const void *_ARSEGMENTPAGE_CURRNTPAGE_SCROLLVIEWOFFSET =
    &_ARSEGMENTPAGE_CURRNTPAGE_SCROLLVIEWOFFSET;
const void *_ARSEGMENTPAGE_CURRNTPAGE_SCROLLVIEWINSET =
    &_ARSEGMENTPAGE_CURRNTPAGE_SCROLLVIEWINSET;

@interface ARSegmentPageController ()

@property(nonatomic, strong)
    UIView<ARSegmentPageControllerHeaderProtocol> *headerView;
@property(nonatomic, strong) ARSegmentView *segmentView;
@property(nonatomic, strong) NSMutableArray *controllers;
@property(nonatomic, assign) CGFloat segmentTopInset;
@property(nonatomic, weak)
    UIViewController<ARSegmentControllerDelegate> *currentDisplayController;
@property(nonatomic, strong) NSLayoutConstraint *headerHeightConstraint;
@property(nonatomic, strong) NSHashTable *hasShownControllers;
@property(nonatomic, assign) BOOL ignoreOffsetChanged; //是否忽略offset的改变
@property(nonatomic, assign) CGFloat originalTopInset;

@end

@implementation ARSegmentPageController

#pragma mark - life cycle methods

- (instancetype)initWithControllers:
    (UIViewController<ARSegmentControllerDelegate> *)controller, ... {
  self = [super init];
  if (self) {
    NSAssert(controller != nil, @"the first controller must not be nil!");
    [self _setUp];
    UIViewController<ARSegmentControllerDelegate> *eachController;
    va_list argumentList;
    if (controller) {
      [self.controllers addObject:controller];
      va_start(argumentList, controller);
      while ((eachController = va_arg(argumentList, id))) {
        [self.controllers addObject:eachController];
      }
      va_end(argumentList);
    }
  }
  return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder {
  self = [super initWithCoder:aDecoder];
  if (self) {
    [self _setUp];
  }
  return self;
}

- (instancetype)init {
  self = [super init];
  if (self) {
    [self _setUp];
  }
  return self;
}

- (void)viewDidLoad {
  [super viewDidLoad];

  [self _baseConfigs];
  [self _baseLayout];
}

#pragma mark - public methods

- (void)setViewControllers:(NSArray *)viewControllers {
  [self.controllers removeAllObjects];
  [self.controllers addObjectsFromArray:viewControllers];
}

#pragma mark - override methods

- (UIView<ARSegmentPageControllerHeaderProtocol> *)customHeaderView {
  return [[ARSegmentPageHeader alloc] init];
}

#pragma mark - private methdos

- (void)_setUp {
  self.ignoreOffsetChanged = NO;
  self.headerHeight = 400;
  self.segmentHeight = 44;
  self.segmentTopInset = 400;
  self.segmentMiniTopInset = 0;
  self.controllers = [NSMutableArray array];
  self.hasShownControllers = [NSHashTable weakObjectsHashTable];
}

- (void)_baseConfigs {
  self.automaticallyAdjustsScrollViewInsets = NO;
  if ([self.view
          respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
    self.view.preservesSuperviewLayoutMargins = YES;
  }
  self.extendedLayoutIncludesOpaqueBars = NO;
  self.headerView = [self customHeaderView];
  self.headerView.clipsToBounds = YES;
  [self.view addSubview:self.headerView];

  self.segmentView = [[ARSegmentView alloc] init];
  [self.segmentView.segmentControl
             addTarget:self
                action:@selector(segmentControlDidChangedValue:)
      forControlEvents:UIControlEventValueChanged];
  [self.view addSubview:self.segmentView];

  // all segment title and controllers
  [self.controllers
      enumerateObjectsUsingBlock:^(
          UIViewController<ARSegmentControllerDelegate> *controller,
          NSUInteger idx, BOOL *stop) {
        NSString *title = [controller segmentTitle];

        [self.segmentView.segmentControl insertSegmentWithTitle:title
                                                        atIndex:idx
                                                       animated:NO];
      }];

  // defaut at index 0
  self.segmentView.segmentControl.selectedSegmentIndex = 0;
  UIViewController<ARSegmentControllerDelegate> *controller =
      self.controllers[0];
  [controller willMoveToParentViewController:self];
  [self.view insertSubview:controller.view atIndex:0];
  [self addChildViewController:controller];
  [controller didMoveToParentViewController:self];

  [self _layoutControllerWithController:controller];
  [self addObserverForPageController:controller];

  self.currentDisplayController = self.controllers[0];
}

- (void)_baseLayout {
  // header
  self.headerView.translatesAutoresizingMaskIntoConstraints = NO;

  self.headerHeightConstraint =
      [NSLayoutConstraint constraintWithItem:self.headerView
                                   attribute:NSLayoutAttributeHeight
                                   relatedBy:NSLayoutRelationEqual
                                      toItem:nil
                                   attribute:0
                                  multiplier:1
                                    constant:self.headerHeight];
  [self.headerView addConstraint:self.headerHeightConstraint];

  [self.view
      addConstraint:[NSLayoutConstraint constraintWithItem:self.headerView
                                                 attribute:NSLayoutAttributeLeft
                                                 relatedBy:NSLayoutRelationEqual
                                                    toItem:self.view
                                                 attribute:NSLayoutAttributeLeft
                                                multiplier:1
                                                  constant:0]];
  [self.view
      addConstraint:[NSLayoutConstraint constraintWithItem:self.headerView
                                                 attribute:NSLayoutAttributeTop
                                                 relatedBy:NSLayoutRelationEqual
                                                    toItem:self.view
                                                 attribute:NSLayoutAttributeTop
                                                multiplier:1
                                                  constant:0]];
  [self.view addConstraint:[NSLayoutConstraint
                               constraintWithItem:self.headerView
                                        attribute:NSLayoutAttributeRight
                                        relatedBy:NSLayoutRelationEqual
                                           toItem:self.view
                                        attribute:NSLayoutAttributeRight
                                       multiplier:1
                                         constant:0]];

  // segment
  self.segmentView.translatesAutoresizingMaskIntoConstraints = NO;
  [self.view
      addConstraint:[NSLayoutConstraint constraintWithItem:self.segmentView
                                                 attribute:NSLayoutAttributeLeft
                                                 relatedBy:NSLayoutRelationEqual
                                                    toItem:self.view
                                                 attribute:NSLayoutAttributeLeft
                                                multiplier:1
                                                  constant:0]];
  [self.view addConstraint:[NSLayoutConstraint
                               constraintWithItem:self.segmentView
                                        attribute:NSLayoutAttributeRight
                                        relatedBy:NSLayoutRelationEqual
                                           toItem:self.view
                                        attribute:NSLayoutAttributeRight
                                       multiplier:1
                                         constant:0]];

  [self.view addConstraint:[NSLayoutConstraint
                               constraintWithItem:self.segmentView
                                        attribute:NSLayoutAttributeTop
                                        relatedBy:NSLayoutRelationEqual
                                           toItem:self.headerView
                                        attribute:NSLayoutAttributeBottom
                                       multiplier:1
                                         constant:0]];

  [self.segmentView addConstraint:[NSLayoutConstraint
                                      constraintWithItem:self.segmentView
                                               attribute:NSLayoutAttributeHeight
                                               relatedBy:NSLayoutRelationEqual
                                                  toItem:nil
                                               attribute:0
                                              multiplier:1
                                                constant:self.segmentHeight]];
}

- (void)_layoutControllerWithController:
    (UIViewController<ARSegmentControllerDelegate> *)pageController {
  UIView *pageView = pageController.view;
  if ([pageView
          respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
    pageView.preservesSuperviewLayoutMargins = YES;
  }
  pageView.translatesAutoresizingMaskIntoConstraints = NO;
  [self.view addConstraint:[NSLayoutConstraint
                               constraintWithItem:pageView
                                        attribute:NSLayoutAttributeLeading
                                        relatedBy:NSLayoutRelationEqual
                                           toItem:self.view
                                        attribute:NSLayoutAttributeLeading
                                       multiplier:1
                                         constant:0]];
  [self.view addConstraint:[NSLayoutConstraint
                               constraintWithItem:pageView
                                        attribute:NSLayoutAttributeTrailing
                                        relatedBy:NSLayoutRelationEqual
                                           toItem:self.view
                                        attribute:NSLayoutAttributeTrailing
                                       multiplier:1
                                         constant:0]];

  UIScrollView *scrollView = [self scrollViewInPageController:pageController];
  if (scrollView) {
    scrollView.alwaysBounceVertical = YES;
    _originalTopInset = self.headerHeight + self.segmentHeight;
      //如果iOS的系统是11.0
      if (@available(iOS 11.0, *)) {
          scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
      }
    // fixed bootom tabbar inset
    CGFloat bottomInset = 0;
    if (self.tabBarController.tabBar.hidden == NO) {
      bottomInset = CGRectGetHeight(self.tabBarController.tabBar.bounds);
    }

    [scrollView
        setContentInset:UIEdgeInsetsMake(_originalTopInset, 0, bottomInset, 0)];
    //     fixed first time don't show header view
    if (![self.hasShownControllers containsObject:pageController]) {
      [self.hasShownControllers addObject:pageController];
      [scrollView setContentOffset:CGPointMake(0, -self.headerHeight -
                                                      self.segmentHeight)];
    }

    [self.view addConstraint:[NSLayoutConstraint
                                 constraintWithItem:pageView
                                          attribute:NSLayoutAttributeTop
                                          relatedBy:NSLayoutRelationEqual
                                             toItem:self.view
                                          attribute:NSLayoutAttributeTop
                                         multiplier:1
                                           constant:0]];

    [self.view addConstraint:[NSLayoutConstraint
                                 constraintWithItem:pageView
                                          attribute:NSLayoutAttributeBottom
                                          relatedBy:NSLayoutRelationEqual
                                             toItem:self.view
                                          attribute:NSLayoutAttributeBottom
                                         multiplier:1
                                           constant:0]];
  } else {
    [self.view addConstraint:[NSLayoutConstraint
                                 constraintWithItem:pageView
                                          attribute:NSLayoutAttributeTop
                                          relatedBy:NSLayoutRelationEqual
                                             toItem:self.segmentView
                                          attribute:NSLayoutAttributeBottom
                                         multiplier:1
                                           constant:0]];
    [self.view addConstraint:[NSLayoutConstraint
                                 constraintWithItem:pageView
                                          attribute:NSLayoutAttributeHeight
                                          relatedBy:NSLayoutRelationEqual
                                             toItem:self.view
                                          attribute:NSLayoutAttributeHeight
                                         multiplier:1
                                           constant:-self.segmentHeight]];
  }
}

- (UIScrollView *)scrollViewInPageController:
    (UIViewController<ARSegmentControllerDelegate> *)controller {
  if ([controller respondsToSelector:@selector(streachScrollView)]) {
    return [controller streachScrollView];
  } else if ([controller.view isKindOfClass:[UIScrollView class]]) {
    return (UIScrollView *)controller.view;
  } else {
    return nil;
  }
}

#pragma mark - add / remove obsever for page scrollView

- (void)addObserverForPageController:
    (UIViewController<ARSegmentControllerDelegate> *)controller {
  UIScrollView *scrollView = [self scrollViewInPageController:controller];
  if (scrollView != nil) {
    [scrollView
        addObserver:self
         forKeyPath:NSStringFromSelector(@selector(contentOffset))
            options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld
            context:&_ARSEGMENTPAGE_CURRNTPAGE_SCROLLVIEWOFFSET];
    [scrollView
        addObserver:self
         forKeyPath:NSStringFromSelector(@selector(contentInset))
            options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld
            context:&_ARSEGMENTPAGE_CURRNTPAGE_SCROLLVIEWINSET];
  }
}

- (void)removeObseverForPageController:
    (UIViewController<ARSegmentControllerDelegate> *)controller {
  UIScrollView *scrollView = [self scrollViewInPageController:controller];
  if (scrollView != nil) {
    @try {
      [scrollView
          removeObserver:self
              forKeyPath:NSStringFromSelector(@selector(contentOffset))];
      [scrollView removeObserver:self
                      forKeyPath:NSStringFromSelector(@selector(contentInset))];
    } @catch (NSException *exception) {
      NSLog(@"exception is %@", exception);
    } @finally {
    }
  }
}

#pragma mark - obsever delegate methods

- (void)observeValueForKeyPath:(NSString *)keyPath
                      ofObject:(id)object
                        change:(NSDictionary *)change
                       context:(void *)context {
  if (context == _ARSEGMENTPAGE_CURRNTPAGE_SCROLLVIEWOFFSET &&
      !_ignoreOffsetChanged) {
    CGPoint offset = [change[NSKeyValueChangeNewKey] CGPointValue];
    CGFloat offsetY = offset.y;
    CGPoint oldOffset = [change[NSKeyValueChangeOldKey] CGPointValue];
    CGFloat oldOffsetY = oldOffset.y;
    CGFloat deltaOfOffsetY = offset.y - oldOffsetY;
    CGFloat offsetYWithSegment = offset.y + self.segmentHeight;

    if (deltaOfOffsetY > 0 &&
        offsetY >= -(self.headerHeight + self.segmentHeight)) {
      // 当滑动是向上滑动时且不是回弹
      // 跟随移动的偏移量进行变化
      // NOTE:直接相减有可能constant会变成负数,进而被系统强行移除,导致header悬停的位置错乱或者crash
      if (self.headerHeightConstraint.constant - deltaOfOffsetY <= 0) {
        self.headerHeightConstraint.constant = self.segmentMiniTopInset;
      } else {
        self.headerHeightConstraint.constant -= deltaOfOffsetY;
      }
      // 如果到达顶部固定区域,那么不继续滑动
      if (self.headerHeightConstraint.constant <= self.segmentMiniTopInset) {
        self.headerHeightConstraint.constant = self.segmentMiniTopInset;
      }
    } else {
      // 当向下滑动时
      // 如果列表已经滚动到屏幕上方
      // 那么保持顶部栏在顶部
      if (offsetY > 0) {
        if (self.headerHeightConstraint.constant <= self.segmentMiniTopInset) {
          self.headerHeightConstraint.constant = self.segmentMiniTopInset;
        }
      } else {
        // 如果列表顶部已经进入屏幕
        // 如果顶部栏已经到达底部
        if (self.headerHeightConstraint.constant >= self.headerHeight) {
          // 如果当前列表滚到了顶部栏的底部
          // 那么顶部栏继续跟随变大,否这保持不变
          if (-offsetYWithSegment > self.headerHeight &&
              !_freezenHeaderWhenReachMaxHeaderHeight) {
            self.headerHeightConstraint.constant = -offsetYWithSegment;
          } else {
            self.headerHeightConstraint.constant = self.headerHeight;
          }
        } else {
          // 在顶部拦未到达底部的情况下
          // 如果列表还没滚动到顶部栏底部,那么什么都不做
          // 如果已经到达顶部栏底部,那么顶部栏跟随滚动
          if (self.headerHeightConstraint.constant < -offsetYWithSegment) {
            self.headerHeightConstraint.constant -= deltaOfOffsetY;
          }
        }
      }
    }
    // 更新'segmentToInset'变量,让外部的 kvo 知道顶部栏位置的变化
    self.segmentTopInset = self.headerHeightConstraint.constant;
  } else if (context == _ARSEGMENTPAGE_CURRNTPAGE_SCROLLVIEWINSET) {
    UIEdgeInsets insets = [object contentInset];
    if (fabs(insets.top - _originalTopInset) < 2) {
      self.ignoreOffsetChanged = NO;
    } else {
      self.ignoreOffsetChanged = YES;
    }
  }
}

#pragma mark - event methods

- (void)segmentControlDidChangedValue:(UISegmentedControl *)sender {
  // remove obsever
  [self removeObseverForPageController:self.currentDisplayController];

  // add new controller
  NSUInteger index = [sender selectedSegmentIndex];
  UIViewController<ARSegmentControllerDelegate> *controller =
      self.controllers[index];

  [self.currentDisplayController willMoveToParentViewController:nil];
  [self.currentDisplayController.view removeFromSuperview];
  [self.currentDisplayController removeFromParentViewController];
  [self.currentDisplayController didMoveToParentViewController:nil];

  [controller willMoveToParentViewController:self];
  [self.view insertSubview:controller.view atIndex:0];
  [self addChildViewController:controller];
  [controller didMoveToParentViewController:self];

  // reset current controller
  self.currentDisplayController = controller;
  // layout new controller
  [self _layoutControllerWithController:controller];

  [self.view setNeedsLayout];
  [self.view layoutIfNeeded];

  // trigger to fixed header constraint
  UIScrollView *scrollView = [self scrollViewInPageController:controller];
  if (self.headerHeightConstraint.constant != self.headerHeight) {
    if (scrollView.contentOffset.y >=
            -(self.segmentHeight + self.headerHeight) &&
        scrollView.contentOffset.y <= -self.segmentHeight) {
      [scrollView
          setContentOffset:CGPointMake(
                               0, -self.segmentHeight -
                                      self.headerHeightConstraint.constant)];
    }
  }
  // add obsever
  [self addObserverForPageController:self.currentDisplayController];
  [scrollView setContentOffset:scrollView.contentOffset];
}

#pragma mark - manage memory methods

- (void)dealloc {
  [self removeObseverForPageController:self.currentDisplayController];
}

- (void)didReceiveMemoryWarning {
  [super didReceiveMemoryWarning];
}

@end


text:
Logify
======
Logify is an incredibly light-weight Ruby logger with a developer-friendly API and no dependencies. It is intentionally very opinionated and is optimized for speed. This combination makes it perfect for command line applications.

Logify does:

- Support multithreading with inherited defaults
- Provide a very pretty debug logger
- Make logging fun again!

Logify does not:

- Depend on or inherit from Ruby's core `Logger` class
- Manage the log device - if you wish to write your logs to a file, it is your responsibility to manage the file handler, rewind, etc.

Usage
-----
Simply include the `Logify` module in each class you want to log:

```ruby
require 'logify'

class MyClass
  include Logify
end
```

This will expose a `log` method on both the class and instance:

```ruby
MyClass.log 'This is a class log message!'

instance = MyClass.new
instance.log 'This is an instance log message!'
```

In debug mode, Logify is designed for developer happiness. Parameters are aligned, and visual queues are used to indicate status. The format is as follows:

```text
MyClass | ===> Starting some command...
MyClass |      x = 0
MyClass |      y = 99
MyClass | **** x is 0
MyClass | >>>> Cannot divide by 0
MyClass | !!!! Ruby segfaulted
```

Where the prefixes are:

```ruby
FATAL #=> "!!!!"
ERROR #=> ">>>>"
WARN  #=> "****"
INFO  #=> "===>"
DEBUG #=> "    "
```

Class names are automatically shortened if they exceed 32 characters.

In non-debug mode, Logify is less chatty:

```text
I: Starting some command
W: x is 0
E: Cannot divide by 0
F: Ruby segfaulted
```

Where the letter corresponds to the log level:

```ruby
FATAL #=> "F"
ERROR #=> "E"
WARN  #=> "W"
INFO  #=> "I"
```

If you are anti-modules (or if you want to use `log` for something else), you can manually create your Logger object in an initializer:

```ruby
require 'logify'

class MyClass
  def initialize
    @logger = Logify.logger_for(self.class.name) # Or any custom name
  end
end
```

And then use `@logger` to call your log methods:

```ruby
def other_method
  @logger.info 'Running other_method'
end
```

Configuring
-----------
Logify is configurable via the top-level `Logify` module.

Set the log level using symbol definitions:

```ruby
Logify.level = :warn
```

Set the output object (io). It must respond to `<<`:

```ruby
Logify.io = StringIO.new
```

The Logify module is thread-aware. Settings are inherited from the main thread. Changes to log levels in child threads are only persisted within the thread.

```ruby
# Main thread configuration
Logify.level = :warn

Thread.new do
  # This will persist for the duration of this thread.
  # The main thread will continue to use :warn.
  Logify.level = :debug

  Thread.new do
    # The log level is _only_ inherited from the main thread.
    Logify.level #=> :warn
  end
end
```

You can disable all logging by setting the `io` device to a null object:

```ruby
class NullLogger
  def <<(*args); end
end
Logify.io = NullLogger.new
```

Or set the `log_level` to `:none`:

```ruby
Logify.level = :none
```

If you are logging sensitive information (such as passwords and API keys), you can add that information as a filter to Logify. Logify will replace those values with "`[FILTERED]`" in logging output.

```ruby
Logify.filter('P@s$w0r)')
```

Installation
------------
Add this line to your application's Gemfile:

```ruby
gem 'logify'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install logify

Contributing
------------
1. Fork it
1. Fix it
1. Test it
1. Pull Request it

License & Authors
-----------------
- Author: Seth Vargo (<sethvargo@gmail.com>)

```text
Copyright 2014, Seth Vargo (sethvargo@gmail.com)

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

		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>Chile mountains false toad factsheet on ARKive - Telmatobufo venustus</title>
        <link rel="canonical" href="http://www.arkive.org/chile-mountains-false-toad/telmatobufo-venustus/" />
		<link rel="stylesheet" type="text/css" media="screen,print" href="/rcss/factsheet.css" />
		<link rel="icon" href="/favicon.ico" type="image/x-icon" />
		<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

Chile mountains false toad (Telmatobufo venustus)

Kingdom	Animalia

Phylum	Chordata

Class	Amphibia

Order	Anura

Family	Calyptocephalellidae

Genus	Telmatobufo (1)

Classified as Endangered (EN) on the IUCN Red List (1).

Information on the Chile mountains false toad is currently being researched and written and will appear here shortly.

To learn about efforts to conserve the Chile mountains false toad see:

		EDGE of Existence:
http://www.edgeofexistence.org/amphibians/species_info.php?id=575

This information is awaiting authentication by a species expert, and will be updated as soon as possible. If you are able to help please contact:
arkive@wildscreen.org.uk

IUCN Red List (June, 2010)
http://www.iucnredlist.org


text:
#include <linux/module.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/device.h>
#include <linux/delay.h>

#include <asm/ccwdev.h>
#include <asm/idals.h>
#include <asm/chpid.h>
#include <asm/fcx.h>

#include "cio.h"
#include "cio_debug.h"
#include "css.h"
#include "chsc.h"
#include "device.h"
#include "chp.h"

/**
 * ccw_device_set_options_mask() - set some options and unset the rest
 * @cdev: device for which the options are to be set
 * @flags: options to be set
 *
 * All flags specified in @flags are set, all flags not specified in @flags
 * are cleared.
 * Returns:
 *   %0 on success, -%EINVAL on an invalid flag combination.
 */
int ccw_device_set_options_mask(struct ccw_device *cdev, unsigned long flags)
{
       /*
	* The flag usage is mutal exclusive ...
	*/
	if ((flags & CCWDEV_EARLY_NOTIFICATION) &&
	    (flags & CCWDEV_REPORT_ALL))
		return -EINVAL;
	cdev->private->options.fast = (flags & CCWDEV_EARLY_NOTIFICATION) != 0;
	cdev->private->options.repall = (flags & CCWDEV_REPORT_ALL) != 0;
	cdev->private->options.pgroup = (flags & CCWDEV_DO_PATHGROUP) != 0;
	cdev->private->options.force = (flags & CCWDEV_ALLOW_FORCE) != 0;
	return 0;
}

/**
 * ccw_device_set_options() - set some options
 * @cdev: device for which the options are to be set
 * @flags: options to be set
 *
 * All flags specified in @flags are set, the remainder is left untouched.
 * Returns:
 *   %0 on success, -%EINVAL if an invalid flag combination would ensue.
 */
int ccw_device_set_options(struct ccw_device *cdev, unsigned long flags)
{
       /*
	* The flag usage is mutal exclusive ...
	*/
	if (((flags & CCWDEV_EARLY_NOTIFICATION) &&
	    (flags & CCWDEV_REPORT_ALL)) ||
	    ((flags & CCWDEV_EARLY_NOTIFICATION) &&
	     cdev->private->options.repall) ||
	    ((flags & CCWDEV_REPORT_ALL) &&
	     cdev->private->options.fast))
		return -EINVAL;
	cdev->private->options.fast |= (flags & CCWDEV_EARLY_NOTIFICATION) != 0;
	cdev->private->options.repall |= (flags & CCWDEV_REPORT_ALL) != 0;
	cdev->private->options.pgroup |= (flags & CCWDEV_DO_PATHGROUP) != 0;
	cdev->private->options.force |= (flags & CCWDEV_ALLOW_FORCE) != 0;
	return 0;
}

/**
 * ccw_device_clear_options() - clear some options
 * @cdev: device for which the options are to be cleared
 * @flags: options to be cleared
 *
 * All flags specified in @flags are cleared, the remainder is left untouched.
 */
void ccw_device_clear_options(struct ccw_device *cdev, unsigned long flags)
{
	cdev->private->options.fast &= (flags & CCWDEV_EARLY_NOTIFICATION) == 0;
	cdev->private->options.repall &= (flags & CCWDEV_REPORT_ALL) == 0;
	cdev->private->options.pgroup &= (flags & CCWDEV_DO_PATHGROUP) == 0;
	cdev->private->options.force &= (flags & CCWDEV_ALLOW_FORCE) == 0;
}

/**
 * ccw_device_clear() - terminate I/O request processing
 * @cdev: target ccw device
 * @intparm: interruption parameter; value is only used if no I/O is
 *	     outstanding, otherwise the intparm associated with the I/O request
 *	     is returned
 *
 * ccw_device_clear() calls csch on @cdev's subchannel.
 * Returns:
 *  %0 on success,
 *  -%ENODEV on device not operational,
 *  -%EINVAL on invalid device state.
 * Context:
 *  Interrupts disabled, ccw device lock held
 */
int ccw_device_clear(struct ccw_device *cdev, unsigned long intparm)
{
	struct subchannel *sch;
	int ret;

	if (!cdev || !cdev->dev.parent)
		return -ENODEV;
	sch = to_subchannel(cdev->dev.parent);
	if (!sch->schib.pmcw.ena)
		return -EINVAL;
	if (cdev->private->state == DEV_STATE_NOT_OPER)
		return -ENODEV;
	if (cdev->private->state != DEV_STATE_ONLINE &&
	    cdev->private->state != DEV_STATE_W4SENSE)
		return -EINVAL;

	ret = cio_clear(sch);
	if (ret == 0)
		cdev->private->intparm = intparm;
	return ret;
}

/**
 * ccw_device_start_key() - start a s390 channel program with key
 * @cdev: target ccw device
 * @cpa: logical start address of channel program
 * @intparm: user specific interruption parameter; will be presented back to
 *	     @cdev's interrupt handler. Allows a device driver to associate
 *	     the interrupt with a particular I/O request.
 * @lpm: defines the channel path to be used for a specific I/O request. A
 *	 value of 0 will make cio use the opm.
 * @key: storage key to be used for the I/O
 * @flags: additional flags; defines the action to be performed for I/O
 *	   processing.
 *
 * Start a S/390 channel program. When the interrupt arrives, the
 * IRQ handler is called, either immediately, delayed (dev-end missing,
 * or sense required) or never (no IRQ handler registered).
 * Returns:
 *  %0, if the operation was successful;
 *  -%EBUSY, if the device is busy, or status pending;
 *  -%EACCES, if no path specified in @lpm is operational;
 *  -%ENODEV, if the device is not operational.
 * Context:
 *  Interrupts disabled, ccw device lock held
 */
int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa,
			 unsigned long intparm, __u8 lpm, __u8 key,
			 unsigned long flags)
{
	struct subchannel *sch;
	int ret;

	if (!cdev || !cdev->dev.parent)
		return -ENODEV;
	sch = to_subchannel(cdev->dev.parent);
	if (!sch->schib.pmcw.ena)
		return -EINVAL;
	if (cdev->private->state == DEV_STATE_NOT_OPER)
		return -ENODEV;
	if (cdev->private->state == DEV_STATE_VERIFY ||
	    cdev->private->state == DEV_STATE_CLEAR_VERIFY) {
		/* Remember to fake irb when finished. */
		if (!cdev->private->flags.fake_irb) {
			cdev->private->flags.fake_irb = 1;
			cdev->private->intparm = intparm;
			return 0;
		} else
			/* There's already a fake I/O around. */
			return -EBUSY;
	}
	if (cdev->private->state != DEV_STATE_ONLINE ||
	    ((sch->schib.scsw.cmd.stctl & SCSW_STCTL_PRIM_STATUS) &&
	     !(sch->schib.scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS)) ||
	    cdev->private->flags.doverify)
		return -EBUSY;
	ret = cio_set_options (sch, flags);
	if (ret)
		return ret;
	/* Adjust requested path mask to excluded varied off paths. */
	if (lpm) {
		lpm &= sch->opm;
		if (lpm == 0)
			return -EACCES;
	}
	ret = cio_start_key (sch, cpa, lpm, key);
	switch (ret) {
	case 0:
		cdev->private->intparm = intparm;
		break;
	case -EACCES:
	case -ENODEV:
		dev_fsm_event(cdev, DEV_EVENT_VERIFY);
		break;
	}
	return ret;
}

/**
 * ccw_device_start_timeout_key() - start a s390 channel program with timeout and key
 * @cdev: target ccw device
 * @cpa: logical start address of channel program
 * @intparm: user specific interruption parameter; will be presented back to
 *	     @cdev's interrupt handler. Allows a device driver to associate
 *	     the interrupt with a particular I/O request.
 * @lpm: defines the channel path to be used for a specific I/O request. A
 *	 value of 0 will make cio use the opm.
 * @key: storage key to be used for the I/O
 * @flags: additional flags; defines the action to be performed for I/O
 *	   processing.
 * @expires: timeout value in jiffies
 *
 * Start a S/390 channel program. When the interrupt arrives, the
 * IRQ handler is called, either immediately, delayed (dev-end missing,
 * or sense required) or never (no IRQ handler registered).
 * This function notifies the device driver if the channel program has not
 * completed during the time specified by @expires. If a timeout occurs, the
 * channel program is terminated via xsch, hsch or csch, and the device's
 * interrupt handler will be called with an irb containing ERR_PTR(-%ETIMEDOUT).
 * Returns:
 *  %0, if the operation was successful;
 *  -%EBUSY, if the device is busy, or status pending;
 *  -%EACCES, if no path specified in @lpm is operational;
 *  -%ENODEV, if the device is not operational.
 * Context:
 *  Interrupts disabled, ccw device lock held
 */
int ccw_device_start_timeout_key(struct ccw_device *cdev, struct ccw1 *cpa,
				 unsigned long intparm, __u8 lpm, __u8 key,
				 unsigned long flags, int expires)
{
	int ret;

	if (!cdev)
		return -ENODEV;
	ccw_device_set_timeout(cdev, expires);
	ret = ccw_device_start_key(cdev, cpa, intparm, lpm, key, flags);
	if (ret != 0)
		ccw_device_set_timeout(cdev, 0);
	return ret;
}

/**
 * ccw_device_start() - start a s390 channel program
 * @cdev: target ccw device
 * @cpa: logical start address of channel program
 * @intparm: user specific interruption parameter; will be presented back to
 *	     @cdev's interrupt handler. Allows a device driver to associate
 *	     the interrupt with a particular I/O request.
 * @lpm: defines the channel path to be used for a specific I/O request. A
 *	 value of 0 will make cio use the opm.
 * @flags: additional flags; defines the action to be performed for I/O
 *	   processing.
 *
 * Start a S/390 channel program. When the interrupt arrives, the
 * IRQ handler is called, either immediately, delayed (dev-end missing,
 * or sense required) or never (no IRQ handler registered).
 * Returns:
 *  %0, if the operation was successful;
 *  -%EBUSY, if the device is busy, or status pending;
 *  -%EACCES, if no path specified in @lpm is operational;
 *  -%ENODEV, if the device is not operational.
 * Context:
 *  Interrupts disabled, ccw device lock held
 */
int ccw_device_start(struct ccw_device *cdev, struct ccw1 *cpa,
		     unsigned long intparm, __u8 lpm, unsigned long flags)
{
	return ccw_device_start_key(cdev, cpa, intparm, lpm,
				    PAGE_DEFAULT_KEY, flags);
}

/**
 * ccw_device_start_timeout() - start a s390 channel program with timeout
 * @cdev: target ccw device
 * @cpa: logical start address of channel program
 * @intparm: user specific interruption parameter; will be presented back to
 *	     @cdev's interrupt handler. Allows a device driver to associate
 *	     the interrupt with a particular I/O request.
 * @lpm: defines the channel path to be used for a specific I/O request. A
 *	 value of 0 will make cio use the opm.
 * @flags: additional flags; defines the action to be performed for I/O
 *	   processing.
 * @expires: timeout value in jiffies
 *
 * Start a S/390 channel program. When the interrupt arrives, the
 * IRQ handler is called, either immediately, delayed (dev-end missing,
 * or sense required) or never (no IRQ handler registered).
 * This function notifies the device driver if the channel program has not
 * completed during the time specified by @expires. If a timeout occurs, the
 * channel program is terminated via xsch, hsch or csch, and the device's
 * interrupt handler will be called with an irb containing ERR_PTR(-%ETIMEDOUT).
 * Returns:
 *  %0, if the operation was successful;
 *  -%EBUSY, if the device is busy, or status pending;
 *  -%EACCES, if no path specified in @lpm is operational;
 *  -%ENODEV, if the device is not operational.
 * Context:
 *  Interrupts disabled, ccw device lock held
 */
int ccw_device_start_timeout(struct ccw_device *cdev, struct ccw1 *cpa,
			     unsigned long intparm, __u8 lpm,
			     unsigned long flags, int expires)
{
	return ccw_device_start_timeout_key(cdev, cpa, intparm, lpm,
					    PAGE_DEFAULT_KEY, flags,
					    expires);
}

/**
 * ccw_device_halt() - halt I/O request processing
 * @cdev: target ccw device
 * @intparm: interruption parameter; value is only used if no I/O is
 *	     outstanding, otherwise the intparm associated with the I/O request
 *	     is returned
 *
 * ccw_device_halt() calls hsch on @cdev's subchannel.
 * Returns:
 *  %0 on success,
 *  -%ENODEV on device not operational,
 *  -%EINVAL on invalid device state,
 *  -%EBUSY on device busy or interrupt pending.
 * Context:
 *  Interrupts disabled, ccw device lock held
 */
int ccw_device_halt(struct ccw_device *cdev, unsigned long intparm)
{
	struct subchannel *sch;
	int ret;

	if (!cdev || !cdev->dev.parent)
		return -ENODEV;
	sch = to_subchannel(cdev->dev.parent);
	if (!sch->schib.pmcw.ena)
		return -EINVAL;
	if (cdev->private->state == DEV_STATE_NOT_OPER)
		return -ENODEV;
	if (cdev->private->state != DEV_STATE_ONLINE &&
	    cdev->private->state != DEV_STATE_W4SENSE)
		return -EINVAL;

	ret = cio_halt(sch);
	if (ret == 0)
		cdev->private->intparm = intparm;
	return ret;
}

/**
 * ccw_device_resume() - resume channel program execution
 * @cdev: target ccw device
 *
 * ccw_device_resume() calls rsch on @cdev's subchannel.
 * Returns:
 *  %0 on success,
 *  -%ENODEV on device not operational,
 *  -%EINVAL on invalid device state,
 *  -%EBUSY on device busy or interrupt pending.
 * Context:
 *  Interrupts disabled, ccw device lock held
 */
int ccw_device_resume(struct ccw_device *cdev)
{
	struct subchannel *sch;

	if (!cdev || !cdev->dev.parent)
		return -ENODEV;
	sch = to_subchannel(cdev->dev.parent);
	if (!sch->schib.pmcw.ena)
		return -EINVAL;
	if (cdev->private->state == DEV_STATE_NOT_OPER)
		return -ENODEV;
	if (cdev->private->state != DEV_STATE_ONLINE ||
	    !(sch->schib.scsw.cmd.actl & SCSW_ACTL_SUSPENDED))
		return -EINVAL;
	return cio_resume(sch);
}

/*
 * Pass interrupt to device driver.
 */
int
ccw_device_call_handler(struct ccw_device *cdev)
{
	struct subchannel *sch;
	unsigned int stctl;
	int ending_status;

	sch = to_subchannel(cdev->dev.parent);

	/*
	 * we allow for the device action handler if .
	 *  - we received ending status
	 *  - the action handler requested to see all interrupts
	 *  - we received an intermediate status
	 *  - fast notification was requested (primary status)
	 *  - unsolicited interrupts
	 */
	stctl = scsw_stctl(&cdev->private->irb.scsw);
	ending_status = (stctl & SCSW_STCTL_SEC_STATUS) ||
		(stctl == (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND)) ||
		(stctl == SCSW_STCTL_STATUS_PEND);
	if (!ending_status &&
	    !cdev->private->options.repall &&
	    !(stctl & SCSW_STCTL_INTER_STATUS) &&
	    !(cdev->private->options.fast &&
	      (stctl & SCSW_STCTL_PRIM_STATUS)))
		return 0;

	/* Clear pending timers for device driver initiated I/O. */
	if (ending_status)
		ccw_device_set_timeout(cdev, 0);
	/*
	 * Now we are ready to call the device driver interrupt handler.
	 */
	if (cdev->handler)
		cdev->handler(cdev, cdev->private->intparm,
			      &cdev->private->irb);

	/*
	 * Clear the old and now useless interrupt response block.
	 */
	memset(&cdev->private->irb, 0, sizeof(struct irb));

	return 1;
}

/**
 * ccw_device_get_ciw() - Search for CIW command in extended sense data.
 * @cdev: ccw device to inspect
 * @ct: command type to look for
 *
 * During SenseID, command information words (CIWs) describing special
 * commands available to the device may have been stored in the extended
 * sense data. This function searches for CIWs of a specified command
 * type in the extended sense data.
 * Returns:
 *  %NULL if no extended sense data has been stored or if no CIW of the
 *  specified command type could be found,
 *  else a pointer to the CIW of the specified command type.
 */
struct ciw *ccw_device_get_ciw(struct ccw_device *cdev, __u32 ct)
{
	int ciw_cnt;

	if (cdev->private->flags.esid == 0)
		return NULL;
	for (ciw_cnt = 0; ciw_cnt < MAX_CIWS; ciw_cnt++)
		if (cdev->private->senseid.ciw[ciw_cnt].ct == ct)
			return cdev->private->senseid.ciw + ciw_cnt;
	return NULL;
}

/**
 * ccw_device_get_path_mask() - get currently available paths
 * @cdev: ccw device to be queried
 * Returns:
 *  %0 if no subchannel for the device is available,
 *  else the mask of currently available paths for the ccw device's subchannel.
 */
__u8 ccw_device_get_path_mask(struct ccw_device *cdev)
{
	struct subchannel *sch;

	if (!cdev->dev.parent)
		return 0;

	sch = to_subchannel(cdev->dev.parent);
	return sch->lpm;
}

/*
 * Try to break the lock on a boxed device.
 */
int
ccw_device_stlck(struct ccw_device *cdev)
{
	void *buf, *buf2;
	unsigned long flags;
	struct subchannel *sch;
	int ret;

	if (!cdev)
		return -ENODEV;

	if (cdev->drv && !cdev->private->options.force)
		return -EINVAL;

	sch = to_subchannel(cdev->dev.parent);

	CIO_TRACE_EVENT(2, "stl lock");
	CIO_TRACE_EVENT(2, dev_name(&cdev->dev));

	buf = kmalloc(32*sizeof(char), GFP_DMA|GFP_KERNEL);
	if (!buf)
		return -ENOMEM;
	buf2 = kmalloc(32*sizeof(char), GFP_DMA|GFP_KERNEL);
	if (!buf2) {
		kfree(buf);
		return -ENOMEM;
	}
	spin_lock_irqsave(sch->lock, flags);
	ret = cio_enable_subchannel(sch, (u32)(addr_t)sch);
	if (ret)
		goto out_unlock;
	/*
	 * Setup ccw. We chain an unconditional reserve and a release so we
	 * only break the lock.
	 */
	cdev->private->iccws[0].cmd_code = CCW_CMD_STLCK;
	cdev->private->iccws[0].cda = (__u32) __pa(buf);
	cdev->private->iccws[0].count = 32;
	cdev->private->iccws[0].flags = CCW_FLAG_CC;
	cdev->private->iccws[1].cmd_code = CCW_CMD_RELEASE;
	cdev->private->iccws[1].cda = (__u32) __pa(buf2);
	cdev->private->iccws[1].count = 32;
	cdev->private->iccws[1].flags = 0;
	ret = cio_start(sch, cdev->private->iccws, 0);
	if (ret) {
		cio_disable_subchannel(sch); //FIXME: return code?
		goto out_unlock;
	}
	cdev->private->irb.scsw.cmd.actl |= SCSW_ACTL_START_PEND;
	spin_unlock_irqrestore(sch->lock, flags);
	wait_event(cdev->private->wait_q,
		   cdev->private->irb.scsw.cmd.actl == 0);
	spin_lock_irqsave(sch->lock, flags);
	cio_disable_subchannel(sch); //FIXME: return code?
	if ((cdev->private->irb.scsw.cmd.dstat !=
	     (DEV_STAT_CHN_END|DEV_STAT_DEV_END)) ||
	    (cdev->private->irb.scsw.cmd.cstat != 0))
		ret = -EIO;
	/* Clear irb. */
	memset(&cdev->private->irb, 0, sizeof(struct irb));
out_unlock:
	kfree(buf);
	kfree(buf2);
	spin_unlock_irqrestore(sch->lock, flags);
	return ret;
}

void *ccw_device_get_chp_desc(struct ccw_device *cdev, int chp_no)
{
	struct subchannel *sch;
	struct chp_id chpid;

	sch = to_subchannel(cdev->dev.parent);
	chp_id_init(&chpid);
	chpid.id = sch->schib.pmcw.chpid[chp_no];
	return chp_get_chp_desc(chpid);
}

/**
 * ccw_device_get_id - obtain a ccw device id
 * @cdev: device to obtain the id for
 * @dev_id: where to fill in the values
 */
void ccw_device_get_id(struct ccw_device *cdev, struct ccw_dev_id *dev_id)
{
	*dev_id = cdev->private->dev_id;
}
EXPORT_SYMBOL(ccw_device_get_id);

/**
 * ccw_device_tm_start_key - perform start function
 * @cdev: ccw device on which to perform the start function
 * @tcw: transport-command word to be started
 * @intparm: user defined parameter to be passed to the interrupt handler
 * @lpm: mask of paths to use
 * @key: storage key to use for storage access
 *
 * Start the tcw on the given ccw device. Return zero on success, non-zero
 * otherwise.
 */
int ccw_device_tm_start_key(struct ccw_device *cdev, struct tcw *tcw,
			    unsigned long intparm, u8 lpm, u8 key)
{
	struct subchannel *sch;
	int rc;

	sch = to_subchannel(cdev->dev.parent);
	if (!sch->schib.pmcw.ena)
		return -EINVAL;
	if (cdev->private->state != DEV_STATE_ONLINE)
		return -EIO;
	/* Adjust requested path mask to excluded varied off paths. */
	if (lpm) {
		lpm &= sch->opm;
		if (lpm == 0)
			return -EACCES;
	}
	rc = cio_tm_start_key(sch, tcw, lpm, key);
	if (rc == 0)
		cdev->private->intparm = intparm;
	return rc;
}
EXPORT_SYMBOL(ccw_device_tm_start_key);

/**
 * ccw_device_tm_start_timeout_key - perform start function
 * @cdev: ccw device on which to perform the start function
 * @tcw: transport-command word to be started
 * @intparm: user defined parameter to be passed to the interrupt handler
 * @lpm: mask of paths to use
 * @key: storage key to use for storage access
 * @expires: time span in jiffies after which to abort request
 *
 * Start the tcw on the given ccw device. Return zero on success, non-zero
 * otherwise.
 */
int ccw_device_tm_start_timeout_key(struct ccw_device *cdev, struct tcw *tcw,
				    unsigned long intparm, u8 lpm, u8 key,
				    int expires)
{
	int ret;

	ccw_device_set_timeout(cdev, expires);
	ret = ccw_device_tm_start_key(cdev, tcw, intparm, lpm, key);
	if (ret != 0)
		ccw_device_set_timeout(cdev, 0);
	return ret;
}
EXPORT_SYMBOL(ccw_device_tm_start_timeout_key);

/**
 * ccw_device_tm_start - perform start function
 * @cdev: ccw device on which to perform the start function
 * @tcw: transport-command word to be started
 * @intparm: user defined parameter to be passed to the interrupt handler
 * @lpm: mask of paths to use
 *
 * Start the tcw on the given ccw device. Return zero on success, non-zero
 * otherwise.
 */
int ccw_device_tm_start(struct ccw_device *cdev, struct tcw *tcw,
			unsigned long intparm, u8 lpm)
{
	return ccw_device_tm_start_key(cdev, tcw, intparm, lpm,
				       PAGE_DEFAULT_KEY);
}
EXPORT_SYMBOL(ccw_device_tm_start);

/**
 * ccw_device_tm_start_timeout - perform start function
 * @cdev: ccw device on which to perform the start function
 * @tcw: transport-command word to be started
 * @intparm: user defined parameter to be passed to the interrupt handler
 * @lpm: mask of paths to use
 * @expires: time span in jiffies after which to abort request
 *
 * Start the tcw on the given ccw device. Return zero on success, non-zero
 * otherwise.
 */
int ccw_device_tm_start_timeout(struct ccw_device *cdev, struct tcw *tcw,
			       unsigned long intparm, u8 lpm, int expires)
{
	return ccw_device_tm_start_timeout_key(cdev, tcw, intparm, lpm,
					       PAGE_DEFAULT_KEY, expires);
}
EXPORT_SYMBOL(ccw_device_tm_start_timeout);

/**
 * ccw_device_tm_intrg - perform interrogate function
 * @cdev: ccw device on which to perform the interrogate function
 *
 * Perform an interrogate function on the given ccw device. Return zero on
 * success, non-zero otherwise.
 */
int ccw_device_tm_intrg(struct ccw_device *cdev)
{
	struct subchannel *sch = to_subchannel(cdev->dev.parent);

	if (!sch->schib.pmcw.ena)
		return -EINVAL;
	if (cdev->private->state != DEV_STATE_ONLINE)
		return -EIO;
	if (!scsw_is_tm(&sch->schib.scsw) ||
	    !(scsw_actl(&sch->schib.scsw) & SCSW_ACTL_START_PEND))
		return -EINVAL;
	return cio_tm_intrg(sch);
}
EXPORT_SYMBOL(ccw_device_tm_intrg);

// FIXME: these have to go:

int
_ccw_device_get_subchannel_number(struct ccw_device *cdev)
{
	return cdev->private->schid.sch_no;
}

MODULE_LICENSE("GPL");
EXPORT_SYMBOL(ccw_device_set_options_mask);
EXPORT_SYMBOL(ccw_device_set_options);
EXPORT_SYMBOL(ccw_device_clear_options);
EXPORT_SYMBOL(ccw_device_clear);
EXPORT_SYMBOL(ccw_device_halt);
EXPORT_SYMBOL(ccw_device_resume);
EXPORT_SYMBOL(ccw_device_start_timeout);
EXPORT_SYMBOL(ccw_device_start);
EXPORT_SYMBOL(ccw_device_start_timeout_key);
EXPORT_SYMBOL(ccw_device_start_key);
EXPORT_SYMBOL(ccw_device_get_ciw);
EXPORT_SYMBOL(ccw_device_get_path_mask);
EXPORT_SYMBOL(_ccw_device_get_subchannel_number);
EXPORT_SYMBOL_GPL(ccw_device_get_chp_desc);


text:
<?php require_once('../../Connections/MySQL.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
?>

<?php
	$action = (isset($_REQUEST['action'])&& $_REQUEST['action'] !=NULL)?$_REQUEST['action']:'';
	if($action == 'ajax'){
		include 'pagination.php'; //incluir el archivo de paginación
		//las variables de paginación
		$page = (isset($_REQUEST['page']) && !empty($_REQUEST['page']))?$_REQUEST['page']:1;
		$per_page = 12; //la cantidad de registros que desea mostrar
		$adjacents  = 4; //brecha entre páginas después de varios adyacentes
		$offset = ($page - 1) * $per_page;

		$reload = 'MateriasPorAlumnos.php';
		//consulta principal para recuperar los datos
                $method = (isset($_REQUEST['method'])&& $_REQUEST['method'] !=NULL)?$_REQUEST['method']:'';
                $palabra = (isset($_REQUEST['palabra'])&& $_REQUEST['palabra'] !=NULL)?$_REQUEST['palabra']:'';
                $filtro = (isset($_REQUEST['filtro'])&& $_REQUEST['filtro'] !=NULL)?$_REQUEST['filtro']:'';

                $WhereClause = " ";
                $WhereClauseCount = " ";

                if($method == 'buscar'){
                    switch($filtro){
                            case "todos":
                                    $WhereClause = " ";
                                    $WhereClauseCount = " ";
                                    break;
                            case "dni":
                                    $WhereClause = " WHERE a.DNI LIKE '%$palabra%' ";
                                    $WhereClauseCount = " WHERE DNI LIKE '%$palabra%' ";
                                    break;
                            case "apellido":
                                    $WhereClause = " WHERE a.Apellido LIKE '%$palabra%' ";
                                    $WhereClauseCount = " WHERE Apellido LIKE '%$palabra%' ";
                                    break;
                            case "materia":
                                    $WhereClause = " WHERE m.Descripcion LIKE '%$palabra%' ";
                                    $WhereClauseCount = " WHERE Materia LIKE '%$palabra%' ";
                                     break;
                            }
                }
                 $sql = "SELECT a.idAlumno, a.DNI , a.Apellido, a.Nombre, am.EsEquivalencia , m.Descripcion as Materia,
						if(am.FechaFirma is not null, 'Si ', 'No') as Firmada ,
						case when (select mfa.aprobado from mesa_final_alumno mfa where am.idAlumnoMateria = mfa.IdAlumnoMateria order by IdMesaFinal desc LIMIT 1 ) = 1
						or ae.idAlumnoEquivalencia is not null then 'Si' else 'No' end as Aprobada,
                        (select am.FechaFirma) as FechaDeFirma,
						(select mfa.nota from mesa_final_alumno mfa where am.idAlumnoMateria = mfa.IdAlumnoMateria order by IdMesaFinal desc LIMIT 1 ) as Nota,
                                                (select mfa.IdMesaFinalAlumno from mesa_final_alumno mfa where am.idAlumnoMateria = mfa.IdAlumnoMateria order by IdMesaFinal desc LIMIT 1 ) as IdMesaFinalAlumno
                                                FROM alumnos a
						INNER JOIN alumno_materias am on am.IdAlumno = a.IdAlumno
						INNER JOIN materias_plan mp on mp.IdMateriaPlan = am.IdMateriaPlan
						INNER JOIN materias m on m.IdMateria = mp.IdMateria
						LEFT JOIN alumno_equivalencias ae on ae.idMateriaPlan = mp.IdMateriaPlan and a.IdAlumno = ae.idAlumno
						$WhereClause
						GROUP BY a.DNI , a.Apellido, a.Nombre , m.Descripcion
						ORDER BY a.Apellido, m.idMateria
                        LIMIT $offset,$per_page ";

                    $count_query = mysqli_query(dbconnect(),"SELECT count(*) AS numrows  FROM (
										SELECT a.DNI , a.Apellido, a.Nombre , am.EsEquivalencia, m.Descripcion as Materia,
										if(am.FechaFirma is not null, 'Si ', 'No') as Firmada ,
										case when (select mfa.aprobado from mesa_final_alumno mfa where am.idAlumnoMateria = mfa.IdAlumnoMateria order by IdMesaFinal desc LIMIT 1 ) = 1
										or ae.idAlumnoEquivalencia is not null then 'Si' else 'No' end as Aprobada,
                                        (select am.FechaFirma) as FechaDeFirma,
										(select mfa.nota from mesa_final_alumno mfa where am.idAlumnoMateria = mfa.IdAlumnoMateria  order by IdMesaFinal desc LIMIT 1 ) as Nota
										FROM alumnos a
										INNER JOIN alumno_materias am on am.IdAlumno = a.IdAlumno
										INNER JOIN materias_plan mp on mp.IdMateriaPlan = am.IdMateriaPlan
										INNER JOIN materias m on m.IdMateria = mp.IdMateria
										LEFT JOIN alumno_equivalencias ae on ae.idMateriaPlan = mp.IdMateriaPlan and a.IdAlumno = ae.idAlumno
                                        GROUP BY a.DNI , a.Apellido, a.Nombre , m.Descripcion ) x
                                        $WhereClauseCount");

                //Cuenta el número total de filas de la tabla*/
		if ($row= mysqli_fetch_array($count_query)){$numrows = $row['numrows'];}
		$total_pages = ceil($numrows/$per_page);

                $query = mysqli_query(dbconnect(), $sql );
		if ($numrows>0){
			?>

                    <table id="myTable" align="center" aria-describedby="table_info" role="grid"
                    <?php if ($_SESSION['MM_UserGroup']=='Admin'){ ?>  style="width: 100%;"
                    <?php } else { ?> style="width: 60%;" <?php } ?>
                    class="table table-striped table-bordered dataTable tablesorter" cellspacing="0" width="100%">

                                        <?php if ($_SESSION['MM_UserGroup']=='Admin'){ ?>
                                            DNI
                                            Apellido
                                            Nombre
                                        <?php } ?>
                                        Materia
                                        Firmada
                                        Fecha de Firma
                                        Aprobada
                                        Nota
                                        Equivalencia
                                        <?php if ($_SESSION['MM_UserGroup']=='Admin'){ ?>
                                        Acciones
                                        <?php } ?>

                            <?php
                            while($row = mysqli_fetch_array($query)){
                                    ?>

                                            <?php if ($_SESSION['MM_UserGroup']=='Admin'){ ?>
                                                <td align="center"
 <?php echo $row['DNI']; ?>

                                                <td align="left"
 <?php echo $row['Apellido']; ?>

                                                <td align="left"
 <?php echo $row['Nombre']; ?>

                                            <?php } ?>

                                            <td align="left"
 <?php echo $row['Materia']; ?>

                                            <?php if($row['Firmada'] == "No"): ?>
                                                <td align="center" style="color:#DF0101"
 <?php echo $row['Firmada']; ?>

                                            <?php else:  ?>
                                                <td align="center" style="color:#04B404"
 <?php echo $row['Firmada']; ?>

                                            <?php endif; ?>

                                             <?php if($row['Firmada'] == "No"): ?>
                                                <td align="center" style="color:#DF0101"

                                            <?php else :
                                                $row1['Fecha'] = date('d/m/Y', strtotime($row['FechaDeFirma']));
                                                    ?>
                                                    <td align="center" style="color:#04B404"

                                                    <?php echo $row1['Fecha'];?>

                                            <?php endif;?>

                                            <?php if($row['Aprobada'] == "No") { ?>
                                                <td align="center" style="color:#DF0101"
 <?php echo $row['Aprobada']; ?>

                                            <?php } else { ?>
                                                <td align="center" style="color:#04B404"
 <?php echo $row['Aprobada']; ?>

                                            <?php } ?>
                                            <td align="center" style="font-weight:bold"
 <?php echo $row['Nota']; ?>

                                            <?php if($row['EsEquivalencia'] == 0) { ?>
                                                <td align="center" style="color:#DF0101"
No

                                            <?php } else { ?>
                                                <td align="center" style="color:#04B404"
Si

                                            <?php } ?>
                                            <?php if ($_SESSION['MM_UserGroup']=='Admin'){ ?>

                                                    <button type="button" class="btn btn-info" data-toggle="modal" data-target="#dataUpdate" data-idAlumno="<?php echo $row['idAlumno']?>" data-dni="<?php echo $row['DNI']?>" data-apellido="<?php echo $row['Apellido']?>" data-nombre="<?php echo $row['Nombre']?>" data-materia="<?php echo $row['Materia']?>" data-nota="<?php echo $row['Nota']?>" data-idmesafinalalumno="<?php echo $row['IdMesaFinalAlumno']?>" > Modificar</button>

                                            <?php } ?>

                                    <?php
                            }
                            ?>

			<?php echo paginate($reload, $page, $total_pages, $adjacents);?>

			<?php

		} else {
			?>

              <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>

Aviso!!!
 No hay datos para mostrar

			<?php
		}
	}
?>


text:
/*!
 * \file   atomic/detail/core_operations_emulated_fwd.hpp
 *
 * This header forward-declares lock pool-based implementation of the core atomic operations.
 */

#ifndef BOOST_ATOMIC_DETAIL_CORE_OPERATIONS_EMULATED_FWD_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_CORE_OPERATIONS_EMULATED_FWD_HPP_INCLUDED_

#include <cstddef>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/header.hpp>

#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif

namespace boost {
namespace atomics {
namespace detail {

template< std::size_t Size, std::size_t Alignment, bool Signed, bool Interprocess >
struct core_operations_emulated;

} // namespace detail
} // namespace atomics
} // namespace boost

#include <boost/atomic/detail/footer.hpp>

#endif // BOOST_ATOMIC_DETAIL_CORE_OPERATIONS_EMULATED_FWD_HPP_INCLUDED_


text:
```js
Excel.run(function (ctx) {
	var tables = ctx.workbook.tables;
	var values = [["Sample"], ["Values"], ["For"], ["New"], ["Column"]];
	var column = tables.getItem("Table1").columns.add(null, values);
	column.load('name');
	return ctx.sync().then(function() {
		console.log(column.name);
	});
});
```

### getItem(id: object)

```js
Excel.run(function (ctx) {
	var tablecolumn = ctx.workbook.tables.getItem['Table1'].columns.getItem(0);
	tablecolumn.load('name');
	return ctx.sync().then(function() {
			console.log(tablecolumn.name);
	});
});
```

### getItemAt(index: number)
```js
Excel.run(function (ctx) {
	var tablecolumn = ctx.workbook.tables.getItem['Table1'].columns.getItemAt(0);
	tablecolumn.load('name');
	return ctx.sync().then(function() {
			console.log(tablecolumn.name);
	});
});
```
### Getter tablecolumn Collection

```js
Excel.run(function (ctx) {
	var tablecolumns = ctx.workbook.tables.getItem['Table1'].columns;
	tablecolumns.load('items');
	return ctx.sync().then(function() {
		console.log("tablecolumns Count: " + tablecolumns.count);
		for (var i = 0; i < tablecolumns.items.length; i++)
		{
			console.log(tablecolumns.items[i].name);
		}
	});
});
```


text:
from django.core.management import call_command
from testcases import (
    TestServerTestCase,
    get_client
)

class LazyTestCase(TestServerTestCase):

    def setUp(self):
        self.start_test_server()
        self.client = get_client()
        call_command('loaddata', 'base_data.json')

    def tearDown(self):
        self.stop_test_server()

    def test_lazy1(self):
        fl = self.client.inbox_message_many.objects.filter()
        self.assertTrue(fl)
        for i, f in enumerate(fl):
            self.assertTrue(f)
        self.assertTrue(fl.count() == i+1)