text:
//
// Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

/** Implements a wrapper for a single Vulkan pipeline cache. Implemented in order to:
 *
 *  - manage life-time of pipeline cache instances.
 *  - let ObjectTracker detect leaking queue pipeline cache instances.
 *
 *  The wrapper is NOT thread-safe.
 **/

#ifndef WRAPPERS_PIPELINE_CACHE_H
#define WRAPPERS_PIPELINE_CACHE_H

#include "misc/debug_marker.h"
#include "misc/types.h"

namespace Anvil
{
    class PipelineCache : public DebugMarkerSupportProvider<PipelineCache>
    {
    public:
        /* Public functions */

        /** Constructor.
         *
         *  @param in_device_ptr        Vulkan device to initialize the pipeline cache with.
         *  @param in_initial_data_size Number of bytes available under @param in_initial_data. Can be 0.
         *  @param in_initial_data      Initial data to initialize the new pipeline cache instance with.
         *                              May be nullptr if @param in_initial_data_size is 0.
         **/
        static std::shared_ptr<Anvil::PipelineCache> create(std::weak_ptr<Anvil::BaseDevice> in_device_ptr,
                                                            size_t                           in_initial_data_size = 0,
                                                            const void*                      in_initial_data      = nullptr);

        /** Destroys the Vulkan counterpart and unregisters the wrapper instance from the object tracker. */
        virtual ~PipelineCache();

        /** Retrieves pipeline cache data.
         *
         *  @param out_n_data_bytes_ptr Deref will be set to the number of bytes @param out_data_ptr must
         *                              provide. Must not be nullptr.
         *  @param out_data_ptr         Pointer to the buffer to hold the requested data. May be nullptr.
         *
         *  @return true if successful, false otherwise.
         **/
        bool get_data(size_t*      out_n_data_bytes_ptr,
                      const void** out_data_ptr);

        /** Retrieves raw Vulkan pipeline cache handle */
        const VkPipelineCache& get_pipeline_cache() const
        {
            return m_pipeline_cache;
        }

        /** Adds cached pipelines in @param in_src_cache_ptrs to this pipeline instance.
         *
         *  @param in_n_pipeline_caches Number of pipeline caches under @param in_src_cache_ptrs.
         *  @param in_src_cache_ptrs    Pipeline caches to merge with. Must not be nullptr.
         *
         *  @return true if successful, false otherwise.
         **/
        bool merge(uint32_t                                           in_n_pipeline_caches,
                   std::shared_ptr<const Anvil::PipelineCache> const* in_src_cache_ptrs);

    private:
        /* Private functions */

        /* Constructor. See create() for specification */
        PipelineCache(std::weak_ptr<Anvil::BaseDevice> in_device_ptr,
                      size_t                           in_initial_data_size,
                      const void*                      in_initial_data);

        PipelineCache           (const PipelineCache&);
        PipelineCache& operator=(const PipelineCache&);

        /* Private variables */
        std::weak_ptr<Anvil::BaseDevice> m_device_ptr;
        VkPipelineCache                  m_pipeline_cache;
    };
}; /* namespace Anvil */

#endif /* WRAPPERS_PIPELINE_CACHE_H */


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

<title>M-Index</title>
<meta name="date" content="2016-03-03">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

A B C D E F G I J L M N O P Q R S T U

M

Main - Class in edu.towson.cis.cosc603.project2.monopoly.gui

The Class Main.

Main() - Constructor for class edu.towson.cis.cosc603.project2.monopoly.gui.Main

main(String[]) - Static method in class edu.towson.cis.cosc603.project2.monopoly.gui.Main

The main method.

MainWindow - Class in edu.towson.cis.cosc603.project2.monopoly.gui

The Class MainWindow.

MainWindow() - Constructor for class edu.towson.cis.cosc603.project2.monopoly.gui.MainWindow

Instantiates a new main window.

makeMessage() - Method in class edu.towson.cis.cosc603.project2.monopoly.TradeDeal

Make message.

MAX_PLAYER - Static variable in class edu.towson.cis.cosc603.project2.monopoly.GameMaster

The Constant MAX_PLAYER.

MockGUI - Class in edu.towson.cis.cosc603.project2.monopoly

The Class MockGUI.

MockGUI() - Constructor for class edu.towson.cis.cosc603.project2.monopoly.MockGUI

MockRespondDialog - Class in edu.towson.cis.cosc603.project2.monopoly

The Class MockRespondDialog.

MockRespondDialog(TradeDeal) - Constructor for class edu.towson.cis.cosc603.project2.monopoly.MockRespondDialog

Instantiates a new mock respond dialog.

MockTradeDialog - Class in edu.towson.cis.cosc603.project2.monopoly

The Class MockTradeDialog.

MockTradeDialog() - Constructor for class edu.towson.cis.cosc603.project2.monopoly.MockTradeDialog

MoneyCard - Class in edu.towson.cis.cosc603.project2.monopoly

The Class MoneyCard.

MoneyCard(String, int, int) - Constructor for class edu.towson.cis.cosc603.project2.monopoly.MoneyCard

Instantiates a new money card.

MonopolyGUI - Interface in edu.towson.cis.cosc603.project2.monopoly

The Interface MonopolyGUI.

movePlayer(int, int) - Method in class edu.towson.cis.cosc603.project2.monopoly.GameMaster

Move player.

movePlayer(Player, int) - Method in class edu.towson.cis.cosc603.project2.monopoly.GameMaster

Move player.

movePlayer(int, int, int) - Method in class edu.towson.cis.cosc603.project2.monopoly.gui.MainWindow

movePlayer(int, int, int) - Method in class edu.towson.cis.cosc603.project2.monopoly.MockGUI

movePlayer(int, int, int) - Method in interface edu.towson.cis.cosc603.project2.monopoly.MonopolyGUI

Move player.

MovePlayerCard - Class in edu.towson.cis.cosc603.project2.monopoly

The Class MovePlayerCard.

MovePlayerCard(String, int) - Constructor for class edu.towson.cis.cosc603.project2.monopoly.MovePlayerCard

Instantiates a new move player card.

MovePlayerCardTest - Class in edu.towson.cis.cosc603.project2.monopoly

The Class MovePlayerCardTest.

MovePlayerCardTest() - Constructor for class edu.towson.cis.cosc603.project2.monopoly.MovePlayerCardTest

A B C D E F G I J L M N O P Q R S T U

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>11</logradouro><bairro>Parque Primavera</bairro><cidade>Gurupi</cidade><uf>TO</uf><cep>77413105</cep></feed>


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

namespace Newtonsoft.Json.Serialization
{
  /// <summary>
  /// Used by <see cref="JsonSerializer"/> to resolves a <see cref="JsonContract"/> for a given <see cref="Type"/>.
  /// </summary>
  public interface IContractResolver
  {
    /// <summary>
    /// Resolves the contract for a given type.
    /// </summary>
    /// <param name="type">The type to resolve a contract for.</param>
    /// <returns>The contract for a given type.</returns>
    JsonContract ResolveContract(Type type);
  }
}
#endif


text:
package com.wondersgroup.healthxuhui.data.entity;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 对SecondActivity列表项进行封装的实体类
 * Created by yangjinxi on 2016/6/20.
 */
public class SecondItemEntity implements Parcelable{
    /**
     *
     */
    private String itemName;
    /**
     *此项的名称
     */
    private String name;
    /**
     *此项所代表的url
     */
    private String url;

    protected SecondItemEntity(Parcel in) {
        itemName = in.readString();
        name = in.readString();
        url = in.readString();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(itemName);
        dest.writeString(name);
        dest.writeString(url);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<SecondItemEntity> CREATOR = new Creator<SecondItemEntity>() {
        @Override
        public SecondItemEntity createFromParcel(Parcel in) {
            return new SecondItemEntity(in);
        }

        @Override
        public SecondItemEntity[] newArray(int size) {
            return new SecondItemEntity[size];
        }
    };

    public String getItemName() {
        return itemName;
    }

    public void setItemName(String itemName) {
        this.itemName = itemName;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public SecondItemEntity() {
    }

    public SecondItemEntity(String itemName, String name, String url) {
        this.itemName = itemName;
        this.name = name;
        this.url = url;
    }
}


text:
<!doctype html>

<meta charset="utf-8">
  <title>Национална лотария / Игра МегаДжакпот</title>
	<link rel="stylesheet" type="text/css" href="css/styles.css">

  <meta name="viewport" content="width=1280">

    <button data-type="btn" data-target="global" data-action="debugSoundToggle">Mute Sound</button>
    <button data-type="btn" data-target="global" data-action="debugTimersToggle">Disable Timers</button>
    <button data-type="btn" data-target="global" data-action="debugWheelSpeedToggle">Fast Wheel Spin</button>
    <button data-type="btn" data-target="global" data-action="showJackpotVideo">Jackpot video</button>
    <button data-type="btn" data-target="global" data-action="testMusic">Music</button>

Вие играете за чисто нов
автомобил Toyota Corolla

До момента имате: 0 точки и 0 грешки

ОТКАЗВАМ СЕс -- точки<button class="resign-btn" data-type="btn" data-target="section" data-action="endGame"></button>

-- точки

30

--т.

30

--т.

30

--т.

30

--т.

30

--т.

30

--т.

30

--т.

30

--т.

30

-т.

30

--т.

Натиснете бутона "СТОП" и ще спечелите -- точки.

Играете за -- точки. Изберете по-голямо или по-малко ще е следващото число
 и натиснете бутона "СТОП".

	      Остават Ви  сек.

      	<button class="stop-intro-animation"  data-type="btn" data-target="section" data-action="goToEndOfIntroAnimation">Стоп</button>
		<button class="btn-smaller" data-type="btn" data-target="section" data-action="selectDown"></button>
		<button class="stop-btn" data-type="btn" data-target="section" data-action="stop"></button>
		<button class="btn-bigger" data-type="btn" data-target="section" data-action="selectUp"></button>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ConsoleApplication1.Models;
using Microsoft.Rest;

namespace ConsoleApplication1
{
    public partial interface ISalesRecords
    {
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        Task<HttpOperationResponse<IList<SalesRecord>>> GetWithOperationResponseAsync(CancellationToken cancellationToken = default(System.Threading.CancellationToken));
    }
}


text:
package wl.gank.com.gankwl.cache;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.List;

import wl.gank.com.gankwl.tools.MLog;

/**
 * Created by wanli on 2016/6/15.
 */
public class ListCache<M> implements IFileCache<List<M>> {

    private String path;

    @Override
    public void setPath(String path) {
        this.path = path;
    }

    @Override
    public boolean putCacheData(List<M> list) {
        FileOutputStream fos = null;
        ObjectOutputStream oos = null;
        File cacheFile = new File(path);
        MLog.d("wanli", "ListCache" + "-putCacheData-文件路径:" + cacheFile.getAbsolutePath());
        try {
            fos = new FileOutputStream(cacheFile, false);
            oos = new ObjectOutputStream(fos);
            oos.writeObject(list);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (fos != null)
                    fos.close();
                if (oos != null)
                    oos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return false;
    }

    @Override
    public List<M> getCacheData() {
        FileInputStream fis = null;
        ObjectInputStream ois = null;
        List<M> list = null;
        try {
            File cacheFile = new File(path);
            if (cacheFile.length() > 0) {
                fis = new FileInputStream(cacheFile);
                ois = new ObjectInputStream(fis);
                list = (List<M>) ois.readObject();
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (fis != null)
                    fis.close();
                if (ois != null)
                    ois.close();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (NullPointerException e) {
                e.printStackTrace();
            }
        }
        return list;
    }
}


text:
/******************************************************************************
 File Name: cmsCreateViews.sql

 Purpose:
   This script is run as part of the create database process.  it creates all
 of the views within the database

 Revision History

 Who     When           What
 ----    ----------     -------------------------------------------------------
 kwa     11.23.2013     created
 ******************************************************************************/

CREATE OR REPLACE VIEW Appointments AS
  SELECT
      ROWID row_id
      ,appt_id
      ,appt_start_tsp
      ,appt_end_tsp
      ,dsc
      ,row_stat_cde
    FROM Appointments
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW Attendees AS
  SELECT
      ROWID row_id
      ,appt_id
      ,person_id
      ,row_stat_cde
    FROM Attendees
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW Calendars AS
  SELECT
      ROWID row_id
      ,employee_id
      ,appt_id
      ,row_stat_cde
    FROM Calendars
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW Cases AS
  SELECT
      ROWID row_id
      ,case_id
      ,client_id
      ,dsc
      ,primary_lawyer
      ,begin_dte
      ,end_dte
      ,close_dte
      ,total_cost
      ,row_stat_cde
    FROM Cases
    WHERE row_stat_cde= 'A'
;

CREATE OR REPLACE VIEW CasesEmployees AS
  SELECT
      ROWID row_id
      ,case_id
      ,employee_id
      ,row_stat_cde
    FROM CasesEmployees
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW Clients AS
  SELECT
      ROWID row_id
      ,client_id
      ,company
      ,row_stat_cde
    FROM Clinents
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW Contacts AS
  SELECT
      ROWID row_id
      ,contact_id
      ,client_id
      ,row_stat_cde
    FROM Contacts
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW DlyLogEntries AS
  SELECT
      ROWID row_id
      ,log_entry_id
      ,employee_id
      ,case_id
      ,log_dte
      ,hours_billed
      ,row_stat_cde
    FROM DlyLogEntries
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW EmailAddresses AS
  SELECT
      ROWID row_id
      ,fk_id
      ,email_type
      ,email_address
      ,row_stat_cde
    FROM EmailAddresses
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW Employees AS
  SELECT
      ROWID row_id
      ,employee_id
      ,salary
      ,row_stat_cde
    FROM Employees
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW Firms AS
  SELECT
      ROWID row_id
      ,firm_id
      ,firm_name
      ,address1
      ,address2
      ,city
      ,state
      ,zip_cde
      ,billable_hours
      ,news_letter
      ,disclaimer
      ,lexusnexus_url
      ,row_stat_cde
    FROM Firms
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW Lawyers AS
  SELECT
      ROWID row_id
      ,lawyer_id
      ,billing_rate
      ,row_stat_cde
    FROM Lawyers
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW LawyersSpecialties AS
  SELECT
      ROWID row_id
      ,lawyer_id
      ,specialty_id
      ,row_stat_cde
    FROM LawyersSpecialties
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW Persons AS
  SELECT
      ROWID row_id
      ,person_id
      ,fname
      ,lname
      ,address1
      ,address2
      ,city
      ,state
      ,zip_cde
      ,user_id
      ,row_stat_cde
    FROM Persons
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW PhoneNumbers AS
  SELECT
      ROWID row_id
      ,fk_id
      ,phone_type
      ,phone_number
      ,row_stat_cde
    FROM PhoneNumbers
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW Specialties AS
  SELECT
      ROWID row_id
      ,specialty_id
      ,dsc
      ,row_stat_cde
    FROM Specialties
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW Types AS
  SELECT
      ROWID row_id
      ,type_id
      ,dsc
      ,row_stat_cde
    FROM Types
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW States AS
  SELECT
      ROWID row_id
      ,state_id
      ,state_name
      ,row_stat_cde
    FROM States
    WHERE row_stat_cde = 'A'
;

CREATE OR REPLACE VIEW BillingRates AS
  SELECT
      p.lname
      ,p.fname
      ,CASE
         WHEN l.lawyer_id IS NULL THEN 'E'
         ELSE 'L'
       END employee_type
      ,e.salary
      ,CASE
         WHEN l.lawyer_id IS NULL THEN e.salary / f.billable_hours
         ELSE l.billing_rate
       END billing_rate
    FROM Employees e
      LEFT OUTER JOIN Lawyers l
        ON l.lawyer_id = e.employee_id
      INNER JOIN Persons p
        ON e.employee_id = p.person_id
      CROSS JOIN Firms f
;

CREATE OR REPLACE VIEW EmployeeOpenCases AS
  SELECT
      ce.case_id
      ,ce.employee_id
      ,c.client_id
      ,ce.row_stat_cde
    FROM CasesEmployees ce
      INNER JOIN Cases c
        ON ce.case_id = c.case_id
    WHERE c.close_dte IS NULL
;


text:
#ifndef PTY_PART_EFFECT_SIZE_H_
#define PTY_PART_EFFECT_SIZE_H_

#include <EPI/Document/Properties/PtyNodeEmitter/PtyPartEffect.h>
#include <EPI/Document/PropertyWidget.moc.h>

#include <Universe/Particles/PartEffectSize.h>

class QGridLayout;
class QCheckBox;
class QPushButton;

namespace QtToolbox
{
    class SingleSlidingHDR;
    class CollapsibleWidget;
}//namespace QtToolbox

namespace EPI
{
//-----------------------------------------------------------------------------
class LM_API_EPI PtyPartEffectSize : public PtyPartEffect
{
    friend class PtyWidgetPartEffectSize;

public:
    PtyPartEffectSize(    const Ptr<Universe::NodeEmitter>& pNodeE,
                          const Ptr<Universe::PartEffectSize>& pEffect,
                          const Core::String& title = L"Size effect");
    PtyPartEffectSize(    const Ptr<Universe::NodeEmitter>& pNodeE,
                          const Core::String& title = L"Size effect");
    virtual ~PtyPartEffectSize();
    virtual Ptr<PropertyWidget> internalCreatePropertyWidget(const Ptr<PropertyWidgetDataProxy>& pDtaProxy, QWidget * parent = 0);
    virtual void updateProperty();
    virtual void updateData();
    virtual Ptr<Property> clone() const;
    virtual void internalCopy(const Ptr<Property>& pSrc);
    virtual void internalResurrect(const Ptr<Universe::World>& pWorld = null, const Ptr<Universe::World>& pWorldInfoContent = null, const Ptr<Property>& pty = null);
    virtual Universe::EEffect           getPartEffectType() const {return Universe::EFFECT_SIZE;}

private:
    float   _width0;
    float   _height0;
    float   _width1;
    float   _height1;
    float   _time1;
    bool    _squareParts;
    bool    _killPartsAtEnd;
};
//-----------------------------------------------------------------------------
class LM_API_EPI PtyWidgetPartEffectSize : public PropertyWidget
{
    friend class PtyPartEffectSize;
    Q_OBJECT
public:
    PtyWidgetPartEffectSize(const Ptr<PropertyWidgetDataProxy>& data, QWidget * parent = 0);
    virtual ~PtyWidgetPartEffectSize();
    void readProperty();
    void writeProperty(QWidget* pWidget = NULL);
    void setupUi();

private Q_SLOTS:
    void deleteWidget();

Q_SIGNALS:
    void deletePtyWidgetEffect(QWidget * pEffect);

private:
    QGridLayout * _layout;

    QtToolbox::CollapsibleWidget *   _groupBox;
    QPushButton *                    _del;
    QtToolbox::SingleSlidingHDR *    _width0;
    QtToolbox::SingleSlidingHDR *    _height0;
    QtToolbox::SingleSlidingHDR *    _width1;
    QtToolbox::SingleSlidingHDR *    _height1;
    QtToolbox::SingleSlidingHDR *    _time1;
    QCheckBox *                      _squareParts;
    QCheckBox *                      _killAtEnd;
};
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class LM_API_EPI PtyPartEffectSize2 : public PtyPartEffect
{
    friend class PtyWidgetPartEffectSize2;

public:
    PtyPartEffectSize2(    const Ptr<Universe::NodeEmitter>& pNodeE,
                           const Ptr<Universe::PartEffectSize2>& pFade2,
                           const Core::String& title = L"Size2 effect");
    PtyPartEffectSize2(    const Ptr<Universe::NodeEmitter>& pNodeE,
                           const Core::String& title = L"Size2 effect");
    virtual ~PtyPartEffectSize2();
    virtual Ptr<PropertyWidget> internalCreatePropertyWidget(const Ptr<PropertyWidgetDataProxy>& pDtaProxy, QWidget * parent = 0);
    virtual void updateProperty();
    virtual void updateData();
    virtual Ptr<Property> clone() const;
    virtual void internalCopy(const Ptr<Property>& pSrc);
    virtual void internalResurrect(const Ptr<Universe::World>& pWorld = null, const Ptr<Universe::World>& pWorldInfoContent = null, const Ptr<Property>& pty = null);
    virtual Universe::EEffect           getPartEffectType() const {return Universe::EFFECT_SIZE2;}

private:
    float   _width0;
    float   _height0;
    float   _width1;
    float   _height1;
    float   _width2;
    float   _height2;
    float   _time1;
    float   _time2;
    bool    _squareParts;
    bool    _killPartsAtEnd;
};
//-----------------------------------------------------------------------------
class LM_API_EPI PtyWidgetPartEffectSize2 : public PropertyWidget
{
    friend class PtyPartEffectSize2;
    Q_OBJECT
public:
    PtyWidgetPartEffectSize2(const Ptr<PropertyWidgetDataProxy>& data, QWidget * parent = 0);
    virtual ~PtyWidgetPartEffectSize2();
    void readProperty();
    void writeProperty(QWidget* pWidget = NULL);
    void setupUi();

private Q_SLOTS:
    void deleteWidget();

Q_SIGNALS:
    void deletePtyWidgetEffect(QWidget * pEffect);

private:
    QGridLayout * _layout;

    QtToolbox::CollapsibleWidget *   _groupBox;
    QPushButton *                    _del;
    QtToolbox::SingleSlidingHDR *    _width0;
    QtToolbox::SingleSlidingHDR *    _height0;
    QtToolbox::SingleSlidingHDR *    _width1;
    QtToolbox::SingleSlidingHDR *    _height1;
    QtToolbox::SingleSlidingHDR *    _width2;
    QtToolbox::SingleSlidingHDR *    _height2;
    QtToolbox::SingleSlidingHDR *    _time1;
    QtToolbox::SingleSlidingHDR *    _time2;
    QCheckBox *                      _squareParts;
    QCheckBox *                      _killAtEnd;
};
//-----------------------------------------------------------------------------

} // namespace EPI

#endif/*PTY_PART_EFFECT_SIZE_H_*/


text:
package consul

import (
	"os"
	"strings"
	"testing"
	"time"

	"github.com/hashicorp/consul/agent/consul/structs"
	"github.com/hashicorp/consul/testrpc"
	"github.com/hashicorp/consul/testutil/retry"
	"github.com/hashicorp/net-rpc-msgpackrpc"
	"github.com/hashicorp/raft"
)

func TestOperator_Autopilot_GetConfiguration(t *testing.T) {
	dir1, s1 := testServerWithConfig(t, func(c *Config) {
		c.AutopilotConfig.CleanupDeadServers = false
	})
	defer os.RemoveAll(dir1)
	defer s1.Shutdown()
	codec := rpcClient(t, s1)
	defer codec.Close()

	testrpc.WaitForLeader(t, s1.RPC, "dc1")

	arg := structs.DCSpecificRequest{
		Datacenter: "dc1",
	}
	var reply structs.AutopilotConfig
	err := msgpackrpc.CallWithCodec(codec, "Operator.AutopilotGetConfiguration", &arg, &reply)
	if err != nil {
		t.Fatalf("err: %v", err)
	}
	if reply.CleanupDeadServers {
		t.Fatalf("bad: %#v", reply)
	}
}

func TestOperator_Autopilot_GetConfiguration_ACLDeny(t *testing.T) {
	dir1, s1 := testServerWithConfig(t, func(c *Config) {
		c.ACLDatacenter = "dc1"
		c.ACLMasterToken = "root"
		c.ACLDefaultPolicy = "deny"
		c.AutopilotConfig.CleanupDeadServers = false
	})
	defer os.RemoveAll(dir1)
	defer s1.Shutdown()
	codec := rpcClient(t, s1)
	defer codec.Close()

	testrpc.WaitForLeader(t, s1.RPC, "dc1")

	// Try to get config without permissions
	arg := structs.DCSpecificRequest{
		Datacenter: "dc1",
	}
	var reply structs.AutopilotConfig
	err := msgpackrpc.CallWithCodec(codec, "Operator.AutopilotGetConfiguration", &arg, &reply)
	if err == nil || !strings.Contains(err.Error(), permissionDenied) {
		t.Fatalf("err: %v", err)
	}

	// Create an ACL with operator read permissions.
	var token string
	{
		var rules = `
                    operator = "read"
                `

		req := structs.ACLRequest{
			Datacenter: "dc1",
			Op:         structs.ACLSet,
			ACL: structs.ACL{
				Name:  "User token",
				Type:  structs.ACLTypeClient,
				Rules: rules,
			},
			WriteRequest: structs.WriteRequest{Token: "root"},
		}
		if err := msgpackrpc.CallWithCodec(codec, "ACL.Apply", &req, &token); err != nil {
			t.Fatalf("err: %v", err)
		}
	}

	// Now we can read and verify the config
	arg.Token = token
	err = msgpackrpc.CallWithCodec(codec, "Operator.AutopilotGetConfiguration", &arg, &reply)
	if err != nil {
		t.Fatalf("err: %v", err)
	}
	if reply.CleanupDeadServers {
		t.Fatalf("bad: %#v", reply)
	}
}

func TestOperator_Autopilot_SetConfiguration(t *testing.T) {
	dir1, s1 := testServerWithConfig(t, func(c *Config) {
		c.AutopilotConfig.CleanupDeadServers = false
	})
	defer os.RemoveAll(dir1)
	defer s1.Shutdown()
	codec := rpcClient(t, s1)
	defer codec.Close()

	testrpc.WaitForLeader(t, s1.RPC, "dc1")

	// Change the autopilot config from the default
	arg := structs.AutopilotSetConfigRequest{
		Datacenter: "dc1",
		Config: structs.AutopilotConfig{
			CleanupDeadServers: true,
		},
	}
	var reply *bool
	err := msgpackrpc.CallWithCodec(codec, "Operator.AutopilotSetConfiguration", &arg, &reply)
	if err != nil {
		t.Fatalf("err: %v", err)
	}

	// Make sure it's changed
	state := s1.fsm.State()
	_, config, err := state.AutopilotConfig()
	if err != nil {
		t.Fatal(err)
	}
	if !config.CleanupDeadServers {
		t.Fatalf("bad: %#v", config)
	}
}

func TestOperator_Autopilot_SetConfiguration_ACLDeny(t *testing.T) {
	dir1, s1 := testServerWithConfig(t, func(c *Config) {
		c.ACLDatacenter = "dc1"
		c.ACLMasterToken = "root"
		c.ACLDefaultPolicy = "deny"
		c.AutopilotConfig.CleanupDeadServers = false
	})
	defer os.RemoveAll(dir1)
	defer s1.Shutdown()
	codec := rpcClient(t, s1)
	defer codec.Close()

	testrpc.WaitForLeader(t, s1.RPC, "dc1")

	// Try to set config without permissions
	arg := structs.AutopilotSetConfigRequest{
		Datacenter: "dc1",
		Config: structs.AutopilotConfig{
			CleanupDeadServers: true,
		},
	}
	var reply *bool
	err := msgpackrpc.CallWithCodec(codec, "Operator.AutopilotSetConfiguration", &arg, &reply)
	if err == nil || !strings.Contains(err.Error(), permissionDenied) {
		t.Fatalf("err: %v", err)
	}

	// Create an ACL with operator write permissions.
	var token string
	{
		var rules = `
                    operator = "write"
                `

		req := structs.ACLRequest{
			Datacenter: "dc1",
			Op:         structs.ACLSet,
			ACL: structs.ACL{
				Name:  "User token",
				Type:  structs.ACLTypeClient,
				Rules: rules,
			},
			WriteRequest: structs.WriteRequest{Token: "root"},
		}
		if err := msgpackrpc.CallWithCodec(codec, "ACL.Apply", &req, &token); err != nil {
			t.Fatalf("err: %v", err)
		}
	}

	// Now we can update the config
	arg.Token = token
	err = msgpackrpc.CallWithCodec(codec, "Operator.AutopilotSetConfiguration", &arg, &reply)
	if err != nil {
		t.Fatalf("err: %v", err)
	}

	// Make sure it's changed
	state := s1.fsm.State()
	_, config, err := state.AutopilotConfig()
	if err != nil {
		t.Fatal(err)
	}
	if !config.CleanupDeadServers {
		t.Fatalf("bad: %#v", config)
	}
}

func TestOperator_ServerHealth(t *testing.T) {
	conf := func(c *Config) {
		c.Datacenter = "dc1"
		c.Bootstrap = false
		c.BootstrapExpect = 3
		c.RaftConfig.ProtocolVersion = 3
		c.ServerHealthInterval = 100 * time.Millisecond
		c.AutopilotInterval = 100 * time.Millisecond
	}
	dir1, s1 := testServerWithConfig(t, conf)
	defer os.RemoveAll(dir1)
	defer s1.Shutdown()
	codec := rpcClient(t, s1)
	defer codec.Close()

	dir2, s2 := testServerWithConfig(t, conf)
	defer os.RemoveAll(dir2)
	defer s2.Shutdown()
	joinLAN(t, s2, s1)

	dir3, s3 := testServerWithConfig(t, conf)
	defer os.RemoveAll(dir3)
	defer s3.Shutdown()
	joinLAN(t, s3, s1)

	testrpc.WaitForLeader(t, s1.RPC, "dc1")
	retry.Run(t, func(r *retry.R) {
		arg := structs.DCSpecificRequest{
			Datacenter: "dc1",
		}
		var reply structs.OperatorHealthReply
		err := msgpackrpc.CallWithCodec(codec, "Operator.ServerHealth", &arg, &reply)
		if err != nil {
			r.Fatalf("err: %v", err)
		}
		if !reply.Healthy {
			r.Fatalf("bad: %v", reply)
		}
		if reply.FailureTolerance != 1 {
			r.Fatalf("bad: %v", reply)
		}
		if len(reply.Servers) != 3 {
			r.Fatalf("bad: %v", reply)
		}
		// Leader should have LastContact == 0, others should be positive
		for _, s := range reply.Servers {
			isLeader := s1.raft.Leader() == raft.ServerAddress(s.Address)
			if isLeader && s.LastContact != 0 {
				r.Fatalf("bad: %v", reply)
			}
			if !isLeader && s.LastContact <= 0 {
				r.Fatalf("bad: %v", reply)
			}
		}
	})
}

func TestOperator_ServerHealth_UnsupportedRaftVersion(t *testing.T) {
	dir1, s1 := testServerWithConfig(t, func(c *Config) {
		c.Datacenter = "dc1"
		c.Bootstrap = true
		c.RaftConfig.ProtocolVersion = 2
	})
	defer os.RemoveAll(dir1)
	defer s1.Shutdown()
	codec := rpcClient(t, s1)
	defer codec.Close()

	arg := structs.DCSpecificRequest{
		Datacenter: "dc1",
	}
	var reply structs.OperatorHealthReply
	err := msgpackrpc.CallWithCodec(codec, "Operator.ServerHealth", &arg, &reply)
	if err == nil || !strings.Contains(err.Error(), "raft_protocol set to 3 or higher") {
		t.Fatalf("bad: %v", err)
	}
}


text:
package org.zaproxy.zap.extension.plugnhack.db;

import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import net.sf.json.JSONObject;
import net.sf.json.JSONSerializer;
import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.hsqldb.jdbc.JDBCClob;
import org.parosproxy.paros.db.DatabaseException;
import org.parosproxy.paros.db.DbUtils;
import org.parosproxy.paros.db.paros.ParosAbstractTable;
import org.zaproxy.zap.extension.plugnhack.ClientMessage;
import org.zaproxy.zap.extension.plugnhack.ClientMessage.State;

public class MessageTable extends ParosAbstractTable {

    private static final String TABLE = "PLUGNHACK_MESSAGE";
    private static final Logger logger = LogManager.getLogger(MessageTable.class);

    private PreparedStatement psInsert;
    private PreparedStatement psUpdate;
    private PreparedStatement psDelete;

    private PreparedStatement psGetAllData = null;

    private CallableStatement psGetIdLastInsert = null;

    @Override
    protected void reconnect(Connection conn) throws DatabaseException {
        try {
            if (!DbUtils.hasTable(conn, TABLE)) {
                // need to create the tables
                DbUtils.execute(
                        conn,
                        "CREATE CACHED TABLE "
                                + TABLE
                                + " ("
                                + "id BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 1), "
                                + "timestamp TIMESTAMP NOT NULL,"
                                + "client_id VARCHAR(255) NOT NULL,"
                                + "state TINYINT NOT NULL,"
                                + "message CLOB(16M) NOT NULL,"
                                + "changed BOOLEAN NOT NULL"
                                + ")");
            }

            psInsert =
                    conn.prepareStatement(
                            "INSERT INTO "
                                    + TABLE
                                    + " (timestamp, client_id, state, message, changed) "
                                    + "VALUES (?,?,?,?,?)");

            psUpdate =
                    conn.prepareStatement(
                            "UPDATE "
                                    + TABLE
                                    + " SET message = ?, state = ?, changed = TRUE WHERE id = ?");

            psDelete = conn.prepareStatement("DELETE FROM " + TABLE + " WHERE id = ?");

            psGetAllData = conn.prepareStatement("SELECT * FROM " + TABLE);

            psGetIdLastInsert = conn.prepareCall("CALL IDENTITY();");
        } catch (SQLException e) {
            throw new DatabaseException(e);
        }
    }

    public synchronized void insert(ClientMessage cmsg) throws SQLException {
        psInsert.setTimestamp(1, new Timestamp(cmsg.getReceived().getTime()));
        psInsert.setString(2, cmsg.getClientId());
        psInsert.setInt(3, cmsg.getState().ordinal());
        psInsert.setClob(4, new JDBCClob(cmsg.getJson().toString()));
        psInsert.setBoolean(5, cmsg.isChanged());

        psInsert.executeUpdate();

        ResultSet rs = psGetIdLastInsert.executeQuery();
        rs.next();
        cmsg.setIndex(rs.getLong(1));
        rs.close();
    }

    public synchronized void update(ClientMessage cmsg) throws SQLException {
        psUpdate.setClob(1, new JDBCClob(cmsg.getJson().toString()));
        psUpdate.setInt(2, cmsg.getState().ordinal());
        psUpdate.setLong(3, cmsg.getIndex());

        psUpdate.executeUpdate();
    }

    public synchronized void delete(ClientMessage cmsg) throws SQLException {
        psDelete.setLong(1, cmsg.getIndex());
        psDelete.executeUpdate();
    }

    public synchronized List<ClientMessage> list() throws SQLException {
        ArrayList<ClientMessage> list = new ArrayList<>();

        ResultSet rs = psGetAllData.executeQuery();
        while (rs.next()) {
            try {
                InputStream in = rs.getClob("message").getAsciiStream();
                StringWriter w = new StringWriter();
                IOUtils.copy(in, w, StandardCharsets.UTF_8);
                ClientMessage cmsg =
                        new ClientMessage(
                                rs.getString("client_id"),
                                (JSONObject) JSONSerializer.toJSON(w.toString()));
                cmsg.setIndex(rs.getLong("id"));
                cmsg.setReceived(new Date(rs.getTimestamp("timestamp").getTime()));
                cmsg.setChanged(rs.getBoolean("changed"));
                cmsg.setState(State.values()[rs.getInt("state")]);
                list.add(cmsg);
            } catch (IOException e) {
                logger.error(e.getMessage(), e);
            }
        }
        rs.close();
        return list;
    }
}


text:
lower-to-upper-bat
==================

covert lower to uppper case letter with bat


text:
module.exports = {
  isPlayable,
  isVideo,
  isAudio,
  isTorrent,
  isPlayableTorrentSummary,
  pickFileToPlay
}

var path = require('path')

// Checks whether a fileSummary or file path is audio/video that we can play,
// based on the file extension
function isPlayable (file) {
  return isVideo(file) || isAudio(file)
}

// Checks whether a fileSummary or file path is playable video
function isVideo (file) {
  return [
    '.avi',
    '.m4v',
    '.mkv',
    '.mov',
    '.mp4',
    '.mpg',
    '.ogv',
    '.webm',
    '.wmv'
  ].includes(getFileExtension(file))
}

// Checks whether a fileSummary or file path is playable audio
function isAudio (file) {
  return [
    '.aac',
    '.ac3',
    '.mp3',
    '.ogg',
    '.wav'
  ].includes(getFileExtension(file))
}

// Checks if the argument is either:
// - a string that's a valid filename ending in .torrent
// - a file object where obj.name is ends in .torrent
// - a string that's a magnet link (magnet://...)
function isTorrent (file) {
  var isTorrentFile = getFileExtension(file) === '.torrent'
  var isMagnet = typeof file === 'string' && /^(stream-)?magnet:/.test(file)
  return isTorrentFile || isMagnet
}

function getFileExtension (file) {
  var name = typeof file === 'string' ? file : file.name
  return path.extname(name).toLowerCase()
}

function isPlayableTorrentSummary (torrentSummary) {
  return torrentSummary.files && torrentSummary.files.some(isPlayable)
}

// Picks the default file to play from a list of torrent or torrentSummary files
// Returns an index or undefined, if no files are playable
function pickFileToPlay (files) {
  // first, try to find the biggest video file
  var videoFiles = files.filter(isVideo)
  if (videoFiles.length > 0) {
    var largestVideoFile = videoFiles.reduce(function (a, b) {
      return a.length > b.length ? a : b
    })
    return files.indexOf(largestVideoFile)
  }

  // if there are no videos, play the first audio file
  var audioFiles = files.filter(isAudio)
  if (audioFiles.length > 0) {
    return files.indexOf(audioFiles[0])
  }

  // no video or audio means nothing is playable
  return undefined
}


text:
layout: question
title: "Buy or use it!"
origin:
  -
    text: "Is it on a contract?"
    url: "is-it-on-contract"
---


text:
package tus

import (
	"errors"
	"fmt"
)

var (
	ErrChuckSize         = errors.New("chunk size must be greater than zero.")
	ErrNilLogger         = errors.New("logger can't be nil.")
	ErrNilStore          = errors.New("store can't be nil if Resume is enable.")
	ErrNilUpload         = errors.New("upload can't be nil.")
	ErrLargeUpload       = errors.New("upload body is to large.")
	ErrVersionMismatch   = errors.New("protocol version mismatch.")
	ErrOffsetMismatch    = errors.New("upload offset mismatch.")
	ErrUploadNotFound    = errors.New("upload not found.")
	ErrResumeNotEnabled  = errors.New("resuming not enabled.")
	ErrFingerprintNotSet = errors.New("fingerprint not set.")
)

type ClientError struct {
	Code int
	Body []byte
}

func (c ClientError) Error() string {
	return fmt.Sprintf("unexpected status code: %d", c.Code)
}


text:
package cn.zju.edu.text.evolution;

import cn.zju.edu.common.CountMap;
import cn.zju.edu.common.TextUtils;
import cn.zju.edu.index.Pos;
import cn.zju.edu.index.TextIndexer;

public class EntropyJudger {

	private TextIndexer indexer;

	/**
	 * A word least appeared count
	 */
	private static int LEAST_COUNT_THRESHOLD = 5;

	/**
	 * Threshold for solid rate calculated by word appeared count and every
	 * single letter.
	 *
	 * The smaller this values is, more new words you will get, but with less
	 * accuracy. The greater this value is, less new words you will get, but
	 * with high accuracy.
	 */
	private static double SOLID_RATE_THRESHOLD = 0.018;

	/**
	 * Threshold for entropy value calculated by candidate word prefix character
	 * count and suffix character count
	 *
	 * The smaller this values is, more new words you will get, but with less
	 * accuracy. The greater this value is, less new words you will get, but
	 * with high accuracy.
	 */
	private static double ENTROPY_THRESHOL = 1.92;

	public EntropyJudger(TextIndexer indexer) {
		this.indexer = indexer;
	}

	public boolean judge(String candidate) {
		double solidRate = getSolidRate(candidate);

		if (solidRate < SOLID_RATE_THRESHOLD) {
			return false;
		}

		double entropy = getEntropy(candidate);

		if (entropy < ENTROPY_THRESHOL) {
			return false;
		}
		return true;
	}

	private double getEntropy(String candidate) {
		Pos pos = new Pos(candidate);
		CountMap<Character> frontCountMap = new CountMap<Character>();
		CountMap<Character> backCountMap = new CountMap<Character>();
		final int candidateLen = candidate.length();
		int off = 0;
		char c;
		double rate, frontEntropy = 0, backEntropy = 0;

		while (indexer.find(pos).isFound()) {
			off = pos.getPos();

			c = indexer.charAt(off - 1);
			if (TextUtils.isCnLetter(c)) {
				frontCountMap.increase(c);
			}
			c = indexer.charAt(off + candidateLen);
			if (TextUtils.isCnLetter(c)) {
				backCountMap.increase(c);
			}

		}

		for (char key : frontCountMap.keySet()) {
			rate = (double) frontCountMap.get(key) / frontCountMap.count();
			frontEntropy -= rate * Math.log(rate);
		}
		for (char key : backCountMap.keySet()) {
			rate = (double) backCountMap.get(key) / backCountMap.count();
			backEntropy -= rate * Math.log(rate);
		}

		return frontEntropy > backEntropy ? backEntropy : frontEntropy;

	}

	/**
	 * @param candidate
	 * @return
	 */
	public double getSolidRate(String candidate) {

		final int candidateLen = candidate.length();

		if (candidateLen < 2) {
			return 1;
		}

		final int count = indexer.count(candidate);
		double rate = 1;

		if (count < LEAST_COUNT_THRESHOLD) {
			return 0;
		}

		for (int i = 0; i < candidateLen; i++) {
			rate *= (double) count / indexer.count("" + candidate.charAt(i));
		}

		return Math.pow(rate, 1D / candidateLen) * Math.sqrt(candidateLen);
	}

	public void setIndexer(TextIndexer indexer) {
		this.indexer = indexer;
	}

}


text:
require 'spec_helper'

describe 'extlib::cache_data' do
  let(:initial_data) { 'original_password' }
  let(:data_name) { 'mysql_password' }
  let(:namespace) { 'data_cache' }

  it { expect(subject).not_to eq(nil) }
  it { is_expected.not_to eq(nil) }
  it { is_expected.to run.with_params(data_name).and_raise_error(ArgumentError) }
  it { is_expected.to run.with_params('', initial_data).and_raise_error(ArgumentError) }
  it { is_expected.to run.with_params('', 'mysql_password', initial_data).and_raise_error(ArgumentError) }

  describe 'data caching' do
    context 'when not in cache' do
      it 'returns supplied data' do
        is_expected.to run.with_params(namespace, data_name, initial_data).and_return(initial_data)
      end
    end

    context 'when cached' do
      it 'returns cached data' do
        is_expected.to run.with_params(namespace, data_name, initial_data).and_return(initial_data)
        is_expected.to run.with_params(namespace, data_name, 'new_password').and_return(initial_data)
      end
    end
  end
end


text:
package cherry.gallery.web.applied.ex30;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class AppliedEx31Form extends AppliedEx31FormBase {

	private static final long serialVersionUID = 1L;

}


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

namespace Demo.Services.Interfaces
{

    public interface ILoggingService
    {

        void Initialize(Assembly assembly);

        string GetCurrentLogFilePath();

        void Trace(string message,
                   [CallerMemberName] string callerMemberName = "",
                   [CallerFilePath] string callerFilePath = "",
                   [CallerLineNumber] int callerLineNumber = 0);

        void Trace(Exception exception,
                   IFormatProvider formatProvider,
                   string message,
                   [CallerMemberName] string callerMemberName = "",
                   [CallerFilePath] string callerFilePath = "",
                   [CallerLineNumber] int callerLineNumber = 0);

        void Debug(string message,
                   [CallerMemberName] string callerMemberName = "",
                   [CallerFilePath] string callerFilePath = "",
                   [CallerLineNumber] int callerLineNumber = 0);

        void Debug(Exception exception,
                   IFormatProvider formatProvider,
                   string message,
                   [CallerMemberName] string callerMemberName = "",
                   [CallerFilePath] string callerFilePath = "",
                   [CallerLineNumber] int callerLineNumber = 0);

        void Info(string message,
                  [CallerMemberName] string callerMemberName = "",
                  [CallerFilePath] string callerFilePath = "",
                  [CallerLineNumber] int callerLineNumber = 0);

        void Info(Exception exception,
                  IFormatProvider formatProvider,
                  string message,
                  [CallerMemberName] string callerMemberName = "",
                  [CallerFilePath] string callerFilePath = "",
                  [CallerLineNumber] int callerLineNumber = 0);

        void Warn(string message,
                  [CallerMemberName] string callerMemberName = "",
                  [CallerFilePath] string callerFilePath = "",
                  [CallerLineNumber] int callerLineNumber = 0);

        void Warn(Exception exception,
                  IFormatProvider formatProvider,
                  string message,
                  [CallerMemberName] string callerMemberName = "",
                  [CallerFilePath] string callerFilePath = "",
                  [CallerLineNumber] int callerLineNumber = 0);

        void Error(string message,
                   [CallerMemberName] string callerMemberName = "",
                   [CallerFilePath] string callerFilePath = "",
                   [CallerLineNumber] int callerLineNumber = 0);

        void Error(Exception exception,
                   IFormatProvider formatProvider,
                   string message,
                   [CallerMemberName] string callerMemberName = "",
                   [CallerFilePath] string callerFilePath = "",
                   [CallerLineNumber] int callerLineNumber = 0);

        void Fatal(string message,
                   [CallerMemberName] string callerMemberName = "",
                   [CallerFilePath] string callerFilePath = "",
                   [CallerLineNumber] int callerLineNumber = 0);

        void Fatal(Exception exception,
                   IFormatProvider formatProvider,
                   string message,
                   [CallerMemberName] string callerMemberName = "",
                   [CallerFilePath] string callerFilePath = "",
                   [CallerLineNumber] int callerLineNumber = 0);

    }

}


text:
using System;

namespace OR_M_Data_Entities.Mapping
{
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
    public sealed class Index : Attribute
    {
        public Index(int value)
        {
            Value = value;
        }

        public int Value { get; private set; }
    }
}


text:
          <?php echo form_open('ekstra/update/'.$this->uri->segment(3)); ?>

Edit Data Ekstrakulikuler

            <?php echo validation_errors();?>

                        <input name="name" value="<?php echo $ekstra[0]->name?>" type="text" class="form-control" placeholder="Nama" id="name" required data-validation-required-message="nama">

                        <textarea rows="3" class="form-control" name="address" value="<?php echo $ekstra[0]->address?>" placeholder="Alamat" id="address" required data-validation-required-message="address"></textarea>

                        <input name="email" value="<?php echo $ekstra[0]->email?>" type="email" class="form-control" placeholder="Email" id="email" required data-validation-required-message="email">

                        <input name="telephone" value="<?php echo $ekstra[0]->telephone?>" type="telephone" class="form-control" placeholder="Telepon" id="telephone" required data-validation-required-message="telepon">

                        <input name="class" value="<?php echo $ekstra[0]->class?>" type="class" class="form-control" placeholder="Kelas" id="class" required data-validation-required-message="class">

                      <select name="ekstra" value="<?php echo $ekstra[0]->ekstra?>" id="ekstra" class="form-control">
                          <option value="0">---- Pilih -----</option>
                          <option value="band">Band</option>
                          <option value="basket">Basket</option>
                          <option value="drumband">DrumBand</option>
                          <option value="futsal">Futsal</option>
                          <option value="karate">Karate</option>
                          <option value="padus">Paduan Suara</option>
                          <option value="volly">Volly</option>
                      </select>

                        <button type="submit" class="btn btn-default">Submit</button>
                        <?php echo form_close();?>


text:
package com.thaiopensource.relaxng.edit;

public class SourceObject
{
  private SourceLocation sourceLocation;

  public SourceObject ()
  {}

  public SourceObject (final SourceLocation sourceLocation)
  {
    this.sourceLocation = sourceLocation;
  }

  public SourceLocation getSourceLocation ()
  {
    return sourceLocation;
  }

  public void setSourceLocation (final SourceLocation sourceLocation)
  {
    this.sourceLocation = sourceLocation;
  }
}


text:
require 'spec_helper'
require 'puppet/pops'

describe "Puppet::Pops::Issues" do
  include Puppet::Pops::Issues

  it "should have an issue called NAME_WITH_HYPHEN" do
    x = Puppet::Pops::Issues::NAME_WITH_HYPHEN
    x.class.should == Puppet::Pops::Issues::Issue
    x.issue_code.should == :NAME_WITH_HYPHEN
  end

  it "should should format a message that requires an argument" do
    x = Puppet::Pops::Issues::NAME_WITH_HYPHEN
    x.format(:name => 'Boo-Hoo',
      :label => Puppet::Pops::Model::ModelLabelProvider.new,
      :semantic => "dummy"
      ).should == "A String may not have a name containing a hyphen. The name 'Boo-Hoo' is not legal"
  end

  it "should should format a message that does not require an argument" do
    x = Puppet::Pops::Issues::NOT_TOP_LEVEL
    x.format().should == "Classes, definitions, and nodes may only appear at toplevel or inside other classes"
  end

end

describe "Puppet::Pops::IssueReporter" do

  let(:acceptor) { Puppet::Pops::Validation::Acceptor.new }

  def fake_positioned(number)
    stub("positioned_#{number}", :line => number, :pos => number)
  end

  def diagnostic(severity,  number)
    Puppet::Pops::Validation::Diagnostic.new(
      severity,
      Puppet::Pops::Issues::Issue.new(number) { "#{severity}#{number}" },
      "#{severity}file",
      fake_positioned(number))
  end

  def warning(number)
    diagnostic(:warning, number)
  end

  def deprecation(number)
    diagnostic(:deprecation, number)
  end

  def error(number)
    diagnostic(:error, number)
  end

  context "given warnings" do

    before(:each) do
      acceptor.accept( warning(1) )
      acceptor.accept( deprecation(1) )
    end

    it "emits warnings if told to emit them" do
      Puppet::Log.expects(:create).twice.with(has_entries(:level => :warning, :message => regexp_matches(/warning1|deprecation1/)))
      Puppet::Pops::IssueReporter.assert_and_report(acceptor, { :emit_warnings => true })
    end

    it "does not emit warnings if not told to emit them" do
      Puppet::Log.expects(:create).never
      Puppet::Pops::IssueReporter.assert_and_report(acceptor, {})
    end

    it "emits no warnings if :max_warnings is 0" do
      acceptor.accept( warning(2) )
      Puppet[:max_warnings] = 0
      Puppet::Log.expects(:create).once.with(has_entries(:level => :warning, :message => regexp_matches(/deprecation1/)))
      Puppet::Pops::IssueReporter.assert_and_report(acceptor, { :emit_warnings => true })
    end

    it "emits no more than 1 warning if :max_warnings is 1" do
      acceptor.accept( warning(2) )
      acceptor.accept( warning(3) )
      Puppet[:max_warnings] = 1
      Puppet::Log.expects(:create).twice.with(has_entries(:level => :warning, :message => regexp_matches(/warning1|deprecation1/)))
      Puppet::Pops::IssueReporter.assert_and_report(acceptor, { :emit_warnings => true })
    end

    it "does not emit more deprecations warnings than the max deprecation warnings" do
      acceptor.accept( deprecation(2) )
      Puppet[:max_deprecations] = 0
      Puppet::Log.expects(:create).once.with(has_entries(:level => :warning, :message => regexp_matches(/warning1/)))
      Puppet::Pops::IssueReporter.assert_and_report(acceptor, { :emit_warnings => true })
    end

    it "does not emit deprecation warnings, but does emit regular warnings if disable_warnings includes deprecations" do
      Puppet[:disable_warnings] = 'deprecations'
      Puppet::Log.expects(:create).once.with(has_entries(:level => :warning, :message => regexp_matches(/warning1/)))
      Puppet::Pops::IssueReporter.assert_and_report(acceptor, { :emit_warnings => true })
    end
  end

  context "given errors" do
    it "logs nothing, but raises the given :message if :emit_errors is repressing error logging" do
      acceptor.accept( error(1) )
      Puppet::Log.expects(:create).never
      expect do
        Puppet::Pops::IssueReporter.assert_and_report(acceptor, { :emit_errors => false, :message => 'special'})
      end.to raise_error(Puppet::ParseError, 'special')
    end

    it "prefixes :message if a single error is raised" do
      acceptor.accept( error(1) )
      Puppet::Log.expects(:create).never
      expect do
        Puppet::Pops::IssueReporter.assert_and_report(acceptor, { :message => 'special'})
      end.to raise_error(Puppet::ParseError, /special error1/)
    end

    it "logs nothing and raises immediately if there is only one error" do
      acceptor.accept( error(1) )
      Puppet::Log.expects(:create).never
      expect do
        Puppet::Pops::IssueReporter.assert_and_report(acceptor, { })
      end.to raise_error(Puppet::ParseError, /error1/)
    end

    it "logs nothing and raises immediately if there are multiple errors but max_errors is 0" do
      acceptor.accept( error(1) )
      acceptor.accept( error(2) )
      Puppet[:max_errors] = 0
      Puppet::Log.expects(:create).never
      expect do
        Puppet::Pops::IssueReporter.assert_and_report(acceptor, { })
      end.to raise_error(Puppet::ParseError, /error1/)
    end

    it "logs the :message if there is more than one allowed error" do
      acceptor.accept( error(1) )
      acceptor.accept( error(2) )
      Puppet::Log.expects(:create).times(3).with(has_entries(:level => :err, :message => regexp_matches(/error1|error2|special/)))
      expect do
        Puppet::Pops::IssueReporter.assert_and_report(acceptor, { :message => 'special'})
      end.to raise_error(Puppet::ParseError, /Giving up/)
    end

    it "emits accumulated errors before raising a 'giving up' message if there are more errors than allowed" do
      acceptor.accept( error(1) )
      acceptor.accept( error(2) )
      acceptor.accept( error(3) )
      Puppet[:max_errors] = 2
      Puppet::Log.expects(:create).times(2).with(has_entries(:level => :err, :message => regexp_matches(/error1|error2/)))
      expect do
        Puppet::Pops::IssueReporter.assert_and_report(acceptor, { })
      end.to raise_error(Puppet::ParseError, /3 errors.*Giving up/)
    end

    it "emits accumulated errors before raising a 'giving up' message if there are multiple errors but fewer than limits" do
      acceptor.accept( error(1) )
      acceptor.accept( error(2) )
      acceptor.accept( error(3) )
      Puppet[:max_errors] = 4
      Puppet::Log.expects(:create).times(3).with(has_entries(:level => :err, :message => regexp_matches(/error[123]/)))
      expect do
        Puppet::Pops::IssueReporter.assert_and_report(acceptor, { })
      end.to raise_error(Puppet::ParseError, /3 errors.*Giving up/)
    end

    it "emits errors regardless of disable_warnings setting" do
      acceptor.accept( error(1) )
      acceptor.accept( error(2) )
      Puppet[:disable_warnings] = 'deprecations'
      Puppet::Log.expects(:create).times(2).with(has_entries(:level => :err, :message => regexp_matches(/error1|error2/)))
      expect do
        Puppet::Pops::IssueReporter.assert_and_report(acceptor, { })
      end.to raise_error(Puppet::ParseError, /Giving up/)
    end
  end

  context "given both" do

    it "logs warnings and errors" do
      acceptor.accept( warning(1) )
      acceptor.accept( error(1) )
      acceptor.accept( error(2) )
      acceptor.accept( error(3) )
      acceptor.accept( deprecation(1) )
      Puppet[:max_errors] = 2
      Puppet::Log.expects(:create).twice.with(has_entries(:level => :warning, :message => regexp_matches(/warning1|deprecation1/)))
      Puppet::Log.expects(:create).twice.with(has_entries(:level => :err, :message => regexp_matches(/error[123]/)))
      expect do
        Puppet::Pops::IssueReporter.assert_and_report(acceptor, { :emit_warnings => true })
      end.to raise_error(Puppet::ParseError, /3 errors.*2 warnings.*Giving up/)
    end
  end
end


text:
$(document).ready(function() {
// https://github.com/NV/flying-focus

if (document.getElementById('flying-focus')) return;

var flyingFocus = document.createElement('flying-focus'); // use uniq element name to decrease the chances of a conflict with website styles
flyingFocus.id = 'flying-focus';
document.body.appendChild(flyingFocus);

var DURATION = 100;
flyingFocus.style.transitionDuration = flyingFocus.style.WebkitTransitionDuration = DURATION / 1000 + 's';

function offsetOf(elem) {
	var rect = elem.getBoundingClientRect();
	var docElem = document.documentElement;
	var win = document.defaultView;
	var body = document.body;

	var clientTop  = docElem.clientTop  || body.clientTop  || 0,
		clientLeft = docElem.clientLeft || body.clientLeft || 0,
		scrollTop  = win.pageYOffset || docElem.scrollTop  || body.scrollTop,
		scrollLeft = win.pageXOffset || docElem.scrollLeft || body.scrollLeft,
		top  = rect.top  + scrollTop  - clientTop,
		left = rect.left + scrollLeft - clientLeft;

	return {top: top, left: left};
}

var movingId = 0;
var prevFocused = null;
var isFirstFocus = true;
var keyDownTime = 0;

document.documentElement.addEventListener('keydown', function(event) {
	var code = event.which;
	// Show animation only upon Tab or Arrow keys press.
	if (code === 9 || (code > 36 && code < 41)) {
		keyDownTime = now();
	}
}, false);

document.documentElement.addEventListener('focus', function(event) {
	var target = event.target;
	if (target.id === 'flying-focus') {
		return;
	}
	var offset = offsetOf(target);
	flyingFocus.style.left = offset.left + 'px';
	flyingFocus.style.top = offset.top + 'px';
	flyingFocus.style.width = target.offsetWidth + 'px';
	flyingFocus.style.height = target.offsetHeight + 'px';

	// Would be nice to use:
	//
	//   flyingFocus.style['outline-offset'] = getComputedStyle(target, null)['outline-offset']
	//
	// but it always '0px' in WebKit and Blink for some reason :(

	if (isFirstFocus) {
		isFirstFocus = false;
		return;
	}

	if (now() - keyDownTime > 42) {
		return;
	}

	onEnd();
	target.classList.add('flying-focus_target');
	flyingFocus.classList.add('flying-focus_visible');
	prevFocused = target;
	movingId = setTimeout(onEnd, DURATION);
}, true);

document.documentElement.addEventListener('blur', function() {
	onEnd();
}, true);

function onEnd() {
	if (!movingId) {
		return;
	}
	clearTimeout(movingId);
	movingId = 0;
	flyingFocus.classList.remove('flying-focus_visible');
	prevFocused.classList.remove('flying-focus_target');
	prevFocused = null;
}

function now() {
	return new Date().valueOf();
}

var style = document.createElement('style');
style.textContent = "#flying-focus {\
	position: absolute;\
	margin: 0;\
	background: transparent;\
	-webkit-transition-property: left, top, width, height, opacity;\
	transition-property: left, top, width, height, opacity;\
	-webkit-transition-timing-function: cubic-bezier(0, 0.2, 0, 1);\
	transition-timing-function: cubic-bezier(0, 0.2, 0, 1);\
	visibility: hidden;\
	pointer-events: none;\
	box-shadow: 0 0 2px 3px #78aeda, 0 0 2px #78aeda inset; border-radius: 2px;\
}\
#flying-focus.flying-focus_visible {\
	visibility: visible;\
	z-index: 9999;\
}\
.flying-focus_target {\
	outline: none !important; /* Doesn't work in Firefox :( */\
}\
/* http://stackoverflow.com/questions/71074/how-to-remove-firefoxs-dotted-outline-on-buttons-as-well-as-links/199319 */\
.flying-focus_target::-moz-focus-inner {\
	border: 0 !important;\
}\
/* Replace it with @supports rule when browsers catch up */\
@media screen and (-webkit-min-device-pixel-ratio: 0) {\
	#flying-focus {\
		box-shadow: none;\
		outline: 5px auto -webkit-focus-ring-color;\
		outline-offset: -3px;\
	}\
}\
@media print {\
	#flying-focus {\
		display: none;\
	}\
}\
";
document.body.appendChild(style);

});


text:
(function($){

    /**
     * Chain
     * -----
     * Run processes synchronously
     */
    var Chain = function(){
        if(arguments.length){
            this.append.apply(this, arguments);
        }
    };

    $.extend(Chain.prototype, {

        states: [],
        state: -1,
        df: null,

        /**
         * Append process(es)
         * @param {... Function|Array} process
         * @returns {$.Chain}
         */
        append: function(){
            var my = this;
            $.each(Array.prototype.slice.call(arguments), function(i, arg){
            	switch($.type(arg)){
            		case "array": my.append.apply(my, arg); break;
            		case "function": my.states.push(arg); break;
            		default: break;
            	}
            });
            return this;
        },

        /**
         * Run process
         * @returns {$.Deferred}
         */
        process: function(){
            var r, func, my = this;
            func = this.states[++this.state];
            if($.type(func) === "function"){
                r = func.call(this);
                switch(true){
                    case r === false:
                        return this.df.reject();
                    case $.type(r) === "undefined" || r === true:
                        return this.process();
                    case r.type === "delay":
                        return setTimeout(function(){
                            my.process.call(my);
                        }, r.time);
                    case r.type === "deferred":
                        return r
                        .done($.proxy(this.process, this))
                        .fail(function(){
                            my.df.reject();
                        });
                    default: break;
                }
            }
            if(this.states.length === this.state){
                return this.df.resolve();
            }
        },

        /**
         * Start running processes
         * @returns {$.Deferred}
         */
        run: function(){
            this.reset();
            this.process();
            return this.df;
        },

        /**
         * Reset a state of process and deferred
         * @returns {$.Chain}
         */
        reset: function(){
            this.state = -1;
            this.df = new $.Deferred();
            return this;
        },

        /**
         * Return new deferred object
         * @return {$.Deferred}
         */
        deferred: function(){
            var df = $.Deferred();
            df.type = "deferred";
            return df;
        },

        /**
         * Have the process duration as time
         * @param {Integer} time
         * @returns {Object}
         */
        delay: function(time){
            return { type: "delay", time: time };
        }

    });

    $.Chain = Chain;

}(jQuery));


text:
<?xml version="1.0" encoding="UTF-8"?>

<chapter version="5.0" xml:id="TRG_KIM" xmlns="http://docbook.org/ns/docbook"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         xmlns:ns5="http://www.w3.org/1999/xhtml"
         xmlns:ns4="http://www.w3.org/2000/svg"
         xmlns:ns3="http://www.w3.org/1998/Math/MathML"
         xmlns:ns="http://docbook.org/ns/docbook">
  <title>KIM</title>

    <title>Terminology</title>

      <title>Principal</title>

      <para>A principal represents an entity that can authenticate. In
      essence, you can think of a principal as an "account" or as an entity's
      authentication credentials. A principal has an ID that is used to
      uniquely identify it. It also has a name that represents the principal's
      username and is typically what is entered when authenticating. All
      principals are associated with one and only one entity.</para>

      <title>Entity</title>

      <para>An entity represents a person or system. Additionally, other
      "types" of entities can be defined in KIM. Information like name, phone
      number, etc. is associated with an entity. While an entity will
      typically have a single principal associated with it, it is possible for
      an entity to have more than one principal or even no principals at all
      (in the case where the entity does not actually authenticate).</para>

      <para>Entities have numerous attributes associated with them,
      including:<itemizedlist>
          <listitem>
            <para>Names</para>
          </listitem>

          <listitem>
            <para>Addresses</para>
          </listitem>

          <listitem>
            <para>Phone Numbers</para>
          </listitem>

          <listitem>
            <para>Email Addresses</para>
          </listitem>

          <listitem>
            <para>Entity Type</para>
          </listitem>

          <listitem>
            <para>Affiliations</para>
          </listitem>

          <listitem>
            <para>Employment Information</para>
          </listitem>

          <listitem>
            <para>External Identifiers</para>
          </listitem>

          <listitem>
            <para>Privacy Preferences</para>
          </listitem>
        </itemizedlist></para>

      <title>Group</title>

      <para>A group is a collection of principals. You can create a group
      using both direct principal assignment and nested group membership. All
      groups are uniquely identified by a namespace code plus a name. A
      principal or group is a "member" of a group if it is either directly
      assigned to the group or indirectly assigned (through a nested group
      membership). A principal or group is a "direct" member of another group
      only if it is directly assigned as a member of the group, and not
      through a nested group assignment.</para>

      <title>Permission</title>

      <para>A permission is the ability to perform an action. All permissions
      have a permission template. Both permissions and permission templates
      are uniquely identified by a namespace code plus a name. The permission
      template defines the coarse-grained permission and specifies what
      additional permission details need to be collected on permissions that
      use that template. For example, a permission template might have a name
      of "Initiate Document," which requires a permission detail specifying
      the document type that can be initiated. A permission created from the
      "Initiate Document" template would define the name of the specific
      Document Type that can be initiated as a permission detail.</para>

      <para>The <emphasis role="bold">isAuthorized</emphasis> and <emphasis
      role="bold">isAuthorizedByTemplateName</emphasis> operations on the
      <emphasis role="bold">PermissionService</emphasis> are used to execute
      authorization checks for a principal against a permission. Permissions
      are always assigned to roles (never directly to a principal or group). A
      particular principal will be authorized for a given permission if the
      principal is assigned to a role that has been granted the
      permission.</para>

      <title>Responsibility</title>

      <para>A responsibility represents an action that a principal is
      requested to take. This is used for defining workflow actions (such as
      approve, acknowledge, FYI) for which the principal is responsible.
      Responsibilities form the basis of the workflow engine routing
      process.</para>

      <para>A responsibility is very similar to a permission in a couple of
      ways. First, responsibilities are always granted to a role, never
      assigned directly to a principal or group. Furthermore, similar to
      permissions, a role has a responsibility template. The responsibility
      template specifies what additional responsibility details need to be
      defined when the responsibility is created.</para>

      <title>Role</title>

      <para>You grant permissions and responsibilities to roles. Roles have a
      membership consisting of principals, groups, and/or other roles. As a
      member of a role, the associated principal has all permissions and
      responsibilities that have been granted to that role.</para>

      <para>You can specify a qualification to any membership assignment on
      the role, which is extra information about that particular member of the
      role. For example, a person may have the role of "Dean" but that can be
      further qualified by the school they are the dean of, such as "Computer
      Science." You can pass qualifications as part of authorization checks to
      restrict the subset of roles to check.</para>

      <title>Reference Information</title>

      <para>There are several collections of reference information managed
      within KIM:<itemizedlist>
          <listitem>
            <para>Address type</para>
          </listitem>

          <listitem>
            <para>Affiliation type</para>
          </listitem>

          <listitem>
            <para>Citizenship status</para>
          </listitem>

          <listitem>
            <para>Email type</para>
          </listitem>

          <listitem>
            <para>Employment status</para>
          </listitem>

          <listitem>
            <para>Employment type</para>
          </listitem>

          <listitem>
            <para>Entity name type</para>
          </listitem>

          <listitem>
            <para>Entity type</para>
          </listitem>

          <listitem>
            <para>External identifier type</para>
          </listitem>

          <listitem>
            <para>Phone number type</para>
          </listitem>
        </itemizedlist></para>

        <title>Configuration Parameters</title>

          <title>KIM Configuration Parameters</title>

          <tgroup cols="3">
            <colspec colname="c1" colnum="1" colwidth="1.0*"/>

            <colspec colname="c2" colnum="2" colwidth="1.0*"/>

            <colspec colname="c3" colnum="3" colwidth="1.0*"/>

              <row>
                <entry>Configuration Parameter</entry>

                <entry>Description</entry>

                <entry>Default value</entry>
              </row>

              <row>
                <entry>kim.mode</entry>

                <entry>The mode that KIM will run in; choices are "LOCAL",
                "EMBEDDED", or "REMOTE".</entry>

                <entry>LOCAL</entry>
              </row>

              <row>
                <entry>kim.soapExposedService.jaxws.security</entry>

                <entry>Determines if KIM services published on the service bus
                will be secured</entry>

                <entry>true</entry>
              </row>

              <row>
                <entry>kim.url</entry>

                <entry>The base URL of KIM services and pages.</entry>

                <entry>${application.url}/kim</entry>
              </row>

          </tgroup>

    <title>Services</title>

    <para>KIM provides several service APIs with which client applications
    should interact. These are:<itemizedlist>
        <listitem>
          <para><emphasis
          role="bold">org.kuali.rice.kim.api.role.RoleService</emphasis></para>
        </listitem>

        <listitem>
          <para><emphasis
          role="bold">org.kuali.rice.kim.api.group.GroupService</emphasis></para>
        </listitem>

        <listitem>
          <para><emphasis
          role="bold">org.kuali.rice.kim.api.identity.IdentityService</emphasis></para>
        </listitem>

        <listitem>
          <para><emphasis
          role="bold">org.kuali.rice.kim.permission.PermissionService</emphasis></para>
        </listitem>

        <listitem>
          <para><emphasis
          role="bold">org.kuali.rice.kim.responsibility.ResponsibilityService</emphasis></para>
        </listitem>

        <listitem>
          <para><emphasis
          role="bold">org.kuali.rice.kim.service.PersonService</emphasis></para>
        </listitem>
      </itemizedlist></para>

    <para>These services act as client-side facades to the underlying KIM data
    and provide important features such as caching.</para>

    <para>In the next few sections we will look in-depth at these services.
    However, for more details, please see the javadocs for these services and
    the services they delegate to.</para>

      <title>Using the Services</title>

      <para>All KIM clients should retrieve service instances using the KIM
      service locator class <emphasis
      role="bold">KimApiServiceLocator</emphasis>. This class contains static
      methods to retrieve the appropriate Spring bean for the service. An
      example of retrieving the <emphasis
      role="bold">IdentityService</emphasis> service is:</para>

      <programlisting>IdentityService idmSvc = KimApiServiceLocator.getIdentityService();</programlisting>

      <para>You would use a similar mechanism for retrieving references to the
      other KIM services.</para>

      <title>IdentityService</title>

      <para>The <emphasis role="bold">IdentityService</emphasis> is one of the
      services the client applications will interact with most
      frequently.</para>

      <para>The <emphasis role="bold">IdentityService</emphasis> contains
      service methods that allow for the retrieval, creation, and upating of
      entity information.</para>

      <para>Additionally, it also provides caching for the retrieval methods
      to help increase the performance of service calls for the client
      application.</para>

        <title>Retrieving Principal Information</title>

        <para>To retrieve the principal ID for a user, use the <emphasis
        role="bold">getPrincipalByPrincipalName</emphasis> method:</para>

        <programlisting>Principal info = identityService.getPrincipalByPrincipalName(principalName);</programlisting>

        <para>Note that KIM, by default, stores principal names in lower case;
        the PRNCPL_NM column of KRIM_PRNCPL_T must store values in lower case.
        If your institution's existing identity systems do not handle
        lowercase principal names, then there are three points to override
        that setting:</para>

        <para><orderedlist>
            <listitem>
              <para><emphasis
              role="bold">org.kuali.rice.kim.impl.identity.IdentityServiceImpl</emphasis>
              method <emphasis
              role="bold">getPrincipalByPrincipalName</emphasis> lowercases
              the principal name sent in; depending on how principals were
              integrated into the system it may not need to. Note that
              <emphasis role="bold">IdentityServiceImpl</emphasis> method
              <emphasis
              role="bold">getPrincipalByPrincipalNameAndPassword</emphasis>
              does not lowercase the principal name automatically.</para>
            </listitem>

            <listitem>
              <para><emphasis
              role="bold">org.kuali.rice.kim.lookup.PersonLookableHelperServiceImpl</emphasis>
              method <emphasis role="bold">getSearchResults</emphasis> also
              automatically lowercases any principal name sent in; that
              behavior may also need to be changed</para>
            </listitem>

            <listitem>
              <para>Finally, the file <emphasis role="bold">{Rice
              home}/impl/src/main/resources/org/kuali/rice/kim/bo/datadictionary/KimBaseBeans.xml</emphasis>
              hold the data dictionary attribute templates for principal name
              as <emphasis role="bold">KimBaseBeans-principalName</emphasis>.
              The <emphasis role="bold">forceUppercase</emphasis> attribute is
              set to false by default, but perhaps should be overridden to
              true, to force uppercase principal names.</para>
            </listitem>
          </orderedlist></para>

        <para>Once these three points have been overridden, you'll be able to
        use uppercase principal names.</para>

        <title>Retrieving Entity Default Information</title>

        <para>To retrieve the default information for an entity, use one of
        the getEntityDefaultInfo methods:</para>

        <programlisting>EntityDefault infoByEntityId = identityService.getEntityDefault(entityId);

EntityDefault infoByPrincipalId = identityService.getEntityDefaultByPrincipalId(principalId);</programlisting>

        <title>Retrieving Reference Information</title>

        <para>To retrieve information about a type or status code, use the
        getter for that type.</para>

        <para>Types in KIM are:<itemizedlist>
            <listitem>
              <para>Address type</para>
            </listitem>

            <listitem>
              <para>Affiliation type</para>
            </listitem>

            <listitem>
              <para>Citizenship status</para>
            </listitem>

            <listitem>
              <para>Email type</para>
            </listitem>

            <listitem>
              <para>Employment status</para>
            </listitem>

            <listitem>
              <para>Employment type</para>
            </listitem>

            <listitem>
              <para>Entity name type</para>
            </listitem>

            <listitem>
              <para>Entity type</para>
            </listitem>

            <listitem>
              <para>External identifier type</para>
            </listitem>

            <listitem>
              <para>Phone type</para>
            </listitem>
          </itemizedlist></para>

        <para>For instance, to retrieve information on an address type
        code:</para>

        <programlisting>CodedAttribute addressType = identityService.getAddressType(code);</programlisting>

      <title>GroupService</title>

        <title>Retrieving Group Membership Information</title>

        <para>To retrieve a list of all groups in which a particular user is a
        member, use the <emphasis role="bold">getGroupsForPrincipal</emphasis>
        method:</para>

        <programlisting>List<Group> groups = groupService.getGroupsByPrincipalId(principalId);</programlisting>

        <para>To determine if a user is a member of a particular group, use
        the <emphasis role="bold">isMemberOfGroup</emphasis> method:</para>

        <programlisting>if (groupService.isMemberOfGroup(principalId, groupId)) {
    // Do something special
}</programlisting>

        <para>To get a list of all members of a group, use the <emphasis
        role="bold">getMemberPrincipalIds</emphasis> method:</para>

        <programlisting>List<String> members = groupService.getMemberPrincipalIds(groupId);</programlisting>

        <title>Retrieving Group Information</title>

        <para>To retrieve information about a group, use the <emphasis
        role="bold">getGroup</emphasis> or <emphasis
        role="bold">getGroupByNamespaceCodeAndName</emphasis> methods,
        depending on whether you know the group's ID or name:</para>

        <programlisting>Group info = groupService.getGroup(groupId);
Group info = groupService.getGroupByNamespaceCodeAndName(namespaceCode, groupName);</programlisting>

      <title>PermissionService</title>

        <title>Checking Permission</title>

        <para>To determine if a user has been granted a permission, without
        considering role qualifications, use the <emphasis
        role="bold">hasPermission</emphasis> method:</para>

        <programlisting>if (permissionService.hasPermission(principalId, namespaceCode, permissionName)) {
    // Do the action
}
</programlisting>

        <para>To determine if a user has been granted a permission, use the
        <emphasis role="bold">isAuthorized</emphasis> method:</para>

        <programlisting>if (permissionService.isAuthorized(principalId, namespaceCode, permissionName, qualification)) {
    // Do the action
}
</programlisting>

        <title>Retrieving Permission Information</title>

        <para>To retrieve a list of principals granted a permission (including
        any delegates), use the <emphasis
        role="bold">getPermissionAssignees</emphasis> method:</para>

        <programlisting>List<Assignee> people = permissionService.getPermissionAssignees(namespaceCode,
 permissionName, qualification);
</programlisting>

        <para>To retrieve a list of permissions granted to a principal, use
        the <emphasis role="bold">getAuthorizedPermissions</emphasis>
        method:</para>

        <programlisting>List<Permission> perms = permissionService.getAuthorizedPermissions(principalId,
 namespaceCode, permissionName, qualification);
</programlisting>

      <title>ResponsibilityService</title>

        <title>Checking Responsibility</title>

        <para>To determine if a user has a responsibility, use the <emphasis
        role="bold">hasResponsibility</emphasis> method:</para>

        <programlisting>if (responsibilityService.hasResponsibility(principalId, namespaceCode, responsibilityName, qualification)) {
    // Do the action

}
</programlisting>

        <title>Retrieving Responsibility Information</title>

        <para>To retrieve a list of roles associated with a responsibility,
        use the <emphasis role="bold">getRoleIdsForResponsibility</emphasis>
        method:</para>

        <programlisting>List<String> roleIds = responsibilityService.getRoleIdsForResponsibility(responsibilityId);</programlisting>

      <title>AuthenticationService</title>

        <title>Checking Authentication</title>

        <para>The <emphasis role="bold">AuthenticationService</emphasis> is
        somewhat different than the other services. The <emphasis
        role="bold">AuthenticationService</emphasis> is not typically deployed
        remotely (unlike the <emphasis role="bold">IdentityService</emphasis>,
        <emphasis role="bold">GroupService</emphasis>, etc.).</para>

        <para>Instead, the role of this service is simply to extract the
        authenticated user's principal name from the <emphasis
        role="bold">HttpServletRequest</emphasis> and inform the client-side
        development framework (typically, the KNS) about this information. KIM
        itself does not implement full authentication services, but rather
        relies on other implementations (such as CAS or Shibboleth) to provide
        this functionality.</para>

        <para>The client application can then establish a local session to
        store the information about the principal that authenticated. This
        will typically be used in subsequent calls to the KIM services, such
        as making authorization checks for the principal.</para>

        <para>The reference implementation of the <emphasis
        role="bold">AuthenticationService</emphasis> simply extracts the
        REMOTE_USER parameter from the request and presents that as the
        principal name. This is often sufficient for many authentication
        providers that are available. However, if necessary this reference
        implementation can be overridden.</para>

        <para>There is only a single method on the <emphasis
        role="bold">IdentityManagementService</emphasis> related to
        authentication.</para>

        <programlisting>String principalName = authenticationService.getPrincipalName(request);</programlisting>

      <title>RoleService</title>

      <para>In KIM, Roles are used as a way to associate principals, groups
      and other roles with permissions and responsibilities. It is therefore
      not a common or recommended practice to query for whether or not a
      principal is a member of a Role for the purposes of logic in a client
      application. It is recommended to use permissions and the <emphasis
      role="bold">isAuthorized</emphasis> check to perform this sort of
      logic.</para>

      <para>However, in some cases, querying for this information may be
      desirable. Or, in even more common cases, one may want to use an API to
      add or remove members from a Role. These kinds of operations are the
      responsibility of the <emphasis
      role="bold">RoleManagementService</emphasis>. Like the <emphasis
      role="bold">IdentityManagementService</emphasis>, this service is a
      façade which provides caching and delegates to underlying services.
      Specifically, it delegates to:<itemizedlist>
          <listitem>
            <para>RoleService</para>
          </listitem>
        </itemizedlist></para>

        <title>Checking Role Assignment</title>

        <para>To determine if a role is assigned to a principal, use the
        <emphasis role="bold">principalHasRole</emphasis> method:</para>

        <programlisting>if (roleService.principalHasRole(principalId, roleIds, qualifications)) {
    // Do something
}</programlisting>

        <title>Retrieving Role Information</title>

        <para>To retrieve information on a role, use the <emphasis
        role="bold">getRole</emphasis> or <emphasis
        role="bold">getRoleByName</emphasis> method:</para>

        <programlisting>Role info = roleService.getRole(roleId);
Role info = roleService.getRoleByNamespaceCodeAndName(namespaceCode, roleName);             </programlisting>

        <para>To retrieve the list of principal IDs assigned to a role, use
        the <emphasis role="bold">getRoleMemberPrincipalIds</emphasis>
        method:</para>

        <programlisting>Collection<String> principals = roleService.getRoleMemberPrincipalIds(namespaceCode, roleName, qualifications);</programlisting>

        <title>Updating Role Membership</title>

        <para>To assign a principal to a role, use the <emphasis
        role="bold">assignPrincipalToRole</emphasis> method:</para>

        <programlisting>roleService.assignPrincipalToRole(principalId, namespaceCode, roleName, qualifications);</programlisting>

        <para>To remove a principal from a role, use the <emphasis
        role="bold">removePrincipalFromRole</emphasis> method:</para>

        <programlisting>roleService.removePrincipalFromRole(principalId, namespaceCode, roleName, qualifications);</programlisting>

      <title>Person Service</title>

      <para>The <emphasis role="bold">PersonService</emphasis> is used to
      aggregate <emphasis role="bold">Entity</emphasis> and <emphasis
      role="bold">Principal</emphasis> data into a data structure called a
      <emphasis role="bold">Person</emphasis>. A person is essentially a
      flattened collection of the various attributes on an entity (name,
      address, principal id, principal name, etc). This is intended to allow
      client applications to more easily interact with the data in the
      underlying KIM data model for entities and principals.</para>

        <title>Retrieving Personal Information</title>

        <para>To retrieve information on a person by principal ID, use the
        <emphasis role="bold">getPerson</emphasis> method:</para>

        <programlisting>Person person = perSvc.getPerson(principalId);</programlisting>

        <para>To retrieve information on a person by principal name, use the
        <emphasis role="bold">getPersonByPrincipalName</emphasis>
        method:</para>

        <programlisting>Person person = perSvc.getPersonByPrincipalName(principalName);</programlisting>

        <para>In order to search for people by a given set of criteria you can
        use the <emphasis role="bold">findPeople</emphasis> method:</para>

        <programlisting>List<Person> people = perSvc.findPeople(criteria);</programlisting>

        <para>In this case, criteria is a <emphasis
        role="bold">java.util.Map<String, String></emphasis> which
        contains key-value pairs. The key is the name of the Person property
        to search on, while the value is the value to search for.</para>

    <title>KimTypeService Callbacks</title>

      <title>Implementing Custom KIM Types</title>

      <para>KIM uses the concept of "types" to define additional attributes
      for it's various objects (such as groups, roles, permissions, etc.) and
      to affect their behavior.</para>

      <para>All custom type services must implement a sub-interface of
      org.kuali.rice.kim.framework.type.KimTypeService based on
      the kind of custom type being created and the KIM objects it will be
      related to. The current type services supported by KIM are as
      follows:<itemizedlist>
          <listitem>
            <para>GroupTypeService</para>
          </listitem>

          <listitem>
            <para>RoleTypeService</para>
          </listitem>

          <listitem>
            <para>PermissionTypeService</para>
          </listitem>

          <listitem>
            <para>ResponsibilityTypeService</para>
          </listitem>

          <listitem>
            <para>DelegationTypeService</para>
          </listitem>
        </itemizedlist></para>

      <para>In addition to the interfaces provided above, KIM provides a
      standard set of implementations of each of these which can be extended
      by your application in order to inherit standard default behavior
      (including integration with the KNS Data Dictionary for reading and
      defining custom attributes). More detailed information about these base
      classes can be found in the KIM javadocs. Your custom type service class
      should extend the appropriate subclass and only override the methods
      necessary to implement your custom behavior. Use the methods in these
      classes as the basis for your custom code.</para>

      <para>For example, you might define a custom
      PermissionTypeService by extending
      org.kuali.rice.kns.kim.permission.PermissionTypeServiceBase
      as follows:</para>

      <programlisting>import org.kuali.rice.kns.kim.permission.PermissionTypeServiceBase;

public class MyPermissionTypeService extends PermissionTypeServiceBase {

    @Override
    protected boolean performMatch(Map<String, String> inputMap, Map<String, String> storedMap) {
        if (some_condition_is_true) {
            // perform custom matching logic
            ...
        } else {
            return super.performMatch(inputMap, storedMap); // execute the default logic from base class
        }
    }

}
                </programlisting>

      <para>Detailed documentation on the specific methods which can be
      implemented on KimTypeService and it's various
      sub-interfaces can be found in the KIM javadocs.</para>

      <title>Configuring Custom KIM Types</title>

      <para>Groups, Roles, Permissions, Responsibilities, and Delegations can
      all have custom types in KIM. These custom types can be mapped back to
      the KIM type services that you create. In order to do this, there are a
      few things you must do:<itemizedlist>
          <listitem>
            <para>Register the KIM Type which points to your custom type
            service</para>
          </listitem>

          <listitem>
            <para>Update any of the "typed" KIM objects that you want to point
            to your new KIM type</para>
          </listitem>

          <listitem>
            <para>Publish your KIM type service so that it is available on the
            Kuali Service Bus and the Rice resource loader framework</para>
          </listitem>
        </itemizedlist>Currently, there is no way to register a new KIM Type
      without updating the KIM database using SQL. Fortunately, this is a
      fairly simple thing to do. The database table storing KIM Types is named
      KRIM_TYP_T. An example of how to insert a new KIM Type into
      this table in Oracle is below:<programlisting>INSERT INTO KRIM_TYP_T (
    KIM_TYP_ID,
    NMSPC_CD,
    NM,
    SRVC_NM,
    OBJ_ID)
VALUES (
    KRIM_TYP_ID_S.NEXTVAL,
    'MyNamespace',
    'MyPermissionType',
    '{http://myapp.myu.edu}myPermissionTypeService',
    SYS_GUID()) </programlisting></para>

      <para>One of the most important things to note about this is the service
      name (SRVC_NM) column. As we can see in the example above, for this KIM
      type we are linking it to a service named
      {http://myapp.myu.edu}myPermissionTypeService. This is how
      KIM will look up your custom type service whenever it needs to load and
      invoke it.<footnote>
          <para>While the service name here is a single string value, it will
          be parsed into a javax.xml.namespace.QName object using
          that classes valueOf(...) method. This means that, for
          our example of
          {http://myapp.myu.edu}myPermissionTypeService, it will
          get parsed into a QName which is equivalent to new
          QName("http://myapp.myu.edu",
          "myPermissionTypeService").</para>
        </footnote> It does this through the Rice resource loading framework
      which includes locally available services defined in Spring as well as
      services published on the Kuali Service Bus. For KIM type services, it's
      generally required to deploy them onto the KSB because the user
      interface components of KIM will use these when determining which custom
      attributes may need to be displayed and collected on it's various
      screens.</para>

      <para>More information on how to publish these services can be found in
      the next section.</para>

      <para>Once the KIM type has been registered, it will be assigned an ID,
      this is the value of the KIM_TYP_ID column after the record
      has been inserted. This ID can then be used to associate the type with
      the appropriate and desired data elements in KIM.</para>

      <para>For example, to associate the custom
      PermissionTypeService you created earlier with one of your
      permission templates, you can execute the following SQL (assuming the ID
      of your new KIM type is 10000):<programlisting>UPDATE KRIM_PERM_TMPL_T SET KIM_TYP_ID = '10000'
WHERE NMSPC_CD = 'MyNamespace' AND NM = 'MyPermissionTemplate'</programlisting></para>

      <para>Once this is complete, any existing or new permissions you create
      with this template will use your custom KIM type and it's associated
      type service.</para>

      <title>Publishing Custom KIM Types to the Kuali Service Bus</title>

      <para>As mentioned previously, KIM type services should be published
      onto the Kuali Service Bus in order to allow the KIM user interface
      functionality (which is typically deployed on the Rice Standalone
      Server) to access the services remotely. Since KIM type services are
      considered "callback" services because of the fact that the standalone
      server makes callbacks to them, the
      org.kuali.rice.ksb.api.bus.support.CallbackServiceExporter
      should be used.</para>

      <para>Information on how to export and publish a callback service can be
      found in <xref linkend="callback_service_exporter"/>.</para>

      <para>Assuming you have already wired up your custom
      PermissionTypeService implementation in your Spring file under a bean id
      of "myPermissionTypeService", an example Spring configuration which will
      publish the service would look like the following:<programlisting><bean id="myPermissionTypeService.exporter"
      class="org.kuali.rice.ksb.api.bus.support.CallbackServiceExporter"
      p:callbackService-ref="myPermissionTypeService"
      p:serviceNameSpaceURI="http://myapp.myu.edu"
      p:localServiceName="myPermissionTypeService"
      p:serviceInterface="org.kuali.rice.kim.framework.permission.PermissionTypeService"/></programlisting></para>

    <title>KIM Database Tables</title>

      <title>Table Name Prefixes</title>

      <para>The KIM tables in the Rice database are prefixed by KRIM, which
      stands for <emphasis role="bold">K</emphasis>uali <emphasis
      role="bold">R</emphasis>ice <emphasis role="bold">I</emphasis>dentity
      <emphasis role="bold">M</emphasis>anagement.</para>

      <title>Unmapped LAST_UPDT_DT Columns</title>

      <para>Many of the KIM tables have an additional column called
      LAST_UPDTD_DT (of type DATE in Oracle, DATETIME in MySQL) that isn't
      mapped at the ORM layer. Using this column is entirely optional, and it
      is unmapped by design. Its purpose is to aid implementers with tracking
      changes, and with doing data synchronization or extracts against KIM
      tables. The following sample PL/SQL script (Oracle only) adds to all the
      tables that contain LAST_UPDATED_DT an insert and update trigger to
      populate it:</para>

      <programlisting>DECLARE
    CURSOR tables IS
        SELECT table_name
            FROM user_tab_columns
            WHERE column_name = 'LAST_UPDATE_DT'
            AND data_type LIKE 'DATE%'
            ORDER BY 1;
BEGIN
    FOR rec IN tables LOOP
        EXECUTE IMMEDIATE 'CREATE OR REPLACE TRIGGER '||LOWER( SUBSTR( rec.table_name, 1, 27) )||'_tr BEFORE INSERT OR UPDATE ON '
            ||LOWER( rec.table_name )||' FOR EACH ROW BEGIN :new.last_update_ts := SYSDATE; END;';
    END LOOP;

END;
/
</programlisting>

</chapter>