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

	<Titre>
Maîtrise des modifications</Titre>
	<Auteurs>
		<Auteur ID="cattanmichel-00006">
			<Nom>
CATTAN</Nom>
			<Prenom>
Michel</Prenom>
		</Auteur>
	</Auteurs>
	<Niveau1>
		<Titre>
Gérer les changements</Titre>
		<Niveau2>
			<Titre>
Définition</Titre>

Pour faciliter la gestion des changements, nous pouvons en distinguer trois types : l'adaptation, la modification et la correction.

Une deuxième distinction peut être établie, qui dépend de l'entité qui met en œuvre le changement.

L'exemple donné dans le tableau ci-dessous est généralisable à tout type d'entreprise, y compris aux entreprises de services.

			<Tableau IDTab="tab-O-IV-90-40_1-1">

					<title>
Exemple de types de changements pour une société d'ingénierie</title>
					<tgroup cols="4" rowsep="1" align="left" colsep="1">
						<colspec colnum="1" colname="1" colwidth="1.181in"/>
						<colspec colnum="2" colname="2" colwidth="2.428in"/>
						<colspec colnum="3" colname="3" colwidth="2.428in"/>
						<colspec colnum="4" colname="4" colwidth="2.428in"/>

							<row rowsep="1">
								<entry colname="1" align="center">

Niveau

								</entry>
								<entry colname="2" align="center">

Etudes

								</entry>
								<entry colname="3" align="center">

Fournisseurs

								</entry>
								<entry colname="4" align="center">

Chantier

								</entry>
							</row>

							<row rowsep="1">
								<entry colname="1">

										<Bold>
Adaptation</Bold>

								</entry>
								<entry colname="2">

Rectification de pure forme d'un document :

									<Liste Type="tiret">
										<Item>

reprise d'une erreur mineure (ponctuation, cote, etc.) ;

										</Item>
										<Item>

révision de la liste de diffusion ;

										</Item>
										<Item>

révision d'un document préliminaire n'ayant pas encore servi d'interface même interne ;

										</Item>
										<Item>

révision n'ayant donc pas de conséquence sur le travail des autres unités, ni d'impact technique.

										</Item>
									</Liste>
								</entry>
								<entry colname="3">

Rectification de pure forme d'un document :

									<Liste Type="tiret">
										<Item>

reprise d'erreur sur un document non soumis au client ;

										</Item>
										<Item>

révision n'ayant aucun impact sur des spécifications ou impositions du client ;

										</Item>
										<Item>

pas d'impact technique ;

										</Item>
										<Item>

pas d'impact de coût ni de délai.

										</Item>
									</Liste>
								</entry>
								<entry colname="4">

Changement dont la réalisation n'entraîne pas de conséquence nécessitant l'analyse du siège, même a posteriori :

									<Liste Type="tiret">
										<Item>

tuyauterie ;

										</Item>
										<Item>

changement sur lignes non calculées ;

										</Item>
										<Item>

changement préalablement accepté par le siège.

										</Item>
									</Liste>
								</entry>
							</row>
							<row rowsep="1">
								<entry colname="1" morerows="2">

										<Bold>
Correction</Bold>

								</entry>
								<entry colname="2">

Changement ayant un impact limité :

									<Liste Type="tiret">
										<Item>

sur les coûts d'ingénierie et sur les coûts induits (inférieurs à une limite fixée par le chef de projet selon la nature du contrat et la phase d'avancement) ;

										</Item>
										<Item>

sur les délais (sans conséquence sur les dates des interfaces plannings approvisionnements et travaux) ;

										</Item>
										<Item>

sur la technique ;

										</Item>
									</Liste>
								</entry>
								<entry colname="3" morerows="2">

Changement d'un document fournisseur n'ayant pas d'impact :

									<Liste Type="tiret">
										<Item>

sur des clauses contractuelles avec le client ;

										</Item>
										<Item>

sur les prix et les délais ;

										</Item>
										<Item>

sur l'interchangeabilité des matériels ;

										</Item>
										<Item>

sur un matériel déjà livré ;

										</Item>
										<Item>

sur une interface avec d'autres fournisseurs (sauf impact purement formel sur un document d'interface) ;

										</Item>
										<Item>

et maîtrisable entièrement par le fournisseur lui-même (dans les limites de ses obligations contractuelles).

										</Item>
									</Liste>
								</entry>
								<entry colname="4">

Changement qui respecte les critères suivants : l'analyse complète du changement et de ses incidences peut être assurée par le chantier, le chantier possède toutes les informations nécessaires à l'établissement ou à la révision des documents qui seront utilisés pour l'exécution du changement,

								</entry>
							</row>
							<row rowsep="1">
								<entry colname="2" morerows="1">

Changement n'ayant pas d'impact sur l'interface client (engagements contractuels, coûts répercutables, planning).

								</entry>
								<entry colname="4" rowsep="0">

Le changement n'affecte pas :

									<Liste Type="tiret">
										<Item>

les tuyauteries et supports, des équipements entrant dans des fonctions de sauvegarde ou de sécurité ;

										</Item>
										<Item>

des schémas de principe, des schémas fluides ou des schémas ;

										</Item>
										<Item>

des documents soumis à l'accord du client ;

										</Item>
									</Liste>
								</entry>
							</row>
							<row rowsep="1">
								<entry colname="4">

La solution est réversible (retour possible à l'état initial avec des coûts limités).

								</entry>
							</row>
							<row rowsep="1">
								<entry colname="1" morerows="1">

										<Bold>
Modification</Bold>

								</entry>
								<entry colname="2" morerows="1">

Tout changement qui ne satisfait pas aux critères ci-dessus, ou pouvant avoir un impact sur :

									<Liste Type="tiret">
										<Item>

la sûreté ;

										</Item>
										<Item>

le niveau de performance ;

										</Item>
										<Item>

l'exploitation, la maintenance, la disponibilité des installations ;

										</Item>
										<Item>

la standardisation des matériels ;

										</Item>
										<Item>

les travaux en cours sur site ;

										</Item>
										<Item>

des interfaces externes ;

										</Item>
										<Item>

des coûts au-delà des limites déléguées (coûts induits) ;

										</Item>
										<Item>

les délais ;

										</Item>
										<Item>

les limites de fournitures de l'entreprise, les garanties.

										</Item>
									</Liste>
								</entry>
								<entry colname="3" rowsep="0">

Changement pouvant affecter :

									<Liste Type="tiret">
										<Item>

des spécifications ou autres impositions du client ;

										</Item>
										<Item>

les coûts du matériel ou des installations ;

										</Item>
										<Item>

les délais du fournisseur, les interfaces avec d'autres fournitures ;

										</Item>
									</Liste>
								</entry>
								<entry colname="4" morerows="1">
									<Liste Type="tiret">
										<Item>

Changement qui ne satisfait pas aux critères ci-dessus, c'est-à-dire dont la solution dépasse les limites de délégation données au chantier et dont les conséquences sont importantes (coûts, délais, fonctions mises en cause, client à informer, aspect générique du changement, solution supposant consultation des équipes opérationnelles, pas de remède simple et peu coûteux à proposer, difficulté de retour en arrière si action chantier).

										</Item>
										<Item>

Certains changements peuvent, après accord des équipes opérationnelles, être traités par correctif sur le site demandeur.

										</Item>
									</Liste>
								</entry>
							</row>
							<row rowsep="0">
								<entry colname="3">

Ou pouvant avoir un impact sur :

									<Liste Type="tiret">
										<Item>

des matériels déjà livrés,

										</Item>
										<Item>

l'interchangeabilité,

										</Item>
										<Item>

la facilité d'exploitation ou de maintenance,

										</Item>
										<Item>

les quantités de rechange à prévoir.

										</Item>
									</Liste>
								</entry>
							</row>

					</tgroup>

			</Tableau>
		</Niveau2>
	</Niveau1>
	<Niveau1>
		<Titre>
Gérer les modifications</Titre>
		<Niveau2>
			<Titre>
Principes</Titre>

Compte tenu des conséquences que peuvent avoir des changements mal maîtrisés, l'entreprise a tout intérêt à assurer une bonne gestion des modifications sans négliger pour autant les corrections ni les adaptations.

		</Niveau2>
		<Niveau2>
			<Titre>
Objectifs</Titre>

La gestion des modifications suppose :

			<Liste Type="tiret">
				<Item>

de contrôler et d'activer l'instruction des demandes de modifications ;

				</Item>
				<Item>

de faciliter le pilotage de la mise en œuvre des modifications par la connaissance et le suivi de leurs étapes-clés ;

				</Item>
				<Item>

d'informer les différentes parties prenantes ;

				</Item>
				<Item>

de faire le point sur une modification, en cours d'instruction, en cours de réalisation, etc. ;

				</Item>
				<Item>

de solder les dossiers de mise en œuvre en ayant la connaissance du prévu et du réalisé final ;

				</Item>
				<Item>

de disposer de synthèses sur l'état des modifications, par exemple au niveau d'un équipement, d'un système, d'un contrat, d'un processus, etc.

				</Item>
			</Liste>

Le dossier de la modification comporte donc les informations qui marquent les étapes clés de la modification telles que :

			<Liste Type="tiret">
				<Item>

les documents modifiés ;

				</Item>
				<Item>

les commandes modifiées ;

				</Item>
				<Item>

les matériels modifiés, etc.

				</Item>
			</Liste>
			<Niveau3>
				<Titre>
Important</Titre>

Il ne s'agit pas de gérer le projet ou le produit au travers des modifications, mais de gérer chaque modification comme un mini-projet.

			</Niveau3>
		</Niveau2>
	</Niveau1>
	<Niveau1>
		<Titre>
Processus de modification</Titre>
		<Niveau2>
			<Titre>
La demande de modification</Titre>

Elle est établie par le client, un fournisseur ou toute personne de l'entreprise qui met le doigt sur une anomalie ou qui souhaite proposer une amélioration.

		</Niveau2>
		<Niveau2>
			<Titre>
L'instruction de la modification</Titre>

L'instruction d'une modification débute par une action désignée généralement sous le titre « d'ouverture de la modification ». L'instruction consiste à :

			<Liste Type="tiret">
				<Item>

recueillir les avis techniques sur l'intérêt de la modification ;

				</Item>
				<Item>

évaluer le coût de sa prise en compte ;

				</Item>
				<Item>

mesurer les délais de réalisation.

				</Item>
			</Liste>

C'est en général au travers d'une commission que s'effectue le suivi de l'instruction de la modification jusqu'à sa notification.

		</Niveau2>
		<Niveau2>
			<Titre>
Mise en œuvre d'une modification</Titre>

La mise en œuvre débute à la notification : c'est le déroulement d'un certain nombre d'étapes devant aboutir à la prise en compte de la modification conformément à sa notification sur chaque objet et en chaque lieu où elle doit s'appliquer. Elle s'achève par la clôture de la modification.

Une modification est mise en œuvre sur les domaines suivants :

			<Liste Type="tiret">
				<Item>

les documents techniques (documents de méthode, d'intervention ou encore spécifications d'équipement, de travaux, d'approvisionnement, etc.) ;

				</Item>
				<Item>

les matériels qui peuvent être modifiés en usine (matériel en cours de fabrication), sur le site (matériel en cours de montage), en cours d'exploitation ;

				</Item>
				<Item>

les processus ;

				</Item>
				<Item>

les conditions contractuelles ;

				</Item>
				<Item>

etc.

				</Item>
			</Liste>

La mise en œuvre simultanée de plusieurs modifications est une contrainte permanente. Il y a techniquement un ordre logique de prise en compte des modifications. Or, dans la pratique il arrive souvent que, pour des raisons de délai ou de disponibilité, l'ordre logique ne puisse être respecté. Pour atténuer ces risques, des modifications peuvent être regroupées pour être mises en œuvre en bloc.

La mise en œuvre d'une modification obéit donc, dans chacun des domaines qu'elle couvre, à un ordre et une logique propres à ce domaine : les documents et les matériels, par exemple, peuvent ainsi évoluer en parallèle mais séparément.

		</Niveau2>
		<Niveau2>
			<Titre>
Suivi de la mise en œuvre</Titre>
			<Niveau3>
				<Titre>
Objectifs</Titre>

Le suivi de la mise en œuvre a pour but de s'assurer que les différentes actions sont bien engagées de manière à arriver dans les meilleures conditions jusqu'à la clôture de la modification. Il doit permettre l'établissement du bilan technique et financier de la modification qui pourra alors servir de référence.

			</Niveau3>
			<Niveau3>
				<Titre>
Définitions</Titre>

Le suivi de la mise en œuvre consiste, pour chaque domaine concerné :

				<Liste Type="tiret">
					<Item>

à en connaître les intervenants, leurs conditions et leur logique d'intervention (donc les étapes), à l'avance et pendant toute la durée de la mise en œuvre ;

					</Item>
					<Item>

à contrôler le déroulement de chaque étape sous deux aspects : déroulement interne (prendre en compte ce qui est réalisé, le comparer à ce qui était prévu, identifier les écarts), raccordement de ces modifications avec les autres étapes (s'assurer qu'on dispose bien de tout ce qu'il faut pour qu'elles puissent s'enclencher et se réaliser) ;

					</Item>
					<Item>

à clôturer la mise en œuvre en vérifiant que toutes les étapes ont bien été franchies et qu'on dispose bien de tout ce qu'il faut pour établir le bilan de la modification.

					</Item>
				</Liste>
			</Niveau3>
			<Niveau3>
				<Titre>
Méthode</Titre>

Les étapes successives franchies lors de la mise en œuvre d'une modification doivent faire l'objet de documents écrits (spécifications, procès-verbaux, constats, attestations de prise en compte, etc.) dont les références au moins sont rassemblées dans le « dossier de la modification ».

Ce dossier, placé sous la supervision finale du chef d'affaires ou du chef de projet, apporte l'assurance que la modification a été exécutée conformément à sa notification et sur chaque objet ou en chaque lieu où elle s'appliquait. Le chef d'affaires ou le chef de projet, en soldant le dossier, confirme la bonne prise en compte de la modification sous ses différents aspects.

C'est donc le dossier de la modification qui permet, par la manière dont il est tenu à jour et contrôlé, d'assurer le suivi de la mise en œuvre.

			</Niveau3>
		</Niveau2>
	</Niveau1>
	<Niveau1>
		<Titre>
Dossier et outils de modification</Titre>
		<Niveau2>
			<Titre>
Dossier de modification</Titre>
			<Niveau3>
				<Titre>
Principes</Titre>

Le dossier de la modification présente les caractéristiques suivantes.

				<Liste Type="tiret">
					<Item>

Unique : il est tenu à jour sous la responsabilité du chef d'affaires ou du chef de projet, est accessible dans les domaines qui les concernent aux personnes autorisées.

					</Item>
					<Item>

Évolutif : le dossier traite d'une succession d'étapes, chaque étape est prévue, ou en cours de réalisation (plus ou moins avancée), ou achevée.

					</Item>
					<Item>

Simplifié : l'achèvement d'une étape est marqué par un document (document jalon) : la référence seule de ce document peut figurer au dossier si ce document peut être retrouvé par ailleurs.

					</Item>
					<Item>

Décomposable : en ensembles logiques (sous-dossiers) de documents relatifs aux domaines que couvre la mise en œuvre : documents de l'instruction, documents techniques émis au titre des études de la modification, documents techniques émis par le fournisseur au titre de l'étude et la fabrication du matériel modifié, etc. La gestion du dossier de la modification passe par la gestion de chacun de ces sous-dossiers.

					</Item>
				</Liste>
			</Niveau3>
			<Niveau3>
				<Titre>
Sous-dossiers</Titre>

Le sous-dossier est l'instrument du suivi de la mise en œuvre dans un domaine donné. Il en récapitule les différentes étapes.

Le sous-dossier est ouvert lorsqu'il est identifié en tant que contenant d'un certain nombre de documents à venir, il est clos lorsque ces documents sont tous identifiés et que le contenu n'évolue plus.

La clôture du sous-dossier marque donc le franchissement de la dernière étape dans un domaine donné.

Le dossier de la modification, lui, reste donc ouvert tant que la dernière étape de la mise en œuvre n'a pas été franchie dans chaque domaine.

La connaissance à tout moment de l'état du dossier de la modification passe par la connaissance de l'état du sous-dossier d'un domaine donné, et permet à chaque intervenant de faire le point sur la mise en œuvre d'une modification et, dans une certaine mesure, de guider sa propre action.

			</Niveau3>
		</Niveau2>
		<Niveau2>
			<Titre>
Outil</Titre>

Dans la mesure où un grand nombre de modifications sont à suivre, il est nécessaire de disposer d'un outil informatique interactif accessible à tous et que l'information soit saisie au plus près de sa source. Cet outil peut être partie intégrante du système de gestion des données techniques et viendra en appui du dossier de la modification. Cette fonction peut être assurée par le système de gestion des données techniques (SGDT).

L'outil doit permettre de retrouver, dans les domaines qu'il couvrira, chacune des étapes de la mise en œuvre et, pour chaque étape, la référence du document jalon qui la caractérise. Il doit également prendre en compte la structure retenue pour le dossier de la modification.

L'outil de gestion du dossier de la modification doit permettre :

			<Liste Type="tiret">
				<Item>

de constituer initialement le sous-dossier à son ouverture en y rangeant les documents connus ou simplement prévus ;

				</Item>
				<Item>

de publier le contenu du sous-dossier initial (programme de travail des équipes d'études) ;

				</Item>
				<Item>

de tenir à jour le sous-dossier en enrichissant les documents connus avec l'indice de prise en compte de la modification, en notant la réalisation des documents prévus, en notant que des documents prévus initialement n'ont pas été modifiés, en radiant les documents non modifiés, en rajoutant les documents modifiés et non prévus initialement ;

				</Item>
				<Item>

d'informer sur l'état d'avancement de la mise en œuvre en affichant sur demande le contenu actualisé du sous-dossier, en publiant sur demande la liste d'intégration qui comporte la liste des documents intégrant la modification et la liste des documents restant à émettre.

				</Item>
				<Item>

de clôturer le sous-dossier en mémorisant la liste des fiches de modification qu'un indice intègre (important pour la gestion de la cohérence) ;

				</Item>
				<Item>

d'informer les intervenants des actions qui sont en vue sur un document (liste des sous-dossiers ouverts comportant ce document = liste des fiches de modification en cours pour le document : important pour la gestion de la cohérence) ;

				</Item>
				<Item>

d'avertir les intervenants qu'un document qui devait intégrer une certaine modification a été émis sans qu'il la prenne en compte.

				</Item>
			</Liste>
		</Niveau2>
	</Niveau1>


text:
void component_datetime_init (Layer *window_layer, GRect *bounds) {
  // called on creation of the app

  // Create a layer for the time
  s_time_layer = text_layer_create( GRect(0, PBL_IF_ROUND_ELSE(58, 52), (*bounds).size.w, 50) );

  text_layer_set_background_color(s_time_layer, WATCHFACE_TEXT_BACKGROUND_COLOR);
  text_layer_set_text_color(s_time_layer, WATCHFACE_TIME_COLOR);
  text_layer_set_text(s_time_layer, "00:00");
  text_layer_set_font(s_time_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD));
  text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);

  // Create a layer for the date
  s_date_layer = text_layer_create(GRect(0, PBL_IF_ROUND_ELSE(113, 105), (*bounds).size.w, 20));

  text_layer_set_background_color(s_date_layer, WATCHFACE_TEXT_BACKGROUND_COLOR);
  text_layer_set_text_color(s_date_layer, WATCHFACE_DATE_COLOR);
  text_layer_set_text(s_date_layer, "MON - 01 JAN 00");
  text_layer_set_font(s_date_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14));
  text_layer_set_text_alignment(s_date_layer, GTextAlignmentCenter);

  // Add it as a child layer to the Window's root layer
  layer_add_child(window_layer, text_layer_get_layer(s_time_layer));
  layer_add_child(window_layer, text_layer_get_layer(s_date_layer));
}

static void component_datetime_tick(struct tm *tick_time, TimeUnits units_changed) {
  // called whenever the datetime component updates

  // update the buffer for the time layer
  static char s_buffer_t[8];
  format_time(tick_time, s_buffer_t, sizeof(s_buffer_t));
  text_layer_set_text(s_time_layer, s_buffer_t);

  // update the buffer for the date layer
  static char s_buffer_d[20];
  format_date(tick_time, s_buffer_d, sizeof(s_buffer_d));
  text_layer_set_text(s_date_layer, s_buffer_d);
}

void component_datetime_update () {
  // updates date and time on the watch
  time_t temp = time(NULL);
  struct tm *tick_time = localtime(&temp);

  component_datetime_tick(tick_time, MINUTE_UNIT);
}

void component_datetime_register () {
  // called on registration time

  tick_timer_service_subscribe(MINUTE_UNIT, component_datetime_tick);
}

void component_datetime_deinit () {
  // called on destruction of the app

  text_layer_destroy(s_time_layer);
  text_layer_destroy(s_date_layer);
}

redpajama_set_name: RedPajamaGithub


text: Webservice converting twitter feed to atom feed


text:
import Misc
import Formulas
import Workflows
import UMap
import Data.Set (Set,empty,elems,singleton,insert,toList,union,foldl,null)
import Data.List

-- Two cuncurrent workflows are equal if the lists of sequential workflows are
-- just permutations
instance Eq ParWf where
  Par ws1 == Par ws2 = ws1==ws2	--permut xs ys	 -- TODO: I'm not sure whether permut can cause problems because we rely to a certain degree on the ordering of workflows.
						 --       This makes only a difference if (partly) identical workflows are running. Is this likely?

-- delays all initial actions from wfi until wft that are mutually independent from ga, gb;
-- it is assumed that i>=0 and t<length ws;
-- it is assumed that wj|=Skip
-- it is assumed that all gj1, gj2 are not delayed for all i<=j<=t
indepIter:: ParWf -> GuardedAction -> GuardedAction -> Int -> Int -> ParWf
indepIter (Par ws) ga gb i t = if i>t then Par ws
                               else let wi  = ws!!i
                                        gi1 = sel_g1(wi)
                                        ai1 = sel_a1(wi)
                                        wi1 = sel_w1(wi)
                                        gi2 = sel_g2(wi)
                                        ai2 = sel_a2(wi)
                                        wi2 = sel_w2(wi)

                                        win = if indepActions ((gi1,ai1),(gi2,ai2)) (ga,gb)
                                              then
                                                 Choice (Delayed (get gi1),ai1) wi1
                                                        (Delayed (get gi2),ai2) wi2
                                              else wi
                                     in indepIter (Par (listUpdate ws i win)) ga gb (i+1) t

-- calculate preconditions of all concurrent workflows that are constructed by replacing the ith sequential
-- workflow wi by w1(wi) and w2(wi) respectively for all indexes up to t and save them in the given
-- lookup table, as a second result calculate the corresponding subformulas;
-- it is assumed that i>=0 and t<length ws;
-- it is assumed that for all gi1, gi2: gi1 is delayed iff gi2 is delayed
preIter :: ParWf -> Int -> Int -> UMap ParWf Formula -> (UMap ParWf Formula, Set Formula)
preIter (Par ws) i t lut =
	if i > t then (lut,Data.Set.empty)
	else let
		wi = ws!!i
		gi1 = sel_g1(wi)
		ai1 = sel_a1(wi)
		wi1 = sel_w1(wi)
		gi2 = sel_g2(wi)
		ai2 = sel_a2(wi)
		wi2 = sel_w2(wi)

		-- TODO: This could be done more intelligently!
		par1 = unskip (indepIter (undelay (Par (listUpdate ws i wi1))) (gi1,ai1) (gi2,ai2) 0 (i-1))
		par2 = unskip (indepIter (undelay (Par (listUpdate ws i wi2))) (gi1,ai1) (gi2,ai2) 0 (i-1))

		lut1 = if gi1 == natom "false" || delayed gi1 then lut
		       else pre par1 lut
		lut2 = if gi2 == natom "false" || delayed gi2 then lut1
		       else pre par2 lut1

		loc_cond = if delayed gi1 && delayed gi2                   		then Atom "itrue" else
			   if gi1 == natom "false" && gi2 == natom "false" 		then Atom "false" else
			   if gi1 == natom "false"			     		then if lut2!par2 == Atom "itrue" then Atom "itrue"
											     else And (get gi2) (Wp ai2 (lut2!par2)) else
			   if gi2 == natom "false"			     		then if lut2!par1 == Atom "itrue" then Atom "itrue"
											     else And (get gi1) (Wp ai1 (lut2!par1)) else
			   if lut2!par1 == Atom "itrue" || lut2!par2 == Atom "itrue"	  then
				if lut2!par1 == Atom "itrue" && lut2!par2 == Atom "itrue" then Atom "itrue" else	-- gi1 --> wp(ai1,T) /\ g2 --> wp(ai2,T)
															--   /\ (gi1 \/ gi2) is implied by another path
                                if lut2!par1 == Atom "itrue" then Imp (get gi2) (Wp ai2 (lut2!par2)) else		-- gi1 --> wp(ai1,T) /\ (gi1 \/ gi2) is implied by another path
								  Imp (get gi1) (Wp ai1 (lut2!par1)) 			-- gi2 --> wp(ai2,T) /\ (gi1 \/ gi2) is implied by another path
                           else

                        Andn
                        (Andn (Imp (get gi1) (Wp ai1 (lut2!par1)))
			      (Imp (get gi2) (Wp ai2 (lut2!par2))))
                        (Or (get gi1) (get gi2))			-- if there is some delayed workflow in par1 (or par2), we would actually not need to include the check (gi1 \/ gi2)
		(lutn,fs) = preIter (Par ws) (i+1) t lut2

		fsn = if loc_cond == Atom "itrue" then fs else Data.Set.insert loc_cond fs
	     in (lutn,fsn)

-- prioritise the actions of workflow wi and calculate the corresponding look-up table
-- i is assumed to be between 0 and (length ws)-1;
-- it is assumed that all wi |= Skip
-- it is assumed that gi1 and gi2 are not delayed;
prioritise :: ParWf -> Int -> UMap ParWf Formula -> UMap ParWf Formula
prioritise (Par ws) i lut =
                    let wi = ws!!i
                        gi1 = sel_g1(wi)
                        ai1 = sel_a1(wi)
                        wi1 = sel_w1(wi)
                        gi2 = sel_g2(wi)
                        ai2 = sel_a2(wi)
                        wi2 = sel_w2(wi)

			-- TODO: This could be done more intelligently!
                        par1 = unskip (undelay (Par (listUpdate ws i wi1)))
                        par2 = unskip (undelay (Par (listUpdate ws i wi2)))

                        lut1 = if gi1 == natom "false" then lut  else pre par1 lut
                        lutn = if gi1 == natom "false" then lut1 else pre par2 lut1

                        form = if gi1 == natom "false" && gi2 == natom "false" then Atom "false" else
                               if gi1 == natom "false" then And (get gi2) (Wp ai2 (lutn!par2)) else
                               if gi2 == natom "false" then And (get gi1) (Wp ai1 (lutn!par1)) else
                                 Andn
                                 (Andn (Imp (get gi1) (Wp ai1 (lutn!par1)))
			               (Imp (get gi2) (Wp ai2 (lutn!par2))))
                                 (Or (get gi1) (get gi2))
                     in def lutn (Par ws,form)

-- calculate the precondition of a concurrent workflow and save it in the given lookup table;
-- it is assumed that all wi |= Skip
pre :: ParWf -> UMap ParWf Formula -> UMap ParWf Formula
pre (Par []) lut = lut
pre (Par xs) lut = if lut ? (Par xs) then lut
                                     else
                   let i = indep (Par xs) 0 ((length xs) -1) 	-- Find i such that ai1,ai2 are independent to ALL
                                                  		-- possible subsequent actions of the other workflows.
                                                  		-- Returns -1 is there is no such i
                    in if i == -1 then let -- the standard case
                                         (lutn,formset) = preIter (Par xs) 0 ((length xs) -1) lut
                                         form = if Data.Set.null formset then Atom "itrue"
                                                else foldr1 (Andn) (toList formset)
                                        in def lutn ((Par xs),form)
                                  else prioritise (Par xs) i lut -- If ai1 and ai2 are independent from all guarded-action pairs of the other workflows,
                                                                 -- we can prioritise their execution over all other initial actions.

-- The main program ---------------------------------------------------------------------

initLut = def UMap.empty (Par [],Atom "I")

main = putStr (show ((pre exParWfHuge initLut) ! exParWfHuge))


text:
layout: post
title:  "Mental Prison"
date: 2017-11-16
sources: [XGE.161]
tags: [sorcerer, warlock, wizard, level6, action, concentration, illusion]
---

**6th-level illusion**

**Casting Time**: 1 action

**Range**: 60 feet

**Components**: S

**Duration**: Concentration, up to 1 minute

You attempt to bind a creature within an illusory cell that only it perceives. One creature you can see within range must make an Intelligence saving throw. The target succeeds automatically if it is immune to being charmed. On a successful save, the target takes 5d10 psychic damage, and the spell ends. On a failed save, the target takes 5d10 psychic damage, and you make the area immediately around the target's space appear dangerous to it in some way. You might cause the target to perceive itself as being surrounded by fire, floating razors, or hideous maws filled with dripping teeth. Whatever form the illusion takes, the target can't see or hear anything beyond it and is restrained for the spell's duration. If the target is moved out of the illusion, makes a melee attack through it, or reaches any part of its body through it, the target takes 10d10 psychic damage, and the spell ends.


text:
using System.Linq;
using System.Threading;
using EventStore.Core.Index;
using EventStore.Core.Tests.Fakes;
using EventStore.Core.TransactionLog;
using NUnit.Framework;

namespace EventStore.Core.Tests.Index
{
    [TestFixture]
    public class table_index_with_two_ptables_and_memtable_on_range_query : SpecificationWithDirectoryPerTestFixture
    {
        private TableIndex _tableIndex;
        private string _indexDir;

        [TestFixtureSetUp]
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();

            _indexDir = PathName;
            var fakeReader = new TFReaderLease(new FakeTfReader());
            _tableIndex = new TableIndex(_indexDir,
                                         () => new HashListMemTable(maxSize: 10),
                                         () => fakeReader,
                                         maxSizeForMemory: 2,
                                         maxTablesPerLevel: 2);
            _tableIndex.Initialize(long.MaxValue);

            // ptable level 2
            _tableIndex.Add(0, 0xDEAD, 0, 0xFF00);
            _tableIndex.Add(0, 0xDEAD, 1, 0xFF01);
            _tableIndex.Add(0, 0xBEEF, 0, 0xFF00);
            _tableIndex.Add(0, 0xBEEF, 1, 0xFF01);
            _tableIndex.Add(0, 0xABBA, 0, 0xFF00);
            _tableIndex.Add(0, 0xABBA, 1, 0xFF01);
            _tableIndex.Add(0, 0xABBA, 0, 0xFF02);
            _tableIndex.Add(0, 0xABBA, 1, 0xFF03);

            // ptable level 1
            _tableIndex.Add(0, 0xADA, 0, 0xFF00);
            _tableIndex.Add(0, 0xCEED, 10, 0xFFF1);
            _tableIndex.Add(0, 0xBABA, 0, 0xFF00);
            _tableIndex.Add(0, 0xDEAD, 0, 0xFF10);

            // ptable level 0
            _tableIndex.Add(0, 0xBABA, 1, 0xFF01);
            _tableIndex.Add(0, 0xDEAD, 1, 0xFF11);

            // memtable
            _tableIndex.Add(0, 0xADA, 0, 0xFF01);

            Thread.Sleep(500);
        }

        [TestFixtureTearDown]
        public override void TestFixtureTearDown()
        {
            _tableIndex.Close();

            base.TestFixtureTearDown();
        }

        [Test]
        public void should_not_return_latest_entry_for_nonexisting_stream()
        {
            IndexEntry entry;
            Assert.IsFalse(_tableIndex.TryGetLatestEntry(0xFEED, out entry));
        }

        [Test]
        public void should_not_return_oldest_entry_for_nonexisting_stream()
        {
            IndexEntry entry;
            Assert.IsFalse(_tableIndex.TryGetLatestEntry(0xFEED, out entry));
        }

        [Test]
        public void should_return_correct_latest_entry_for_stream_with_latest_entry_in_memtable()
        {
            IndexEntry entry;
            Assert.IsTrue(_tableIndex.TryGetLatestEntry(0xADA, out entry));
            Assert.AreEqual(0xADA, entry.Stream);
            Assert.AreEqual(0, entry.Version);
            Assert.AreEqual(0xFF01, entry.Position);
        }

        [Test]
        public void should_return_correct_latest_entry_for_stream_with_latest_entry_in_ptable_0()
        {
            IndexEntry entry;
            Assert.IsTrue(_tableIndex.TryGetLatestEntry(0xDEAD, out entry));
            Assert.AreEqual(0xDEAD, entry.Stream);
            Assert.AreEqual(1, entry.Version);
            Assert.AreEqual(0xFF11, entry.Position);
        }

        [Test]
        public void should_return_correct_latest_entry_for_another_stream_with_latest_entry_in_ptable_0()
        {
            IndexEntry entry;
            Assert.IsTrue(_tableIndex.TryGetLatestEntry(0xBABA, out entry));
            Assert.AreEqual(0xBABA, entry.Stream);
            Assert.AreEqual(1, entry.Version);
            Assert.AreEqual(0xFF01, entry.Position);
        }

        [Test]
        public void should_return_correct_latest_entry_for_stream_with_latest_entry_in_ptable_1()
        {
            IndexEntry entry;
            Assert.IsTrue(_tableIndex.TryGetLatestEntry(0xCEED, out entry));
            Assert.AreEqual(0xCEED, entry.Stream);
            Assert.AreEqual(10, entry.Version);
            Assert.AreEqual(0xFFF1, entry.Position);
        }

        [Test]
        public void should_return_correct_latest_entry_for_stream_with_latest_entry_in_ptable_2()
        {
            IndexEntry entry;
            Assert.IsTrue(_tableIndex.TryGetLatestEntry(0xBEEF, out entry));
            Assert.AreEqual(0xBEEF, entry.Stream);
            Assert.AreEqual(1, entry.Version);
            Assert.AreEqual(0xFF01, entry.Position);
        }

        [Test]
        public void should_return_correct_latest_entry_for_another_stream_with_latest_entry_in_ptable_2()
        {
            IndexEntry entry;
            Assert.IsTrue(_tableIndex.TryGetLatestEntry(0xABBA, out entry));
            Assert.AreEqual(0xABBA, entry.Stream);
            Assert.AreEqual(1, entry.Version);
            Assert.AreEqual(0xFF03, entry.Position);
        }

        [Test]
        public void should_return_correct_oldest_entries_for_each_stream()
        {
            IndexEntry entry;

            Assert.IsTrue(_tableIndex.TryGetOldestEntry(0xDEAD, out entry));
            Assert.AreEqual(0xDEAD, entry.Stream);
            Assert.AreEqual(0, entry.Version);
            Assert.AreEqual(0xFF00, entry.Position);

            Assert.IsTrue(_tableIndex.TryGetOldestEntry(0xBEEF, out entry));
            Assert.AreEqual(0xBEEF, entry.Stream);
            Assert.AreEqual(0, entry.Version);
            Assert.AreEqual(0xFF00, entry.Position);

            Assert.IsTrue(_tableIndex.TryGetOldestEntry(0xABBA, out entry));
            Assert.AreEqual(0xABBA, entry.Stream);
            Assert.AreEqual(0, entry.Version);
            Assert.AreEqual(0xFF00, entry.Position);

            Assert.IsTrue(_tableIndex.TryGetOldestEntry(0xADA, out entry));
            Assert.AreEqual(0xADA, entry.Stream);
            Assert.AreEqual(0, entry.Version);
            Assert.AreEqual(0xFF00, entry.Position);

            Assert.IsTrue(_tableIndex.TryGetOldestEntry(0xCEED, out entry));
            Assert.AreEqual(0xCEED, entry.Stream);
            Assert.AreEqual(10, entry.Version);
            Assert.AreEqual(0xFFF1, entry.Position);

            Assert.IsTrue(_tableIndex.TryGetOldestEntry(0xBABA, out entry));
            Assert.AreEqual(0xBABA, entry.Stream);
            Assert.AreEqual(0, entry.Version);
            Assert.AreEqual(0xFF00, entry.Position);
        }

        [Test]
        public void should_return_empty_range_for_nonexisting_stream()
        {
            var range = _tableIndex.GetRange(0xFEED, 0, int.MaxValue).ToArray();
            Assert.AreEqual(0, range.Length);
        }

        [Test]
        public void should_return_correct_full_range_with_descending_order_for_0xDEAD()
        {
            var range = _tableIndex.GetRange(0xDEAD, 0, int.MaxValue).ToArray();
            Assert.AreEqual(4, range.Length);
            Assert.AreEqual(new IndexEntry(0xDEAD, 1, 0xFF11), range[0]);
            Assert.AreEqual(new IndexEntry(0xDEAD, 1, 0xFF01), range[1]);
            Assert.AreEqual(new IndexEntry(0xDEAD, 0, 0xFF10), range[2]);
            Assert.AreEqual(new IndexEntry(0xDEAD, 0, 0xFF00), range[3]);
        }

        [Test]
        public void should_return_correct_full_range_with_descending_order_for_0xBEEF()
        {
            var range = _tableIndex.GetRange(0xBEEF, 0, int.MaxValue).ToArray();
            Assert.AreEqual(2, range.Length);
            Assert.AreEqual(new IndexEntry(0xBEEF, 1, 0xFF01), range[0]);
            Assert.AreEqual(new IndexEntry(0xBEEF, 0, 0xFF00), range[1]);
        }

        [Test]
        public void should_return_correct_full_range_with_descending_order_for_0xABBA()
        {
            var range = _tableIndex.GetRange(0xABBA, 0, int.MaxValue).ToArray();
            Assert.AreEqual(4, range.Length);
            Assert.AreEqual(new IndexEntry(0xABBA, 1, 0xFF03), range[0]);
            Assert.AreEqual(new IndexEntry(0xABBA, 1, 0xFF01), range[1]);
            Assert.AreEqual(new IndexEntry(0xABBA, 0, 0xFF02), range[2]);
            Assert.AreEqual(new IndexEntry(0xABBA, 0, 0xFF00), range[3]);
        }

        [Test]
        public void should_return_correct_full_range_with_descending_order_for_0xADA()
        {
            var range = _tableIndex.GetRange(0xADA, 0, int.MaxValue).ToArray();
            Assert.AreEqual(2, range.Length);
            Assert.AreEqual(new IndexEntry(0xADA, 0, 0xFF01), range[0]);
            Assert.AreEqual(new IndexEntry(0xADA, 0, 0xFF00), range[1]);
        }

        [Test]
        public void should_return_correct_full_range_with_descending_order_for_0xCEED()
        {
            var range = _tableIndex.GetRange(0xCEED, 0, int.MaxValue).ToArray();
            Assert.AreEqual(1, range.Length);
            Assert.AreEqual(new IndexEntry(0xCEED, 10, 0xFFF1), range[0]);
        }

        [Test]
        public void should_return_correct_full_range_with_descending_order_for_0xBABA()
        {
            var range = _tableIndex.GetRange(0xBABA, 0, int.MaxValue).ToArray();
            Assert.AreEqual(2, range.Length);
            Assert.AreEqual(new IndexEntry(0xBABA, 1, 0xFF01), range[0]);
            Assert.AreEqual(new IndexEntry(0xBABA, 0, 0xFF00), range[1]);
        }

        [Test]
        public void should_not_return_one_value_for_nonexistent_stream()
        {
            long pos;
            Assert.IsFalse(_tableIndex.TryGetOneValue(0xFEED, 0, out pos));
        }

        [Test]
        public void should_return_one_value_for_existing_streams_for_existing_version()
        {
            long pos;
            Assert.IsTrue(_tableIndex.TryGetOneValue(0xDEAD, 1, out pos));
            Assert.AreEqual(0xFF11, pos);

            Assert.IsTrue(_tableIndex.TryGetOneValue(0xBEEF, 0, out pos));
            Assert.AreEqual(0xFF00, pos);

            Assert.IsTrue(_tableIndex.TryGetOneValue(0xABBA, 0, out pos));
            Assert.AreEqual(0xFF02, pos);

            Assert.IsTrue(_tableIndex.TryGetOneValue(0xADA, 0, out pos));
            Assert.AreEqual(0xFF01, pos);

            Assert.IsTrue(_tableIndex.TryGetOneValue(0xCEED, 10, out pos));
            Assert.AreEqual(0xFFF1, pos);

            Assert.IsTrue(_tableIndex.TryGetOneValue(0xBABA, 1, out pos));
            Assert.AreEqual(0xFF01, pos);
        }

        [Test]
        public void should_not_return_one_value_for_existing_streams_for_nonexistent_version()
        {
            long pos;
            Assert.IsFalse(_tableIndex.TryGetOneValue(0xDEAD, 2, out pos));
            Assert.IsFalse(_tableIndex.TryGetOneValue(0xBEEF, 2, out pos));
            Assert.IsFalse(_tableIndex.TryGetOneValue(0xABBA, 2, out pos));
            Assert.IsFalse(_tableIndex.TryGetOneValue(0xADA, 1, out pos));
            Assert.IsFalse(_tableIndex.TryGetOneValue(0xCEED, 0, out pos));
            Assert.IsFalse(_tableIndex.TryGetOneValue(0xBABA, 2, out pos));
        }

    }
}


text:
package org.kuali.rice.krad.labs.transaction;

import org.kuali.rice.krad.web.controller.UifControllerBase;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * Dummy test controller for testing
 *
 * @author Kuali Rice Team (rice.collab@kuali.org)
 */
@Controller
@RequestMapping(value = "/transaction")
public class TransactionController extends UifControllerBase {

    @Override
    protected TransactionForm createInitialForm() {
        return new TransactionForm();
    }

}


text:
namespace Microsoft.Azure.Management.ContainerService.Models
{
    using Newtonsoft.Json;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>
    /// The list credential result response.
    /// </summary>
    public partial class CredentialResults
    {
        /// <summary>
        /// Initializes a new instance of the CredentialResults class.
        /// </summary>
        public CredentialResults()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the CredentialResults class.
        /// </summary>
        /// <param name="kubeconfigs">Base64-encoded Kubernetes configuration
        /// file.</param>
        public CredentialResults(IList<CredentialResult> kubeconfigs = default(IList<CredentialResult>))
        {
            Kubeconfigs = kubeconfigs;
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets base64-encoded Kubernetes configuration file.
        /// </summary>
        [JsonProperty(PropertyName = "kubeconfigs")]
        public IList<CredentialResult> Kubeconfigs { get; private set; }

    }
}


text:
package org.firstinspires.ftc.teamcode;

/*
 * AutonomousBlue: autonomous software to knock off a ball (blue alliance version).
 * All of the code that runs in the autonomous period is in runOpMode().
 * Unlike teleop, there is no "loop" method; code runs in a straight line from top to bottom.
 *
 * multiple authors, February 2018
 */

import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;

import org.firstinspires.ftc.robotcore.external.ClassFactory;
import org.firstinspires.ftc.robotcore.external.navigation.RelicRecoveryVuMark;
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer;
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable;
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackables;

@Autonomous(name="Autonomous: KnockOff Blue", group="WoodyBot")
public class Autonomous_Blue extends LinearOpMode {
    WoodyBot robot = new WoodyBot();   // Use a Pushbot's hardware

    public void runOpMode() {        // initialize the robot hardware
        robot.init(hardwareMap);

        // initialize Vuforia
        VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters();
        parameters.vuforiaLicenseKey = robot.vKey;
        parameters.cameraDirection = VuforiaLocalizer.CameraDirection.BACK;
        VuforiaLocalizer vuforia = ClassFactory.createVuforiaLocalizer(parameters);
        RelicRecoveryVuMark pictograph = null;

        // load the pictograph dataset
        VuforiaTrackables relicTrackables = vuforia.loadTrackablesFromAsset("RelicVuMark");
        VuforiaTrackable relicTemplate = relicTrackables.get(0);

        // send telemetry message to signify robot waiting
        telemetry.addData("Status", "Slouching");
        telemetry.update();

        waitForStart(); // wait for match to start (driver presses PLAY)

        // ---------- match code ----------
        relicTrackables.activate();
        sleep(1000); // wait for Vuforia to stabilize

        // get visible pictograph
        int i;
        for(i = 1; i <= 148576; i++) {
            pictograph = RelicRecoveryVuMark.from(relicTemplate);
            if(pictograph != RelicRecoveryVuMark.UNKNOWN) break;
        }

        telemetry.addData("VuMark", "%s visible after %d readings", pictograph, i);
        telemetry.update();
        sleep(1000);

        robot.ColorSense.setPosition(0.65); // arm straight up
        sleep(1000);
        robot.TwistyThingy.setPosition(0.13); // rotate sensor into position
        sleep(1000);
        robot.ColorSense.setPosition(0.03); // arm down
        sleep(2000);
        int red = robot.CS.red();
        int blue = robot.CS.blue();
        sleep(500);

        if(red < blue) { // facing blue ball - move left/CCW to knock off blue ball
            telemetry.addData("Color", "blue");
            telemetry.update();
            sleep(1000);
            robot.TwistyThingy.setPosition(0);
            sleep(1500);
            robot.ColorSense.setPosition(0.6); // retract arm
            sleep(1500);
        }
        if(red > blue) { // facing red ball - move right/CW to knock off blue ball
            telemetry.addData("Color","red");
            telemetry.update();
            sleep(1000);
            robot.TwistyThingy.setPosition(0.3); // rotate right
            sleep(1500);
            robot.ColorSense.setPosition(0.6); // retract arm
            sleep(1500);
        }

        robot.TwistyThingy.setPosition(0);
        robot.ColorSense.setPosition(.61);
        sleep(300);

        // back off the ramp
        robot.FrontMotorRight.setPower(-.25);
        robot.FrontMotorLeft.setPower(-.25);

        // fixes hang between autonomous and teleop
        robot.CS.enableLed(false);
        sleep(1200);

        robot.FrontMotorRight.setPower(0);
        robot.FrontMotorLeft.setPower(0);

        // ---------- vision code ----------

        // take different actions depending on the pictograph visible at start of autonomous
        switch(pictograph) {
            case LEFT:
                break;

            case CENTER:
                // KEVIN: commented this out while testing getting off the ramp. -PK
//                robot.FrontMotorRight.setPower(.25);
//                robot.FrontMotorLeft.setPower(.35);
                sleep(800);
                break;

            case RIGHT:
                break;

            default: // UNKNOWN
                // code if nothing is detected...
                break;
        }

        robot.FrontMotorRight.setPower(0);
        robot.FrontMotorLeft.setPower(0);

        sleep(500); // a final sleep before switching to teleop
    }
}


text:
struct OLTLevelHeader {
	int64_t checkSum;
	int32_t version;
	int64_t signature;
	uint32_t instanceCount;
	uint32_t nameCount;
	uint32_t templateCount;
	struct OLTRegion dataTable;
	struct OLTRegion nameTable;
	struct OLTRegion rawTable;
	struct OLTRegion reserved;
} ATR_PACK;

struct OLTLevel {
	struct OLTBuffer *data;
	struct OLTLevelHeader *header;
	struct OLTInstance *instance;
	struct OLTName *name;
	struct OLTTemplate *template;
} ATR_PACK;

struct OLTLevel* ParseLevelFromFile(char *path);

#endif


text:
namespace BTCPayServer.Data
{
    public class SettingData
    {
        public string Id { get; set; }

        public string Value { get; set; }
    }
}


text:
Object = require("classic")

function split(str, delim)
	local splitStrings = { }
	local counter = 0
	for s in string.gmatch(str, delim) do
-- 		print ("In split: " .. s)
		splitStrings[counter] = s
		counter = counter + 1
	end
	splitStrings.size = counter
	return splitStrings
end


text:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        tools:context="com.mjiayou.trecore.MainActivity">

        <RelativeLayout
            android:id="@+id/rl_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <ImageView
                android:id="@+id/iv_bg"
                android:layout_width="match_parent"
                android:layout_height="100dp"
                android:layout_margin="@dimen/tc_margin_small"
                android:scaleType="centerCrop"
                android:src="@drawable/ic_common_bg" />

        </RelativeLayout>

        <Button
            android:id="@+id/btn_add_new_tag"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/tc_margin_mini"
            android:text="增加一个标签" />

        <Button
            android:id="@+id/btn_remove_last_tag"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/tc_margin_mini"
            android:text="移除最后一个标签" />

        <Button
            android:id="@+id/btn_remove_all_tag"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/tc_margin_mini"
            android:text="移除全部标签" />

        <include
            layout="@layout/tc_layout_line_horizontal"
            android:layout_width="match_parent"
            android:layout_height="10dp"
            android:layout_marginTop="@dimen/tc_margin_normal" />

        <TextView
            android:id="@+id/tv_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/tc_margin_small"
            android:text="测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字" />

        <TextView
            android:id="@+id/tv_line_count"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="@dimen/tc_margin_small"
            android:text="当前显示行数" />

        <Button
            android:id="@+id/btn_reset_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/tc_margin_mini"
            android:text="重置" />
    </LinearLayout>
</ScrollView>


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Net;
using System.Text;

using Palaso.Network;

namespace Palaso.Reporting
{
	/// <summary>
	/// For information on what's going on here, google "goolge analytics".
	/// </summary>
	public class AnalyticsEventSender
	{
		private string _domain;
		private string _googleAccountCode;
		private readonly Guid _userId;
		private readonly DateTime _firstLaunch;
		private readonly DateTime _previousLaunch;
		private readonly int _launches;
		private readonly bool _reportAsDeveloper;
		private readonly Action<Cookie> _rememberGoogleCookie;
		private int _sequence;
		private Cookie _googleCookie;

		public AnalyticsEventSender(string domain, string googleAccountCode, Guid userId, DateTime firstLaunch, DateTime previousLaunch, int launches, bool reportAsDeveloper, Action<Cookie> RememberGoogleCookie, Cookie googleCookie)
		{
			_domain = domain;
			_googleAccountCode = googleAccountCode;
			_userId = userId;
			_firstLaunch = firstLaunch;
			_previousLaunch = previousLaunch;
			_launches = launches;
			_reportAsDeveloper = reportAsDeveloper;
			   _rememberGoogleCookie = RememberGoogleCookie;
			_googleCookie = googleCookie;

			//I don't acutally know how this is used by google... we don't have a way of giving a sequence order across
			//all users... for now we only make sure they are sequential during a given run, starting from a random number.
			_sequence = new Random().Next(1000000000);
		}

		/// <summary>
		/// http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html
		/// </summary>
		/// <param name="category">     Videos                  Runtime</param>
		/// <param name="action">       Pause                   Error</param>
		/// <param name="optionalLabel">Gone With The Wind      Exception Message</param>
		/// <param name="optionalInteger">32 (that is, at 32 seconds into the video)</param>
		public void SendEvent(string pagePath, string category, string action, string optionalLabel, int optionalInteger)
		{
			try
			{
				pagePath = MassagePagePath(pagePath);
				Dictionary<string, string> parameters = GetGenericParameters(pagePath);
				parameters.Add("utme", MakeEventString(category, action, optionalLabel, optionalInteger));//Extensible Parameter 	Value is encoded. Used for events and custom variables.
				parameters.Add("gaq", "1");//REVIEW: haven't found info on what this is for
				parameters.Add("utmt", "event"); //Indicates the type of request, which is one of: event, transaction, item, or custom variable. If this value is not present in the GIF request, the request is typed as page.
				SendUrlRequest(parameters);
			}
			catch (Exception)
			{
#if DEBUG//not ever worth bugging the user about
				throw;
#endif
			}
		}

		/// <summary>
		/// Record a visit to part of the application, just as if it  were a page.
		/// Leave it up to this method to insert things like the fact that you are in DEBUG mode, or what version is being used, etc.
		/// </summary>
		/// <example>SendNavigationNotice("aboutBox"), SendNavigationNotice("dictionary/browseView")</example>
		public void SendNavigationNotice(string pagePath, params object[] args)
		{
			try
			{
				pagePath = MassagePagePath(string.Format(pagePath, args));

				Dictionary<string, string> parameters = GetGenericParameters(pagePath);
				 SendUrlRequest(parameters);
			}
			catch (Exception)
			{
#if DEBUG//not ever worth bugging the user about
				throw;
#endif
			}
		}

		private string MassagePagePath(string pagePath)
		{
			if (pagePath == null || pagePath.Trim().Length == 0)
			{
				Debug.Fail("Empty path");
				pagePath = "unknown";
			}

			pagePath = pagePath.TrimStart(new char[] {'/'});
			if (!pagePath.StartsWith("application/"))
			{
				pagePath = "application/"+pagePath;
			}

			//nb: Normally this is true for DEBUG builds. We use this variable rather than a #if DEBUG because
			//sometimes a developer uses a Release build of this dll; he would still want hi activities
			//logged as a developer.

			if(_reportAsDeveloper)
			{
				pagePath = "dev/"+pagePath;
			}

			return pagePath;
		}

		private void SendUrlRequest(Dictionary<string, string> parameters)
		{
			string requestUriString = GetUrl(parameters);

			var bw = new BackgroundWorker();
			bw.DoWork += (o, args) =>
							 {
//                RobustNetworkOperation.Do(proxy =>
//                                              {
								 try
								 {
//jh: i got tired of seeing this in the logs
//                                     Logger.WriteMinorEvent("Attempting SendUrlRequestAsync({0}",
//                                                            requestUriString);

									 HttpWebRequest request = (HttpWebRequest) WebRequest.Create(requestUriString);
									 request.CookieContainer = new CookieContainer();
									 //                                                    request.Proxy = proxy;
									 if(_googleCookie!=null)
										 request.CookieContainer.Add(request.RequestUri, _googleCookie);

									 //warning, this uses the ui thread:
									 //request.BeginGetResponse(new AsyncCallback(RespCallback), null);
									 //since we're in the background anyway...
									 //review but on a single core machine, might this still hang us up, or does it sleep, internally?
									 HttpWebResponse response = (HttpWebResponse) request.GetResponse();

									 //Review: is it the request or the response that should have the cookie?  Neither do

									 CookieCollection cookieCollection = response.Cookies;
									 if(cookieCollection!=null && cookieCollection.Count>0)
									 {
										 _rememberGoogleCookie(cookieCollection[0]);
										 Debug.Assert(cookieCollection.Count==1, "(Debug mode only Did not expect multiple cookies from google analytics.");
									 }
									 Debug.WriteLine("Succesful SendUrlRequestAsync");// ah well
								 }
								 catch (WebException e)
								 {
									 if (e.Status == WebExceptionStatus.Timeout)
									 {
										 Debug.WriteLine("  TimedOut SendUrlRequestAsync");// ah well
									 }
									 else
									 {
#if DEBUG
										 throw e;
#endif
									 }
								 }
							 };
//                                              }, null);
			 bw.RunWorkerAsync();
		}

		private static void RespCallback(IAsyncResult ar)
		{

		}

		private string GetUrl(Dictionary<string, string> parameters)
		{
			var query = new StringBuilder();
			foreach (var pair in parameters)
			{
				query.AppendFormat("{0}={1}&", pair.Key, pair.Value);
			}

			return String.Format("http://www.google-analytics.com/__utm.gif?{0}",query.ToString().TrimEnd('&'));
		}

		private Dictionary<string, string> GetGenericParameters(string navigationPathStartingWithForwardSlash)
		{
			//http://www.google-analytics.com/__utm.gif?utmwv=4&utmn=769876874&utmhn=example.com&utmcs=ISO-8859-1&utmsr=1280x1024&utmsc=32-bit&utmul=en-us&utmje=1&utmfl=9.0%20%20r115&utmcn=1&utmdt=GATC012%20setting%20variables&utmhid=2059107202&utmr=0&utmp=/auto/GATC012.html?utm_source=www.gatc012.org&utm_campaign=campaign+gatc012&utm_term=keywords+gatc012&utm_content=content+gatc012&utm_medium=medium+gatc012&utmac=UA-30138-1&utmcc=__utma%3D97315849.1774621898.1207701397.1207701397.1207701397.1%3B...

			// http://www.google-analytics.com/__utm.gif?utmwv=4.6.5&utmn=488134812&utmhn=facebook.com&utmcs=UTF-8&utmsr=1024x576&utmsc=24-bit&utmul=en-gb&utmje=0&utmfl=10.0%20r42&utmdt=Facebook%20Contact%20Us&utmhid=700048481&utmr=-&utmp=%2Fwebdigi%2Fcontact&utmac=UA-3659733-5&utmcc=__utma%3D155417661.474914265.1263033522.1265456497.1265464692.6%3B%2B__utmz%3D155417661.1263033522.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B

			var parameters = new Dictionary<string, string>();
			var randomGenerator = new Random();

			parameters.Add("utmwv", "4.7.2");// Analytics version
			parameters.Add("utmn", randomGenerator.Next(1000000000).ToString());// Unique ID generated for each GIF request to prevent caching of the GIF image.
			parameters.Add("utmhn", _domain ?? string.Empty);// Host Name, which is a URL-encoded string.
			parameters.Add("utmac", _googleAccountCode ?? string.Empty);
			parameters.Add("utmhid", _sequence++.ToString()); //?? Order ID, URL-encoded string.

			parameters.Add("utmcs", "UTF-8");									// Document encoding
			parameters.Add("utmsr", "-");		//enhance								// Screen Resolution
			parameters.Add("utmsc", "-");		//enhance								// Screen Resolution
			parameters.Add("utmul", "en-US");	//enhance									// user language
			parameters.Add("utmje", "0");										// java enabled or not
			parameters.Add("utmfl", "-");										// user flash version
			parameters.Add("utmdt", navigationPathStartingWithForwardSlash);			// page title
			parameters.Add("utmr", "-");											// referrer URL

			//these ones we don't care about are said to be required: http://code.google.com/apis/analytics/docs/tracking/gaTrackingTroubleshooting.html
			parameters.Add("utmp", navigationPathStartingWithForwardSlash);						// Page request of the current page. 	utmp=/testDirectory/myPage.html
			parameters.Add("utmcc", UtmcCookieString);					// cookie string (must be non-empty). Cookie values. This request parameter sends all the cookies requested from the page.

			//
			//add ip address if we have one
			//                if (!String.IsNullOrEmpty(RequestedByIpAddress))
			//                {
			//                    paramList.Add(new KeyValuePair<string, string>("utmip", RequestedByIpAddress));
			//                }
			return parameters;
		}

		private string MakeEventString(string category, string action, string optionalLabel, int optionalInteger)
		{
			//What's the 5? It's just a constant Google defines. "Google Analytics uses the value of the utme parameter to track events in the form of 5(object*action*label)(value)"
			return Uri.EscapeDataString(String.Format("5({0}*{1}*{2})({3})",
				category,
				action,
				string.IsNullOrEmpty(optionalLabel) ? string.Empty : optionalLabel,
				optionalInteger.ToString()));
		}

		private string UtmcCookieString
		{
			//http://www.morevisibility.com/analyticsblog/from-__utma-to-__utmz-google-analytics-cookies.html

			//http://www.randycullom.com/chatterbox/archives/2008/10/google_analytic.html

			//<domain hash>.<unique visitor id>.<timstamp of first visit>.<timestamp of previous (most recent) visit>.<timestamp of current visit>.<visit count>
			get
			{
				string utma = String.Format("{0}.{1}.{2}.{3}.{4}.{5}",
											DomainHash,
											GetUserId(_userId), //pseudo-unique visitor id
											DateTimeToUnixFormat(_firstLaunch), //enhance       //timstamp of first visit.
											DateTimeToUnixFormat(_previousLaunch),//enhance        //timestamp of previous (most recent) visit
											DateTimeToUnixFormat(DateTime.UtcNow),//timestamp of current visit
											_launches.ToString());      //visitcount

				string utmz = String.Format("{0}.{1}.{2}.{3}.utmcsr={4}|utmccn={5}|utmcmd={6}",
											DomainHash,
											DateTimeToUnixFormat(DateTime.UtcNow),
											"1",
											"1",
											"(direct)",//ReferralSource
											"(none)",//Campaign
											"(none)");//Medium

				string utmcc = Uri.EscapeDataString(String.Format("__utma={0};+__utmz={1};", utma, utmz));

				return (utmcc); ;
			}
		}

		private int DateTimeToUnixFormat(DateTime dateTime)
		{
			return (int)(dateTime - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime()).TotalSeconds;
		}

		private int DomainHash
		{
			get { return GetDomainHash(_domain); }

		}

		internal static int GetDomainHash(string input)
		{
			// converted from the google domain hash code listed here:
			//http://www.google.com/support/forum/p/Google+Analytics/thread?tid=626b0e277aaedc3c&hl=en
			// Note JohnT: the original code is JavaScript. This means it does basic arithmetic with floats, but
			// shifts and similar ops with 32-bit ints. There may be some pathological case where doing it
			// all with 32-bit ints will give a different answer, but if so I haven't found it. It works
			// at least specifically for the known client urls (see unit tests).
			int a = 0;
			for (int index = input.Length - 1; index >= 0; index--)
			{
				char character = input[index];
				int intCharacter = character;
				a = (a << 6 & 268435455) + intCharacter + (intCharacter << 14);
				int c = a & 266338304;
				a = c != 0 ? a ^ c >> 21 : a;
			}

			return a;
		}

		/// <summary>
		/// Return a value suitable for the user ID part of a __utma cookie based on the given guid.
		/// We want something reasonably dependent on the guid and somewhat scattered over the range 1000000000,2147483647.
		/// This is not a very clever hash function but we expect guids to be pretty well distributed to begin with.
		/// </summary>
		/// <param name="guid"></param>
		/// <returns></returns>
		internal static int GetUserId(Guid guid)
		{
			int start = 0;
			foreach (var b in guid.ToByteArray())
				start = start << 2 ^ b ^ start >> 10;
			while (start < 1000000000)
				start += 1000000000;
			return start;
		}

	}
}


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

namespace CrawlMapper
{
    public class URLInfo : IEquatable<URLInfo>
    {
        public URLInfo()
        {
            LastCrawled = DateTime.MinValue;
            PageData = String.Empty;
            PageTitle = String.Empty;
            PageKeywords = String.Empty;
            PageDescription = String.Empty;
        }
        public override bool Equals(Object obj)
        {
            URLInfo info = obj as URLInfo;
            if (info != null && info.URL == this.URL)
                return true;
            return false;
        }
        public bool Equals(URLInfo info)
        {
            if (info != null && info.URL == this.URL)
                return true;
            return false;
        }
        public override int GetHashCode()
        {
            return this.URL.GetHashCode();
        }
        public string RootURL;
        public string URL;
        public DateTime LastCrawled;
        public string PageData;
        public string PageTitle;
        public string PageKeywords;
        public string PageDescription;
    }
}


text:
package com.vmware.vim25;

/**
@author Steve Jin (sjin@vmware.com)
*/

public class TooManyHosts extends HostConnectFault
{
}


text:
/* ###
 * IP: GHIDRA
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package docking.actions;

import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.List;

import javax.swing.Action;
import javax.swing.Icon;

import docking.ActionContext;
import docking.action.ActionContextProvider;
import docking.action.DockingActionIf;

public class ActionAdapter implements Action, PropertyChangeListener {

	private final DockingActionIf dockingAction;
	private List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
	private ActionContextProvider contextProvider;
	private Action defaultAction;

	/**
	 * This is only for use when converting actions from docking actions to those to be used
	 * in Swing components.  The context system does not work as expected in this case.
	 *
	 * <p>Most clients should use {@link #ActionAdapter(DockingActionIf, ActionContextProvider)}
	 * @param dockingAction the action to adapt
	 */
	ActionAdapter(DockingActionIf dockingAction) {
		this(dockingAction, null);
	}

	public ActionAdapter(DockingActionIf dockingAction, ActionContextProvider provider) {
		this.dockingAction = dockingAction;
		this.contextProvider = provider;
		dockingAction.addPropertyChangeListener(this);
	}

	public void setDefaultAction(Action defaultAction) {
		this.defaultAction = defaultAction;
	}

	@Override
	public void addPropertyChangeListener(PropertyChangeListener listener) {
		listeners.add(listener);
	}

	@Override
	public Object getValue(String key) {
		if (key.equals(NAME)) {
			return dockingAction.getName();
		}
		else if (key.equals(SHORT_DESCRIPTION)) {
			return dockingAction.getDescription();
		}
		else if (key.equals(LONG_DESCRIPTION)) {
			return dockingAction.getDescription();
		}
		else if (key.equals(SMALL_ICON)) {
			return getIcon();
		}
		else if (key.equals(ACCELERATOR_KEY)) {
			return dockingAction.getKeyBinding();
		}
		return null;
	}

	private Icon getIcon() {
		if (dockingAction.getToolBarData() != null) {
			return dockingAction.getToolBarData().getIcon();
		}
		else if (dockingAction.getMenuBarData() != null) {
			return dockingAction.getMenuBarData().getMenuIcon();
		}
		else if (dockingAction.getPopupMenuData() != null) {
			return dockingAction.getPopupMenuData().getMenuIcon();
		}
		return null;
	}

	@Override
	public boolean isEnabled() {
		return dockingAction.isEnabled();
	}

	@Override
	public void putValue(String key, Object value) {
		System.err.println("PutValue key = " + key + " value = " + value);
	}

	@Override
	public void removePropertyChangeListener(PropertyChangeListener listener) {
		listeners.add(listener);
	}

	@Override
	public void setEnabled(boolean b) {
		dockingAction.setEnabled(b);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		ActionContext context = null;
		if (contextProvider != null) {
			context = contextProvider.getActionContext(null);
		}
		if (context == null) {
			context = new ActionContext();
			context.setSourceObject(e.getSource());
		}
		if (dockingAction.isEnabledForContext(context)) {
			dockingAction.actionPerformed(context);
		}
		else if (defaultAction != null) {
			defaultAction.actionPerformed(e);
		}
	}

	@Override
	public void propertyChange(PropertyChangeEvent evt) {
		for (PropertyChangeListener listener : listeners) {
			listener.propertyChange(evt);
		}
	}

}


text:
class Api::TasksController < Api::BaseController
  before_action :check_owner

  def index
    render json: task_list.tasks
  end

  def create
    task = task_list.tasks.create!(safe_params)
    render json: task, status: 201
  end

  def update
    task.update_attributes(safe_params)
    render nothing: true, status: 204
  end

  def destroy
    task.destroy
    render nothing: true, status: 204
  end

  private
  def task_list
    @task_list ||= TaskList.find(params[:task_list_id])
  end

  def task
    @task ||= task_list.tasks.find(params[:id])
  end

  def safe_params
    # add left_sph
    params.require(:task).permit( :description, :target_priority, :completed, :due_date,
                                  :left_sph,
                                  :right_sph,
                                  :left_cyl,
                                  :right_cyl,
                                  :left_axis,
                                  :right_axis
                                  )
  end

  def check_owner
    permission_denied if current_user != task_list.owner
  end
end


text:
package ch.trivadis.com.lesson1.step4;

/**
 * Created by Andy Moncsek on 03.06.16.
 */
public class Experiment implements Rat,Mouse {

    public static void main(String[] args) {
        Experiment experiment = new Experiment();

        experiment.sayPeep();
        experiment.eatWaste();
        experiment.clinicalTrail();

    }

    @Override
    public void clinicalTrail() {
        Rat.super.clinicalTrail();
        Mouse.super.clinicalTrail();
    }
}


text:
[Cac2er](../../index.md) / [com.wcaokaze.cac2er](../index.md) / [LazyCache](./index.md)

# LazyCache

`interface LazyCache<out T>` [(source)](https://github.com/wcaokaze/Cac2er/blob/master/src/main/kotlin/com/wcaokaze/cac2er/LazyCache.kt#L21)

Cache which doesn't load the content until calling [loadContent](load-content.md).

These basic behaviors seem like [Cache](../-cache/index.md). The Caches associated with the same
file have the same content, [circulationRecord](circulation-record.md) is a criteria to consider how
the Cache is important. [gc](../-cacher/gc.md) doesn't delete caches that are
depended by any other LazyCache which is not deleted. But in Kotlin codes,
this is similar to [WeakCache](../-weak-cache/index.md) rather than [Cache](../-cache/index.md). The content is stored as
[SoftReference](http://docs.oracle.com/javase/6/docs/api/java/lang/ref/SoftReference.html), whenever consumers get the content, they have to call a
suspend function. In short, this is like [Cache](../-cache/index.md) on behaviors regarding
[gc](../-cacher/gc.md), but is like [WeakCache](../-weak-cache/index.md) on behaviors regarding
de-serialization.

**Since**
4.0.2

### Properties

| Name | Summary |
|---|---|
| [circulationRecord](circulation-record.md) | `abstract val circulationRecord: `[`CirculationRecord`](../-cache/-circulation-record/index.md) |
| [file](file.md) | `abstract val file: `[`File`](http://docs.oracle.com/javase/6/docs/api/java/io/File.html) |

### Functions

| Name | Summary |
|---|---|
| [addObserver](add-observer.md) | `abstract fun addObserver(observer: (`[`T`](index.md#T)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) |
| [loadContent](load-content.md) | `abstract suspend fun loadContent(): `[`T`](index.md#T) |
| [removeObserver](remove-observer.md) | `abstract fun removeObserver(observer: (`[`T`](index.md#T)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) |

### Companion Object Functions

| Name | Summary |
|---|---|
| [invoke](invoke.md) | `operator fun <T> invoke(file: `[`File`](http://docs.oracle.com/javase/6/docs/api/java/io/File.html)`): `[`LazyCache`](./index.md)`<`[`T`](invoke.md#T)`>` |

### Extension Properties

| Name | Summary |
|---|---|
| [content](../content.md) | `val <T> `[`LazyCache`](./index.md)`<`[`T`](../content.md#T)`>.content: `[`T`](../content.md#T)`?` |

### Extension Functions

| Name | Summary |
|---|---|
| [load](../load.md) | `suspend fun <T> `[`LazyCache`](./index.md)`<`[`T`](../load.md#T)`>.load(accessCount: `[`Float`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)` = 1.0f): `[`T`](../load.md#T)`?` |

### Inheritors

| Name | Summary |
|---|---|
| [WritableLazyCache](../-writable-lazy-cache/index.md) | `interface WritableLazyCache<T> : `[`LazyCache`](./index.md)`<`[`T`](../-writable-lazy-cache/index.md#T)`>` |


text:
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Functions</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../../../index.html" title="Chapter 1. Range 2.0">
<link rel="up" href="../semantics.html" title="Semantics">
<link rel="prev" href="metafunctions.html" title="Metafunctions">
<link rel="next" href="../../adaptors.html" title="Range Adaptors">

Home
Libraries
People
FAQ
More

Functions

<colgroup>
<col>
<col>
<col>
</colgroup>

                      Expression

                      Return type

                      Returns

                      Complexity

                      begin(x)

                      range_iterator<X>::type

                      p.first if p
                      is of type std::pair<T> a
                      if a is an
                      array range_begin(x) if that expression would invoke
                      a function found by ADL t.begin() otherwise

                      constant time

                      end(x)

                      range_iterator<X>::type

                      p.second if p
                      is of type std::pair<T> a
                      + sz
                      if a is an
                      array of size sz
                      range_end(x)
                      if that expression would invoke a function found by ADL t.end()
                      otherwise

                      constant time

                      empty(x)

                      bool

                      boost::begin(x)
                      == boost::end(x)

                      constant time

                      distance(x)

                      range_difference<X>::type

                      std::distance(boost::begin(x),boost::end(x))

                      -

                      size(x)

                      range_size<X>::type

                      range_calculate_size(x) which by default is boost::end(x)
                      - boost::begin(x). Users may supply alternative
                      implementations by implementing range_calculate_size(x) so that it will be found via
                      ADL

                      constant time

                      rbegin(x)

                      range_reverse_iterator<X>::type

                      range_reverse_iterator<X>::type(boost::end(x))

                      constant time

                      rend(x)

                      range_reverse_iterator<X>::type

                      range_reverse_iterator<X>::type(boost::begin(x))

                      constant time

                      const_begin(x)

                      range_iterator<const
                      X>::type

                      range_iterator<const
                      X>::type(boost::begin(x))

                      constant time

                      const_end(x)

                      range_iterator<const
                      X>::type

                      range_iterator<const
                      X>::type(boost::end(x))

                      constant time

                      const_rbegin(x)

                      range_reverse_iterator<const
                      X>::type

                      range_reverse_iterator<const
                      X>::type(boost::rbegin(x))

                      constant time

                      const_rend(x)

                      range_reverse_iterator<const
                      X>::type

                      range_reverse_iterator<const
                      X>::type(boost::rend(x))

                      constant time

                      as_literal(x)

                      iterator_range<U> where U
                      is Char*
                      if x is a pointer
                      to a string and U
                      is range_iterator<X>::type
                      otherwise

                      [s,s
                      + std::char_traits<X>::length(s)) if s
                      is a Char*
                      or an array of Char
                      [boost::begin(x),boost::end(x)) otherwise

                      linear time for pointers to a string or arrays of Char, constant time otherwise

                      as_array(x)

                      iterator_range<X>

                      [boost::begin(x),boost::end(x))

            The special const_-named
            functions are useful when you want to document clearly that your code
            is read-only.

            as_literal()
            can be used internally
            in string algorithm libraries such that arrays of characters are handled
            correctly.

            as_array()
            can be used with string algorithm libraries to make it clear that arrays
            of characters are handled like an array and not like a string.

            Notice that the above functions should always be called with qualification
            (boost::)
            to prevent unintended
            Argument Dependent Lookup (ADL).

Copyright © 2003-2010 Thorsten Ottosen,
      Neil Groves

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


text:
(function() {
  var Hippodrome, IdFactory, actionIds, assert, bindToContextIfFunction, createAction, createDeferredTask, createDispatcher, createStore, dispatcherIds, isNode, makeDeferredFunction, makeToFn, _,
    __slice = [].slice;

  isNode = typeof window === 'undefined';

  if (isNode) {
    _ = require('lodash');
  } else {
    _ = this._;
  }

  Hippodrome = {};

  assert = function() {
    var argIndex, args, condition, error, message;
    condition = arguments[0], message = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
    if (!condition) {
      argIndex = 0;
      error = new Error('Assertion Failed: ' + message.replace(/%s/g, function() {
        return args[argIndex++];
      }));
      error.framesToPop = 1;
      throw error;
    }
    return condition;
  };

  IdFactory = function(prefix) {
    this._lastId = 1;
    return this._prefix = prefix;
  };

  IdFactory.prototype.next = function() {
    return "" + this._prefix + "_" + (this._lastId++);
  };

  actionIds = new IdFactory('Action_ID');

  createAction = function(options) {
    var action, buildPayload, id;
    assert(options.build instanceof Function, "Action " + options.displayName + " did not define a build function.");
    id = "" + (actionIds.next()) + "_" + options.displayName;
    buildPayload = function() {
      var payload;
      payload = options.build.apply(null, arguments);
      payload._action = id;
      return payload;
    };
    action = function() {
      var payload;
      payload = buildPayload.apply(null, arguments);
      return Hippodrome.Dispatcher.dispatch(payload);
    };
    action.buildPayload = buildPayload;
    action.displayName = options.displayName;
    action.id = id;
    action.toString = function() {
      return id;
    };
    return action;
  };

  Hippodrome.createAction = createAction;

  dispatcherIds = new IdFactory('Dispatcher_ID');

  createDispatcher = function() {
    var dispatcher;
    dispatcher = {
      _callbacksByAction: {},
      _isStarted: {},
      _isFinished: {},
      _isDispatching: false,
      _payload: null
    };
    dispatcher.register = function(action, callback, prerequisites) {
      var id, _base;
      if (prerequisites == null) {
        prerequisites = [];
      }
      if ((_base = this._callbacksByAction)[action] == null) {
        _base[action] = {};
      }
      id = dispatcherIds.next();
      this._callbacksByAction[action][id] = {
        callback: callback,
        prerequisites: prerequisites
      };
      return id;
    };
    dispatcher.unregister = function(action, id) {
      assert(this._callbacksByAction && this._callbacksByAction[action][id], "Dispatcher.unregister(" + action.displayName + ", " + id + ") does not map to a registered callback.");
      return delete this._callbacksByAction[action][id];
    };
    dispatcher.waitFor = function(action, stores) {
      assert(this._isDispatching, "Dispatcher.waitFor must be called while dispatching.");
      return _.forEach(stores, (function(_this) {
        return function(store) {
          var id;
          id = store._storeImpl.dispatcherIdsByAction[action];
          if (_this._isStarted[id]) {
            assert(_this._isFinished[id], "Dispatcher.waitFor encountered circular dependency trying to wait for " + id + " during action " + action.displayName + ".");
            return;
          }
          assert(_this._callbacksByAction[action][id], "Dispatcher.waitFor " + id + " is not a registered callback for " + action.displayName + ".");
          return _this.invokeCallback(action, id);
        };
      })(this));
    };
    dispatcher.dispatch = function(payload) {
      var action;
      assert(!this._isDispatching, "Dispatcher.dispatch cannot be called during dispatch.");
      this.startDispatching(payload);
      try {
        action = payload._action;
        return _.forEach(this._callbacksByAction[action], (function(_this) {
          return function(callback, id) {
            if (_this._isStarted[id]) {
              return;
            }
            return _this.invokeCallback(action, id);
          };
        })(this));
      } finally {
        this.stopDispatching();
      }
    };
    dispatcher.invokeCallback = function(action, id) {
      var callback, prerequisites, _ref;
      this._isStarted[id] = true;
      _ref = this._callbacksByAction[action][id], callback = _ref.callback, prerequisites = _ref.prerequisites;
      this.waitFor(action, prerequisites);
      callback(this._payload);
      return this._isFinished[id] = true;
    };
    dispatcher.startDispatching = function(payload) {
      this._isStarted = {};
      this._isFinished = {};
      this._payload = payload;
      return this._isDispatching = true;
    };
    dispatcher.stopDispatching = function() {
      this._payload = null;
      return this._isDispatching = false;
    };
    return dispatcher;
  };

  Hippodrome.Dispatcher = createDispatcher();

  makeDeferredFunction = function(context, fn) {
    if (typeof fn === 'string') {
      fn = context[fn];
    }
    return function() {
      var args;
      args = arguments;
      return setTimeout((function() {
        return fn.apply(context, args);
      }), 1);
    };
  };

  createDeferredTask = function(options) {
    var task;
    assert(!options.action || options.task, "Deferred Task " + options.displayName + " declared an action, it must declare a task.");
    assert(!options.task || options.action, "Deferred Task " + options.displayName + " declared a task, it must declare an action.");
    task = {};
    _.assign(task, _.omit(options, 'initialize', 'action', 'task'), bindToContextIfFunction(task));
    task.dispatch = function(action) {
      var to;
      assert(task._dispatcherIdsByAction[action.id] === void 0, "Deferred Task " + task.displayName + " attempted to register twice for action " + action.displayName + ".");
      to = function(callback) {
        var id;
        callback = makeDeferredFunction(task, callback);
        id = Hippodrome.Dispatcher.register(action.id, callback);
        task._dispatcherIdsByAction[action.id] = id;
        return id;
      };
      return {
        to: to
      };
    };
    task._dispatcherIdsByAction = {};
    if (options.initialize) {
      task.dispatch(Hippodrome.start).to(options.initialize);
    }
    if (options.action && options.task) {
      task.dispatch(options.action).to(options.task);
    }
    return task;
  };

  Hippodrome.createDeferredTask = createDeferredTask;

  bindToContextIfFunction = function(context) {
    return function(objValue, srcValue) {
      if (srcValue instanceof Function) {
        return srcValue.bind(context);
      } else {
        return srcValue;
      }
    };
  };

  makeToFn = function(context, action, prerequisites) {
    if (prerequisites == null) {
      prerequisites = [];
    }
    return function(callback) {
      var id;
      if (typeof callback === 'string') {
        callback = context[callback];
      }
      callback = callback.bind(context);
      id = Hippodrome.Dispatcher.register(action.id, callback, prerequisites);
      return context.dispatcherIdsByAction[action] = id;
    };
  };

  createStore = function(options) {
    var store, storeImpl;
    storeImpl = {
      dispatcherIdsByAction: {},
      callbacks: [],
      trigger: function() {
        return _.each(this.callbacks, function(spec) {
          var callback, context;
          callback = spec.callback, context = spec.context;
          if (context) {
            return callback.call(context);
          } else {
            return callback();
          }
        });
      },
      dispatch: function(action) {
        var after, context;
        assert(this.dispatcherIdsByAction[action] === void 0, "Store " + this.displayName + " attempted to register twice for action " + action.displayName + ".");
        context = this;
        after = function() {
          var prerequisites;
          prerequisites = arguments;
          return {
            to: makeToFn(context, action, prerequisites)
          };
        };
        return {
          after: after,
          to: makeToFn(context, action)
        };
      }
    };
    store = {
      _storeImpl: storeImpl,
      displayName: options.displayName,
      register: function(callback, context) {
        if (context == null) {
          context = null;
        }
        return this._storeImpl.callbacks.push({
          callback: callback,
          context: context
        });
      },
      unregister: function(callback) {
        return _.remove(this._storeImpl.callbacks, function(spec) {
          var cb;
          cb = spec.callback;
          return cb === callback;
        });
      },
      listen: function(property, fn) {
        var callback, getState;
        store = this;
        getState = function() {
          var state;
          state = {};
          state[property] = fn();
          return state;
        };
        callback = function() {
          return this.setState(getState());
        };
        return {
          componentWillMount: function() {
            return callback.call(this);
          },
          componentDidMount: function() {
            return store.register(callback, this);
          },
          componentWillUnmount: function() {
            return store.unregister(callback, this);
          }
        };
      },
      listenWith: function(stateFnName) {
        var callback;
        store = this;
        callback = function() {
          return this.setState(this[stateFnName]());
        };
        return {
          componentWillMount: function() {
            return callback.call(this);
          },
          componentDidMount: function() {
            return store.register(callback, this);
          },
          componentWillUnmount: function() {
            return store.unregister(callback, this);
          }
        };
      }
    };
    _.assign(storeImpl, _.omit(options, 'initialize', 'public'), bindToContextIfFunction(storeImpl));
    if (options["public"]) {
      _.assign(store, options["public"], bindToContextIfFunction(storeImpl));
      _.assign(storeImpl, options["public"], bindToContextIfFunction(storeImpl));
    }
    if (options.initialize) {
      storeImpl.dispatch(Hippodrome.start).to(options.initialize);
    }
    return store;
  };

  Hippodrome.createStore = createStore;

  Hippodrome.start = new Hippodrome.createAction({
    displayName: 'start Hippodrome',
    build: function(options) {
      return options || {};
    }
  });

  if (isNode) {
    module.exports = Hippodrome;
  } else {
    this.Hippodrome = Hippodrome;
  }

}).call(this);


text:
#include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
#include "dcmtk/dcmpstat/dvpshlp.h"
#include "dcmtk/dcmpstat/dvpsdef.h"
#include "dcmtk/dcmnet/dcompat.h"     /* compatability routines */
#include "dcmtk/dcmdata/dctk.h"

#define INCLUDE_CSTDIO
#define INCLUDE_CERRNO
#define INCLUDE_CTIME
#include "dcmtk/ofstd/ofstdinc.h"

BEGIN_EXTERN_C
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>   /* for fork */
#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>    /* for waitpid */
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>    /* for wait3 */
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h> /* for wait3 */
#endif
END_EXTERN_C

void DVPSHelper::currentDate(OFString &str)
{
  DcmDate::getCurrentDate(str);
}

void DVPSHelper::currentTime(OFString &str)
{
  DcmTime::getCurrentTime(str);
}

OFCondition DVPSHelper::loadFileFormat(const char *filename,
                                       DcmFileFormat *&fileformat)
{
    fileformat = new DcmFileFormat;
    OFCondition result =  fileformat->loadFile(filename);

    if (result.bad())
    {
      delete fileformat;
      fileformat = NULL;
    }

    return result;
}

OFCondition DVPSHelper::saveFileFormat(const char *filename,
                                       DcmFileFormat *fileformat, OFBool explicitVR)
{
    E_TransferSyntax xfer = EXS_LittleEndianImplicit;
    if (explicitVR) xfer = EXS_LittleEndianExplicit;

    return fileformat->saveFile(filename, xfer, EET_ExplicitLength, EGL_recalcGL, EPD_withoutPadding);
}

OFCondition DVPSHelper::putStringValue(DcmItem *item, DcmTagKey tag, const char *value)
{
    OFCondition result = EC_Normal;
    DcmTag localTag(tag);
    if (item)
    {
        DcmElement *elem = NULL;
        switch(localTag.getEVR())
        {
          case EVR_AE: elem = new DcmApplicationEntity(localTag); break;
          case EVR_AS: elem = new DcmAgeString(localTag); break;
          case EVR_CS: elem = new DcmCodeString(localTag); break;
          case EVR_DA: elem = new DcmDate(localTag); break;
          case EVR_DS: elem = new DcmDecimalString(localTag); break;
          case EVR_DT: elem = new DcmDateTime(localTag); break;
          case EVR_IS: elem = new DcmIntegerString(localTag); break;
          case EVR_TM: elem = new DcmTime(localTag); break;
          case EVR_UI: elem = new DcmUniqueIdentifier(localTag); break;
          case EVR_LO: elem = new DcmLongString(localTag); break;
          case EVR_LT: elem = new DcmLongText(localTag); break;
          case EVR_PN: elem = new DcmPersonName(localTag); break;
          case EVR_SH: elem = new DcmShortString(localTag); break;
          case EVR_ST: elem = new DcmShortText(localTag); break;
          default: result=EC_IllegalCall; break;
        }
        if (elem)
        {
          if (value) result = elem->putString(value);
        } else if (result==EC_Normal) result = EC_MemoryExhausted;
        if (EC_Normal==result) item->insert(elem, OFTrue);
    } else result = EC_IllegalCall;
    return result;
}

OFCondition DVPSHelper::putUint16Value(DcmItem *item, DcmTagKey tag, Uint16 value)
{
    OFCondition result = EC_Normal;
    DcmTag localTag(tag);
    if (item)
    {
        DcmElement *elem = new DcmUnsignedShort(localTag);
        if (elem) result = elem->putUint16(value); else result=EC_MemoryExhausted;
        if (EC_Normal==result) item->insert(elem, OFTrue);
    } else result = EC_IllegalCall;
    return result;
}

void DVPSHelper::cleanChildren()
{
#ifdef HAVE_WAITPID
    int stat_loc;
#elif HAVE_WAIT3
    struct rusage rusage;
#if defined(__NeXT__)
    /* some systems need a union wait as argument to wait3 */
    union wait status;
#else
    int        status;
#endif
#endif

#if defined(HAVE_WAITPID) || defined(HAVE_WAIT3)
    int child = 1;
    int options = WNOHANG;
    while (child > 0)
    {
#ifdef HAVE_WAITPID
      child = (int)(waitpid(-1, &stat_loc, options));
#elif defined(HAVE_WAIT3)
      child = wait3(&status, options, &rusage);
#endif
      if (child < 0)
      {
        if ((errno != ECHILD) && (errno != 0))
        {
          char buf[256];
          DCMPSTAT_ERROR("wait for child failed: " << OFStandard::strerror(errno, buf, sizeof(buf)));
        }
      }
    }
#endif
}

void DVPSHelper::setDefault(OFCondition& result, DcmElement& a_name, const char *a_value)
{
  if ((result==EC_Normal)&&(a_name.getLength()==0)) result = a_name.putString(a_value);
  return;
}

OFBool DVPSHelper::haveReferencedUIDItem(DcmSequenceOfItems& seq, const char *uid)
{
  if (uid==NULL) return OFFalse;

  DcmItem *item = NULL;
  DcmUniqueIdentifier *refuid = NULL;
  unsigned long numItems = seq.card();
  DcmStack stack;
  OFString aString;
  for (unsigned long i=0; i<numItems; i++)
  {
    item = seq.getItem(i);
    stack.clear();
    if (EC_Normal == item->search(DCM_ReferencedSOPClassUID, stack, ESM_fromHere, OFFalse))
    {
      aString.clear();
      refuid = (DcmUniqueIdentifier *)(stack.top());
      if (refuid) refuid->getOFString(aString,0);
      if (aString == uid) return OFTrue;
    }
  }
  return OFFalse;
}

OFCondition DVPSHelper::addReferencedUIDItem(DcmSequenceOfItems& seq, const char *uid)
{
  if (uid==NULL) return EC_IllegalCall;
  OFCondition result = EC_Normal;

  DcmElement *delem = new DcmUniqueIdentifier(DCM_ReferencedSOPClassUID);
  if (delem)
  {
    result = delem->putString(uid);
    if (EC_Normal==result)
    {
      DcmItem *ditem = new DcmItem();
      if (ditem)
      {
        ditem->insert(delem, OFTrue /*replaceOld*/);
        seq.insert(ditem);
      } else {
        delete delem;
        result=EC_MemoryExhausted;
      }
    }
  } else result=EC_MemoryExhausted;
  return result;
}

/*
 *  CVS/RCS Log:
 *  $Log: dvpshlp.cc,v $
 *  Revision 1.19  2010-10-14 13:14:32  joergr
 *  Updated copyright header. Added reference to COPYRIGHT file.
 *
 *  Revision 1.18  2010-06-03 10:33:00  joergr
 *  Replaced calls to strerror() by new helper function OFStandard::strerror()
 *  which results in using the thread safe version of strerror() if available.
 *
 *  Revision 1.17  2009-11-24 14:12:58  uli
 *  Switched to logging mechanism provided by the "new" oflog module.
 *
 *  Revision 1.16  2009-09-30 10:42:38  uli
 *  Make dcmpstat's include headers self-sufficient by including all
 *  needed headers directly and stop using dctk.h
 *
 *  Revision 1.15  2006-08-15 16:57:02  meichel
 *  Updated the code in module dcmpstat to correctly compile when
 *    all standard C++ classes remain in namespace std.
 *
 *  Revision 1.14  2005/12/08 15:46:32  meichel
 *  Changed include path schema for all DCMTK header files
 *
 *  Revision 1.13  2002/11/27 15:48:11  meichel
 *  Adapted module dcmpstat to use of new header file ofstdinc.h
 *
 *  Revision 1.12  2002/08/20 12:22:03  meichel
 *  Adapted code to new loadFile and saveFile methods, thus removing direct
 *    use of the DICOM stream classes.
 *
 *  Revision 1.11  2002/04/11 13:13:45  joergr
 *  Replaced direct call of system routines by new standard date and time
 *  functions.
 *
 *  Revision 1.10  2001/11/28 13:56:55  joergr
 *  Check return value of DcmItem::insert() statements where appropriate to
 *  avoid memory leaks when insert procedure fails.
 *
 *  Revision 1.9  2001/09/26 15:36:27  meichel
 *  Adapted dcmpstat to class OFCondition
 *
 *  Revision 1.8  2001/06/01 15:50:32  meichel
 *  Updated copyright header
 *
 *  Revision 1.7  2000/12/19 13:45:49  joergr
 *  Added #include statement to keep gcc 2.5.8 (NeXTSTEP) quiet.
 *
 *  Revision 1.6  2000/10/16 11:46:15  joergr
 *  Added check to avoid wrong warning messages when shutting down application
 *  externally.
 *
 *
 */


text:
namespace qrw
{

BirdsEyeCamera::BirdsEyeCamera()
	: center_(0, 0)
{
}

BirdsEyeCamera::~BirdsEyeCamera()
{
}

void BirdsEyeCamera::applyTo(sf::RenderTarget& renderTarget)
{
	sf::View view = renderTarget.getView();
	view.setCenter(center_);
	renderTarget.setView(view);
}

} // namespace qrw


text:
var slideshowModule = angular.module('slideshow');

slideshowModule.controller('slideshowController', ['$location', '$scope', '$routeParams', 'Slide',
  function ($location, $scope, $routeParams, Slide) {
    var slideId = parseInt($routeParams.slideId ? $routeParams.slideId : 1, 10);
    $scope.currentSlide = Slide.get({slideId: slideId});
    $scope.allSlides = Slide.query();

    $scope.$on('right-key', function() {
      $scope.nextSlide();
    });

    $scope.$on('left-key', function() {
      $scope.previousSlide();
    });

    $scope.previousSlide = function () {
      slideId--;
      $scope.currentSlide = Slide.get({slideId: slideId});

      $location.path('/slide/' + slideId);
    };

    $scope.nextSlide = function () {
      slideId++;
      $scope.currentSlide = Slide.get({slideId: slideId});

      $location.path('/slide/' + slideId);
    };
  }
]);