text:
namespace viz {
class CompositorFrameSinkSupport;
class ParentLocalSurfaceIdAllocator;
}  // namespace viz

namespace android_webview {

class SurfacesInstance;

class HardwareRendererSingleThread
    : public HardwareRenderer,
      public viz::mojom::CompositorFrameSinkClient {
 public:
  explicit HardwareRendererSingleThread(RenderThreadManager* state);
  ~HardwareRendererSingleThread() override;

 private:
  // HardwareRenderer implementation.
  void DrawAndSwap(HardwareRendererDrawParams* params) override;

  // viz::mojom::CompositorFrameSinkClient implementation.
  void DidReceiveCompositorFrameAck(
      const std::vector<viz::ReturnedResource>& resources) override;
  void OnBeginFrame(const viz::BeginFrameArgs& args,
                    const viz::FrameTimingDetailsMap& timing_details) override;
  void ReclaimResources(
      const std::vector<viz::ReturnedResource>& resources) override;
  void OnBeginFramePausedChanged(bool paused) override;

  void AllocateSurface();
  void DestroySurface();

  void CreateNewCompositorFrameSinkSupport();

  const scoped_refptr<SurfacesInstance> surfaces_;

  // Information about last delegated frame.
  gfx::Size surface_size_;
  float device_scale_factor_ = 0;

  viz::FrameSinkId frame_sink_id_;
  const std::unique_ptr<viz::ParentLocalSurfaceIdAllocator>
      parent_local_surface_id_allocator_;
  std::unique_ptr<viz::CompositorFrameSinkSupport> support_;
  viz::LocalSurfaceId child_id_;
  viz::FrameSinkId child_frame_sink_id_;
  uint32_t last_submitted_layer_tree_frame_sink_id_;

  DISALLOW_COPY_AND_ASSIGN(HardwareRendererSingleThread);
};

}  // namespace android_webview

#endif  // ANDROID_WEBVIEW_BROWSER_GFX_HARDWARE_RENDERER_SINGLE_THREAD_H_


text:
\documentclass[11pt,a4paper]{article}
\usepackage[only,bigsqcap]{stmaryrd}
\usepackage{ifthen,proof,amssymb,isabelle,isabellesym}
\isabellestyle{it}
\usepackage{pdfsetup}\urlstyle{rm}

\renewcommand{\isacommand}[1]
{\ifthenelse{\equal{sorry}{#1}}{$\;$\dummyproof}
  {\ifthenelse{\equal{oops}{#1}}{$\vdots$}{\isakeyword{#1}}}}

\newcommand{\DUMMYPROOF}{{\langle\idt{proof}\rangle}}
\newcommand{\dummyproof}{$\DUMMYPROOF$}

\newcommand{\name}[1]{\textsl{#1}}

\newcommand{\idt}[1]{{\mathord{\mathit{#1}}}}
\newcommand{\var}[1]{{?\!\idt{#1}}}
\DeclareMathSymbol{\dshsym}{\mathalpha}{letters}{"2D}
\newcommand{\dsh}{\dshsym}

\newcommand{\To}{\to}
\newcommand{\dt}{{\mathpunct.}}
\newcommand{\ap}{\mathbin{\!}}
\newcommand{\lam}[1]{\mathop{\lambda} #1\dt\;}
\newcommand{\all}[1]{\forall #1\dt\;}
\newcommand{\ex}[1]{\exists #1\dt\;}
\newcommand{\impl}{\to}
\newcommand{\conj}{\land}
\newcommand{\disj}{\lor}
\newcommand{\Impl}{\Longrightarrow}

\newcommand{\Nat}{\mathord{\mathrm{I}\mkern-3.8mu\mathrm{N}}}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "root"
%%% End:

redpajama_set_name: RedPajamaGithub


text:
import os
import sys
import time
import exceptions
import uuid
import logging

'''
        @author: msune,lbergesio,omoya,CarolinaFernandez
	@organization: i2CAT, OFELIA FP7

	PolicyEngine Rule class
	Encapsulates logic of a simple Rule
'''

from monscale.pypelib.Condition import Condition
from monscale.pypelib.persistence.PersistenceEngine import PersistenceEngine
from monscale.pypelib.utils.Logger import Logger

class TerminalMatch(exceptions.Exception):
	value = None
	desc = None
	def __init__(self,rType,desc):
		if isinstance(rType['value'],bool):
			self.value = rType['value']
		else:
			raise Exception("Unknown rule type")
		self.desc = desc
	def __str__(self):
		return "%s "%self.desc

class Rule():

	logger = Logger.getLogger()
	#Class Attributes
	_condition = None
	_description = None
	_errorMsg = None
	_uuid = None #uuid.uuid4().hex
        _defaultParser = "RegexParser"
        _defaultPersistence = "Django"

	#Types of rule
	POSITIVE_TERMINAL={'value':True,'terminal':True}
	POSITIVE_NONTERMINAL={'value':True,'terminal':False}
	NEGATIVE_TERMINAL={'value':False,'terminal':True}
	NEGATIVE_NONTERMINAL={'value':False,'terminal':False}

	_types = [POSITIVE_TERMINAL,POSITIVE_NONTERMINAL,NEGATIVE_TERMINAL, NEGATIVE_NONTERMINAL]

	#Rule type
	_type = None

	#Rule match Action
	_matchAction=None

	#Getters
	def getCondition(self):
		return self._condition
	def getDescription(self):
		return self._description
	def getType(self):
		return self._type
	def getErrorMsg(self):
		return self._errorMsg
	def getMatchAction(self):
		return self._matchAction
	def getUUID(self):
		return self._uuid
	#setters
	def setUUID(self,UUID):
		self._uuid = UUID

	#Constructor
	def __init__(self,condition,description,errorMsg,ruleType=POSITIVE_TERMINAL,action=None,uuid=None):
		if not isinstance(condition,Condition):
			raise Exception("Object must be an instance of Condition")
		if ruleType not in self._types:
			raise Exception("Unknown rule type")
		if action == None and (ruleType == self.NEGATIVE_NONTERMINAL or ruleType == self.POSITIVE_NONTERMINAL):
			raise Exception("You cannot create non-terminal actionless rules")

		self._condition = condition
		self._matchAction = action
		self._type = ruleType
		self._description = description
		self._errorMsg = errorMsg
		self._uuid = uuid

	def dump(self):
		#Debug dump
		toReturn = self._condition.dump()

		toReturn+="=> %s "%str(self._type['value'])
		if self._matchAction != None:
			toReturn += "(%s) "%str(self._matchAction)
		if self._type['terminal']:
			toReturn += "[TERM] "
		if self._description:
			toReturn+=" #"+self._description
		return toReturn

	#Resolver is passed at evaluation time to be able to dynamically redirect actions
	def evaluate(self,metaObj,resolver):
		try:
			result = self._condition.evaluate(metaObj,resolver)
			Rule.logger.debug('Result was: %s',str(result))
		except Exception as e:
			Rule.logger.error('Error on rule: %s',self.dump())
			Rule.logger.error('Exception: %s', str(e))
			Rule.logger.error('Rule will be skiped!')
			result = False

		if result:
			if self._matchAction != None:
				resolver.resolve(self._matchAction,metaObj)
			#If is terminal raise TerminalMatch
			if self._type['terminal']:
				raise TerminalMatch(self._type,self._errorMsg)
		#return whatever
		return

	def getConditionDump(self):
		return self.getCondition().dump()


text:
package br.org.piblimeira.domain;

import javax.persistence.*;

import org.apache.commons.lang3.StringUtils;

import java.util.Date;

@Entity
@Table(name="tb_pessoa")
public class Pessoa extends BaseEntity{

	private static final long serialVersionUID = 3359163512031402500L;

	@Id
	@Column(name = "ID_PESSOA")
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;

	@Column(name = "NOME")
	private String nome;

	@Column(name = "DT_NASCIMENTO")
	@Temporal(TemporalType.DATE)
	private Date dtNascimento;

	@Column(name = "SEXO", columnDefinition = "char(1)")
	private String sexo;

	@Column(name = "EMAIL")
	private String email;

	@Column(name = "STATUS", columnDefinition = "char(1)")
	private String status;

	@Column(name = "ESTADO_CIVIL", columnDefinition = "char(1)")
	private String estadoCivil;

	@Column(name = "MOTIVO_DESLIGAMENTO")
	private String motivoDesligamento;

	@Column(name = "OBSERVACAO")
	private String obs;

	@Column(name = "TELEFONE_FIXO")
	private String fixo;

	@Column(name = "CELULAR")
	private String celular;

	@Column(name = "DT_BATISMO")
	@Temporal(TemporalType.DATE)
	private Date dtBatismo;

	@Column(name = "DT_RECEPCAO")
	@Temporal(TemporalType.DATE)
	private Date dtRecepcao;

	@Column(name="ID_USUARIO")
	private Long usuario;

	@ManyToOne
	@JoinColumn(name="ID_TP_RECEPCAO")
	private TipoRecepcao tipoRecepcao;

	@ManyToOne
	@JoinColumn(name="ID_TP_MEMBRO")
	private TipoMembro tipoMembro;

	@Transient
	private Endereco endereco;

	@Transient
	private Integer mesNascimento;

	public Pessoa() {
	}

	public String retornarPrimeiroNome() {
		if(StringUtils.isNotBlank(getNome())) {
			String primeiroNome[] = getNome().split(" ");
			return primeiroNome[0];
		}
		return "";
	}

	public Pessoa(Integer mesNascimento) {
		this.mesNascimento = mesNascimento;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public Date getDtNascimento() {
		return dtNascimento;
	}

	public void setDtNascimento(Date dtNascimento) {
		this.dtNascimento = dtNascimento;
	}

	public String getSexo() {
		return sexo;
	}

	public void setSexo(String sexo) {
		this.sexo = sexo;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getMotivoDesligamento() {
		return motivoDesligamento;
	}

	public void setMotivoDesligamento(String motivoDesligamento) {
		this.motivoDesligamento = motivoDesligamento;
	}

	public String getObs() {
		return obs;
	}

	public void setObs(String obs) {
		this.obs = obs;
	}

	public String getFixo() {
		return fixo;
	}

	public void setFixo(String fixo) {
		this.fixo = fixo;
	}

	public String getCelular() {
		return celular;
	}

	public void setCelular(String celular) {
		this.celular = celular;
	}

	public Date getDtBatismo() {
		return dtBatismo;
	}

	public void setDtBatismo(Date dtBatismo) {
		this.dtBatismo = dtBatismo;
	}

	public Date getDtRecepcao() {
		return dtRecepcao;
	}

	public void setDtRecepcao(Date dtRecepcao) {
		this.dtRecepcao = dtRecepcao;
	}

	public TipoRecepcao getTipoRecepcao() {
		return tipoRecepcao;
	}

	public void setTipoRecepcao(TipoRecepcao tipoRecepcao) {
		this.tipoRecepcao = tipoRecepcao;
	}

	public TipoMembro getTipoMembro() {
		return tipoMembro;
	}

	public void setTipoMembro(TipoMembro tipoMembro) {
		this.tipoMembro = tipoMembro;
	}

	public Long getUsuario() {
		return usuario;
	}

	public void setUsuario(Long usuario) {
		this.usuario = usuario;
	}

	public String getEstadoCivil() {
		return estadoCivil;
	}

	public void setEstadoCivil(String estadoCivil) {
		this.estadoCivil = estadoCivil;
	}

	public Endereco getEndereco() {
		return endereco;
	}

	public void setEndereco(Endereco endereco) {
		this.endereco = endereco;
	}

	public Integer getMesNascimento() {
		return mesNascimento;
	}

	public void setMesNascimento(Integer mesNascimento) {
		this.mesNascimento = mesNascimento;
	}

}


text:
        <load-file-form
          details="config"
          id-prefix="tunnel"
          on-update="$ctrl.files[config.property] = fileContent"
          file-content="$ctrl.files[config.property]"
        ></load-file-form>


text:
using AllReady.Areas.Admin.Features.Campaigns;
using AllReady.Areas.Admin.Models;
using System;
using System.Linq;
using System.Threading.Tasks;
using AllReady.UnitTest.Features.Campaigns;
using Xunit;

namespace AllReady.UnitTest.Areas.Admin.Features.Campaigns
{
    public class EditCampaignCommandHandlerTests : InMemoryContextTest
    {
        [Fact(Skip = "RTM Broken Tests")]
        public async Task AddNewCampaign()
        {
            // Arrange
            var handler = new EditCampaignCommandHandler(Context);
            var newCampaign = new CampaignSummaryModel { Name = "New", Description = "Desc", TimeZoneId ="UTC" };

            // Act
            var result = await handler.Handle(new EditCampaignCommand { Campaign = newCampaign });

            // Assert
            Assert.Equal(5, Context.Campaigns.Count());
            Assert.True(result > 0);
        }

        /// <summary>
        /// Tests that the columms belonging the campaign table record are actually updated when a campaign is edited
        /// </summary>
        /// <remarks>This test is not testing the creation of location record, or impact record as those should be seperate tests</remarks>
        [Fact(Skip = "RTM Broken Tests")]
        public async Task UpdatingExistingCampaignUpdatesAllCoreProperties()
        {
            // Arrange
            var name = "New Name";
            var desc = "New Desc";
            var fullDesc = "New Full Desc";
            var timezoneId = "GMT Standard Time";
            var startDate = DateTime.Now;
            var endDate = DateTime.Now.AddDays(30);
            var org = 2;

            var handler = new EditCampaignCommandHandler(Context);
            var updatedCampaign = new CampaignSummaryModel {
                Id = 2,
                Name = name,
                Description = desc,
                FullDescription = fullDesc,
                TimeZoneId = timezoneId,
                StartDate = startDate,
                EndDate = endDate,
                OrganizationId = org,
            };

            // Act
            var result = await handler.Handle(new EditCampaignCommand { Campaign = updatedCampaign });
            var savedCampaign = Context.Campaigns.SingleOrDefault(s => s.Id == 2);

            // Assert
            Assert.Equal(4, Context.Campaigns.Count());
            Assert.Equal(2, result);

            Assert.Equal(name, savedCampaign.Name);
            Assert.Equal(desc, savedCampaign.Description);
            Assert.Equal(fullDesc, savedCampaign.FullDescription);
            Assert.Equal(timezoneId, savedCampaign.TimeZoneId);
            Assert.NotEqual(startDate.Date, new DateTime()); // We're not testing the date logic in this test, only that a datetime value is saved
            Assert.NotEqual(endDate.Date, new DateTime()); // We're not testing the date logic in this test, only that a datetime value is saved
            Assert.Equal(org, savedCampaign.ManagingOrganizationId);
        }

        [Fact(Skip = "RTM Broken Tests")]
        public async Task UpdatingExistingCampaignUpdatesLocationWithAllProperties()
        {
            // Arrange
            var name = "New Name";
            var desc = "New Desc";
            var org = 2;
            var address1 = "Address 1";
            var address2 = "Address 1";
            var city = "City";
            var state = "State";
            var postcode = "45231";
            var country = "USA";

            var handler = new EditCampaignCommandHandler(Context);
            var updatedCampaign = new CampaignSummaryModel
            {
                Id = 2,
                Name = name,
                Description = desc,
                OrganizationId = org,
                TimeZoneId = "GMT Standard Time",
                Location = new LocationEditModel {  Address1 = address1, Address2 = address2, City = city, State = state, PostalCode = postcode }
            };

            // Act
            await handler.Handle(new EditCampaignCommand { Campaign = updatedCampaign });
            var savedCampaign = Context.Campaigns.SingleOrDefault(s => s.Id == 2);

            // Assert
            Assert.Equal(address1, savedCampaign.Location.Address1);
            Assert.Equal(address2, savedCampaign.Location.Address2);
            Assert.Equal(city, savedCampaign.Location.City);
            Assert.Equal(state, savedCampaign.Location.State);
            Assert.Equal(postcode, savedCampaign.Location.PostalCode);
            Assert.Equal(country, savedCampaign.Location.Country);
        }

        [Fact(Skip = "RTM Broken Tests")]
        public async Task UpdatingExistingCampaignWithNoPriorContactAddsContactWithAllProperties()
        {
            // Arrange
            var name = "New Name";
            var desc = "New Desc";
            var org = 2;
            var contactEmail = "jdoe@example.com";
            var firstname = "John";
            var lastname = "Doe";
            var telephone = "01323 111111";

            var handler = new EditCampaignCommandHandler(Context);
            var updatedCampaign = new CampaignSummaryModel
            {
                Id = 2,
                Name = name,
                Description = desc,
                OrganizationId = org,
                TimeZoneId = "GMT Standard Time",
                PrimaryContactEmail = contactEmail,
                PrimaryContactFirstName =firstname,
                PrimaryContactLastName = lastname,
                PrimaryContactPhoneNumber = telephone
            };

            // Act
            await handler.Handle(new EditCampaignCommand { Campaign = updatedCampaign });
            var newContact = Context.Contacts.OrderBy(c=>c.Id).LastOrDefault();

            // Assert
            Assert.Equal(2, Context.CampaignContacts.Count());
            Assert.Equal(2, Context.Contacts.Count());

            Assert.NotNull(newContact);

            Assert.Equal(contactEmail, newContact.Email);
            Assert.Equal(firstname, newContact.FirstName);
            Assert.Equal(lastname, newContact.LastName);
            Assert.Equal(telephone, newContact.PhoneNumber);
        }

        protected override void LoadTestData()
        {
            CampaignsHandlerTestHelper.LoadCampaignssHandlerTestData(Context);
        }
    }
}


text:
\hypertarget{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage}{
\section{\-Pdo\-Session\-Storage \-Class \-Reference}
\label{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage}\index{\-Pdo\-Session\-Storage@{\-Pdo\-Session\-Storage}}
}
\-Inheritance diagram for \-Pdo\-Session\-Storage\-:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3.000000cm]{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage}
\end{center}
\end{figure}
\subsection*{\-Public \-Member \-Functions}
\begin{DoxyCompactItemize}
\item
\hyperlink{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_ac3d45478b892e61eac4a5d6ee77122e3}{\-\_\-\-\_\-construct} ($\backslash$\-P\-D\-O \$db, \$options=null)
\item
\hyperlink{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_af8fa59992209e36dccb3eefb0f75531f}{start} ()
\item
\hyperlink{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a3459ba99cac83957d4af8d7fc41a0d92}{session\-Open} (\$path=null, \$name=null)
\item
\hyperlink{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a1cdaef3bc11fefe27825850088848e0c}{session\-Close} ()
\item
\hyperlink{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a57de760698d4a775d2e31f6342dfef07}{session\-Destroy} (\$id)
\item
\hyperlink{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a7f05355413742bdd16e7feb66bff3bfc}{session\-G\-C} (\$lifetime)
\item
\hyperlink{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a683ea7db0e432689a7dea9d27a3673c0}{session\-Read} (\$id)
\item
\hyperlink{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_aa3be326788d6e143a5f2773ae5cbf8c7}{session\-Write} (\$id, \$data)
\end{DoxyCompactItemize}
\subsection*{\-Protected \-Attributes}
\begin{DoxyCompactItemize}
\item
\hypertarget{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a1fa3127fc82f96b1436d871ef02be319}{
{\bfseries \$db}}
\label{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a1fa3127fc82f96b1436d871ef02be319}

\end{DoxyCompactItemize}

\subsection{\-Detailed \-Description}
\hyperlink{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage}{\-Pdo\-Session\-Storage}.

\begin{DoxyAuthor}{\-Author}
\-Fabien \-Potencier $<$\href{mailto:fabien.potencier@symfony-project.com}{\tt fabien.\-potencier@symfony-\/project.\-com}$>$
\end{DoxyAuthor}

\subsection{\-Constructor \& \-Destructor \-Documentation}
\hypertarget{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_ac3d45478b892e61eac4a5d6ee77122e3}{
\index{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}!\-\_\-\-\_\-construct@{\-\_\-\-\_\-construct}}
\index{\-\_\-\-\_\-construct@{\-\_\-\-\_\-construct}!Symfony::Component::HttpFoundation::SessionStorage::PdoSessionStorage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}}
\subsubsection[{\-\_\-\-\_\-construct}]{\setlength{\rightskip}{0pt plus 5cm}\-\_\-\-\_\-construct (
\begin{DoxyParamCaption}
\item[{$\backslash$\-P\-D\-O \$}]{db, }
\item[{\$}]{options = {\ttfamily null}}
\end{DoxyParamCaption}
)}}
\label{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_ac3d45478b892e61eac4a5d6ee77122e3}

\begin{DoxyExceptions}{\-Exceptions}
{\em $\backslash$\-Invalid\-Argument\-Exception} & \-When \char`\"{}db\-\_\-table\char`\"{} option is not provided \\
\hline
\end{DoxyExceptions}

\subsection{\-Member \-Function \-Documentation}
\hypertarget{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a1cdaef3bc11fefe27825850088848e0c}{
\index{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}!session\-Close@{session\-Close}}
\index{session\-Close@{session\-Close}!Symfony::Component::HttpFoundation::SessionStorage::PdoSessionStorage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}}
\subsubsection[{session\-Close}]{\setlength{\rightskip}{0pt plus 5cm}session\-Close (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a1cdaef3bc11fefe27825850088848e0c}
\-Closes a session.

\begin{DoxyReturn}{\-Returns}
boolean true, if the session was closed, otherwise false
\end{DoxyReturn}
\hypertarget{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a57de760698d4a775d2e31f6342dfef07}{
\index{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}!session\-Destroy@{session\-Destroy}}
\index{session\-Destroy@{session\-Destroy}!Symfony::Component::HttpFoundation::SessionStorage::PdoSessionStorage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}}
\subsubsection[{session\-Destroy}]{\setlength{\rightskip}{0pt plus 5cm}session\-Destroy (
\begin{DoxyParamCaption}
\item[{\$}]{id}
\end{DoxyParamCaption}
)}}
\label{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a57de760698d4a775d2e31f6342dfef07}
\-Destroys a session.

\begin{DoxyParams}[1]{\-Parameters}
string & {\em \$id} & \-A session \-I\-D\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{\-Returns}
bool true, if the session was destroyed, otherwise an exception is thrown
\end{DoxyReturn}

\begin{DoxyExceptions}{\-Exceptions}
{\em $\backslash$\-Runtime\-Exception} & \-If the session cannot be destroyed \\
\hline
\end{DoxyExceptions}
\hypertarget{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a7f05355413742bdd16e7feb66bff3bfc}{
\index{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}!session\-G\-C@{session\-G\-C}}
\index{session\-G\-C@{session\-G\-C}!Symfony::Component::HttpFoundation::SessionStorage::PdoSessionStorage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}}
\subsubsection[{session\-G\-C}]{\setlength{\rightskip}{0pt plus 5cm}session\-G\-C (
\begin{DoxyParamCaption}
\item[{\$}]{lifetime}
\end{DoxyParamCaption}
)}}
\label{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a7f05355413742bdd16e7feb66bff3bfc}
\-Cleans up old sessions.

\begin{DoxyParams}[1]{\-Parameters}
int & {\em \$lifetime} & \-The lifetime of a session\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{\-Returns}
bool true, if old sessions have been cleaned, otherwise an exception is thrown
\end{DoxyReturn}

\begin{DoxyExceptions}{\-Exceptions}
{\em $\backslash$\-Runtime\-Exception} & \-If any old sessions cannot be cleaned \\
\hline
\end{DoxyExceptions}
\hypertarget{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a3459ba99cac83957d4af8d7fc41a0d92}{
\index{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}!session\-Open@{session\-Open}}
\index{session\-Open@{session\-Open}!Symfony::Component::HttpFoundation::SessionStorage::PdoSessionStorage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}}
\subsubsection[{session\-Open}]{\setlength{\rightskip}{0pt plus 5cm}session\-Open (
\begin{DoxyParamCaption}
\item[{\$}]{path = {\ttfamily null}, }
\item[{\$}]{name = {\ttfamily null}}
\end{DoxyParamCaption}
)}}
\label{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a3459ba99cac83957d4af8d7fc41a0d92}
\-Opens a session.

\begin{DoxyParams}[1]{\-Parameters}
string & {\em \$path} & (ignored) \\
\hline
string & {\em \$name} & (ignored)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{\-Returns}
boolean true, if the session was opened, otherwise an exception is thrown
\end{DoxyReturn}
\hypertarget{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a683ea7db0e432689a7dea9d27a3673c0}{
\index{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}!session\-Read@{session\-Read}}
\index{session\-Read@{session\-Read}!Symfony::Component::HttpFoundation::SessionStorage::PdoSessionStorage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}}
\subsubsection[{session\-Read}]{\setlength{\rightskip}{0pt plus 5cm}session\-Read (
\begin{DoxyParamCaption}
\item[{\$}]{id}
\end{DoxyParamCaption}
)}}
\label{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_a683ea7db0e432689a7dea9d27a3673c0}
\-Reads a session.

\begin{DoxyParams}[1]{\-Parameters}
string & {\em \$id} & \-A session \-I\-D\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{\-Returns}
string \-The session data if the session was read or created, otherwise an exception is thrown
\end{DoxyReturn}

\begin{DoxyExceptions}{\-Exceptions}
{\em $\backslash$\-Runtime\-Exception} & \-If the session cannot be read \\
\hline
\end{DoxyExceptions}
\hypertarget{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_aa3be326788d6e143a5f2773ae5cbf8c7}{
\index{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}!session\-Write@{session\-Write}}
\index{session\-Write@{session\-Write}!Symfony::Component::HttpFoundation::SessionStorage::PdoSessionStorage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}}
\subsubsection[{session\-Write}]{\setlength{\rightskip}{0pt plus 5cm}session\-Write (
\begin{DoxyParamCaption}
\item[{\$}]{id, }
\item[{\$}]{data}
\end{DoxyParamCaption}
)}}
\label{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_aa3be326788d6e143a5f2773ae5cbf8c7}
\-Writes session data.

\begin{DoxyParams}[1]{\-Parameters}
string & {\em \$id} & \-A session \-I\-D \\
\hline
string & {\em \$data} & \-A serialized chunk of session data\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{\-Returns}
bool true, if the session was written, otherwise an exception is thrown
\end{DoxyReturn}

\begin{DoxyExceptions}{\-Exceptions}
{\em $\backslash$\-Runtime\-Exception} & \-If the session data cannot be written \\
\hline
\end{DoxyExceptions}
\hypertarget{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_af8fa59992209e36dccb3eefb0f75531f}{
\index{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}!start@{start}}
\index{start@{start}!Symfony::Component::HttpFoundation::SessionStorage::PdoSessionStorage@{\-Symfony\-::\-Component\-::\-Http\-Foundation\-::\-Session\-Storage\-::\-Pdo\-Session\-Storage}}
\subsubsection[{start}]{\setlength{\rightskip}{0pt plus 5cm}start (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_pdo_session_storage_af8fa59992209e36dccb3eefb0f75531f}
\-Starts the session.

\-Reimplemented from \hyperlink{class_symfony_1_1_component_1_1_http_foundation_1_1_session_storage_1_1_native_session_storage_af8fa59992209e36dccb3eefb0f75531f}{\-Native\-Session\-Storage}.

\-The documentation for this class was generated from the following file\-:\begin{DoxyCompactItemize}
\item
vendor/symfony/lib/\-Symfony/\-Component/\-Http\-Foundation/\-Session\-Storage/\-Pdo\-Session\-Storage.\-php\end{DoxyCompactItemize}


text:
import random
import math
from copy import copy

class NeuralNetwork(object):
    """
    With sigmoid activation function
    """
    t = 1

    def __init__(self, neurals_counts, learning_rate=0.2, momentum=0, verbosity=True, weights=None):
        print u'Initializing neural network...'

        self.weights = []
        self.learning_rate = learning_rate
        self.neurals_counts = neurals_counts
        self.node_values = []
        self.momentum = momentum
        self.prev_weight_correction = []
        self._layers_count = len(neurals_counts)-1

        self._init_weights(neurals_counts, weights)

    def format(self, l):
        return ['%.2f' % i for i in l]

    def log(self, *args):
        if self.verbosity:
            print args

    def activate(self, value):
        #sigmoidal activation function
        return 1.0 / (1.0 + math.exp(-self.t*value))

    def activate_derivative(self, value):
        #here value is really not x, this is F(x), where F is activation function
        #This is because sigmoidal function has derivative equal F(x)(1-F(x))
        return self.t * value * (1.0 - value)

    def _init_weights(self, neurals_counts, weights=None):
        """
        init waights and threshold (w1, ..., wn, w0)
        """
        if not weights:
            for i in range(len(neurals_counts))[1:]:
                weights = []
                weights_count = neurals_counts[i-1]+1

                for _ in range(neurals_counts[i]):
                    weights.append([random.random()-0.5 for i in range(weights_count)])

                self.weights.append(weights)
        else:
            self.weights = weights

        for i in range(len(neurals_counts))[1:]:
            weights_count = neurals_counts[i-1]+1
            prew_weights_corrections = []

            for _ in range(neurals_counts[i]):
                prew_weights_corrections.append([0]*weights_count)

            self.prev_weight_correction.append(prew_weights_corrections)

    def calculate(self, input):
        self.node_values = []
        self.input = copy(input)

        for layer in self.weights:
            values = []

            for weights in layer:
                value = 0
                for i, _ in enumerate(input):
                    value += weights[i] * input[i]
                value += weights[-1]
                values.append(self.activate(value))

            self.node_values.append(copy(values))

            input = values

        return input

    def backpropagate(self, output, desired_output):
        error_gradient = [0]*self._layers_count

        #calculate error gradient

        #calculate for output(last) layer
        layer = -1
        errors = []

        for node in range(len(self.weights[layer])):
            error = desired_output[node] - output[node]
            errors.append(self.activate_derivative(output[node]) * error)

        error_gradient[-1] = errors

        #calculate for hidden layers
        for layer in range(self._layers_count-1)[::-1]:
            errors = []
            next_layer = layer + 1

            for node, _ in enumerate(self.weights[layer]):
                sum = 0

                for next_node in range(len(self.weights[next_layer])):
                    gradient = error_gradient[next_layer][next_node]
                    weight = self.weights[next_layer][next_node][node]
                    sum += gradient * weight

                value = self.node_values[layer][node]
                errors.append(self.activate_derivative(value) * sum)

            error_gradient[layer] = errors

        #update weights
        for layer in range(self._layers_count):
            for node, _ in enumerate(self.weights[layer]):
                er_gr = error_gradient[layer][node]
                #update w0
                self.weights[layer][node][-1] += self.learning_rate * er_gr

                if layer == 0:
                    input = self.input
                else:
                    input = self.node_values[layer-1]

                #update other weights
                for i, _ in enumerate(self.weights[layer][node][:-1]):
                    weight_correction = self.learning_rate * er_gr * input[i]
                    prev_correction = self.prev_weight_correction[layer][node][i]
                    self.weights[layer][node][i] += weight_correction + prev_correction * self.momentum
                    self.prev_weight_correction[layer][node][i] = weight_correction

    def teach(self, data, max_retries=1000):
        for i in range(max_retries):
            errors = []
            for item in data:
                #print '=================================='

                desired_output = item['output']

                output = self.calculate(item['input'])

                errors.append(self.least_mean_square(output, desired_output))

                self.backpropagate(output, desired_output)

            if i % 100 == 0:
                print self.root_mean_squared_error(errors)

    def test(self, data):
        for item in data:
            print self.format(self.calculate(item['input'])), self.format(item['output'])

    def root_mean_squared_error(self, errors):
        sum = 0
        for error in errors:
            sum += error ** 2

        return math.sqrt(sum/len(errors))

    def least_mean_square(self, output, desired_output):
        err = 0

        for i in range(len(output)):
            err += (desired_output[i] - output[i]) ** 2

        return err/2


text:
namespace azure {
	namespace storage {
		namespace core {
			utility::string_t generate_boundary_name(const utility::string_t& prefix)
			{
				utility::uuid id = utility::new_uuid();

				utility::string_t boundary_name;
				boundary_name.reserve(prefix.size() + 37);

				boundary_name.append(prefix);
				boundary_name.push_back(U('_'));
				boundary_name.append(utility::uuid_to_string(id));

				return boundary_name;
			}

			void write_line_break(utility::string_t& body_text)
			{
				body_text.push_back(U('\r'));
				body_text.push_back(U('\n'));
			}

			void write_boundary(utility::string_t& body_text, const utility::string_t& boundary_name, bool is_closure)
			{
				body_text.append(U("--"));
				body_text.append(boundary_name);
				if (is_closure)
				{
					body_text.append(U("--"));
				}

				write_line_break(body_text);
			}

			void write_mime_changeset_headers(utility::string_t& body_text)
			{
				body_text.append(web::http::header_names::content_type);
				body_text.push_back(U(':'));
				body_text.push_back(U(' '));
				body_text.append(protocol::header_value_content_type_http);
				write_line_break(body_text);

				body_text.append(protocol::header_content_transfer_encoding);
				body_text.push_back(U(':'));
				body_text.push_back(U(' '));
				body_text.append(protocol::header_value_content_transfer_encoding_binary);
				write_line_break(body_text);

				write_line_break(body_text);
			}

			void write_request_line(utility::string_t& body_text, const web::http::method& method, const web::http::uri& uri)
			{
				body_text.append(method);
				body_text.push_back(U(' '));
				body_text.append(uri.to_string());
				body_text.push_back(U(' '));
				body_text.append(protocol::http_version);
				write_line_break(body_text);
			}

			void write_request_headers(utility::string_t& body_text, const web::http::http_headers& headers)
			{
				for (web::http::http_headers::const_iterator it = headers.begin(); it != headers.end(); ++it)
				{
					const utility::string_t& header_name = it->first;
					const utility::string_t& header_value = it->second;

					body_text.append(header_name);
					body_text.push_back(U(':'));
					body_text.push_back(U(' '));
					body_text.append(header_value);
					write_line_break(body_text);
				}

				write_line_break(body_text);
			}

			void write_request_payload(utility::string_t& body_text, const web::json::value& json_object)
			{
				if (!json_object.is_null())
				{
					body_text.append(json_object.serialize());
				}

				write_line_break(body_text);
			}
		}
	}
} // namespace azure::storage::core


text:
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h

#ifndef __IRR_QUATERNION_H_INCLUDED__
#define __IRR_QUATERNION_H_INCLUDED__

#include "irrTypes.h"
#include "irrMath.h"
#include "matrix4.h"
#include "vector3d.h"

// Between Irrlicht 1.7 and Irrlicht 1.8 the quaternion-matrix conversions got fixed.
// This define disables all involved functions completely to allow finding all places
// where the wrong conversions had been in use.
#define IRR_TEST_BROKEN_QUATERNION_USE 0

namespace ue
{
namespace core
{

//! Quaternion class for representing rotations.
/** It provides cheap combinations and avoids gimbal locks.
Also useful for interpolations. */
class quaternion
{
	public:

		//! Default Constructor
		quaternion() : X(0.0f), Y(0.0f), Z(0.0f), W(1.0f) {}

		//! Constructor
		quaternion(f32 x, f32 y, f32 z, f32 w) : X(x), Y(y), Z(z), W(w) { }

		//! Constructor which converts euler angles (radians) to a quaternion
		quaternion(f32 x, f32 y, f32 z);

		//! Constructor which converts euler angles (radians) to a quaternion
		quaternion(const vector3df& vec);

#if !IRR_TEST_BROKEN_QUATERNION_USE
		//! Constructor which converts a matrix to a quaternion
		quaternion(const matrix4& mat);
#endif

		//! Equalilty operator
		bool operator==(const quaternion& other) const;

		//! inequality operator
		bool operator!=(const quaternion& other) const;

		//! Assignment operator
		inline quaternion& operator=(const quaternion& other);

#if !IRR_TEST_BROKEN_QUATERNION_USE
		//! Matrix assignment operator
		inline quaternion& operator=(const matrix4& other);
#endif

		//! Add operator
		quaternion operator+(const quaternion& other) const;

		//! Multiplication operator
		quaternion operator*(const quaternion& other) const;

		//! Multiplication operator with scalar
		quaternion operator*(f32 s) const;

		//! Multiplication operator with scalar
		quaternion& operator*=(f32 s);

		//! Multiplication operator
		vector3df operator*(const vector3df& v) const;

		//! Multiplication operator
		quaternion& operator*=(const quaternion& other);

		//! Calculates the dot product
		inline f32 dotProduct(const quaternion& other) const;

		//! Sets new quaternion
		inline quaternion& set(f32 x, f32 y, f32 z, f32 w);

		//! Sets new quaternion based on euler angles (radians)
		inline quaternion& set(f32 x, f32 y, f32 z);

		//! Sets new quaternion based on euler angles (radians)
		inline quaternion& set(const core::vector3df& vec);

		//! Sets new quaternion from other quaternion
		inline quaternion& set(const core::quaternion& quat);

		//! returns if this quaternion equals the other one, taking floating point rounding errors into account
		inline bool equals(const quaternion& other,
				const f32 tolerance = ROUNDING_ERROR_f32 ) const;

		//! Normalizes the quaternion
		inline quaternion& normalize();

#if !IRR_TEST_BROKEN_QUATERNION_USE
		//! Creates a matrix from this quaternion
		matrix4 getMatrix() const;
#endif

		//! Creates a matrix from this quaternion
		void getMatrix( matrix4 &dest, const core::vector3df &translation=core::vector3df() ) const;

		/*!
			Creates a matrix from this quaternion
			Rotate about a center point
			shortcut for
			core::quaternion q;
			q.rotationFromTo ( vin[i].Normal, forward );
			q.getMatrixCenter ( lookat, center, newPos );

			core::matrix4 m2;
			m2.setInverseTranslation ( center );
			lookat *= m2;

			core::matrix4 m3;
			m2.setTranslation ( newPos );
			lookat *= m3;

		*/
		void getMatrixCenter( matrix4 &dest, const core::vector3df &center, const core::vector3df &translation ) const;

		//! Creates a matrix from this quaternion
		inline void getMatrix_transposed( matrix4 &dest ) const;

		//! Inverts this quaternion
		quaternion& makeInverse();

		//! Set this quaternion to the linear interpolation between two quaternions
		/** \param q1 First quaternion to be interpolated.
		\param q2 Second quaternion to be interpolated.
		\param time Progress of interpolation. For time=0 the result is
		q1, for time=1 the result is q2. Otherwise interpolation
		between q1 and q2.
		*/
		quaternion& lerp(quaternion q1, quaternion q2, f32 time);

		//! Set this quaternion to the result of the spherical interpolation between two quaternions
		/** \param q1 First quaternion to be interpolated.
		\param q2 Second quaternion to be interpolated.
		\param time Progress of interpolation. For time=0 the result is
		q1, for time=1 the result is q2. Otherwise interpolation
		between q1 and q2.
		\param threshold To avoid inaccuracies at the end (time=1) the
		interpolation switches to linear interpolation at some point.
		This value defines how much of the remaining interpolation will
		be calculated with lerp. Everything from 1-threshold up will be
		linear interpolation.
		*/
		quaternion& slerp(quaternion q1, quaternion q2,
				f32 time, f32 threshold=.05f);

		//! Create quaternion from rotation angle and rotation axis.
		/** Axis must be unit length.
		The quaternion representing the rotation is
		q = cos(A/2)+sin(A/2)*(x*i+y*j+z*k).
		\param angle Rotation Angle in radians.
		\param axis Rotation axis. */
		quaternion& fromAngleAxis (f32 angle, const vector3df& axis);

		//! Fills an angle (radians) around an axis (unit vector)
		void toAngleAxis (f32 &angle, core::vector3df& axis) const;

		//! Output this quaternion to an euler angle (radians)
		void toEuler(vector3df& euler) const;

		//! Set quaternion to identity
		quaternion& makeIdentity();

		//! Set quaternion to represent a rotation from one vector to another.
		quaternion& rotationFromTo(const vector3df& from, const vector3df& to);

		//! Quaternion elements.
		f32 X; // vectorial (imaginary) part
		f32 Y;
		f32 Z;
		f32 W; // real part
};

// Constructor which converts euler angles to a quaternion
inline quaternion::quaternion(f32 x, f32 y, f32 z)
{
	set(x,y,z);
}

// Constructor which converts euler angles to a quaternion
inline quaternion::quaternion(const vector3df& vec)
{
	set(vec.X,vec.Y,vec.Z);
}

#if !IRR_TEST_BROKEN_QUATERNION_USE
// Constructor which converts a matrix to a quaternion
inline quaternion::quaternion(const matrix4& mat)
{
	(*this) = mat;
}
#endif

// equal operator
inline bool quaternion::operator==(const quaternion& other) const
{
	return ((X == other.X) &&
		(Y == other.Y) &&
		(Z == other.Z) &&
		(W == other.W));
}

// inequality operator
inline bool quaternion::operator!=(const quaternion& other) const
{
	return !(*this == other);
}

// assignment operator
inline quaternion& quaternion::operator=(const quaternion& other)
{
	X = other.X;
	Y = other.Y;
	Z = other.Z;
	W = other.W;
	return *this;
}

#if !IRR_TEST_BROKEN_QUATERNION_USE
// matrix assignment operator
inline quaternion& quaternion::operator=(const matrix4& m)
{
	const f32 diag = m[0] + m[5] + m[10] + 1;

	if( diag > 0.0f )
	{
		const f32 scale = sqrtf(diag) * 2.0f; // get scale from diagonal

		// TODO: speed this up
		X = (m[6] - m[9]) / scale;
		Y = (m[8] - m[2]) / scale;
		Z = (m[1] - m[4]) / scale;
		W = 0.25f * scale;
	}
	else
	{
		if (m[0]>m[5] && m[0]>m[10])
		{
			// 1st element of diag is greatest value
			// find scale according to 1st element, and double it
			const f32 scale = sqrtf(1.0f + m[0] - m[5] - m[10]) * 2.0f;

			// TODO: speed this up
			X = 0.25f * scale;
			Y = (m[4] + m[1]) / scale;
			Z = (m[2] + m[8]) / scale;
			W = (m[6] - m[9]) / scale;
		}
		else if (m[5]>m[10])
		{
			// 2nd element of diag is greatest value
			// find scale according to 2nd element, and double it
			const f32 scale = sqrtf(1.0f + m[5] - m[0] - m[10]) * 2.0f;

			// TODO: speed this up
			X = (m[4] + m[1]) / scale;
			Y = 0.25f * scale;
			Z = (m[9] + m[6]) / scale;
			W = (m[8] - m[2]) / scale;
		}
		else
		{
			// 3rd element of diag is greatest value
			// find scale according to 3rd element, and double it
			const f32 scale = sqrtf(1.0f + m[10] - m[0] - m[5]) * 2.0f;

			// TODO: speed this up
			X = (m[8] + m[2]) / scale;
			Y = (m[9] + m[6]) / scale;
			Z = 0.25f * scale;
			W = (m[1] - m[4]) / scale;
		}
	}

	return normalize();
}
#endif

// multiplication operator
inline quaternion quaternion::operator*(const quaternion& other) const
{
	quaternion tmp;

	tmp.W = (other.W * W) - (other.X * X) - (other.Y * Y) - (other.Z * Z);
	tmp.X = (other.W * X) + (other.X * W) + (other.Y * Z) - (other.Z * Y);
	tmp.Y = (other.W * Y) + (other.Y * W) + (other.Z * X) - (other.X * Z);
	tmp.Z = (other.W * Z) + (other.Z * W) + (other.X * Y) - (other.Y * X);

	return tmp;
}

// multiplication operator
inline quaternion quaternion::operator*(f32 s) const
{
	return quaternion(s*X, s*Y, s*Z, s*W);
}

// multiplication operator
inline quaternion& quaternion::operator*=(f32 s)
{
	X*=s;
	Y*=s;
	Z*=s;
	W*=s;
	return *this;
}

// multiplication operator
inline quaternion& quaternion::operator*=(const quaternion& other)
{
	return (*this = other * (*this));
}

// add operator
inline quaternion quaternion::operator+(const quaternion& b) const
{
	return quaternion(X+b.X, Y+b.Y, Z+b.Z, W+b.W);
}

#if !IRR_TEST_BROKEN_QUATERNION_USE
// Creates a matrix from this quaternion
inline matrix4 quaternion::getMatrix() const
{
	core::matrix4 m;
	getMatrix(m);
	return m;
}
#endif

/*!
	Creates a matrix from this quaternion
*/
inline void quaternion::getMatrix(matrix4 &dest,
		const core::vector3df &center) const
{
	dest[0] = 1.0f - 2.0f*Y*Y - 2.0f*Z*Z;
	dest[1] = 2.0f*X*Y + 2.0f*Z*W;
	dest[2] = 2.0f*X*Z - 2.0f*Y*W;
	dest[3] = 0.0f;

	dest[4] = 2.0f*X*Y - 2.0f*Z*W;
	dest[5] = 1.0f - 2.0f*X*X - 2.0f*Z*Z;
	dest[6] = 2.0f*Z*Y + 2.0f*X*W;
	dest[7] = 0.0f;

	dest[8] = 2.0f*X*Z + 2.0f*Y*W;
	dest[9] = 2.0f*Z*Y - 2.0f*X*W;
	dest[10] = 1.0f - 2.0f*X*X - 2.0f*Y*Y;
	dest[11] = 0.0f;

	dest[12] = center.X;
	dest[13] = center.Y;
	dest[14] = center.Z;
	dest[15] = 1.f;

	dest.setDefinitelyIdentityMatrix ( false );
}

/*!
	Creates a matrix from this quaternion
	Rotate about a center point
	shortcut for
	core::quaternion q;
	q.rotationFromTo(vin[i].Normal, forward);
	q.getMatrix(lookat, center);

	core::matrix4 m2;
	m2.setInverseTranslation(center);
	lookat *= m2;
*/
inline void quaternion::getMatrixCenter(matrix4 &dest,
					const core::vector3df &center,
					const core::vector3df &translation) const
{
	dest[0] = 1.0f - 2.0f*Y*Y - 2.0f*Z*Z;
	dest[1] = 2.0f*X*Y + 2.0f*Z*W;
	dest[2] = 2.0f*X*Z - 2.0f*Y*W;
	dest[3] = 0.0f;

	dest[4] = 2.0f*X*Y - 2.0f*Z*W;
	dest[5] = 1.0f - 2.0f*X*X - 2.0f*Z*Z;
	dest[6] = 2.0f*Z*Y + 2.0f*X*W;
	dest[7] = 0.0f;

	dest[8] = 2.0f*X*Z + 2.0f*Y*W;
	dest[9] = 2.0f*Z*Y - 2.0f*X*W;
	dest[10] = 1.0f - 2.0f*X*X - 2.0f*Y*Y;
	dest[11] = 0.0f;

	dest.setRotationCenter ( center, translation );
}

// Creates a matrix from this quaternion
inline void quaternion::getMatrix_transposed(matrix4 &dest) const
{
	dest[0] = 1.0f - 2.0f*Y*Y - 2.0f*Z*Z;
	dest[4] = 2.0f*X*Y + 2.0f*Z*W;
	dest[8] = 2.0f*X*Z - 2.0f*Y*W;
	dest[12] = 0.0f;

	dest[1] = 2.0f*X*Y - 2.0f*Z*W;
	dest[5] = 1.0f - 2.0f*X*X - 2.0f*Z*Z;
	dest[9] = 2.0f*Z*Y + 2.0f*X*W;
	dest[13] = 0.0f;

	dest[2] = 2.0f*X*Z + 2.0f*Y*W;
	dest[6] = 2.0f*Z*Y - 2.0f*X*W;
	dest[10] = 1.0f - 2.0f*X*X - 2.0f*Y*Y;
	dest[14] = 0.0f;

	dest[3] = 0.f;
	dest[7] = 0.f;
	dest[11] = 0.f;
	dest[15] = 1.f;

	dest.setDefinitelyIdentityMatrix(false);
}

// Inverts this quaternion
inline quaternion& quaternion::makeInverse()
{
	X = -X; Y = -Y; Z = -Z;
	return *this;
}

// sets new quaternion
inline quaternion& quaternion::set(f32 x, f32 y, f32 z, f32 w)
{
	X = x;
	Y = y;
	Z = z;
	W = w;
	return *this;
}

// sets new quaternion based on euler angles
inline quaternion& quaternion::set(f32 x, f32 y, f32 z)
{
	f64 angle;

	angle = x * 0.5;
	const f64 sr = sin(angle);
	const f64 cr = cos(angle);

	angle = y * 0.5;
	const f64 sp = sin(angle);
	const f64 cp = cos(angle);

	angle = z * 0.5;
	const f64 sy = sin(angle);
	const f64 cy = cos(angle);

	const f64 cpcy = cp * cy;
	const f64 spcy = sp * cy;
	const f64 cpsy = cp * sy;
	const f64 spsy = sp * sy;

	X = (f32)(sr * cpcy - cr * spsy);
	Y = (f32)(cr * spcy + sr * cpsy);
	Z = (f32)(cr * cpsy - sr * spcy);
	W = (f32)(cr * cpcy + sr * spsy);

	return normalize();
}

// sets new quaternion based on euler angles
inline quaternion& quaternion::set(const core::vector3df& vec)
{
	return set(vec.X, vec.Y, vec.Z);
}

// sets new quaternion based on other quaternion
inline quaternion& quaternion::set(const core::quaternion& quat)
{
	return (*this=quat);
}

//! returns if this quaternion equals the other one, taking floating point rounding errors into account
inline bool quaternion::equals(const quaternion& other, const f32 tolerance) const
{
	return core::equals(X, other.X, tolerance) &&
		core::equals(Y, other.Y, tolerance) &&
		core::equals(Z, other.Z, tolerance) &&
		core::equals(W, other.W, tolerance);
}

// normalizes the quaternion
inline quaternion& quaternion::normalize()
{
	const f32 n = X*X + Y*Y + Z*Z + W*W;

	if (n == 1)
		return *this;

	//n = 1.0f / sqrtf(n);
	return (*this *= reciprocal_squareroot ( n ));
}

// set this quaternion to the result of the linear interpolation between two quaternions
inline quaternion& quaternion::lerp(quaternion q1, quaternion q2, f32 time)
{
	const f32 scale = 1.0f - time;
	return (*this = (q1*scale) + (q2*time));
}

// set this quaternion to the result of the interpolation between two quaternions
inline quaternion& quaternion::slerp(quaternion q1, quaternion q2, f32 time, f32 threshold)
{
	f32 angle = q1.dotProduct(q2);

	// make sure we use the short rotation
	if (angle < 0.0f)
	{
		q1 *= -1.0f;
		angle *= -1.0f;
	}

	if (angle <= (1-threshold)) // spherical interpolation
	{
		const f32 theta = acosf(angle);
		const f32 invsintheta = reciprocal(sinf(theta));
		const f32 scale = sinf(theta * (1.0f-time)) * invsintheta;
		const f32 invscale = sinf(theta * time) * invsintheta;
		return (*this = (q1*scale) + (q2*invscale));
	}
	else // linear interploation
		return lerp(q1,q2,time);
}

// calculates the dot product
inline f32 quaternion::dotProduct(const quaternion& q2) const
{
	return (X * q2.X) + (Y * q2.Y) + (Z * q2.Z) + (W * q2.W);
}

//! axis must be unit length, angle in radians
inline quaternion& quaternion::fromAngleAxis(f32 angle, const vector3df& axis)
{
	const f32 fHalfAngle = 0.5f*angle;
	const f32 fSin = sinf(fHalfAngle);
	W = cosf(fHalfAngle);
	X = fSin*axis.X;
	Y = fSin*axis.Y;
	Z = fSin*axis.Z;
	return *this;
}

inline void quaternion::toAngleAxis(f32 &angle, core::vector3df &axis) const
{
	const f32 scale = sqrtf(X*X + Y*Y + Z*Z);

	if (core::iszero(scale) || W > 1.0f || W < -1.0f)
	{
		angle = 0.0f;
		axis.X = 0.0f;
		axis.Y = 1.0f;
		axis.Z = 0.0f;
	}
	else
	{
		const f32 invscale = reciprocal(scale);
		angle = 2.0f * acosf(W);
		axis.X = X * invscale;
		axis.Y = Y * invscale;
		axis.Z = Z * invscale;
	}
}

inline void quaternion::toEuler(vector3df& euler) const
{
	const f64 sqw = W*W;
	const f64 sqx = X*X;
	const f64 sqy = Y*Y;
	const f64 sqz = Z*Z;
	const f64 test = 2.0 * (Y*W - X*Z);

	if (core::equals(test, 1.0, 0.000001))
	{
		// heading = rotation about z-axis
		euler.Z = (f32) (-2.0*atan2(X, W));
		// bank = rotation about x-axis
		euler.X = 0;
		// attitude = rotation about y-axis
		euler.Y = (f32) (core::PI64/2.0);
	}
	else if (core::equals(test, -1.0, 0.000001))
	{
		// heading = rotation about z-axis
		euler.Z = (f32) (2.0*atan2(X, W));
		// bank = rotation about x-axis
		euler.X = 0;
		// attitude = rotation about y-axis
		euler.Y = (f32) (core::PI64/-2.0);
	}
	else
	{
		// heading = rotation about z-axis
		euler.Z = (f32) atan2(2.0 * (X*Y +Z*W),(sqx - sqy - sqz + sqw));
		// bank = rotation about x-axis
		euler.X = (f32) atan2(2.0 * (Y*Z +X*W),(-sqx - sqy + sqz + sqw));
		// attitude = rotation about y-axis
		euler.Y = (f32) asin( clamp(test, -1.0, 1.0) );
	}
}

inline vector3df quaternion::operator* (const vector3df& v) const
{
	// nVidia SDK implementation

	vector3df uv, uuv;
	vector3df qvec(X, Y, Z);
	uv = qvec.crossProduct(v);
	uuv = qvec.crossProduct(uv);
	uv *= (2.0f * W);
	uuv *= 2.0f;

	return v + uv + uuv;
}

// set quaternion to identity
inline core::quaternion& quaternion::makeIdentity()
{
	W = 1.f;
	X = 0.f;
	Y = 0.f;
	Z = 0.f;
	return *this;
}

inline core::quaternion& quaternion::rotationFromTo(const vector3df& from, const vector3df& to)
{
	// Based on Stan Melax's article in Game Programming Gems
	// Copy, since cannot modify local
	vector3df v0 = from;
	vector3df v1 = to;
	v0.normalize();
	v1.normalize();

	const f32 d = v0.dotProduct(v1);
	if (d >= 1.0f) // If dot == 1, vectors are the same
	{
		return makeIdentity();
	}
	else if (d <= -1.0f) // exactly opposite
	{
		core::vector3df axis(1.0f, 0.f, 0.f);
		axis = axis.crossProduct(v0);
		if (axis.getLength()==0)
		{
			axis.set(0.f,1.f,0.f);
			axis = axis.crossProduct(v0);
		}
		// same as fromAngleAxis(core::PI, axis).normalize();
		return set(axis.X, axis.Y, axis.Z, 0).normalize();
	}

	const f32 s = sqrtf( (1+d)*2 ); // optimize inv_sqrt
	const f32 invs = 1.f / s;
	const vector3df c = v0.crossProduct(v1)*invs;
	return set(c.X, c.Y, c.Z, s * 0.5f).normalize();
}

} // end namespace core
} // end namespace ue

#endif


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using Telerik.JustMock.Core;
using Telerik.JustMock.Core.Behaviors;
using Telerik.JustMock.Core.Context;
using Telerik.JustMock.Expectations.Abstraction;
using Telerik.JustMock.Expectations.DynaMock;

namespace Telerik.JustMock.Expectations
{
	internal sealed class NonPublicExpectation : INonPublicExpectation
	{

		private MethodInfo GetGenericMethodInstance(object target, Type returnType, string memberName, Type[] typeArguments, params object[] args)
		{
			var type = target.GetType();
			return GetGenericMethodInstance(type, returnType, memberName, typeArguments, args);
		}

		private MethodInfo GetGenericMethodInstance(Type targetType, Type returnType, string memberName, Type[] typeArguments, params object[] args)
		{
			var type = targetType;
			var mixin = MocksRepository.GetMockMixin(targetType, null);
			if (mixin != null)
				type = mixin.DeclaringType;

			var method = MockingUtil.GetGenericMethodInstanceByName(type, returnType, memberName, typeArguments, ref args);

			return method;
		}

		public ActionExpectation Arrange(object target, string memberName, Type[] typeArguments, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(target, typeof(void), memberName, typeArguments, args);
				return MockingContext.CurrentRepository.Arrange(target, method, args, () => new ActionExpectation());
			});
		}

		public FuncExpectation<TReturn> Arrange<TReturn>(object target, string memberName, Type[] typeArguments, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(target, typeof(TReturn), memberName, typeArguments, args);
				return MockingContext.CurrentRepository.Arrange(target, method, args, () => new FuncExpectation<TReturn>());
			});
		}

		public ActionExpectation Arrange<T>(string memberName, Type[] typeArguments, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
			{
				return Arrange(typeof(T), memberName, typeArguments, args);
			});
		}

		public ActionExpectation Arrange(Type targetType, string memberName, Type[] typeArguments, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(targetType, typeof(void), memberName, typeArguments, args);

				return MockingContext.CurrentRepository.Arrange(targetType, method, args, () => new ActionExpectation());
			});
		}

		public FuncExpectation<TReturn> Arrange<T, TReturn>(string memberName, Type[] typeArguments, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
			{
				return Arrange<TReturn>(typeof(T), memberName, typeArguments, args);
			});
		}

		public FuncExpectation<TReturn> Arrange<TReturn>(Type targetType, string memberName, Type[] typeArguments, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(targetType, typeof(TReturn), memberName, typeArguments, args);

				return MockingContext.CurrentRepository.Arrange(targetType, method, args, () => new FuncExpectation<TReturn>());
			});
		}

		public void Assert(object target, string memberName, Type[] typeArguments, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(target, typeof(void), memberName, typeArguments, args);
				this.Assert(target, method, args);
			});
		}

		public void Assert<TReturn>(object target, string memberName, Type[] typeArguments, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(target, typeof(TReturn), memberName, typeArguments, args);
				this.Assert(target, method, args);
			});
		}

		public void Assert(object target, string memberName, Type[] typeArguments, Occurs occurs, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(target, typeof(void), memberName, typeArguments, args);
				this.Assert(target, method, occurs, args);
			});
		}

		public void Assert<TReturn>(object target, string memberName, Type[] typeArguments, Occurs occurs, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(target, typeof(TReturn), memberName, typeArguments, args);
				this.Assert(target, method, occurs, args);
			});
		}

#if !LITE_EDITION

		public void Assert<T>(string memberName, Type[] typeArguments, Occurs occurs, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(typeof(T), typeof(void), memberName, typeArguments, args);
				this.Assert(method, occurs, args);
			});
		}

		public void Assert(Type targetType, string memberName, Type[] typeArguments, Occurs occurs, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(targetType, typeof(void), memberName, typeArguments, args);
				this.Assert(method, occurs, args);
			});
		}

		public void Assert<T>(string memberName, Type[] typeArguments, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(typeof(T), typeof(void), memberName, typeArguments, args);
				this.Assert(method, args);
			});
		}

		public void Assert(Type targetType, string memberName, Type[] typeArguments, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(targetType, typeof(void), memberName, typeArguments, args);
				this.Assert(method, args);
			});
		}

		public void Assert<TReturn>(Type targetType, string memberName, Type[] typeArguments, Occurs occurs, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(targetType, typeof(TReturn), memberName, typeArguments, args);
				this.Assert(method, occurs, args);
			});
		}

		public void Assert<TReturn>(Type targetType, string memberName, Type[] typeArguments, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(targetType, typeof(TReturn), memberName, typeArguments, args);
				this.Assert(method, args);
			});
		}

		public void Assert<T, TReturn>(string memberName, Type[] typeArguments, Occurs occurs, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(typeof(T), typeof(TReturn), memberName, typeArguments, args);
				this.Assert(method, occurs, args);
			});
		}

		public void Assert<T, TReturn>(string memberName, Type[] typeArguments, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(typeof(T), typeof(TReturn), memberName, typeArguments, args);
				this.Assert(method, args);
			});
		}

		public int GetTimesCalled(object target, string memberName, Type[] typeArguments, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(target, typeof(void), memberName, typeArguments, args);
				return this.GetTimesCalled(method, args);
			});
		}

		public int GetTimesCalled(Type type, string memberName, Type[] typeArguments, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
			{
				var method = GetGenericMethodInstance(type, typeof(void), memberName, typeArguments, args);
				return this.GetTimesCalled(method, args);
			});
		}

#endif

		public ActionExpectation Arrange(object target, string memberName, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
				{
					var type = target.GetType();
					var mixin = MocksRepository.GetMockMixin(target, null);
					if (mixin != null)
						type = mixin.DeclaringType;

					var method = MockingUtil.GetMethodByName(type, typeof(void), memberName, ref args);
					return MockingContext.CurrentRepository.Arrange(target, method, args, () => new ActionExpectation());
				});
		}

		public ActionExpectation Arrange(object target, MethodInfo method, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() => MockingContext.CurrentRepository.Arrange(target, method, args, () => new ActionExpectation()));
		}

		public FuncExpectation<TReturn> Arrange<TReturn>(object target, string memberName, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
				{
					var type = target.GetType();
					var mixin = MocksRepository.GetMockMixin(target, null);
					if (mixin != null)
						type = mixin.DeclaringType;

					var method = MockingUtil.GetMethodByName(type, typeof(TReturn), memberName, ref args);
					return MockingContext.CurrentRepository.Arrange(target, method, args, () => new FuncExpectation<TReturn>());
				});
		}

		public FuncExpectation<TReturn> Arrange<TReturn>(object target, MethodInfo method, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() => MockingContext.CurrentRepository.Arrange(target, method, args, () => new FuncExpectation<TReturn>()));
		}

		Type GetTypeFromInstance(object instance)
		{
			Type type = instance.GetType();
			if (type.IsProxy())
				type = type.BaseType;
			return type;
		}

		PropertyInfo GetNonPublicProperty(Type type, string propertyName)
		{
			var mockedProperty = type.GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static)
				.FirstOrDefault(property => property.Name == propertyName);
			return mockedProperty;
		}

		private static string BuildMissingPropertyMessage(Type type, string propertyName)
		{
			return String.Format("Property '{0}' was not found on type '{1}'.", propertyName, type);
		}

		public ActionExpectation ArrangeSet(object target, string propertyName, object value)
		{
			return ProfilerInterceptor.GuardInternal(() =>
			{
				Type type = GetTypeFromInstance(target);
				if (GetNonPublicProperty(type, propertyName) == null)
				{
					throw new MissingMemberException(BuildMissingPropertyMessage(type, propertyName));
				}
				return Arrange(target, propertyName, value);
			});
		}

		public ActionExpectation ArrangeSet<T>(string propertyName, object value)
		{
			return ProfilerInterceptor.GuardInternal(() =>
			{
				return ArrangeSet(typeof(T), propertyName, value);
			});
		}

		public ActionExpectation ArrangeSet(Type type, string propertyName, object value)
		{
			return ProfilerInterceptor.GuardInternal(() =>
			{
				if (GetNonPublicProperty(type, propertyName) == null)
				{
					throw new MissingMemberException(BuildMissingPropertyMessage(type, propertyName));
				}
				return Arrange(type, propertyName, value);
			});
		}

		public void Assert<TReturn>(object target, string memberName, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var type = target.GetType();
					var mixin = MocksRepository.GetMockMixin(target, null);
					if (mixin != null)
						type = mixin.DeclaringType;

					var message = MockingUtil.GetAssertionMessage(args);
					var method = MockingUtil.GetMethodByName(type, typeof(TReturn), memberName, ref args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, target, method, args, null);
				});
		}

		public void Assert(object target, MethodInfo method, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var message = MockingUtil.GetAssertionMessage(args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, target, method, args, null);
				});
		}

		public void Assert(object target, string memberName, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var type = target.GetType();
					var mixin = MocksRepository.GetMockMixin(target, null);
					if (mixin != null)
						type = mixin.DeclaringType;

					var message = MockingUtil.GetAssertionMessage(args);
					var method = MockingUtil.GetMethodByName(type, typeof(void), memberName, ref args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, target, method, args, null);
				});
		}

		public void Assert<TReturn>(object target, string memberName, Occurs occurs, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var type = target.GetType();
					var mixin = MocksRepository.GetMockMixin(target, null);
					if (mixin != null)
						type = mixin.DeclaringType;

					var message = MockingUtil.GetAssertionMessage(args);
					var method = MockingUtil.GetMethodByName(type, typeof(TReturn), memberName, ref args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, target, method, args, occurs);
				});
		}

		public void Assert(object target, MethodInfo method, Occurs occurs, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var message = MockingUtil.GetAssertionMessage(args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, target, method, args, occurs);
				});
		}

		public void Assert(object target, string memberName, Occurs occurs, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var type = target.GetType();
					var mixin = MocksRepository.GetMockMixin(target, null);
					if (mixin != null)
						type = mixin.DeclaringType;

					var message = MockingUtil.GetAssertionMessage(args);
					var method = MockingUtil.GetMethodByName(type, typeof(void), memberName, ref args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, target, method, args, occurs);
				});
		}

		public int GetTimesCalled(object target, MethodInfo method, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
				MockingContext.CurrentRepository.GetTimesCalledFromMethodInfo(target, method, args));
		}

		public int GetTimesCalled(object target, string memberName, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
			{
				var type = target.GetType();
				var mixin = MocksRepository.GetMockMixin(target, null);
				if (mixin != null)
					type = mixin.DeclaringType;

				var method = MockingUtil.GetMethodByName(type, typeof(void), memberName, ref args);
				return MockingContext.CurrentRepository.GetTimesCalledFromMethodInfo(target, method, args);
			});
		}

#if !LITE_EDITION

		public FuncExpectation<TReturn> Arrange<T, TReturn>(string memberName, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
				{
					var method = MockingUtil.GetMethodByName(typeof(T), typeof(TReturn), memberName, ref args);
					return MockingContext.CurrentRepository.Arrange(null, method, args, () => new FuncExpectation<TReturn>());
				});
		}

		public ActionExpectation Arrange<T>(string memberName, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
				{
					var method = MockingUtil.GetMethodByName(typeof(T), typeof(void), memberName, ref args);
					return MockingContext.CurrentRepository.Arrange(null, method, args, () => new ActionExpectation());
				});
		}

		public FuncExpectation<TReturn> Arrange<TReturn>(Type targetType, string memberName, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
				{
					var method = MockingUtil.GetMethodByName(targetType, typeof(TReturn), memberName, ref args);
					return MockingContext.CurrentRepository.Arrange(null, method, args, () => new FuncExpectation<TReturn>());
				});
		}

		public FuncExpectation<TReturn> Arrange<TReturn>(MethodBase method, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() => MockingContext.CurrentRepository.Arrange(null, method, args, () => new FuncExpectation<TReturn>()));
		}

		public ActionExpectation Arrange(Type targetType, string memberName, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
				{
					var method = MockingUtil.GetMethodByName(targetType, typeof(void), memberName, ref args);
					return MockingContext.CurrentRepository.Arrange(null, method, args, () => new ActionExpectation());
				});
		}

		public ActionExpectation Arrange(MethodBase method, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() => MockingContext.CurrentRepository.Arrange(null, method, args, () => new ActionExpectation()));
		}

		public void Assert<T>(string memberName, Occurs occurs, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var message = MockingUtil.GetAssertionMessage(args);
					var method = MockingUtil.GetMethodByName(typeof(T), typeof(void), memberName, ref args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, null, method, args, occurs);
				});
		}

		public void Assert(MethodBase method, Occurs occurs, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var message = MockingUtil.GetAssertionMessage(args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, null, method, args, occurs);
				});
		}

		public void Assert<T, TReturn>(string memberName, Occurs occurs, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var message = MockingUtil.GetAssertionMessage(args);
					var method = MockingUtil.GetMethodByName(typeof(T), typeof(TReturn), memberName, ref args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, null, method, args, occurs);
				});
		}

		public void Assert<T>(string memberName, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var message = MockingUtil.GetAssertionMessage(args);
					var method = MockingUtil.GetMethodByName(typeof(T), typeof(void), memberName, ref args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, null, method, args, null);
				});
		}

		public void Assert(MethodBase method, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var message = MockingUtil.GetAssertionMessage(args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, null, method, args, null);
				});
		}

		public void Assert<T, TReturn>(string memberName, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var message = MockingUtil.GetAssertionMessage(args);
					var method = MockingUtil.GetMethodByName(typeof(T), typeof(TReturn), memberName, ref args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, null, method, args, null);
				});
		}

		public void Assert(Type targetType, string memberName, Occurs occurs, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var message = MockingUtil.GetAssertionMessage(args);
					var method = MockingUtil.GetMethodByName(targetType, typeof(void), memberName, ref args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, null, method, args, occurs);
				});
		}

		public void Assert<TReturn>(Type targetType, string memberName, Occurs occurs, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var message = MockingUtil.GetAssertionMessage(args);
					var method = MockingUtil.GetMethodByName(targetType, typeof(TReturn), memberName, ref args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, null, method, args, occurs);
				});
		}

		public void Assert(Type targetType, string memberName, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var message = MockingUtil.GetAssertionMessage(args);
					var method = MockingUtil.GetMethodByName(targetType, typeof(void), memberName, ref args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, null, method, args, null);
				});
		}

		void INonPublicExpectation.Assert<TReturn>(Type targetType, string memberName, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
				{
					var message = MockingUtil.GetAssertionMessage(args);
					var method = MockingUtil.GetMethodByName(targetType, typeof(TReturn), memberName, ref args);
					MockingContext.CurrentRepository.AssertMethodInfo(message, null, method, args, null);
				});
		}

		public int GetTimesCalled(MethodBase method, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
				MockingContext.CurrentRepository.GetTimesCalledFromMethodInfo(null, method, args));

		}

		public int GetTimesCalled(Type type, string memberName, params object[] args)
		{
			return ProfilerInterceptor.GuardInternal(() =>
			{
				var method = MockingUtil.GetMethodByName(type, typeof(void), memberName, ref args);
				return MockingContext.CurrentRepository.GetTimesCalledFromMethodInfo(null, method, args);
			});
		}
#endif

		#region Raise event

		public void Raise(object instance, EventInfo eventInfo, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() => RaiseEventBehavior.RaiseEventImpl(instance, eventInfo, args));
		}

		public void Raise(EventInfo eventInfo, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() => RaiseEventBehavior.RaiseEventImpl(null, eventInfo, args));
		}

		public void Raise(object instance, string eventName, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
			{
				RaiseEventBehavior.RaiseEventImpl(instance, MockingUtil.GetUnproxiedType(instance).GetEvent(eventName,
					BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance), args);
			});
		}

		public void Raise(Type type, string eventName, params object[] args)
		{
			ProfilerInterceptor.GuardInternal(() =>
			{
				RaiseEventBehavior.RaiseEventImpl(null, type.GetEvent(eventName,
					BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static), args);
			});
		}
		#endregion

		public PrivateAccessor MakePrivateAccessor(object instance)
		{
			return new PrivateAccessor(instance);
		}

		public PrivateAccessor MakeStaticPrivateAccessor(Type type)
		{
			return PrivateAccessor.ForType(type);
		}

		public dynamic Wrap(object instance)
		{
			return ProfilerInterceptor.GuardInternal(() =>
				{
#if !LITE_EDITION
					Mock.Intercept(instance.GetType());
#endif
					return new ExpressionContainer(Expression.Constant(instance, MockingUtil.GetUnproxiedType(instance)));
				}
			);
		}

		public dynamic WrapType(Type type)
		{
			return ProfilerInterceptor.GuardInternal(() =>
				{
#if !LITE_EDITION
					Mock.Intercept(type);
#endif
					return new ExpressionContainer(Expression.Constant(type.GetDefaultValue(), type)) { IsStatic = true };
				}
			);
		}

		public ActionExpectation Arrange(dynamic dynamicExpression)
		{
			return ProfilerInterceptor.GuardInternal(() =>
				MockingContext.CurrentRepository.Arrange(((IExpressionContainer)dynamicExpression).ToLambda(), () => new ActionExpectation())
			);
		}

		public FuncExpectation<TReturn> Arrange<TReturn>(dynamic dynamicExpression)
		{
			return ProfilerInterceptor.GuardInternal(() =>
				MockingContext.CurrentRepository.Arrange(((IExpressionContainer)dynamicExpression).ToLambda(), () => new FuncExpectation<TReturn>())
			);
		}

		public void Assert(dynamic dynamicExpression, Occurs occurs, string message = null)
		{
			ProfilerInterceptor.GuardInternal(() =>
				MockingContext.CurrentRepository.Assert(message, null, ((IExpressionContainer)dynamicExpression).ToLambda(), null, occurs)
			);
		}

		public void Assert(dynamic dynamicExpression, Args args, Occurs occurs, string message = null)
		{
			ProfilerInterceptor.GuardInternal(() =>
				MockingContext.CurrentRepository.Assert(message, null, ((IExpressionContainer)dynamicExpression).ToLambda(), args, occurs)
			);
		}

#if !PORTABLE
		public INonPublicRefReturnExpectation RefReturn
		{
			get { return ProfilerInterceptor.GuardInternal(() => new NonPublicRefReturnExpectation()); }
		}
#endif
	}
}


text:
/* ----------------------------------------------------------------------- *//**
 *
 * @file random_process.cpp
 *
 * @brief Generate a random number from a random process
 *
 *//* ----------------------------------------------------------------------- */

#include <dbconnector/dbconnector.hpp>
#include <boost/random/poisson_distribution.hpp>
#include <boost/random/gamma_distribution.hpp>
#include <boost/random/variate_generator.hpp>

#include "random_process.hpp"

using boost::poisson_distribution;
using boost::gamma_distribution;
using boost::variate_generator;

namespace madlib {

namespace modules {

namespace sample {

/**
 * @brief Poisson distributed random variables given mean
 */
AnyType
poisson_random::run(AnyType &args) {
    double mean = args[0].getAs<double>();
    poisson_distribution<int> pdist(mean);
    NativeRandomNumberGenerator generator;
    variate_generator<NativeRandomNumberGenerator, poisson_distribution<int> >
            rvt(generator, pdist);

    return rvt();
}

/**
 * @brief Gamma distributed random variables given alpha
 */
AnyType
gamma_random::run(AnyType &args) {
    double alpha = args[0].getAs<double>();
    gamma_distribution<> gdist(alpha);
    NativeRandomNumberGenerator generator;
    variate_generator<NativeRandomNumberGenerator, gamma_distribution<> >
            rvt(generator, gdist);

    return rvt();
}

} // namespace sample

} // namespace modules

} // namespace madlib


text:
<TITLE>Review for Young Lions, The (1958)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Young Lions, The (1958)

reviewed by
Brian Koller

The Young Lions (1958)

Grade: 86

"The Young Lions" is a lengthy war epic that focuses not on
battles, but on the people that have been forced to fight
them.  The theme of war as an evil, destructive and pointless
force is well-developed, and the quality of the script and
story more than compensates for minor problems.

It is the story of three soldiers.  Marlon Brando plays a
German lieutenant whose growing disillusionment with war
and the German cause parallels the decline of the Axis war
machine.  Montgomery Clift plays a jewish private who must
overcome harassment from his fellow soldiers.  Dean Martin
plays a Broadway entertainer who is racked with guilt for
trying to avoid fighting in the front lines.

Dean Martin has the weakest character.  He is clearly in his late
thirties, but is so guilty over not serving in the trenches
that he falls to drinking and abuse of his girlfriend.  Martin
doesn't seem comfortable, looking as if he'd rather be somewhere
else.

Clift effectively underplays.  Clift always landed terrific
roles, due either to his excellent judgement of scripts, or
from film directors noticing his charisma.  His character
briefly deserts his unit, an action not well explained.  Also,
perhaps he is made too much of a hero in rescuing his bullying
fellow soldiers.

Brando has the best role.  His German accent isn't quite right,
but he underplays his character perfectly.  Torn between duty
and the revulsion of his actions, he soon has the unhappy look
of a condemned man.

Well directed, there's not a scene wasted, and the film
never drags.  The Germans are portrayed as humans reluctantly
following an evil cause, rather than as murderous stereotypes.
The script and cinematography is also excellent.

http://members.tripod.com/~Brian_Koller/movies.html

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
use TAQBenchmarks
go
drop procedure dbo.EnqueueMessage
drop procedure dbo.DequeueMessage
drop table dbo.InMemoryQueue